Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TODO: Create a function to initialize app
function init() { promptUser(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initApp() {\n var router = new App.Router();\n var dispatcher = new App.Dispatcher();\n\n router.once('route', function() {\n dispatcher.runAction(router.getCurrent(), router.getParams());\n });\n\n // Start!\n router.startHistory();\n}", "function initApp() {\n\tinitSounds();\n\tinitSensors();\n\tshowWelcome();\n}", "function _initApp(){\n console.log('[ app_logic.js ] : ' + 'initiating app ..'); // debug message > app is launching\n _check_modules(); // check if the necessary modules are present\n _initial_setup_app_init(); // actually init the app's 'initial setup' config/params (..)\n }", "function init() {\n inquirer.prompt(questions).then(answers => {\n let appTitle = answers.appTitle.trim();\n let appDescription = answers.appDescription ? answers.appDescription.trim() : \"\";\n let packageName = answers.packageName.trim();\n let openui5 = answers.openui5.trim();\n let appType = answers.type.trim();\n let splitApp = appType === \"split\";\n let routing = answers.routing || splitApp;\n\n ui5init.createFolders();\n ui5init.createComponent(packageName, routing);\n ui5init.createManifest(packageName, appType, routing);\n ui5init.createIndex(packageName, appTitle);\n ui5init.createI18n(appTitle, appDescription);\n jsGenerator.generateFile(\"App\", packageName, jsGenerator.types.controller);\n viewGenerator.generateAppView(packageName, splitApp, routing);\n if (routing || splitApp) {\n jsGenerator.generateFile(\"Master\", packageName, jsGenerator.types.controller);\n viewGenerator.generateView(\"Master\", packageName);\n }\n if (splitApp) {\n jsGenerator.generateFile(\"Detail\", packageName, jsGenerator.types.controller);\n viewGenerator.generateView(\"Detail\", packageName);\n }\n\n runtime.createPackage(appTitle, appDescription);\n runtime.createServer(openui5);\n runtime.createGruntEnvironment();\n\n console.log(`Application \"${appTitle}\" initialized.`);\n console.log(`Run npm install && npm start to install and start the app.`);\n });\n}", "function initApp() {\n var urlParams, configManager, layoutManager;\n console.log('jimu.js init...');\n urlParams = getUrlParams();\n\n DataManager.getInstance();\n\n html.setStyle(jimuConfig.loadingId, 'display', 'none');\n html.setStyle(jimuConfig.mainPageId, 'display', 'block');\n\n layoutManager = LayoutManager.getInstance({\n mapId: jimuConfig.mapId\n }, jimuConfig.layoutId);\n configManager = ConfigManager.getInstance(urlParams);\n\n layoutManager.startup();\n configManager.loadConfig();\n }", "init() {\n // Action to execute on load of the app\n }", "function initApp() {\n\tauthCode = null;\n\tchildWindow = null;\n\t//registerBbm();\n\n\t// setup our Foursquare credentials, and callback URL to monitor\n\tfoursquareOptions = {\n\t\tclientId: '*',\n\t\tclientSecret: '*',\n\t\tredirectUri: '*'\n\t};\n\n\t// (bbUI) push the start.html page\n\tbb.pushScreen('start.html', 'start');\n}", "async initApp() {\n if (!this.context) {\n await this.connect();\n }\n }", "function init() {\n return new Application();\n}", "function get_app() {\n return app;\n}", "function App() {\n this.modules = [];\n this.registry = new registry.Registry();\n\n this._started = false;\n\n // Register a bunch of default utilities\n this.registry.registerUtility(notification.defaultNotifier,\n 'notifier');\n\n // And set up default components.\n this.include(authz.acl);\n this.include(identity.simple);\n this.include(storage.noop);\n}", "function init() {\n\t\t//console.log(\"app.init()\");\n\t\tif(initDone) {\n\t\t\t//console.log(\"init already done.\");\n\t\t\treturn;\n\t\t} else {\n\t\t\tinitDone = true;\n\t\t}\n\n\t\t// Init HTML layout and from there the GUI/UI with interaction.\n\t\tlayout.init();\n\t\tscene.init();\n\t\t//ui.init();\n\t\t// Proceed directly to startup of the loop.\n\t\t//start();\n\t}", "function initApp () {\n loadThemes();\n}", "function initApplication() {\n\tconsole.log(\"Starting Mustang v2...\");\n}", "function init() {\n console.log(\"Init app.\");\n gapi.hangout.data.addStateChangeListener(stateUpdated);\n gapi.hangout.addParticipantsListener(participantsUpdated);\n\n // This application is pretty simple, but use this special api ready state\n // event if you would like to any more complex app setup.\n gapi.hangout.addApiReadyListener(apiReady);\n}", "function initializeApp () {\n makeQuiz();\n eventHandlers();\n}", "constructor(app = null) {\n this.app = app;\n }", "function $$init() {\n let windowAllClosed = false;\n\n /**\n * creates a window\n */\n function createStartupWindow() {\n // startup window will shown immediately after created regardless of the preference\n createWindow(`${appProtocol}://${appHostname}${appStartupPath}`, null, true);\n }\n\n // quit application when all windows are closed\n app.on('window-all-closed', () => {\n // on macOS it is common for applications to stay open until the user explicitly quits\n windowAllClosed = true;\n if (process.platform !== 'darwin') {\n app.quit();\n }\n });\n\n app.on('activate', () => {\n // on macOS it is common to re-create a window even after all windows have been closed\n if (windowAllClosed) {\n createStartupWindow();\n windowAllClosed = false;\n }\n });\n\n createStartupWindow();\n }", "function App() {\n\n // load some scripts (uses promises :D)\n loader.load({\n url: \"./bower_components/jquery/dist/jquery.min.js\"\n }, {\n url: \"./bower_components/lodash/dist/lodash.min.js\"\n }, {\n url: \"./bower_components/backbone/backbone.js\"\n }, {\n url: \"./bower_components/backbone.localStorage/backbone.localStorage.js\"\n }, {\n url: \"./js/models/todo.js\"\n }, {\n url: \"./js/collections/todos.js\"\n }, {\n url: \"./js/views/todos.js\"\n }, {\n url: \"./js/views/app.js\"\n }, {\n url: \"./js/routers/router.js\"\n }, {\n url: \"./js/tapp.js\"\n }).then(function() {\n _.templateSettings.interpolate = /{([\\s\\S]+?)}/g;\n\n // start app?\n \n });\n}", "function initializeApplication(initObj) {\n initializeConfig();\n _router.initialize();\n\n if (initObj.view) {\n _view = initObj.view;\n } else {\n console.log('Nori, no view. Creating default.');\n _view = createApplicationView({});\n }\n\n if (initObj.model) {\n _model = initObj.model;\n } else {\n console.log('Nori, no model. Creating default.');\n _model = createApplicationModel({});\n }\n\n configureApplicationEvents();\n\n _appEvents.applicationInitialized();\n }", "function onAppReady(obj) {\r\n \"use strict\";\r\n \r\n console.log(\"init.js: onAppReady\");\r\n \r\n require([\"MainApp\", \"Router\", \"Config\", \"DataService\", \"handlebars\", \"templates\"], function (MainApp, Router, Config, DataService, handlebars, templates) {\r\n window.app = new MainApp(Config, templates, DataService);\r\n window.app.init();\r\n });\r\n}", "function initApp() {\r\n var startUpInfo;\r\n MemoryMatch.setPlatform();\r\n startUpInfo = \"Loading \" + MemoryMatch.getAppInfo();\r\n if (MemoryMatch.debugMode) {\r\n MemoryMatch.debugLog(startUpInfo);\r\n } else {\r\n console.log(startUpInfo);\r\n }\r\n\r\n // Listeners for all possible cache events\r\n\r\n var cache = window.applicationCache;\r\n if (cache != null) {\r\n cache.addEventListener('cached', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('checking', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('downloading', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('error', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('noupdate', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('obsolete', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('progress', MemoryMatch.logCacheEvent, false);\r\n cache.addEventListener('updateready', MemoryMatch.logCacheEvent, false);\r\n }\r\n if (document.getElementById(MemoryMatch.loaderElement) != null) {\r\n // show canvas under loader so we can implement a loadbar until we get everything setup for EaselJS to take over\r\n document.getElementById(MemoryMatch.loaderElement).style.display = \"block\";\r\n document.getElementById(MemoryMatch.stageCanvasElement).style.display = \"block\";\r\n }\r\n\r\n // Determine canvas size, it will determine which assets need to be loaded\r\n MemoryMatch.isDesiredOrientationWhenLoadStarted = MemoryMatch.isDesiredOrientation();\r\n MemoryMatch.setCanvasSize(null);\r\n MemoryMatch.loadAllAssets(false);\r\n\r\n //runTests(); // run unit tests\r\n}", "function createApp(){ console.log(\"create an app\") }", "function createApp(){\n\tconsole.log('createApp: ')\n\tu.createMetroApp(app.name);\n}", "function App () {\n Base.call(this);\n this.dependencies = {};\n}", "function initializeApplication() {\n\n app.utils.getPageResources(chkErr(function(templates, content, config) {\n \n app.storage.getData(chkErr(function(contacts) {\n\n listTemplate = templates.partials_contact_list;\n pageContents = content;\n\n app.utils.renderPage(templates.page_contacts, content);\n refreshContactList(contacts);\n addContactPageListeners();\n\n }));\n\n }));\n\n }", "initialize() {\n templates.loadTemplates()\n .then(() => {\n // Initialize GUIs\n GUI.initialize();\n\n // Initialize Others\n this.initializeAutoMinimize();\n this.initializeHotkeys();\n this.initializeIpcListeners();\n\n // Check dependencies and update poe.ninja\n this.checkDependencies();\n Pricecheck.updateNinja();\n Pricecheck.updatePoeData();\n return;\n })\n .catch((error) => {\n var errorMsg = \"Error initializing app\\n\" + JSON.stringify(error, null, 4);\n\n log.error(errorMsg);\n alert(errorMsg);\n windowManager.closeAll();\n return;\n });\n }", "async function initialize() {\n process.on('uncaughtException', criticalErrorHandler.processUncaughtExceptionHandler.bind(criticalErrorHandler));\n global.willAppQuit = false;\n\n // initialization that can run before the app is ready\n initializeArgs();\n initializeConfig();\n initializeAppEventListeners();\n initializeBeforeAppReady();\n\n // wait for registry config data to load and app ready event\n await Promise.all([\n registryConfig.init(),\n app.whenReady(),\n ]);\n\n // no need to continue initializing if app is quitting\n if (global.willAppQuit) {\n return;\n }\n\n // initialization that should run once the app is ready\n initializeInterCommunicationEventListeners();\n initializeAfterAppReady();\n initializeMainWindowListeners();\n}", "function startApplication() {\n app.router = new Router({\n collection:app.collections.projectCollection\n });\n\n app.navigation = new HamburgerComponent({\n router:app.router\n });\n }", "function startApp(attrs) {\n var App;\n\n var attributes = Ember['default'].merge({}, config['default'].APP);\n attributes = Ember['default'].merge(attributes, attrs); // use defaults, but you can override;\n\n Router['default'].reopen({\n location: 'none'\n });\n\n Ember['default'].run(function() {\n App = Application['default'].create(attributes);\n App.setupForTesting();\n App.injectTestHelpers();\n });\n\n // App.reset(); // this shouldn't be needed, i want to be able to \"start an app at a specific URL\"\n\n return App;\n }", "function app() {\n\n // load some scripts (uses promises :D)\n //loader.load(\n {\n url: \"./bower_components/jquery/dist/jquery.min.js\"\n }; {\n url: \"./bower_components/lodash/dist/lodash.min.js\"\n }; {\n url: \"./bower_components/pathjs/path.min.js\"\n };then(function() {\n _.templateSettings.interpolate = /{([\\s\\S]+?)}/g;\n\n var options = {\n api_key: \"ab2ph0vvjrfql5ppli3pucmw\"\n }\n // start app?\n var client = new EtsyClient(options);\n\n\n })\n\n}", "function startApp() {\n //first calls, default dataset? \n }", "async function start () {\n await app.initDB()\n app.initSocket()\n app.initMiddlewares()\n app.initSubApp()\n await app.initHttp()\n }", "function App() {\n return null;\n }", "function App() {\n return null;\n }", "function runApp(app_name){\n app.mount(app_name);\n}", "static init() {\n console.log(\"App is Initialize...\");\n }", "function initApp(appname) {\n return new Promise(function( resolve, reject ) {\n return RPCCall(0,'load',[appname]).then( function() {\n resolve( cache[0] ); // return the apploader\n } );\n } );\n}", "function startup() {\n // Set initial UI data for our app and Vue\n // App data will be populated after updateUI is called in onMessage EVENT_BRIDGE_OPEN_MESSAGE \n dynamicData = deepCopy(CONFIG.INITIAL_DYNAMIC_DATA);\n defaultMaterialProperties = {\n shadeless: deepCopy(CONFIG.INITIAL_DYNAMIC_DATA[STRING_MATERIAL].shadeless),\n pbr: deepCopy(CONFIG.INITIAL_DYNAMIC_DATA[STRING_MATERIAL].pbr)\n };\n \n // Create the tablet app\n ui = new AppUi({\n buttonName: CONFIG.BUTTON_NAME,\n home: URL,\n onMessage: onMessage, // UI event listener \n // Icons are located in graphicsDirectory\n // AppUI is looking for icons named with the BUTTON_NAME \"avatar-101\" \n // For example: avatar-101-a.svg for active button icon, avatar-101-i.svg for inactive button icon\n graphicsDirectory: Script.resolvePath(\"./resources/icons/\"), \n onOpened: onOpened,\n onClosed: onClosed\n });\n\n // Connect unload function to the script ending\n Script.scriptEnding.connect(unload);\n // Connect function callback to model url changed signal\n MyAvatar.skeletonModelURLChanged.connect(onAvatarModelURLChanged);\n }", "function init() {\n\n require('dotenv').load();\n\n app.port = process.env.PORT || 3002;\n\n // Default route\n app.get('/', function (req, res) {\n res.json({\n name: 'League of Legends eSports API',\n version: \"0.9.0\",\n author: \"Robert Manolea <manolea.robert@gmail.com>\",\n repository: \"https://github.com/Pupix/lol-esports-api\"\n });\n });\n\n // Dynamic API routes\n XP.forEach(routes, function (func, route) {\n app.get(route, requestHandler);\n });\n\n //Error Handling\n app.use(function (req, res) { res.status(404).json({error: 404, message: \"Not Found\"}); });\n app.use(function (req, res) { res.status(500).json({error: 500, message: 'Internal Server Error'}); });\n\n // Listening\n app.listen(app.port, function () { console.log('League of Legends eSports API is listening on port ' + app.port); });\n }", "function App() {\n this.express = express();\n this.middleware();\n this.routes();\n }", "setupApp() {\n this.app = express();\n if (this.config.bodyParserOptions.json) {\n this.app.use(bodyParser.json(this.config.bodyParserOptions.json));\n }\n if (this.config.bodyParserOptions.raw) {\n this.app.use(bodyParser.raw(this.config.bodyParserOptions.raw));\n }\n if (this.config.bodyParserOptions.text) {\n this.app.use(bodyParser.text(this.config.bodyParserOptions.text));\n }\n if (this.config.bodyParserOptions.urlencoded) {\n this.app.use(bodyParser.urlencoded(this.config.bodyParserOptions.urlencoded));\n }\n this.app.use(cookieParser(this.config.cookieParserOptions));\n this.app.use(morgan(this.config.morganOptions));\n this.app.use(compression(this.config.compressionOptions));\n }", "function main() {\n // Resolve our container and intialize our application\n let canvasEl = document.getElementById('canvas');\n assert(canvasEl, 'Unable to find #canvas element');\n window.app = new App(canvasEl);\n}", "function main() {\n new App().main();\n}", "function initApp() {\n const logoutBtn = document.querySelector('#logout');\n const search = document.querySelector('#search');\n\n logoutBtn.addEventListener('click', logout);\n search.addEventListener('submit', searchContacts);\n\n loadAppState();\n}", "function initializeApp() {\n return function(dispatch, getState) {\n dispatcherHandler_2.registerListener();\n dispatch(registerRibbonFunctions());\n dispatcherHandler_2.getResourceStrings(resources_2.resourceStrings,\n function(response) {\n var values = JSON.parse(response.functionArguments[1]).values;\n resources_2.default.initialize(values);\n });\n dispatcherHandler_2.getCrmAccessKey(function(response) {\n var crmAccessKey = JSON.parse(response.functionArguments[1]).requestSecurityTokenResponse;\n var result = crmAccessKey.replace('<RequestOAuthSecurityTokenResponse><AccessToken>', '');\n result = result.substring(0, result.indexOf('</AccessToken><EncodedAccessToken>'));\n dispatch(acquiredCrmAccessKey(result));\n });\n dispatcherHandler_2.getCallbackTokenAsync(function(response) {\n var value = JSON.parse(response.functionArguments[1]).onRequestCallbackTokenAsyncResponse;\n // Since the dispatcher doesn't actually let us know if it succeeds or not, we must test its type.\n if (typeof value == 'string') {\n dispatch(acquiredCallbackToken(value));\n }\n dispatcherHandler_2.sendTelemetryEvent({\n name: 'mailapp_module_init',\n data: {\n type: 'mailapp_module_init'\n }\n });\n // If it's some error object. This is unsupported, try old auth?\n dispatch({\n type: actionTypes.INITIALIZE_APP,\n payload: {}\n });\n });\n };\n }", "function startApplication() {\n var appComponent = new AppComponent(document.querySelector('.content'));\n appComponent.start();\n}", "constructor(app) {\n super(app);\n }", "function initializeAppEnv() {\n appEnv = cfenv.getAppEnv(appEnvOpts);\n if (appEnv.isLocal) {\n require('dotenv').load();\n }\n if (appEnv.services.cloudantNoSQLDB) {\n initCloudant();\n } else {\n console.error(\"No Cloudant service exists.\");\n }\n\n if(appEnv.services.conversation){\n console.log(\"Services\");\n initConversation();\n }else{\n console.error(\"No Conversation service exists\");\n }\n}", "function onPreappinit() {\n kony.print(\"LOG : onPreappinit - START\");\n gAppData = new initAppData();\n}", "start() {\n //DO BEFORE START APP CONFIGURATION/INITIALIZATION\n super.start();\n }", "function initExpressApp() {\n\n const port = process.env.PORT || 3001;\n\n if (isDev()) {\n dotenv.config();\n }\n\n const app = express();\n app.use(cors());\n app.use(bodyParser.json());\n\n app.listen(port, () => {\n console.log(`listening on port ${port}`);\n });\n\n return app;\n}", "function App() {\n this.googlePassportObj = new GooglePassport_1[\"default\"]();\n this.expressApp = express();\n this.middleware();\n this.routes();\n this.idGenerator = 100;\n this.Postcards = new PostcardModel_1.PostcardModel();\n this.Collections = new CollectionModel_1.CollectionModel();\n }", "function Application() {}", "function auxinApp(uiaId)\n{\n log.debug(\"auxinApp App constructor called...\");\n\n baseApp.init(this, uiaId);\n}", "function init() {\n console.log(\"FaustPlayground: version 1.0.0\");\n var app = new App();\n var ressource = new Ressources;\n ressource.getRessources(app);\n}", "function initializeApplication() {\n invokePageFunction(APPLICATION_METHOD_INITIALIZE);\n }", "function App(core, ee) {\n this.core = core;\n this.ee = ee;\n this.sessionfile = __dirname + \"/session.json\";\n}", "function _createApplication() {\n /**\n * Create the root of the application\n */\n mkdirSync(appPath);\n\n /**\n * Copy the baseline structure of the application\n */\n const templateBaselinePath = path.join(__dirname, '..', constants.TEMPLATE_BASELINE_PATH);\n deepCopySync(templateBaselinePath, appPath);\n\n /**\n * Copy the index.html file according to the configuration\n */\n if (program.menu === 'left') {\n deepCopySync(path.join(__dirname, '..', constants.INDEX_LEFT_MENU), appPath);\n } else {\n deepCopySync(path.join(__dirname, '..', constants.INDEX_TOP_MENU), appPath);\n }\n\n /**\n * Create the other directiories that are needed for the start\n */\n constants.DIRECTORIES_FOR_mkdirSync.forEach(__path => {\n mkdirSync(path.join(appPath, __path));\n });\n\n /**\n * Run the steps to aquire the final form of the skeleton\n */\n startTaskRunner(appPath);\n}", "function init()\r\n{\r\n\tif(!$.appConfiguration)\r\n\t{\r\n\t\tconsole.error(\"No appliation configuration is defined.\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n\t//Load templates\r\n\tvar templateFiles = $.appConfiguration.templates;\r\n\r\n\tif(templateFiles)\r\n\t{\r\n\t\tfor(var i = 0; i < templateFiles.length; i++)\r\n\t\t{\r\n\t\t\tconsole.log(\"Loading template file - \" + templateFiles[i]);\r\n\t\t\t$.loadCustomDirectives(templateFiles[i]);\r\n\t\t}\r\n\t}\r\n}", "constructor(_atdiroverride = -1, _apiurl = -1, _averbose = false){\r\n\t\tthis._app_initialized = false;\r\n\t\tthis._app_conf = { _template_dir: _atdiroverride, _api_url: _apiurl };\r\n\t\tthis._app_templates = [];\r\n\t\tthis._app_templates_buffer = [];\r\n\t\tthis._app_template_styles = [];\r\n\t\tthis._app_started = false;\r\n\t\tthis._app_verbose = _averbose;\r\n\t}", "function initializeApp(options, name) {\n\t if (name === undefined) {\n\t name = DEFAULT_ENTRY_NAME;\n\t } else {\n\t if (typeof name !== 'string' || name === '') {\n\t error('bad-app-name', { name: name + '' });\n\t }\n\t }\n\t if (contains(apps_, name)) {\n\t error('duplicate-app', { name: name });\n\t }\n\t var app = new FirebaseAppImpl(options, name, namespace);\n\t apps_[name] = app;\n\t callAppHooks(app, 'create');\n\t return app;\n\t }", "function init(){\n var config = JSON.parse(fs.readFileSync(CONFIG_FILE));\n \n var projectConfig = config[\"project\"];\n console.log(\"\\n --- \" + projectConfig[\"name\"] + \" --- \\n\" + projectConfig[\"description\"] + \"\\n\"); //project logo\n \n var databaseConfig = config[\"databaseConnection\"];\n var systemUser = config[\"systemUser\"];\n var keysPath = config[\"keysPath\"];\n \n var privateKey = fs.readFileSync(path.join(__dirname, keysPath[\"privateKey\"])).toString();\n \n var dataManager = new DataManager({\n host: databaseConfig[\"host\"],\n port: databaseConfig[\"port\"],\n database: databaseConfig[\"database\"],\n user: databaseConfig[\"user\"],\n password: databaseConfig[\"password\"]\n }, privateKey);\n \n dataManager.query(\"UPDATE Users SET password = ?, inputDate = NOW() WHERE firstName = 'System'\", [dataManager.strToAES(systemUser[\"password\"])], function(field, row, err){});\n \n dataManager.setConfigData(config);\n \n var channelManager = new ChannelManager(dataManager);\n var app = new App(dataManager, channelManager, privateKey);\n \n app.getApp().on(\"error\", function(err){\n console.log(\"FATAL ERROR: \" + err);\n init();\n });\n\n var systemConfig = config[\"system\"];\n http.globalAgent.maxSockets = config[\"maxClients\"];\n http.createServer(app.getApp()).listen(systemConfig[\"serverPort\"]);\n console.log(\"Server running on port \" + systemConfig[\"serverPort\"]);\n}", "_boot(){\r\n\t\tvar core = this;\r\n\t\tif(core._app_conf._template_dir != -1){\r\n\t\t\t\tcore._app_initialized = true;\r\n\t\t} else {\r\n\t\t\t\tcore._rest(\"POST\", core._app_conf._api_url, [[\"api\", \"template_get_dir\"]], core._app_conf, \"_template_dir\");\r\n\r\n\t\t\t// Wait until all the config variables are all retrieved\r\n\t\t\tvar _tmpVarCheck = setInterval(function(){\r\n\r\n\t\t\t\tif(core._app_verbose) console.log(\"Initializing application...\");\r\n\t\t\t\tif(core._app_conf._template_dir != -1){\r\n\t\t\t\t\tcore._app_initialized = true;\r\n\t\t\t\t\tclearInterval(_tmpVarCheck);\r\n\t\t\t\t}\r\n\t\t\t}, 1);\r\n\t\t}\r\n\t}", "async initialize(appConfig) {\n this.preferences = this.externalServices.createPreferences();\n this.appConfig = appConfig;\n\n await this._readPreferences();\n await this._parseHashParameters();\n this._forceCssTheme();\n await this._initializeL10n();\n\n if (\n this.isViewerEmbedded &&\n AppOptions.get(\"externalLinkTarget\") === LinkTarget.NONE\n ) {\n // Prevent external links from \"replacing\" the viewer,\n // when it's embedded in e.g. an <iframe> or an <object>.\n AppOptions.set(\"externalLinkTarget\", LinkTarget.TOP);\n }\n await this._initializeViewerComponents();\n\n // Bind the various event handlers *after* the viewer has been\n // initialized, to prevent errors if an event arrives too soon.\n this.bindEvents();\n this.bindWindowEvents();\n\n // We can start UI localization now.\n const appContainer = appConfig.appContainer || document.documentElement;\n this.l10n.translate(appContainer).then(() => {\n // Dispatch the 'localized' event on the `eventBus` once the viewer\n // has been fully initialized and translated.\n this.eventBus.dispatch(\"localized\", { source: this });\n });\n\n this._initializedCapability.resolve();\n }", "function serverInit(app){\n\n\tvar config = app.config;\n\tconsole.log('app init...');\n\t\n\tapp.set('views', config.static_assets.views);\n\tapp.use(favicon(path.join(config.static_assets.dir, 'favicon.ico')));\n\t\n\tif(config.app.env == 'development') {\n\t\tapp.use(logger('dev'));\n\t}\n\tapp.use(bodyParser.json());\n\tapp.use(bodyParser.urlencoded());\n\tapp.use(cookieParser());\n\tapp.use(session({ secret: config.session.secret, cookie: { maxAge: config.session.max_age} }));\n\tapp.use(express.static(config.static_assets.dir));\n\t\t\n\t//db e config injecting\n\tapp.use(function(req, res, next){\n\t\treq.dataDB = app.db.data;\n\t\treq.userDB = app.db.users;\n\t\treq.config = config;\n\t\tnext();\n\t});\n\t\n\t//inizializzo le componenti del controller\n\tvar controller = require('./controller');\n\tcontroller.init(app);\n\t\n}", "async function bootApp() {\n await sessionStore.sync();\n await syncDb();\n await createApp();\n await startListening();\n}", "function loadApplication() {\n console.log(\"Application loaded\");\n // Load directly to the main menu\n configureUI(displayMainMenu());\n\n}", "async function init(){\n const libAppSettings = require(\"lib-app-settings\");\n var appSettings = new libAppSettings(\".settings\");\n await appSettings.loadSettingsFromFile()\n .then((settings)=>{\n if (settings){\n apps = settings.apps;\n addApps();\n checkAppsSlow();\n startApps();\n }\n })\n .catch((error)=>{\n alert(\"Problem with settings file - \" + error);\n });\n}", "function loadApp() {\n console.log(\"loadApp\");\n displayHomePage();\n}", "function App(opts) {\n // new customizable settings for each App instance\n this.settings = getAppSettings();\n\n // if no path sent in to init, nor to App constructor,\n // then take the process's working directory as apper root\n this.path = opts.path || process.cwd();\n\n this.mountPath = opts.mountPath || \"\";\n\n // indent starts at 0 to demarcate subapps with increasing indent\n this.indent = opts.indent || 1;\n\n this.socketIO = opts.socketIO;\n}", "function App() {\n this.googlePassportObj = new GooglePassport_1[\"default\"]();\n this.expressApp = express();\n this.middleware();\n this.routes();\n this.idGenerator = Math.floor(Math.random() * (max - min) + min);\n this.Recipes = new RecipeModel_1.RecipeModel();\n this.RecipesCatalog = new RecipeCatalogModel_1.RecipeCatalogModel();\n this.RecipeCatalogDetails = new RecipeCatalogDetailsModel_1.RecipeCatalogDetailsModel();\n this.User = new UserModel_1.UserModel();\n }", "function init(application, config) {\n app = application;\n cfg = config;\n\n // register URLs\n\tapp.get(/.*/, function(req, res) { utils.processRequest(req, res, cfg, FUNCTIONS); } );\n\tapp.put(/.*/, function(req, res) { utils.processRequest(req, res, cfg, FUNCTIONS); } );\n\tapp.post(/.*/, function(req, res) { utils.processRequest(req, res, cfg, FUNCTIONS); } );\n\tapp.delete(/.*/, function(req, res) { utils.processRequest(req, res, cfg, FUNCTIONS); } );\n}", "function Application( autoInvoke /*, Arguments */ ) {\n\n if( autoInvoke ) {\n\n this.Init( /* Arguments */ )\n\n }\n\n return this;\n}", "async function bootApp() {\n await syncDb() // initializing and seeding your database\n await createApp()\n await startListening()\n }", "constructor() {\n this.app = express();\n this.config();\n }", "function init() {\n\twindow.addEventListener(\"error\", errorHandler)\n\twindow.addEventListener(\"unhandledrejection\", errorHandler)\n\tif (document.readyState !== \"loading\")\n\t\tdocument.addEventListener(\"DOMContentLoaded\", app)\n\telse\n\t\tapp()\n}", "function initApp(apiUrl) {\n //localStorage.clear();\n localStorage.setItem(\"api\", apiUrl);\n localStorage.setItem(\"currPost\", 0);\n // Initialises the page.\n genNavBar();\n genSearch(\"generate\");\n genLogin(\"generate\");\n genSignup(\"generate\");\n genProfile(\"generate\");\n genModDelPost(\"generate\");\n genFeed(\"generate\");\n genPages(\"generate\");\n genUpvotes(\"generate\");\n genComments(\"generate\");\n genPost(\"generate\");\n eventListen();\n scroll();\n}", "function startApp() {\n Backbone.history.start({\n pushState: false\n });\n\n var isFirstLoad = localStorage.getItem('firstLoad') === null;\n\n if (isFirstLoad) {\n var onboardView = new OnboardView();\n\n $('body').append(onboardView.render().el);\n localStorage.setItem('firstLoad', 1);\n }\n}", "function startApp() {\n connection.connect(function (err) {\n if (err) throw err;\n console.log('connected as id ' + connection.threadId);\n console.log('\\n');\n managerView();\n });\n}", "function init() {\n\tspeechEngine = Homey.manager('speech-output');\n\tHomey.log('NU.nl news app loaded.');\n\t\n\t// Create settings variables with default values if none seem to exist\n\tif (!Homey.manager('settings').get('mode')) {\n\t\tHomey.manager('settings').set('mode', 'title');\n\t\tHomey.log('Created setting: mode');\n\t}\n\tif (!Homey.manager('settings').get('max')) {\n\t\tHomey.manager('settings').set('max', 10);\n\t\tHomey.log('Created setting: max');\n\t}\n}", "function createApp() {\n const app = new Koa();\n const router = new Router();\n /* \n Middlewares\n */\n\tapp.use(helmet());\n\tapp.use( async (ctx, next) => {\n\t\tconst reqOrigin = ctx.header.origin;\n\t\tregisterName.forEach(origin => {\n\t\t\tif (origin === reqOrigin) ctx.set(\"Access-Control-Allow-Origin\", reqOrigin);\n\t\t});\n\t\tctx.set(\"Access-Control-Allow-Methods\", \"GET, POST\");\n\t\tctx.set(\"Access-Control-Allow-Credentials\", true);\n\t\tctx.set(\"Access-Control-Allow-Headers\", [\n\t\t\t'Origin', 'Content-Type', 'Accept', 'Authorization', 'Access-token', 'Refresh-token'\n\t\t]);\n\t\tctx.set(\"X-Powered-By\", \"PHP 4.2.0\");\n\t\tctx.set(\"X-XSS-Protection\", \"1; mode=block; report=/report-xss-violation\");\n\t\tawait next();\n\t});\n app.use(uid);\n /*\n Connect all routes\n */\n router.use('/api/v1/auth', authRouter.routes());\n router.use('/api/v1/global', refreshRouter.routes());\n\n app.use(router.allowedMethods());\n app.use(router.routes());\n return app;\n}", "function AppUtils() {}", "async function start () {\n\n\ttry {\n\t\t/*\n\t\t * Store basic inforamation about the application\n\t\t * for other modules to use */\n\t\t//args.name_pretty = 'Admin Dashboard';\n\t\t//args.desc = 'Mission control station';\n\n\t\t/*\n\t\t * Common startup file for all apss */\n\t\t//log = await startup.init(args);\n\t\t//await kv.get_and_store (`config/app/vc/`, { recurse : true });\n\n\t\t//log.info ({ args }, `starting app ${name} with arguments`);\n\n\t\trequire ('./www');\n\t}\n\tcatch (e) {\n\t\tconsole.error (colors.red ('fatal error : ') + e);\n\t\tif (e.stack)\n\t\t\tconsole.error (e.stack);\n\n\t\tprocess.exit (1);\n\t}\n}", "function intiApp() {\n app.listen(port, (err) => {\n if (err)\n logger.error(`Unable to lunch the application :: ${err.message}`);\n else {\n logger.info(`Application launch successfully on port ${port}`);\n console.log('application is running on port ' + port);\n }\n })\n}", "function init() {\n\tconst params = getUrlParameters() // valuable information is encoded in the URL\n\tconst dataPromise = loadData(params) // start loading the data\n\tconst callback = () => app(params, dataPromise)\n\n\t// set error handlers\n\twindow.addEventListener(\"error\", errorHandler)\n\twindow.addEventListener(\"unhandledrejection\", errorHandler)\n\n\tif (document.readyState !== \"loading\")\n\t\tdocument.addEventListener(\"DOMContentLoaded\", callback)\n\telse\n\t\tcallback()\n}", "function App() {\n this.expressApp = express();\n this.middleware();\n this.routes();\n this.idGenerator = 102;\n this.Properties = new PropertyModel_1.PropertyModel();\n this.Users = new UserModel_1.UserModel();\n this.Bookings = new BookingModel_1.BookingModel();\n this.Reviews = new ReviewModel_1.ReviewModel();\n this.googlePassportObj = new GooglePassport_1[\"default\"]();\n }", "async function givenRunningApplicationWithCustomConfiguration() {\n app = new application_1.TodoListApplication({\n rest: testlab_1.givenHttpServerConfig(),\n });\n await app.boot();\n /**\n * Override default config for DataSource for testing so we don't write\n * test data to file when using the memory connector.\n */\n app.bind('datasources.config.db').to({\n name: 'db',\n connector: 'memory',\n });\n // Start Application\n await app.start();\n }", "init(app) {\n this.app = app;\n this.expressLimiter();\n this.bodyParser();\n this.cors();\n this.helmet();\n this.override();\n this.compression();\n }", "appExecute() {\n\n\t\tthis.appConfig();\n\t\tthis.includeRoutes(this.app);\n\n\t\tthis.http.listen(this.port, this.host, () => {\n\t\t\tconsole.log(`Listening on http://${this.host}:${this.port}`);\n\t\t});\n\t}", "function App() {\n this.db = new DatabaseConnection_1.DatabaseConnection();\n this.express = express();\n this.middleware();\n this.routes();\n this.setViews();\n var classifier = new ReleaseClassifier_1.ReleaseClassifier();\n var commitClassifier = new CommitClassifier_1.CommitClassifier();\n //classifier.readReleases();\n //commitClassifier.readCommits();\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n } else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n } else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n } else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeAppEnv() {\n appEnv = cfenv.getAppEnv(appEnvOpts);\n if (appEnv.isLocal) {\n require('dotenv').load();\n }\n if (appEnv.services.cloudantNoSQLDB) {\n initCloudant();\n } else {\n console.error(\"No Cloudant service exists.\");\n }\n}", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n }\n else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n }\n else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n }\n else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n }\n else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function initializeApp(options, name) {\n if (name === undefined) {\n name = DEFAULT_ENTRY_NAME;\n }\n else {\n if (typeof name !== 'string' || name === '') {\n error('bad-app-name', { name: name + '' });\n }\n }\n if (contains(apps_, name)) {\n error('duplicate-app', { name: name });\n }\n var app = new FirebaseAppImpl(options, name, namespace);\n apps_[name] = app;\n callAppHooks(app, 'create');\n return app;\n }", "function App () {\n\n this.taskRepository = new TaskRepository();\n\n this.todosController = new TodosController(this.taskRepository);\n\n }" ]
[ "0.79483765", "0.77004915", "0.75859904", "0.7392242", "0.73389673", "0.7337566", "0.7098709", "0.7094714", "0.70335907", "0.70264256", "0.70233685", "0.69898516", "0.6983825", "0.6980272", "0.69399434", "0.6926202", "0.69252443", "0.69087744", "0.68747747", "0.6861737", "0.6847013", "0.68469596", "0.6832527", "0.6807746", "0.6807065", "0.6787931", "0.67023855", "0.6674997", "0.6657791", "0.6643947", "0.663732", "0.6608848", "0.66065794", "0.6593314", "0.6593314", "0.658335", "0.6577757", "0.6574134", "0.6567644", "0.65669584", "0.65658617", "0.65598804", "0.6554315", "0.65538895", "0.65213585", "0.6507013", "0.6504236", "0.65017086", "0.65005606", "0.6497632", "0.6479279", "0.6476846", "0.6465423", "0.6463654", "0.64554805", "0.6454109", "0.64504546", "0.64500046", "0.6440417", "0.6438924", "0.64259344", "0.640501", "0.63972026", "0.6394819", "0.6391415", "0.6385431", "0.6381386", "0.63813645", "0.63789535", "0.63741195", "0.6369189", "0.6368408", "0.6364923", "0.6363224", "0.6354211", "0.63459194", "0.63426226", "0.6337443", "0.63346434", "0.633441", "0.63161135", "0.6308342", "0.6301769", "0.6300281", "0.6291626", "0.6276836", "0.62760425", "0.6275703", "0.6271411", "0.62698746", "0.6267628", "0.62652314", "0.62652314", "0.62652314", "0.62651914", "0.62641805", "0.62641805", "0.62641805", "0.62641805", "0.62641805", "0.6260911" ]
0.0
-1
add a node at the end of the linked list
append(value) { let node = new Node(value) // if list is empty, add the element and make it head if(this.head === null) { this.head = node } else { let current = this.head // iterate to the end of the list and append node while(current.next) { current = current.next } current.next = node } this.size++ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addToEnd(newNode) {\n\n // check if empty\n if (head == null) {\n head = newNode;\n tail = newNode;\n } else {\n tail.next = newNode;\n tail = newNode;\n\n }\n }", "appendNode(node) {\n if(!this.getLast()) {\n this.head = node;\n } else {\n this.getLast().next = node;\n }\n }", "addNodeAtLast(data) {\n let node = new Node(data);\n let next = this.head;\n if (!next) {\n this.head = node;\n } else {\n while (next && next.next) {\n next = next.next;\n }\n next.next = node;\n }\n }", "addatLast(data){\n var node = new Node(data);\n let current;\n if(!this.head){\n this.head = node;\n }else{\n current = this.head;\n while(current.next){\n current = current.next\n }\n current.next = node;\n\n\n\n }\n this.size++;\n\n }", "insert_end(newnode) {\r\n let temp = this.head\r\n if (temp == null) {\r\n this.head = newnode\r\n } else {\r\n while (temp.next != null) {\r\n temp = temp.next\r\n }\r\n temp.next = newnode\r\n }\r\n }", "addNodeAtEnd(headNode, newData) {\n if (headNode === null) {\n this.head = new Node(newData);\n } else {\n let lastNode = headNode;\n while (lastNode.next !== null) {\n lastNode = lastNode.next;\n }\n lastNode.next = new Node(newData);\n }\n }", "addAtEnd(data) {\n console.log(\"add \" + data);\n const node = new Node(data); // {data: data, next:null}\n if (this.head === null) {\n this.head = node;\n } else {\n let currentNode = this.head;\n // while: mientras (condicion: se cumpla la condicion) {hace esto}\n while (currentNode.next) {\n // verifico si next tiene un nodo\n currentNode = currentNode.next; // sustitutyo el nodo que vive en next, a mi nodo actual\n }\n // cuando next sea nulo, entonces sale del while y continua con el resto del codigo\n currentNode.next = node;\n }\n\n this.length++;\n }", "addToTheEnd(value) {\n let node = new Node(value);\n\n if (this.length === 0) {\n this.head = node;\n } else {\n let current = this.head;\n\n while (current.next) {\n current = current.next;\n }\n\n current.next = new Node(value);\n }\n\n this.length++;\n }", "addLast (value) {\n\t\tif (this.head === null) {\n\t\t\tthis.addFirst(value);\n\t\t} else {\n\t\t\tlet temp = this.head;\n\t\t\twhile (temp.next !== null) {\n\t\t\t\ttemp = temp.next;\n\t\t\t}\n\t\t\tlet n = new Node(value);\n\t\t\ttemp.next = n;\n\t\t\tthis.length++;\n\t\t}\n\t}", "addLast(element){ \n let node = new SinglyNode(element);\n if(this.isEmpty()){\n this.head = node,this.tail = node;\n } else {\n this.tail.next = node;\n this.tail = node;\n }\n this.size++;\n }", "insertEnd(data) {\n let node = new Node(data);\n if (this.head == null) {\n this.head = node;\n this.tail = node;\n this.size++;\n } else {\n node.next = null;\n let tail = this.head;\n while (tail.next !== null) tail = tail.next;\n tail.next = node;\n tail;\n this.size++;\n }\n }", "addAfter(node, data) {\n let currentNode = this.head;\n \n // if list is empty, call addHead function\n if (currentNode === null) {\n this.addHead(data);\n }\n \n // traverse list starting at the head\n while (currentNode !== null) {\n if (currentNode.data === node) {\n // if the specified node is the tail,\n // call addTail function else insert\n // new node and update next properties\n // for the surrounding nodes\n if (currentNode.getNext() === null) {\n this.addTail(data);\n } else {\n let newNode = new Node(data);\n newNode.setNext(currentNode.getNext());\n currentNode.setNext(newNode);\n newNode.setColor(this.chooseColor());\n break;\n }\n }\n currentNode = currentNode.getNext();\n }\n this.printMessage('addAfter', data, node);\n }", "appendNode(data){\n if(this.head === null){\n this.head = new Node(data);\n }\n let currentNode = this.head;\n while(currentNode.next !== null){\n currentNode = currentNode.next;\n }\n currentNode.next = new Node(data);\n }", "append(item){\n // add new item to end of list\n var node = new Node(item);\n var current;\n // if 1st item in LL -> make it the head...\n if (this.head === null){\n this.head = node;\n } else {\n // start at front of LL...\n current = this.head;\n // need to find last item so loop until find the very last item...\n // while(current.next){\n while(current.next !== null){\n current = current.next\n }\n // once at the last item (there is no next item) -> make the next item the node\n current.next = node;\n }\n this.length++;\n }", "append(value){\n this.head.next=value;\n this.tail = this.head.next;\n this.length++;\n }", "append(data) {\n //if list is empty\n\n if (!this.tail) {\n this.head = this.tail = new Node(data);\n } else {\n let oldTail = this.tail;\n this.tail = new Node(data);\n oldTail.next = this.tail;\n this.tail.prev = oldTail;\n }\n }", "append(newVal) {\r\n // check if the list exists\r\n // traverse to the end\r\n\r\n // O(n)\r\n // end of the list: currentNode.next = null\r\n\r\n let currentNode = this.head;\r\n\r\n // what if list is empty\r\n if (!currentNode) {\r\n this.head = new Node(newVal);\r\n return;\r\n }\r\n\r\n // while (null.next)\r\n while (currentNode.next) {\r\n // not null\r\n currentNode = currentNode.next;\r\n }\r\n\r\n\r\n let newNode = new Node(newVal);\r\n // currentNode is the end of the list\r\n currentNode.next = newNode;\r\n }", "append(data) {\n const newNode = new Node(data);\n\n if (this.head === null) {\n this.head = newNode;\n }\n\n if (this.tail !== null) {\n this.tail.next = newNode;\n }\n\n this.tail = newNode;\n }", "insertLast(item) {\n //check to see if the list is empty\n if (this.head === null) {\n this.insertFirst(item);\n }\n else {\n //create a new node item\n let tempNode = this.head;\n //start at the begining of the list and move thrrough til end\n while (tempNode.next !== null) {\n tempNode = tempNode.next;\n }\n //set the node's next pointer to the new node and give it the next pointer\n //of null, indicating that it is the last item in the list\n tempNode.next = new _Node(item, null)\n }\n }", "addLast(value) {\n if (this.isEmpty()) this.head = this.tail = new Node(value);\n else this.tail = this.tail.next = new Node(value);\n this.length++;\n return this;\n }", "insertAtEnd(value) {\n const node = new Node(value);\n\n if (!this.head) {\n this.head = node;\n return this;\n }\n\n let currentNode = this.head;\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n currentNode.next = node;\n return this;\n }", "insertAtEnd(value) {\n const node = new Node(value);\n\n if (!this.head) {\n this.head = node;\n return this;\n }\n\n let currentNode = this.head;\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n currentNode.next = node;\n return this;\n }", "add(data){\n let newNode = new Node(data);\n let currentNode = this.head;\n if(currentNode == null){\n this.head = newNode;\n }\n else{\n while(currentNode.next != null){\n currentNode = currentNode.next;\n }\n currentNode.next = newNode;\n }\n this.size ++;\n }", "append(data) {\n console.log(\"append\", data);\n const node = new Node(data);\n if (this.head === null) {\n this.head = node;\n return;\n }\n let current = this.head;\n while (current.next !== null) {\n current = current.next;\n }\n current.next = node;\n }", "insertLast(data) {\n const last = this.getLast();\n // Check if the list is empty\n if (last) {\n // There are nodes in the list\n last.next = new Node(data);\n } else {\n // The list is empty, so create a new head node\n this.head = new Node(data);\n }\n }", "addToTail(data) {\n let tail = this.head; // Set tail as the head of the list\n if (!tail) { // Check if there isn't a tail\n this.head = new Node(data); // Create a new head with parameter\n } else {\n // While tail doesn't have a next Node assign tail to the nextNode\n while (tail.getNextNode() !== null) {\n tail = tail.getNextNode();\n }\n // Create a new node after the tail\n tail.setNextNode(new Node(data));\n }\n }", "append(value){\nconst newNode = {\n value:value,\n next:null\n}\nthis.tail.next = newNode;\nthis.tail = newNode;\nthis.length++;\n}", "addToTail(val) {\n const node = new Node(val);\n\n if (!this.head) {\n this.head = node;\n this.tail = node;\n } else {\n this.tail.next = node;\n this.tail = node;\n }\n }", "append(value){\n if(this.head === null) {\n this.head = new Node(value);\n } else if(this.next !== null){\n let currentNode = this.head;\n while(currentNode.next !== null){\n currentNode = currentNode.next;\n }\n currentNode.next = new Node(value);\n }\n this.size++;\n }", "addToTail(value) {\n let node = new Node(value);\n let current;\n // update tail to be the new node\n this.tail = node;\n // if list is empty then value is the head\n if (this.head === null) {\n this.head = node;\n } else {\n // list is not empty\n // go to the end and add the value\n current = this.head;\n\n while (current.next) {\n current = current.next;\n }\n current.next = node;\n }\n }", "append(value) {\n // if list is empty\n if (!this.tail) {\n this.head = this.tail = new Node(value);\n } else {\n let oldTail = this.tail;\n this.tail = new Node(value);\n oldTail.next = this.tail;\n this.tail.prev = oldTail;\n }\n }", "insertLast(item){\n if(this.head === null){\n this.insertFirst(item);\n }\n else{\n let tempNode = this.head;\n while(tempNode.next !== null){\n tempNode = tempNode.next;\n }\n tempNode.next = new _Node(item, null);\n }\n }", "addLast(object) {\n let newLink = new Link(object);\n if(this.isEmpty()) \n this.head = newLink;\n else {\n this.tail.next = newLink;\n newLink.prev = this.tail;\n }\n this.tail = newLink;\n this.length++;\n return true;\n }", "append(value) {\n let node = new Node(value);\n if (!this.head) {\n this.head = node;\n return;\n }\n let current = this.head;\n while (current.next) {\n current = current.next;\n }\n current.next = node;\n }", "function addNode(head, value) {\n var tail;\n  var currentNode = head;\n  while(currentNode) { // while currentNode is NOT null\n    if (currentNode.next === null) {\n        tail = currentNode\n    }\n    currentNode = currentNode.next\n  }\n\n  tail.next = new Node(value)\n  return tail.next\n}", "append(data) {\n const newNode = new Node(data);\n if (!this.head) {\n this.head = newNode;\n } else {\n let current = this.head;\n while (current.next) {\n current = current.next;\n }\n current.next = newNode;\n }\n }", "appendData(data) {\n let new_node = new Node(data);\n if(!this.getLast()) {\n this.head = new_node;\n } else {\n this.getLast().next = new_node;\n }\n }", "insertLast(data) {\n let node = new Node(data);\n let current;\n this.size++;\n\n //If empty, make a head\n if (!this.head) {\n this.head = node;\n } else {\n current = this.head;\n\n while (current.next) {\n current = current.next;\n }\n current.next = node;\n }\n this.size++;\n }", "addToBack(data) {\n if(this._head === null) {\n this._head = new Node(data, null);\n } else {\n let current = this._head;\n\n while(current.next != null) {\n current = current.next;\n }\n\n current.next = new Node(data, null);\n }\n\n this._size++;\n }", "insertTailNode(data){\n //find the end of the list\n let current = this.head; //start at beginning of list\n let previous = null;\n while(current){\n previous = current;\n current = current.next; //moves current through the list until current is null (at the end of the list) which stops the while loop\n }\n //after while loop, previous is the last node in the list\n let tail = new Node(data, null); //use data to create the node to add\n previous.next = tail; //add the node at the end of the list\n this.size++; //increment list size\n}", "addToBack(value) {\n var new_node = new ListNode(value);\n\n if (this.head == null) {\n this.head = new_node;\n this.tail = new_node;\n }\n\n else {\n this.tail.next = new_node;\n this.tail = new_node;\n }\n }", "append(value) {\n // make a new node\n const newNode = new Node(value);\n\n // update head and tail if list if empty\n if(this.isEmpty()){\n this.head = newNode;\n this.tail = newNode;\n // asiign head to the next of the new node and place the new node at the head\n } else {\n newNode.next = this.head;\n this.head = newNode\n }\n this.size++\n }", "insertLast(item) {\n if (this.head === null) {\n this.insertFirst(item);\n } else {\n let tempNode = this.head;\n while (tempNode.next !== null) {\n tempNode = tempNode.next;\n }\n tempNode.next = new _Node(item, null);\n }\n }", "append(value){\nconst newNode={\n value: value,\n next: null\n}\nthis.tail.next = newNode\nthis.tail =newNode\nthis.length++;\nreturn this\n}", "addLast(element) {\n const newElement = new Node(element)\n\n if (this.isEmpty()) {\n this.firstElement = this.lastElement = newElement\n } else {\n this.lastElement.setNext(newElement)\n this.lastElement = newElement\n }\n\n this.size++\n }", "insertLast(item) {\n if (this.head === null) {\n this.insertFirst(item);\n }\n else {\n let tempNode = this.head;\n while (tempNode.next !== null) {\n tempNode = tempNode.next;\n }\n tempNode.next = new _Node(item, null);\n }\n }", "add(num) {\n if (this.tail === null){\n const nextNode = new Node(num);\n this.head = nextNode;\n this.tail = nextNode;\n }\n else if (this.tail.next === null){\n const nextNode = new Node(this.tail.value + num);\n nextNode.prev = this.tail;\n this.tail.next = nextNode;\n this.tail = nextNode;\n } else {\n this.tail.next.value = this.tail.value + num;\n this.tail = this.tail.next;\n }\n this.value = this.tail.value;\n this.tail.command = num;\n }", "add(value) {\n const node = new Node(value);\n if (!this.head) {\n this.head = node;\n }\n if (this.tail) {\n this.tail.next = node;\n }\n this.tail = node;\n }", "append(data) {\n // create new node\n let node = new Node(data);\n // if we haven't got any node, we should assign any nodes to this._head and this._tail \n if (this.length === 0) {\n this._head = node;\n this._tail = node;\n } else { \n // if we already have node, we should add new data to the end of the linked list\n let curNode = this._tail;\n curNode.next = node;\n node.prev = curNode;\n this._tail = node;\n }\n // increase length of the linked list\n this.length++;\n }", "addToBack(value) {\n var new_node = new ListNode(value);\n\n if (this.head == null && this.tail == null) {\n this.head = new_node;\n this.tail = new_node;\n }\n\n else {\n this.tail.next = new_node;\n this.tail = new_node;\n }\n }", "addToTail(value) {\n const newNode = { value, next: null };\n if (this.head === null) {\n this.head = newNode;\n this.tail = newNode;\n }\n const holder = this.tail;\n holder.next = newNode;\n this.tail = newNode;\n }", "setTail(node) {\n if(!node) return\n\n // check if the node is in this list already\n if(this.containsNode(node)) {\n this.remove(node)\n }\n\n this.push(node)\n }", "add(data) {\n let newNode = new Node(data);\n if (!this.head) {\n this.head = newNode;\n } else {\n let current = this.head;\n while (current.next) {\n current = current.next;\n }\n current.next = newNode;\n }\n this.size++;\n }", "append(value){\n const newNode = new Node(value);\n // Generamos nuevo nodo que esta al final\n this.tail.next = newNode;\n this.tail = newNode;\n this.length++;\n return this;\n }", "addTail(data) {\n let tail = this.head;\n \n // if there is no head (empty list), create a new node and set\n // it as the head\n if (!tail) {\n let newNode = new Node(data);\n newNode.setColor(this.chooseColor());\n this.head = newNode;\n } else {\n // traverse to end of list \n while (tail.getNext() !== null) {\n tail = tail.getNext();\n }\n // create new tail add end of list\n let newNode = new Node(data);\n newNode.setColor(this.chooseColor());\n tail.setNext(newNode);\n }\n this.printMessage('addTail', data);\n }", "addToTail(value) {\n // declare newNode with value and next property.\n const newNode = {\n value: value,\n next: null,\n }\n //if no head, create both a head and tail.\n if (this.head === null) {\n this.head = newNode;\n this.tail = newNode;\n return;\n }\n //update next pointer for the 'old' tail node to point to the new node and then add new node to the tail. \n this.tail.next = newNode;\n this.tail = newNode;\n }", "function addAtLast() {\r\n value = document.getElementById('element').value;\r\n if(value) {\r\n array = getArray();\r\n if (!array.length) {\r\n alert('Linked List not exists \\n create first..')\r\n }\r\n else {\r\n array.push(new Node(value, null));\r\n setArray(array);\r\n arrayStatus(true, 'Linked List: ');\r\n }\r\n }\r\n else {\r\n alert('field must be fill..');\r\n }\r\n}", "addToTail(value) {\n let currentTail = this.tail;\n let newTail = new ListNode(value);\n \n // if first node\n if (!this.head) {\n this.head = newTail;\n this.tail = newTail;\n return;\n }\n\n // otherwise\n currentTail.next = newTail;\n newTail.prev = currentTail;\n this.tail = newTail;\n }", "insertLast(data){\n // create a new node pass the data\n const node = new Node(data);\n // create a place holder for the nodes in the linked list as we loop through\n let current;\n\n // check if list is empty\n if(!this.head){\n this.head = node;\n }\n // if linked list is populater then do the following\n else {\n // assign the variable current to the be the head of the linked list\n current = this.head;\n\n // loop until you get to the last node of the linked list\n while(current.next){\n // since we are looping then we want to assigned our current to be the last node\n current = current.next;\n }\n // add the new created node to the last node/item of the linked list\n current.next = node; \n }\n // Increase the count\n this.size++;\n }", "addToTail(val) {\n const newNode = new Node(val)\n if(this.length === 0){\n this.head = newNode\n this.tail = newNode\n } else {\n this.tail.next = newNode\n this.tail = newNode\n }\n this.length++\n return this\n }", "append(value) {\n // if list is empty\n if (!this.head) {\n return (this.head = new Node(value));\n } else {\n let eventualTail = this.head;\n while (eventualTail.next !== null) {\n eventualTail = eventualTail.next;\n }\n return (eventualTail.next = new Node(value));\n }\n }", "add(element) {\n //create a new node w given element\n let newNode = new Node(element);\n //a place keeper\n let current;\n //if list is empty\n if (this.head === null) this.head = newNode\n //if list has head...\n else {\n //assign the place keeper to head\n current = this.head\n //if the node.next points to another node\n while (current.next) {\n //move placekeeperforward to assign it the value of the next node\n //then repeat the step above\n current = current.next;\n }\n //after the while loop finds the last node\n //(current.next === null) assign the value of that nodes next to be the newNode\n current.next = newNode;\n }\n this.size++;\n }", "add(element)\r\n {\r\n let node = new Node(element); //creates new node\r\n let current; //to store current node\r\n //if this list is empty add the element & make it head\r\n if(this.head === null)\r\n {\r\n this.head = node;\r\n }\r\n else \r\n {\r\n current = this.head;\r\n //iterate through end of list\r\n while(current.next){\r\n current = current.next;\r\n }\r\n\r\n // add node\r\n current.next = node;\r\n }\r\n this.size++;\r\n }", "append(newData) {\n let newNode = new Node(newData);\n if (this.tail !== null) {\n this.tail.next = newNode;\n newNode.prev = this.tail;\n this.tail = newNode;\n } else {\n newNode.prev = this.head;\n this.tail = newNode;\n }\n\n if (this.head === null) {\n this.head = newNode;\n }\n }", "add(data){\n let newNode = new LinkedListNode(data);\n\n if(this.head == null){\n this.head = newNode;\n this.prev = newNode;\n }else{\n this.prev.next = newNode;\n this.prev = newNode;\n }\n this.size++;\n }", "addToTail(val) {\n this.length++\n let newNode = new Node(val);\n if( this.length === 1 ){\n this.head = newNode\n this.head.next = null\n }\n let oldTail = this.tail\n this.tail = newNode\n if(this.length >= 2) {\n oldTail.next = this.tail\n }\n return this\n }", "moveend(){\n if(!this.head && this.head === this.tail)\n {\n return undefined;\n }\n this.add(this.head.data)\n this.shift()\n }", "append(value) {\n let node = new Node(value);\n if (!this.head) {\n this.head = node\n } else {\n let current = this.head;\n while (current.next) {\n current = current.next;\n }\n current.next = node;\n }\n }", "add(val) {\n const newNode = new Node(val);\n let current;\n if (this.head === null) {\n this.head = newNode;\n } else {\n current = this.head;\n\n while (current.next) {\n current = current.next;\n }\n current.next = newNode;\n }\n\n this.size++;\n }", "append(elem) {\n const NEW_NODE = new Node(elem);\n\n\n //如果当前列表为空,直接append到head引用上\n if (head.get(this) === null) {\n head.set(this, NEW_NODE);\n } else {\n\n //如果当前列表不为空,直接在最后一个节点上append节点即可\n prevLastNode.get(this).next = NEW_NODE;\n }\n\n prevLastNode.set(this, NEW_NODE);\n length.set(this, length.get(this) + 1);\n }", "append(value) {\n let node = new Node(value);\n\n // first node for the linked list (e.g. empty ll)\n if (!this.head) {\n this.head = node;\n this.tail = node;\n this.length++;\n return this;\n }\n // appending subsequent nodes to the end of the linked list\n let current = this.head;\n\n // find the last node, which will have a next value of null\n while (current.next) {\n current = current.next;\n }\n\n // break out of the loop, and the current node's next is null.\n current.next = node;\n this.tail = node;\n this.length++;\n return this;\n }", "InsertLast(value) {\n let node = new Node(value);\n let current;\n\n if(!this.head) {\n this.head = node;\n } else {\n current = this.head;\n while(current.next) {\n current = current.next;\n }\n\n current.next = node;\n }\n this.size++;\n }", "append(val) {\n const newNode = { value: val, next: null };\n\n // If we have a tail, update it. Otherwise just set it (below)\n // Update the next value of PREVIOUS tail points to this new node\n if (this.tail) this.tail.next = newNode;\n\n // This does not replace the old node in memory... it's still there\n // It just reassigns the tail to point to this new node. \n this.tail = newNode;\n\n // If there is no head currently, set it to newNode. Only happens for \n // first element\n if (!this.head) this.head = newNode;\n }", "add(element) {\n // create a new Node\n let node = new Node(element);\n if(this.head == null) {\n this.head = node;\n } \n else {\n let current = this.head;\n // iterate to the end of the list\n while(current.next) {\n current = current.next\n }\n current.next = node;\n }\n this.size++;\n }", "add(data) {\n const node = new Node(data);\n\n if (!this.head) {\n this.head = this.tail = node;\n } else {\n node.prev = this.tail;\n this.tail.next = node;\n this.tail = node;\n }\n\n this.size++;\n }", "add(val){\n var run = this.head;\n\n if (run) {\n while (run.next) {\n run = run.next;\n }\n run.next = new Node(val);\n this.tail = run.next;\n } else {\n this.head = new Node(val);\n this.tail = this.head;\n }\n\n this.length++;\n }", "add(element){\n var node = new Node(element);\n if(this.head == null){\n this.head = node;\n }\n else{\n var current = this.head;\n while(current.next){\n current = current.next;\n }\n current.next = node;\n }\n this.size++;\n }", "function append(elem, next) {\n removeElement(next);\n var parent = elem.parent;\n var currNext = elem.next;\n next.next = currNext;\n next.prev = elem;\n elem.next = next;\n next.parent = parent;\n if (currNext) {\n currNext.prev = next;\n if (parent) {\n var childs = parent.children;\n childs.splice(childs.lastIndexOf(currNext), 0, next);\n }\n } else if (parent) {\n parent.children.push(next);\n }\n }", "function append(elem,next){var parent=elem.parent,currNext=elem.next;next.next=currNext;next.prev=elem;elem.next=next;next.parent=parent;if(currNext){currNext.prev=next;if(parent){var childs=parent.children;childs.splice(childs.lastIndexOf(currNext),0,next);}}else if(parent){parent.children.push(next);}}", "function append(list, value) {\n while (list.next) {\n list = list.next;\n }\n list.next = new LinkedList(value);\n}", "add(data){\n // create new node and set its connections to the head\n let node = new Node(data,this.head, this.head.prev);\n this.head.next.prev = node;\n this.head.next = node;\n //Connect the current head to the new node\n this._size++;\n }", "add (data){\n var newNode = new Node(data)\n if(!this.head) {\n this.head = newNode\n this.tail = newNode\n }else {\n this.tail.next = newNode\n this.tail = newNode\n }\n this.length++\n return this;\n }", "append(value) {\n //instancia de la clase Node y le pasamos el value\n const newNode = new Node(value);\n //le decimos a la cola que agregue el nodo, este ya tiene su propio next \n this.tail.next = newNode;\n //posicionamos el tail al nuevo nodo\n this.tail = newNode;\n //crece la longitud de la lista\n this.length++;\n\n return this;\n }", "add(element) \n { \n let node = new Node(element); \n let current; \n if (this.head == null) \n this.head = node; \n else { \n current = this.head; \n while (current.next) { \n current = current.next; \n }\n current.next = node; \n } \n this.size++; \n }", "addToTail(val) {\n const node = new Node(val, null);\n\n if (!this.tail) {\n this.tail = node;\n this.head = node;\n } else {\n this.tail.next = node;\n this.tail = node;\n }\n\n this.length += 1;\n\n return this;\n }", "add(element) {\n let node = new Node(element);\n if(this.head === null) {\n this.head = node;\n } \n else {\n let currentNode = this.head; \n while(currentNode.next) {\n currentNode = currentNode.next;\n }\n currentNode.next = node;\n } \n this.length++;\n }", "add(value) {\n let newNode = new Node(value);\n let currentNode = this.head;\n\n if (currentNode === null) {\n this.head = newNode;\n } else {\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n\n currentNode.next = newNode;\n }\n\n this.size++;\n }", "push(node) {\n if(!this.tail) {\n this.tail = node\n this.head = node\n }\n else {\n this.tail.next = node\n node.prev = this.tail\n this.tail = node\n }\n this.length++\n }", "pushback(value){\r\n let newNode=new Node(value)\r\n if( this.tail == null){ //first node\r\n this.head = newNode; \r\n }\r\n else {\r\n this.tail.next = newNode;//Link the nodes\r\n }\r\n this.tail = newNode;\r\n }", "add(element){\n\n // creates a new node\n var node = new Node(element);\n\n // var to store current node\n var current;\n\n // if list is empty add the\n // element and make it head\n if (this.head == null){\n this.head = node\n } else {\n current = this.head\n\n //iterate to end of list\n while (current.next){\n current = current.next;\n }\n\n // add node\n current.next = node;\n }\n this.size++;\n }", "add(element) {\n const newNode = DoublyLinkedList.createListNode(element);\n const lastNode = this.getLast();\n if (lastNode == null) {\n this.head = newNode\n } else {\n lastNode.both.next = newNode;\n }\n newNode.both.prev = lastNode;\n return newNode;\n }", "add(data) {\n const nodeToAdd = new Node(data);\n let nodeToCheck = this.head;\n if(!nodeToCheck) {\n this.head = nodeToAdd;\n this.length++;\n return nodeToAdd;\n }\n while(nodeToCheck.next) {\n nodeToCheck = nodeToCheck.next;\n }\n nodeToCheck.next.val = data;\n nodeToCheck.next.next = null\n this.length++;\n return nodeToAdd;\n }", "add(data) {\n //create new node\n var node = new Node(data);\n var current;\n\n //check the list is empty\n if (this.head == null) {\n this.head = node;\n }else {\n current = this.head;\n\n //to traverse to the end of the list\n while (current.next) {\n current = current.next;\n }\n\n //add node\n current.next = node;\n }\n this.size++;\n }", "addToBack(nodes){ // does not return anything\n var runner=this.head\n while(runner){\n if(runner.next==null){\n runner.next=nodes;\n }\n else runner=runner.next;\n }\n }", "append(value) {\r\n if(this.isEmpty()){\r\n this.head = new DLNode(value);\r\n return this;\r\n }\r\n let runner = this.head;\r\n while(runner.next != null){\r\n runner = runner.next;\r\n }\r\n let newNode = new DLNode(value);\r\n runner.next = newNode;\r\n newNode.prev = runner;\r\n return this;\r\n }", "add(element) { \n // creates a new node \n var node = new LinkedNode(element); \n \n // to store current node \n var current; \n \n // if list is Empty add the \n // element and make it head \n if (this.head == null) \n this.head = node; \n else { \n current = this.head; \n \n // iterate to the end of the \n // list \n while (current.next) { \n current = current.next; \n } \n \n // add node \n current.next = node; \n } \n this.size++; \n }", "add(data) {\n // creates a new node \n var node = new Node(data);\n\n // to store current node \n var current;\n\n // if list is Empty add the \n // element and make it head \n if (this.head == null)\n this.head = node;\n else {\n current = this.head;\n\n // iterate to the end of the \n // list \n while (current.next) {\n current = current.next;\n }\n\n // add node \n current.next = node;\n }\n this.size++;\n }", "function append(elem, next) {\n var parent = elem.parent, currNext = elem.next;\n next.next = currNext;\n next.prev = elem;\n elem.next = next;\n next.parent = parent;\n if (currNext) {\n currNext.prev = next;\n if (parent) {\n var childs = parent.children;\n childs.splice(childs.lastIndexOf(currNext), 0, next);\n }\n }\n else if (parent) {\n parent.children.push(next);\n }\n}", "addToTail(val) {\n if (this.head === null) {\n let newNode = new Node(val);\n this.head = newNode;\n this.tail = newNode;\n } else {\n let newNode = new Node(val);\n this.tail.next = newNode;\n this.tail = newNode;\n }\n\n this.length += 1;\n return this;\n }", "append(value) {\n let currentNode = this.head;\n\n if (!value) { return 'Please pass a value to be added'; }\n\n if (!currentNode) {\n currentNode = new Node(value, currentNode);\n return currentNode;\n }\n\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n\n currentNode.next = new Node(value, currentNode.next);\n return this;\n }" ]
[ "0.7882263", "0.7794062", "0.76836634", "0.76361555", "0.7563977", "0.7499833", "0.7472396", "0.74472404", "0.73862857", "0.7371578", "0.7261185", "0.7227437", "0.7202137", "0.71464866", "0.71114504", "0.7091297", "0.7082687", "0.707473", "0.7063289", "0.70525056", "0.70361036", "0.70361036", "0.7034718", "0.7032863", "0.7032605", "0.7030122", "0.7019851", "0.6995726", "0.69885236", "0.6969412", "0.6952836", "0.69293827", "0.6927768", "0.6916361", "0.6915095", "0.690693", "0.6897227", "0.68922085", "0.6891922", "0.688963", "0.6857155", "0.6855183", "0.6853636", "0.6842346", "0.68410105", "0.68260294", "0.68108404", "0.68086386", "0.68035597", "0.6803097", "0.6786521", "0.67736363", "0.67652506", "0.67519546", "0.67203873", "0.6720165", "0.6716233", "0.67126966", "0.67099655", "0.67060965", "0.6696538", "0.66868675", "0.6655263", "0.6652269", "0.66521907", "0.66411114", "0.6629021", "0.6625228", "0.66135186", "0.6598676", "0.658905", "0.6583599", "0.6582135", "0.6544012", "0.6543469", "0.6538764", "0.65339893", "0.6533283", "0.6532601", "0.6529101", "0.65161455", "0.65146047", "0.65072143", "0.65023947", "0.6492114", "0.6472289", "0.6459421", "0.6452845", "0.6445567", "0.6445226", "0.64342505", "0.64283234", "0.6426349", "0.642448", "0.6419134", "0.64178944", "0.64178437", "0.6415358", "0.64111555", "0.6409274" ]
0.66096115
69
print all the value form head to tail
printList() { let curr = this.head, str = "" while(curr) { str += curr.value + (curr.next && " -> ") curr = curr.next } console.log(str) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "printHeadToTail() {\n if(!this.length) return\n\n let curr = this.head, str = \"\"\n while(curr) {\n str += (curr.value + (curr.next && \" <-> \"))\n curr = curr.next\n }\n console.log(str)\n }", "printTailToHead() {\n if(!this.length) return\n\n let curr = this.tail, str = \"\"\n while(curr) {\n str += (curr.value + (curr.prev && \" <-> \"))\n curr = curr.prev\n }\n console.log(str)\n }", "print(){\n let temp = this.head;\n while(temp != null){\n process.stdout.write(temp.data + \" > \");\n temp = temp.next;\n }\n console.log(null);\n }", "print() {\n let current = this.head;\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "print() {\n let cur = this.head;\n let answer = \"\";\n while (cur != null) {\n answer += cur.data + \" \";\n cur = cur.next;\n }\n console.log(answer);\n }", "print() {\n let arr = [], current = this.head\n while (current) {\n arr.push(current.val);\n current = current.next\n }\n console.log(arr)\n }", "print() {\n let current = this.head;\n while (current !== null) {\n console.log(current.data);\n\n current = current.next;\n }\n }", "print(){\n var arr = [];\n var current = this.head\n while(current){\n arr.push(current.val);\n current= current.next;\n }\n console.log(arr)\n }", "print(){\n let arr = [];\n var current = this.head;\n while(current){\n arr.push(current.val);\n current = current.next\n }\n console.log(arr);\n }", "function print(head) {\n var sentence = '';\n while(head != null) {\n sentence += (head.data + ' --> ');\n head = head.next;\n }\n console.log(sentence);\n}", "print(){\n let arr = [];\n var current = this.head;\n while(current) {\n arr.push(current.val)\n current = current.next\n }\n console.log(arr);\n }", "print() {\n let current = this.head;\n\n while (current) {\n process.stdout.write(`${current.value} <-> `);\n current = current.next;\n }\n\n console.log(\"NULL\");\n }", "print(){\n const values = [];\n let current = this.head;\n while(current){\n values.push(current.value);\n current = current.next;\n }\n\n return values.join(' => ');\n }", "print(){\n let arr = [];\n let current = this.head;\n while(current){\n arr.push(current.val)\n current = current.next;\n }\n console.log(arr);\n }", "printList() {\n var curr = this.head;\n var str = \"\";\n while (curr) {\n str += curr.data + \"-->\";\n curr = curr.next;\n }\n console.log(str);\n }", "print() {\n let runner = this.head;\n let vals = \"\";\n\n while (runner) {\n vals += `${runner.data}${runner.next ? \", \" : \"\"}`;\n runner = runner.next;\n }\n console.log(vals);\n return vals;\n }", "toString(){\n let result = \"head → \";\n let current = this.head;\n while(current !== null){\n if(current.next !== null){\n result += current.data +\" → \";\n } else {\n result += current.data;\n }\n current = current.next;\n }\n result += \" ← tail\"\n console.log(result);\n }", "print() {\n\t\tlet current = this.head;\n\t\tlet string = \"\";\n\t\twhile(current) {\n\t\t\tstring += current.element + \"->\";\n\t\t\tcurrent = current.next;\n\t\t}\n\t\tconsole.log(string);\n\t}", "printList() \n { \n let curr = this.#_head; \n let str = \"[ \"; \n while (curr!=null) { \n str += curr.data.Value+ \", \"; //.Value \n curr = curr.next; \n } \n str+=\"]\"\n console.log(str); \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 }", "print() {\n let printArr = [];\n let current = this.head;\n while(current){\n printArr.push(current.value);\n current = current.next;\n }\n console.log(printArr);\n return printArr;\n }", "printForward() {\n if (this.isEmpty()) {\n console.info(\"List is empty!\");\n return;\n }\n\n let node = Object.assign({}, this.head);\n let i = 0;\n let result = 'Print Forward: \\n(';\n let sep = '';\n while (node) {\n result += sep + `\\n [${i}]: ${JSON.stringify(node.data)}`;\n sep = ',';\n i++;\n node = node.next;\n }\n result += '\\n)\\n';\n console.log(result);\n }", "print() {\n this.pointer = this.head;\n while (true) {\n console.log(this.pointer.value)\n if (this.pointer.next) {\n this.pointer = this.pointer.next;\n } else {\n break;\n }\n }\n }", "printList() {\n let n = this.head;\n\n while (n !== null) {\n console.log(n.val);\n n = n.next;\n }\n }", "printList() {\n let current = this.head;\n while (current) {\n console.log(current.data + \" \");\n current = current.next;\n }\n }", "print() {\n let current;\n let linkliststr = '';\n if (this.head === null) {\n console.log('List Empty');\n } else {\n current = this.head;\n while (current !== null) {\n linkliststr += `${current.value}->`;\n current = current.next;\n }\n }\n console.log(linkliststr + 'null');\n }", "printForward() {\n let current = this.head;\n while(current != null) {\n console.log(current.object);\n current = current.next;\n }\n }", "printValues() {\n if(this.head == null) {\n console.log(\"There's nothing in this list!\");\n return this;\n }\n var runner = this.head;\n while(runner != null) {\n console.log(`${runner.value} --> `);\n // console.log(runner.value + \" --> \");\n runner = runner.next;\n }\n return this;\n }", "print(){\n let current = this.head;\n let str = \"\";\n while(current){\n str += `${current.element} `;\n current = current.next;\n }\n return str.trim();\n }", "printListData() {\n let current = this.head;\n while(current) {\n console.log(current.data);\n current = current.next;\n }\n }", "printListData() {\n let current = this.head;\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "printListData(){\n let current = this.head;\n while(current){\n console.log(current.data);\n current = current.next;\n }\n }", "printList() {\n let currentNode = this.head;\n let output = \"<head> \";\n\n //iterate through the list\n while (currentNode !== null) {\n //concate node data to output list\n output += currentNode.data + \" \";\n currentNode = currentNode.getNextNode();\n }\n\n output = output + \"<tail>\";\n console.log(output);\n }", "function display(ll){\n let currNode = ll.head;\n let output = 'head->';\n while (currNode !== null){\n output += `${currNode.value}->`;\n currNode = currNode.next;\n }\n output += 'null';\n console.log(output);\n return output;\n}", "print(){\n // si la lista no tiene un tamaño, devuelve nulo\n if(!this.size){\n return null;\n }\n // guardamos los datos \n let current = this.head;\n let result = '';\n // mientras current exista o tenga un valor\n while(current){\n // result tomara el valor de current y current tomara el siguiente valor\n result += current.data + \"->\";\n current = current.next;\n }\n // asignamos como ultimo valor una x para indicar que es el ultimo nodo\n result += \"x\"; \n return result;\n }", "printListData() {\n let current = this.head;\n\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "function printLinkedList(head) {\n let current = head\n while(current.next) {\n console.log(current.data)\n current = current.next\n }\n console.log(current.data)\n}", "printList() {\n let currentNode = this.head; // Set currentNode to the head\n let output = '<head> '; // Output message\n while (currentNode !== null) { // Run while there isn't a currentNode\n output += currentNode.data + ' '; // Add data of currentNode to the message\n currentNode = currentNode.getNextNode(); // Set currentNode to the following Node\n }\n output += '<tail>';\n console.log(output); // Output list data\n }", "printList() {\n var curr = _head;\n var str = \"\";\n while (curr) {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n }", "printList() {\r\n\t\tlet curr = this.head;\r\n\t\tlet string = \"\";\r\n\r\n\t\twhile (curr) {\r\n\t\t\tstring += curr.element + \" \";\r\n\t\t\tcurr = curr.next;\r\n\t\t}\r\n\t\tconsole.log(string);\r\n\t}", "printList() {\n let arr = [];\n let current = this.head;\n while (current) {\n arr.push(current.data);\n current = current.next;\n }\n console.log(arr);\n }", "printList() {\n let curr = this.head;\n let str = \"\";\n while (curr) {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n }", "print_list() {\n let result = \"\";\n let temp = this;\n while (temp !== null) {\n result += temp.value + \" \"\n temp = temp.next;\n }\n console.log(result);\n }", "print() {\n const arr = [];\n let node = this.head;\n while (node !== null) {\n arr.push(node.value);\n node = node.next;\n }\n console.log(arr);\n return arr;\n }", "show() {\n var current = this.head;\n var string = \" \";\n while (current) {\n string = string + current.data;\n if (current.next != null) {\n string = string + \" \";\n }\n current = current.next;\n }\n console.log(string);\n return;\n }", "display(){\n var current = this.head;\n\n while(current){\n console.log(current.data);\n current = current.next;\n }\n }", "get () {\n var output = ''\n var current = this.head\n while (current != null) {\n output += current.data\n output += ' '\n current = current.next\n }\n// return output\n console.log(output)\n}", "log() {\n const arr = [];\n let current = this.head;\n\n while (current) {\n arr.push(current);\n current = current.next;\n }\n\n console.log(arr);\n }", "show() {\n\n var temp = this.head;\n var str = \"\";\n while (temp != null) {\n str = str + temp.element + \" \";\n if (temp.next != null) {\n str = str + \" \";\n }\n temp = temp.next;\n }\n console.log(str);\n }", "printList(){\n let currentNode = this.head;\n let currentString = \"\";\n while(currentNode!==null){\n currentString += \" \" + currentNode.data + \" \" + \"-->\" + \" \";\n currentNode = currentNode.next;\n }\n currentString += \"null\";\n console.log(currentString);\n }", "function outputList(head) {\n let pointer = head;\n while (true) {\n console.log(pointer.value)\n if (pointer.next) {\n pointer = pointer.next;\n } else {\n break;\n }\n }\n}", "printList() \n { \n var curr = this.head; \n var str = \"\"; \n while (curr) { \n str += curr.element + \" \"; \n curr = curr.next; \n } \n console.log(str); \n }", "printList1() {\n var curr = this.head;\n var str = \"\";\n while (curr) {\n str += curr.data + \" \";\n curr = curr.next;\n }\n return str;\n }", "print() {\n\t\treturn \"(\" + this._head + \", \" + this._tail + \" , \" + this._capacity + \", \" + this._flow + \")\";\n\t}", "prnt() {\n console.log(this.size);\n let current = this.head;\n while (current != null) {\n console.log(current);\n current = current.next;\n }\n }", "printBackward() {\n if (this.isEmpty()) {\n console.info(\"List is empty!\");\n return;\n }\n\n let node = Object.assign({}, this.tail);\n let i = this.size - 1;\n let result = 'Print Backward: \\n(';\n let sep = '';\n while (node) {\n result += sep + `\\n [${i}]: ${JSON.stringify(node.data)}`;\n sep = ',';\n i--;\n node = node.prev;\n }\n result += '\\n)\\n';\n console.log(result);\n }", "printFromHere(toPrintFrom){\n\t\tconsole.log(\"Printing the values of all nodes from this one\");\n\t\t\n\t\t//Traverse to end of linked list\n\t\tlet i = 0;\n\t\twhile(toPrintFrom != null){\n\t\t\tconsole.log(`Value of node ${i} = ${toPrintFrom.element}`);\n\t\t\t\n\t\t\ttoPrintFrom = toPrintFrom.next;\n\t\t\ti = i + 1;\n\t\t}\n\t\t\n\t}", "display() {\n\n if (this.head == null) {\n return null;\n }\n\n var output = this.head.value;\n var runner = this.head.next;\n\n while (runner != null) {\n output += \" - \" + runner.value;\n runner = runner.next;\n }\n\n return output;\n }", "traverse() {\n let current = this.head;\n\n while (current) {\n console.log(current.val)\n current = current.next\n }\n }", "function print(head) {\n // code goes here\n}", "print (list) {\n var result = [];\n var currentNode = list.head;\n while (currentNode) {\n result.push(currentNode.val);\n currentNode=currentNode.next;\n }\n return result;\n }", "function printValues(list) {\n var str = '';\n\n function rec() {\n\n str = str + list.value + ', ';\n if (list.next) {\n list = list.next;\n rec();\n }\n }\n rec();\n\n str = str.slice(0, (str.length - 2));\n console.log(str);\n return str;\n}", "traverse(){\n let current = this.head;\n while(current){\n console.log(current.val);\n current = current.next;\n }\n }", "function display(list) {\n let currentNode = list.head;\n let output = \"\";\n \n if (!list.head) {\n return null;\n }\n while (currentNode.next !== null) {\n output += currentNode.value + \" \";\n currentNode = currentNode.next;\n }\n output += currentNode.value;\n console.log(output);\n }", "printValues() {\n console.log( \"====================\" )\n\n if ( ! this.head )\n console.log( \"There's nothing in this list!\" )\n\n let runner = this.head\n\n while ( runner ) {\n console.log( runner.value )\n runner = runner.next\n }\n\n console.log( \"====================\" )\n\n return this\n }", "printList()\n{\n var curr = this.head;\n var str = \"\";\n while (curr) \n {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n return str\n}", "printList()\n{\n var curr = this.head;\n var str = \"\";\n while (curr) \n {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n return str\n}", "printList()\n{\n var curr = this.head;\n var str = \"\";\n while (curr) \n {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n return str\n}", "display() {\n var output = '';\n\n var runner = this.head;\n\n if (runner == null) {\n return 'empty';\n }\n\n while (runner.next != null) {\n output += runner.value + ' - ';\n runner = runner.next;\n }\n\n output += runner.value;\n\n return output;\n }", "display() {\n console.log('pprinting list');\n\n let current = this.head;\n\n while (current !== null) {\n console.log(`Node has value of ${current.value}`);\n current = current.next;\n }\n\n console.log('list pprinting complete');\n }", "function display(list) {\n while (list.head !== null) {\n // console.log(list.head.value)\n list.head = list.head.next;\n }\n}", "function display(llist) {\n let currNode = llist.head;\n while (currNode !== null) {\n console.log(currNode.value);\n currNode = currNode.next;\n }\n}", "printList() {\n if (this.isEmpty()) {\n console.log(\"Empty List\");\n return false;\n } else {\n let temp = this.head;\n while (temp != null) {\n process.stdout.write(String(temp.data));\n process.stdout.write(\" -> \");\n temp = temp.nextElement;\n }\n console.log(\"null\");\n return true;\n }\n }", "print() {\n console.log(\"Size:\", this.size);\n\n // If the DLL is empty, log empty and return\n if (!this.head) {\n console.log(\"Empty DLL \\n\");\n return;\n }\n\n // Initialize currentNode pointer and set it to this.head\n let currentNode = this.head;\n\n // while currentNode exists\n do {\n // log currentNode.prev.value to console\n console.log(\"----------\");\n console.log(\"Prev:\", currentNode.prev.value);\n\n // log currentNode.value to console\n console.log(\"Node:\", currentNode.value);\n\n // log currentNode.next.value to console\n console.log(\"Next:\", currentNode.next.value);\n\n // update currentNode to currentNode.next\n currentNode = currentNode.next;\n } while (currentNode !== this.head);\n\n console.log();\n }", "printList(){\n // initialize current as the head node of the list\n var current = this.head;\n // empty string\n var string = \"\";\n \n // iterating through the list (till the end of the list)\n while(current){\n // append the value of current element to the string\n string += current.element + \" \";\n current = current.next;\n }\n console.log(string);\n }", "function dohead(def){var tit=[],ul=[];def.map(function(e){\n tit.push(strpad(e[0],e[1]));ul.push(strpad('=',e[1],'='))});\n process.stdout.write(ul.join(' ')+\"\\n\");\n process.stdout.write(style(tit.join(' '),'fg_blu')+\"\\n\");\n process.stdout.write(ul.join(' ')+\"\\n\");\n}", "display(){\n let runner = this.head;\n while (runner) {\n console.log(runner.value);\n runner = runner.next;\n }\n return this;\n }", "display(){\n let runner = this.head;\n while (runner) {\n console.log(runner.value);\n runner = runner.next;\n }\n return this;\n }", "list(){\n var cur = this.head;\n\n while (cur) {\n console.log(cur.val);\n cur = cur.next;\n }\n }", "recursiveDisplay(current = this.head){\n if(current === null) return;\n console.log(current.data);\n this.recursiveDisplay(current.next);\n }", "printList(){\n let count = 0;\n let current = this.head; //start at first node\n while(current){\n console.log(\"node index: \" + count + \" Data: \" + current.data)//output the data at that node\n current = current.next; //current node moves through the list until current is null which stops the while loop\n count++;\n }\n console.log(\"Linked List length: \" + this.size)\n}", "showLastData() {\n let result = []\n if (!this.head) {\n return result\n }\n let current = this.head\n while (current.next) {\n current = current.next\n }\n\n result.push(current.data)\n\n return result\n }", "function displayList(list) {\n let currNode = list.head;\n while (currNode !== null) {\n console.log(currNode.value);\n currNode = currNode.next;\n }\n}", "printList(){\n const array=[];\n let currentNode = this.head;\n while(currentNode!==null){\narray.push(currentNode.value);\ncurrentNode = currentNode.next;\n\n }\n return array;\n}", "function display() {\r\n\tvar currNode = this.head;\r\n\twhile (!(currNode.next == null)) {\r\n\t\tconsole.log(currNode.next.element);\r\n\t\tcurrNode = currNode.next;\r\n\t}\r\n}", "function display(list) {\n let printNode = list.head;\n while (printNode !== null) {\n console.log(printNode);\n printNode = printNode.next;\n }\n}", "print() {\n const self = this;\n this.forEveryLine(TOP_TO_DOWN, (line) => {\n let lineStr = '';\n\n self.forEveryColumn(LEFT_TO_RIGHT, (column) => {\n let elm = self.getElement(new Position(line, column));\n lineStr = `${lineStr}\\t${elm.value}`; \n });\n console.log(lineStr + '\\t\\t\\t\\t' + Math.random());\n });\n console.log('-------------------------');\n }", "function display(stack) {\n let displayString = 'Top ->> ';\n let curr = stack.top;\n while (curr !== null) {\n displayString += curr.data + ', ';\n curr = curr.next;\n }\n return console.log(displayString);\n}", "toString(){\n let currentNode = this.head;\n let string = '';\n\n while(currentNode){\n string += `${currentNode.value}`;\n currentNode = currentNode.next;\n }\n return string;\n }", "function display(stack) {\n while (stack.top !== null) {\n console.log(stack.top.data);\n stack.top = stack.top.next;\n }\n}", "function display(stack) {\n let currTop = stack.top;\n\n while (currTop !== null) {\n console.log(currTop.data);\n currTop = currTop.next;\n }\n}", "printListPretty() {\n \tconst array = [];\n \tlet currentNode = this.head;\n \twhile(currentNode !== null) {\n \t\tarray.push(currentNode.value);\n \t\tcurrentNode = currentNode.next;\n \t}\n \treturn array.join('->');\n }", "display(list) {\n const listObj = list.head;\n console.log(JSON.stringify(listObj));\n \n }", "printList() {\n\t\tconst arr = []\n\t\tlet currentNode = this.head\n\n\t\twhile (currentNode) {\n\t\t\tarr.push(currentNode.value)\n\t\t\tcurrentNode = currentNode.next\n\t\t}\n\t\treturn arr\n\t}", "top(){\n if(!this.head){\n console.log('List is empty')\n }\n else{\n let current = this.head;\n do{\n current = current.next;\n }while(current.next != null)\n console.log('Top element:', current.data);\n }\n }", "toStringify() {\n let current = this.head;\n let string = \"\";\n\n while (current) {\n string += current.data + (current.next ? \"\\n\" : \"\");\n current = current.next;\n }\n return string;\n }", "printDisplay() {\n \n // If the queue is empty. If there is no front, console.log \"Empty Queue\"\n if (this.isEmpty()) {\n console.log(\"EMPTY QUEUE\");\n }\n \n //else if it's not empty\n else {\n // Temp LinkedList\n let list = new LinkedList();\n \n // temp variable to the front of the queue\n let current = this.front;\n \n // iterate through the queue\n while (current) {\n \n // add value into List\n list.push(current.data);\n \n // Move to the next element\n current = current.next;\n \n \n // Loop through the Link List and print out the elements\n let i;\n if(i=0, i < list.length, i++) {\n document.getElementById('output').innerHTML = (list.head.data);\n }\n \n }\n \n \n }\n \n }", "tail() {\n return this._tail.data;\n }", "get tail() {\n return this._tail;\n }", "showFirstData() {\n let result = []\n if (!this.head) {\n return result\n }\n result.push(this.head.data)\n return result\n }" ]
[ "0.802325", "0.80127275", "0.7258001", "0.7215462", "0.71758175", "0.7095735", "0.70412534", "0.7026612", "0.6998431", "0.6995226", "0.6991426", "0.6954334", "0.69536316", "0.69283694", "0.6902882", "0.6873582", "0.6843101", "0.6821668", "0.6793423", "0.67441916", "0.67263794", "0.6707684", "0.6705747", "0.6686662", "0.6680313", "0.6665281", "0.6664012", "0.66195214", "0.65943855", "0.65817523", "0.6577212", "0.6568837", "0.6559205", "0.65493494", "0.65349144", "0.6533582", "0.65301335", "0.65287507", "0.6511451", "0.6466197", "0.6446536", "0.64420176", "0.6440747", "0.64064705", "0.64019656", "0.6393051", "0.6389601", "0.6373443", "0.6371585", "0.6336583", "0.63253826", "0.6265174", "0.6262467", "0.62621456", "0.625902", "0.62588614", "0.6214683", "0.6200104", "0.6173849", "0.61479753", "0.61436254", "0.61117536", "0.61063594", "0.6104067", "0.6094859", "0.60942966", "0.60942966", "0.60942966", "0.6041549", "0.5992522", "0.59811366", "0.5949519", "0.59460086", "0.59324104", "0.59265345", "0.59218633", "0.5903997", "0.5903997", "0.59003323", "0.5860293", "0.5848673", "0.583762", "0.5806401", "0.5757003", "0.5750759", "0.57488513", "0.57433236", "0.57422966", "0.57313275", "0.57129014", "0.5707592", "0.56579053", "0.56577903", "0.56535256", "0.56293374", "0.561574", "0.5591692", "0.55891395", "0.5586879", "0.5584204" ]
0.6865843
16
Adapted from convertsourcemap (MIT)
function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extractSourceMap(fs, logger, file) {\n var inline = convert_source_map_1.commentRegex.test(file.text);\n var external = convert_source_map_1.mapFileCommentRegex.exec(file.text);\n if (inline) {\n var inlineSourceMap = convert_source_map_1.fromSource(file.text);\n return {\n source: convert_source_map_1.removeComments(file.text).replace(/\\n\\n$/, '\\n'),\n map: inlineSourceMap,\n isInline: true,\n };\n }\n else if (external) {\n var externalSourceMap = null;\n try {\n var fileName = external[1] || external[2];\n var filePath = file_system_1.resolve(file_system_1.dirname(file_system_1.absoluteFromSourceFile(file)), fileName);\n var mappingFile = fs.readFile(filePath);\n externalSourceMap = convert_source_map_1.fromJSON(mappingFile);\n }\n catch (e) {\n if (e.code === 'ENOENT') {\n logger.warn(\"The external map file specified in the source code comment \\\"\" + e.path + \"\\\" was not found on the file system.\");\n var mapPath = file_system_1.absoluteFrom(file.fileName + '.map');\n if (file_system_1.basename(e.path) !== file_system_1.basename(mapPath) && fs.exists(mapPath) &&\n fs.stat(mapPath).isFile()) {\n logger.warn(\"Guessing the map file name from the source file name: \\\"\" + file_system_1.basename(mapPath) + \"\\\"\");\n try {\n externalSourceMap = convert_source_map_1.fromObject(JSON.parse(fs.readFile(mapPath)));\n }\n catch (e) {\n logger.error(e);\n }\n }\n }\n }\n return {\n source: convert_source_map_1.removeMapFileComments(file.text).replace(/\\n\\n$/, '\\n'),\n map: externalSourceMap,\n isInline: false,\n };\n }\n else {\n return { source: file.text, map: null, isInline: false };\n }\n }", "function computeSourceMap(\n code,\n filePath,\n {compiledFilename},\n) {\n let mappings = \"AAAA\";\n for (let i = 0; i < code.length; i++) {\n if (code.charCodeAt(i) === charCodes.lineFeed) {\n mappings += \";AACA\";\n }\n }\n return {\n version: 3,\n file: compiledFilename || \"\",\n sources: [filePath],\n mappings,\n names: [],\n };\n}", "_generateSourceMap(baseDir, code, units){\n const sections = [];\n for (let unit of Array.from(units)) {\n const unitDir = path.dirname(unit.fpath);\n if (unit.sm) {\n // TODO: should support http, https, etc...\n var i, s, sm, sp;\n const url = path.resolve(unitDir, unit.sm.url);\n try {\n sm = JSON.parse(fs.readFileSync(url));\n } catch (e) {\n log(`Skipped invalid source map file ${path.relative(baseDir,url)}`);\n continue;\n }\n\n // if sm itself consists of concatenated sections, merge them\n if (sm.sections) {\n const iterable = sm.sections || [];\n for (i = 0; i < iterable.length; i++) {\n const sec = iterable[i];\n sec.offset.line += unit.smline;\n for (i = 0; i < sec.map.sources.length; i++) {\n s = sec.map.sources[i];\n sp = path.resolve(unitDir, s);\n sec.map.sources[i] = path.relative(baseDir, sp);\n }\n }\n sections.push(...Array.from(sm.sections || []));\n } else {\n // concatenate sources into sections, with path resolved\n for (i = 0; i < sm.sources.length; i++) {\n s = sm.sources[i];\n sp = path.resolve(unitDir, s);\n sm.sources[i] = path.relative(baseDir, sp);\n }\n sections.push({\n offset: {line : unit.smline, column : 0},\n map : sm\n });\n }\n } else { // js file has no matching source map file, generate it\n var line;\n const { SourceMapGenerator } = sourceMap;\n const srcfile = path.relative(baseDir, unit.fpath);\n const map = new SourceMapGenerator({file:srcfile});\n const lc = fuse._lc(unit.src);\n if (lc > 0) {\n for (line = 1, end = lc, asc = 1 <= end; asc ? line <= end : line >= end; asc ? line++ : line--) { // 1 to 1 mapping for each line\n var asc, end;\n map.addMapping({\n source: srcfile,\n original : {line, column:0},\n generated : {line, column:0}\n });\n }\n }\n sections.push({\n offset: {line: unit.smline, column: 0},\n map: map.toJSON()\n });\n }\n }\n return sections.length === 0 ? null : {\n version : 3,\n file : '',\n sections\n };\n }", "function SourceMap(){\n this.lines = [];\n }", "_parseMappings(aStr, aSourceRoot) {\n const generatedMappings = (this.__generatedMappingsUnsorted = [])\n const originalMappings = (this.__originalMappingsUnsorted = [])\n for (let i = 0; i < this._sections.length; i++) {\n const section = this._sections[i]\n\n const sectionMappings = []\n section.consumer.eachMapping((m) => sectionMappings.push(m))\n\n for (let j = 0; j < sectionMappings.length; j++) {\n const mapping = sectionMappings[j]\n\n // TODO: test if null is correct here. The original code used\n // `source`, which would actually have gotten used as null because\n // var's get hoisted.\n // See: https://github.com/mozilla/source-map/issues/333\n let source = util.computeSourceURL(\n section.consumer.sourceRoot,\n null,\n this._sourceMapURL\n )\n this._sources.add(source)\n source = this._sources.indexOf(source)\n\n let name = null\n if (mapping.name) {\n this._names.add(mapping.name)\n name = this._names.indexOf(mapping.name)\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n const adjustedMapping = {\n source,\n generatedLine:\n mapping.generatedLine + (section.generatedOffset.generatedLine - 1),\n generatedColumn:\n mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name,\n }\n\n generatedMappings.push(adjustedMapping)\n if (typeof adjustedMapping.originalLine === 'number') {\n originalMappings.push(adjustedMapping)\n }\n }\n }\n }", "function w(e,t){if(!he)\n// with no source maps, generated is either an\n// array or a string. if an array, flatten it.\n// if a string, just return it\n// with no source maps, generated is either an\n// array or a string. if an array, flatten it.\n// if a string, just return it\nreturn Q(e)?y(e):e;if(null==t){if(e instanceof $)return e;t={}}return null==t.loc?new $(null,null,he,e,t.name||null):new $(t.loc.start.line,t.loc.start.column,he===!0?t.loc.source||null:he,e,t.name||null)}", "function updateSourceMap(sourceMapText, fileName) {\n var sourceMap = JSON.parse(sourceMapText);\n sourceMap.file = fileName;\n sourceMap.sources = [fileName];\n delete sourceMap.sourceRoot;\n return JSON.stringify(sourceMap);\n}", "function renderSourceAndMap(sourceFile, input, output) {\n var outputPath = file_system_1.absoluteFromSourceFile(sourceFile);\n var outputMapPath = file_system_1.absoluteFrom(outputPath + \".map\");\n var relativeSourcePath = file_system_1.basename(outputPath);\n var relativeMapPath = relativeSourcePath + \".map\";\n var outputMap = output.generateMap({\n source: outputPath,\n includeContent: true,\n });\n // we must set this after generation as magic string does \"manipulation\" on the path\n outputMap.file = relativeSourcePath;\n var mergedMap = mergeSourceMaps(input.map && input.map.toObject(), JSON.parse(outputMap.toString()));\n var result = [];\n if (input.isInline) {\n result.push({ path: outputPath, contents: output.toString() + \"\\n\" + mergedMap.toComment() });\n }\n else {\n result.push({\n path: outputPath,\n contents: output.toString() + \"\\n\" + convert_source_map_1.generateMapFileComment(relativeMapPath)\n });\n result.push({ path: outputMapPath, contents: mergedMap.toJSON() });\n }\n return result;\n }", "findSourceMapUrl(contents) {\n const lines = contents.split('\\n');\n for (let l = lines.length - 1; l >= Math.max(lines.length - 10, 0); l--) {\n const line = lines[l].trim();\n const matches = EagerSourceMapTransformer.SOURCE_MAPPING_MATCHER.exec(line);\n if (matches && matches.length === 2) {\n return matches[1].trim();\n }\n }\n return null;\n }", "function SourceMap(input) {\n if (!(this instanceof SourceMap)) {\n return new SourceMap(input);\n }\n this.file = [];\n this.mappings = [];\n this.filemap = {};\n if (input && typeof input == 'object') {\n if (input instanceof SourceMap) {\n return input;\n } else {\n this.append(input);\n }\n }\n}", "function w(e,t){if(!ht)// with no source maps, generated is either an\n// array or a string. if an array, flatten it.\n// if a string, just return it\n// with no source maps, generated is either an\n// array or a string. if an array, flatten it.\n// if a string, just return it\nreturn Q(e)?y(e):e;if(null==t){if(e instanceof $)return e;t={}}return null==t.loc?new $(null,null,ht,e,t.name||null):new $(t.loc.start.line,t.loc.start.column,ht===!0?t.loc.source||null:ht,e,t.name||null)}", "function toComment(sourceMap) {\n\tvar base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n\tvar base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n\tvar base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}", "function $i__NM$$css$$_$$loader$lib$css$$_$$base__toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}", "function SourceMapGenerator(aArgs){if(!aArgs){aArgs={};}this._file=util.getArg(aArgs,'file',null);this._sourceRoot=util.getArg(aArgs,'sourceRoot',null);this._skipValidation=util.getArg(aArgs,'skipValidation',false);this._sources=new ArraySet();this._names=new ArraySet();this._mappings=new MappingList();this._sourcesContents=null;}", "function computeSourceMap(\n {code: generatedCode, mappings: rawMappings},\n filePath,\n options,\n source,\n tokens,\n) {\n const sourceColumns = computeSourceColumns(source, tokens);\n const map = new (0, _genmapping.GenMapping)({file: options.compiledFilename});\n let tokenIndex = 0;\n // currentMapping is the output source index for the current input token being\n // considered.\n let currentMapping = rawMappings[0];\n while (currentMapping === undefined && tokenIndex < rawMappings.length - 1) {\n tokenIndex++;\n currentMapping = rawMappings[tokenIndex];\n }\n let line = 0;\n let lineStart = 0;\n if (currentMapping !== lineStart) {\n _genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);\n }\n for (let i = 0; i < generatedCode.length; i++) {\n if (i === currentMapping) {\n const genColumn = currentMapping - lineStart;\n const sourceColumn = sourceColumns[tokenIndex];\n _genmapping.maybeAddSegment.call(void 0, map, line, genColumn, filePath, line, sourceColumn);\n while (\n (currentMapping === i || currentMapping === undefined) &&\n tokenIndex < rawMappings.length - 1\n ) {\n tokenIndex++;\n currentMapping = rawMappings[tokenIndex];\n }\n }\n if (generatedCode.charCodeAt(i) === _charcodes.charCodes.lineFeed) {\n line++;\n lineStart = i + 1;\n if (currentMapping !== lineStart) {\n _genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);\n }\n }\n }\n const {sourceRoot, sourcesContent, ...sourceMap} = _genmapping.toEncodedMap.call(void 0, map);\n return sourceMap ;\n}", "function relocateSourceMapSources({ artefacts, entryPoint }) {\n return __awaiter(this, void 0, void 0, function* () {\n yield json_1.modifyJsonFiles(`${artefacts.stageDir}/+(bundles|esm2015|esm5)/**/*.js.map`, (sourceMap) => {\n sourceMap.sources = sourceMap.sources\n .map((path) => {\n let trimmedPath = path;\n // Trim leading '../' path separators\n while (trimmedPath.startsWith('../')) {\n trimmedPath = trimmedPath.substring(3);\n }\n return `ng://${entryPoint.moduleId}/${trimmedPath}`;\n });\n return sourceMap;\n });\n });\n}", "function getSourceMap(outFile, sourceMap) {\n let resolvedSourceMap = sourceMap;\n\n // dynamic source map; run the given iterator function\n if (typeof sourceMap === 'function') {\n resolvedSourceMap = sourceMap(outFile);\n }\n\n // source map is a boolean; use the output file\n if (sourceMap === true) {\n resolvedSourceMap = outFile;\n }\n\n // source map is a directory; append the output's basename\n if (!isFile(resolvedSourceMap)) {\n resolvedSourceMap = path.join(\n resolvedSourceMap,\n path.basename(outFile)\n );\n }\n\n // resolve and ensure '.map' extension\n return path.resolve(resolvedSourceMap.replace(/(\\.map)?$/, '.map'));\n}", "function createJsIdentitySourcemap(sourceUrl, sourceContent, lineOffset, firstLineCharOffset) {\n const generator = new source_map_1.SourceMapGenerator();\n const tokens = espree.tokenize(sourceContent, { loc: true, ecmaVersion: 2017, sourceType: 'module' });\n tokens.forEach(token => {\n if (!token.loc) {\n return null;\n }\n let mapping = {\n original: {\n line: token.loc.start.line + lineOffset,\n column: token.loc.start.column +\n (token.loc.start.line === 1 ? firstLineCharOffset : 0)\n },\n generated: token.loc.start,\n source: sourceUrl\n };\n if (token.type === 'Identifier') {\n mapping.name = token.value;\n }\n generator.addMapping(mapping);\n });\n return generator.toJSON();\n}", "function SourceMap(options) {\n options = defaults(options, {\n file : null,\n root : null,\n orig : null,\n\n orig_line_diff : 0,\n dest_line_diff : 0,\n });\n var generator = new MOZ_SourceMap.SourceMapGenerator({\n file : options.file,\n sourceRoot : options.root\n });\n var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);\n function add(source, gen_line, gen_col, orig_line, orig_col, name) {\n if (orig_map) {\n var info = orig_map.originalPositionFor({\n line: orig_line,\n column: orig_col\n });\n if (info.source === null) {\n return;\n }\n source = info.source;\n orig_line = info.line;\n orig_col = info.column;\n name = info.name;\n }\n generator.addMapping({\n generated : { line: gen_line + options.dest_line_diff, column: gen_col },\n original : { line: orig_line + options.orig_line_diff, column: orig_col },\n source : source,\n name : name\n });\n };\n return {\n add : add,\n get : function() { return generator },\n toString : function() { return generator.toString() }\n };\n}", "function SourceMap(options) {\n options = defaults(options, {\n file : null,\n root : null,\n orig : null,\n\n orig_line_diff : 0,\n dest_line_diff : 0,\n });\n var generator = new MOZ_SourceMap.SourceMapGenerator({\n file : options.file,\n sourceRoot : options.root\n });\n var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);\n function add(source, gen_line, gen_col, orig_line, orig_col, name) {\n if (orig_map) {\n var info = orig_map.originalPositionFor({\n line: orig_line,\n column: orig_col\n });\n if (info.source === null) {\n return;\n }\n source = info.source;\n orig_line = info.line;\n orig_col = info.column;\n name = info.name;\n }\n generator.addMapping({\n generated : { line: gen_line + options.dest_line_diff, column: gen_col },\n original : { line: orig_line + options.orig_line_diff, column: orig_col },\n source : source,\n name : name\n });\n };\n return {\n add : add,\n get : function() { return generator },\n toString : function() { return generator.toString() }\n };\n}", "function updateSourcemapLocations(document, ast) {\n // We need to serialize and reparse the dom for updated location information\n const documentContents = parse5.serialize(ast);\n ast = astUtils.parse(documentContents, { locationInfo: true });\n const reparsedDoc = new polymer_analyzer_1.ParsedHtmlDocument({\n url: document.url,\n contents: documentContents,\n ast: ast,\n isInline: document.isInline,\n locationOffset: undefined,\n astNode: null\n });\n const inlineScripts = dom5.queryAll(ast, matchers.inlineJavascript);\n inlineScripts.forEach(script => {\n let content = dom5.getTextContent(script);\n const sourceMapUrlParts = content.match(sourceMappingUrlExpr);\n if (!sourceMapUrlParts) {\n return;\n }\n const sourceMapContentParts = sourceMapUrlParts[1].match(inlineSourceMapExpr);\n if (!sourceMapContentParts) {\n return;\n }\n const sourceRange = reparsedDoc.sourceRangeForStartTag(script);\n const sourceMap = base64StringToRawSourceMap(sourceMapContentParts[2]);\n const updatedMap = offsetSourceMap(sourceMap, sourceRange.end.line, sourceRange.end.column);\n const base64Map = rawSourceMapToBase64String(updatedMap);\n content = content.replace(sourceMappingUrlExpr, `${inlineSourcemapPrefix}${base64Map}\\n`);\n dom5.setTextContent(script, content);\n });\n return ast;\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function toComment(sourceMap) {\n var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64');\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n return '/*# ' + data + ' */';\n}", "function remapping(input, loader, options) {\n const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };\n const tree = buildSourceMapTree(input, loader);\n return new SourceMap(traceMappings(tree), opts);\n}", "dumpSource(filename) {\n const config = this.getConfigFor(filename);\n const resolved = config.resolve();\n const sources = resolved.transformFilename(filename);\n return sources.reduce((result, source) => {\n result.push(`Source ${source.filename}@${source.line}:${source.column} (offset: ${source.offset})`);\n if (source.transformedBy) {\n result.push(\"Transformed by:\");\n result = result.concat(source.transformedBy.reverse().map((name) => ` - ${name}`));\n }\n if (source.hooks && Object.keys(source.hooks).length > 0) {\n result.push(\"Hooks\");\n for (const [key, present] of Object.entries(source.hooks)) {\n if (present) {\n result.push(` - ${key}`);\n }\n }\n }\n result.push(\"---\");\n result = result.concat(source.data.split(\"\\n\"));\n result.push(\"---\");\n return result;\n }, []);\n }", "function simpleShimSourceMap(sourceMap) {\n if (sourceMap === undefined) {\n return undefined; //undefined case\n }\n else if (typeof sourceMap === \"object\") {\n return sourceMap.pc_pos_map_compressed; //Vyper object case\n }\n else {\n try {\n return JSON.parse(sourceMap).pc_pos_map_compressed; //Vyper JSON case\n }\n catch (_) {\n return sourceMap; //Solidity case\n }\n }\n}" ]
[ "0.69679236", "0.69377637", "0.67660517", "0.644171", "0.63287604", "0.62983114", "0.6256009", "0.6210124", "0.61941147", "0.61812603", "0.6174446", "0.6158444", "0.6158444", "0.6158444", "0.6154958", "0.60953784", "0.6039884", "0.5989862", "0.5980611", "0.5979347", "0.5979151", "0.5979151", "0.5962547", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.59396034", "0.5933014", "0.59271747", "0.58930284" ]
0.0
-1
TESTER for all gauge types
function testGood (level, spotMeta=streetsville) { let value = 'bad'; spotMeta.levels .some( function (d) { if ( (d[0] < level) && ( level < d[1]) ) { // console.log(d); value = d[2]; return; } }); //console.log(value) return value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GaugeChartsTest() {\n \n return (\n <ApplicationProvider mapping={mapping} theme={lightTheme}>\n <WidgetGauge graphType={\"thermometer\"} title={\"TEST\"} max={\"100\"} min={\"10\"} unit={\"1\"} color={[]} value={'65'} target={[]} />\n </ApplicationProvider>\n )\n}", "function setupGaugeEstimation() {\n var gaugeColor = [];\n var i = -100;\n while (i <= 100) {\n if ((i < -25) || (i > 25)) gaugeColor.push(\"#ff4b4b\");\n else\n if ((i < -10) || (i > 10)) gaugeColor.push(\"#ffa500\");\n else gaugeColor.push(\"#4bff4b\");\n i = i + 5;\n }\n\n window.gauge = new JustGage({\n id: \"gaugeEstimationFactor\",\n value: 0,\n min: -100,\n max: 100,\n title: \"Team estimation factor\",\n label: \"%\",\n valueFontColor: \"#FFF\",\n titleFontColor: \"#FFF\",\n labelFontColor: \"#FFF\",\n levelColors: gaugeColor\n });\n}", "function checkGaugeType(type, gaugevalue) {\n var newGauge = {};\n if (gaugevalue < 0) { gaugevalue=0;}\n if (type == 'half') {\n newGauge = {\n rangeSize: 8,\n majorTicks: {visible: false},\n minorTicks: {visible: false},\n labels: {\n visible: false\n },\n min: 0,\n max: gaugemax,\n startAngle: 0,\n endAngle: 180,\n ranges: [\n {\n from: 0,\n to: gaugevalue,\n color: color\n }\n ]\n };\n }\n else if (type == 'full') {\n newGauge = {\n rangeSize: 6,\n majorTicks: {visible: false},\n minorTicks: {visible: false},\n labels: {visible: false},\n min: 0,\n max: gaugemax,\n startAngle: 90,\n endAngle: 450,\n ranges: [\n {\n from: 0,\n to: gaugevalue,\n color: color\n }\n ]\n };\n\n }\n return newGauge;\n }", "function test_utilization_utilization_graphs() {}", "function test_candu_verify_global_utilization_metrics() {}", "function gauge(options, type) {\n //remove legend\n if (options.legend) {\n options.legend.enabled = false;\n } else {\n options.legend = {\n enabled: false\n };\n }\n\n //declare needed variables\n let diagram = eve.initVis(options),\n currentSerie = diagram.series[0];\n\n //check whether the diagram data is not number\n if (typeof diagram.data !== \"number\")\n diagram.data = 0;\n\n //precaution for min range\n if (currentSerie.minRange == null || typeof currentSerie.minRange !== \"number\")\n currentSerie.minRange = 0;\n\n //precaution for max range\n if (currentSerie.maxRange == null || typeof currentSerie.maxRange !== \"number\")\n currentSerie.maxRange = 0;\n\n //check whther the min and max ranges are 0\n if (currentSerie.minRange === 0 && currentSerie.maxRange === 0) {\n currentSerie.minRange = 0;\n currentSerie.maxRange = 100;\n }\n\n //declare variables\n let currentRange = 0,\n valueIsNull = diagram.data == null ? true : false,\n actualValue = +diagram.data,\n value = +diagram.data,\n trendHeight = 0,\n radius = 0,\n innerRadius = 0,\n transX = 0,\n transY = 0,\n trendOffset = 0,\n width = diagram.plot.width - diagram.plot.left - diagram.plot.right,\n height = diagram.plot.height,\n percentValue = 0,\n oldPercentValue = 0,\n titleTextSize = 0,\n handleTextSize = 0,\n labelTextSize = 0,\n valueTextSize = 0,\n backArc = null,\n innerArc = null,\n titleSVG = null,\n minHandleSVG = null,\n maxHandleSVG = null,\n labelSVG = null,\n handleSVG = null,\n pathG = null,\n markerSVG = null,\n backCircleSVG = null,\n gaugeCircle = null,\n size = 0,\n textOffset = 5,\n handlePath = null,\n handleLine = null,\n hasHeader = currentSerie.title !== '',\n headerHeight = hasHeader ? height / textOffset : 0,\n centerHeight = height - headerHeight,\n negativePercent = 0,\n positivePercent = 0,\n posX, bwp, posY,\n tooltipContent = '',\n bbox = null,\n currentRadius = 0,\n minFontSize = 8,\n baseColor = currentSerie.color ? currentSerie.color : e.colors[0],\n element = document.getElementById(diagram.container),\n elementOffset = e.offset(element),\n cumulativeMax = Number.MIN_VALUE,\n currentTrendHeightPercent = 0,\n currentTrendWidthPercent = 0,\n currentTrendWidth = 0,\n currentTrendHeight = 0,\n currentHeight = 0,\n currentWidth = 0,\n widthOffset = 0,\n heightOffset = 0,\n markerPercent = 0,\n labelOffset = currentSerie.labelFormat ? (currentSerie.labelFontSize === 'auto' ? 11 : currentSerie.labelFontSize) : 0,\n availableBarHeight = diagram.plot.height,\n availableBarWidth = diagram.plot.width,\n xStartMargin = 0,\n xPrevTrend = 0,\n p1, p2;\n\n //fix value\n if (diagram.data > currentSerie.maxRange)\n currentSerie.maxRange = diagram.data;\n\n //set current range\n currentRange = currentSerie.maxRange - currentSerie.minRange;\n\n //calculate percent value\n percentValue = getPercentValue(value);\n\n //gets percent value\n function getPercentValue(val) {\n //return percentage\n let percentage = Math.abs(val) / currentRange * 100 - (currentSerie.minRange / currentRange * 100);\n if (isNaN(percentage))\n percentage = 0;\n return percentage;\n }\n\n //gets percent range\n function getPercentRange(cumulativeMax, val) { return val / cumulativeMax * 100 - (currentSerie.minRange / cumulativeMax * 100); }\n\n //gets positive percent value\n function getPositivePercentValue(val) { return val / currentSerie.maxRange * 100; }\n\n //gets negative percent value\n function getNegativePercentValue(val) { return val / Math.abs(currentSerie.minRange) * 100; }\n\n //converts value to degrees\n function convertToDegrees(val) { return val / currentRange * 270 - (currentSerie.minRange / currentRange * 270 + 45); }\n\n //converts value to radians\n function convertToRadians(val) { return convertToDegrees(val) * Math.PI / 180; }\n\n //converts value to point\n function convertToPoint(val, factor) {\n //set the object\n let pointObject = {\n x: transX - radius * factor * Math.cos(convertToRadians(val)),\n y: transY - radius * factor * Math.sin(convertToRadians(val))\n };\n\n if (isNaN(pointObject.x))\n pointObject.x = 0;\n\n if (isNaN(pointObject.y))\n pointObject.y = 0;\n\n return pointObject;\n }\n\n //Gets needle path\n function getHandlePath(val) {\n //declare variables\n let delta = currentRange / 13,\n head = convertToPoint(val, 0.85),\n head1 = convertToPoint(val - delta, 0.12),\n head2 = convertToPoint(val + delta, 0.12),\n tailValue = val - (currentRange * (1 / (270 / 360)) / 2),\n tail = convertToPoint(tailValue, 0.28),\n tail1 = convertToPoint(tailValue - delta, 0.12),\n tail2 = convertToPoint(tailValue + delta, 0.12);\n\n //return path\n return [head, head1, tail2, tail, tail1, head2, head];\n }\n\n //returns an arc tween to interpolate values\n function arcTween(newValue, oldValue) {\n let interpolated = d3.interpolate(oldValue ? oldValue : 0, newValue);\n return function (t) {\n return innerArc(interpolated(t));\n };\n }\n\n //initializes standard gauge\n function standardGauge() {\n //calculate needed variables\n trendOffset = 10;\n trendHeight = diagram.trends.length > 0 ? trendOffset : 0;\n radius = (Math.min(width, height) - trendHeight) / 2;\n innerRadius = radius / 2 + trendOffset;\n titleTextSize = radius / 4;\n handleTextSize = titleTextSize * 0.5;\n labelTextSize = titleTextSize * 0.4;\n valueTextSize = titleTextSize * 0.9;\n transX = (width - trendHeight) / 2;\n transY = height / 2 + innerRadius;\n backArc = d3.arc().outerRadius(radius).innerRadius(innerRadius).startAngle(0).endAngle(Math.PI),\n innerArc = d3.arc().outerRadius(radius).innerRadius(innerRadius).startAngle(0).endAngle(function (d) { return d / 100 * Math.PI; });\n\n //generate the path\n pathG = diagramG.append('g')\n .attr('transform', 'translate(0,' + (transY - transX) + ')');\n\n //create back circle\n backCircleSVG = pathG.append('path')\n .attr('transform', 'rotate(270,' + transX + ',0)')\n .style('fill', currentSerie.backColor)\n .style('stroke', currentSerie.borderColor)\n .attr('d', backArc);\n\n //create gauge circle\n gaugeCircle = pathG.append('path')\n .attr('transform', 'rotate(270,' + transX + ',0)')\n .attr('class', 'eve-handle')\n .style('fill', baseColor)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attrTween('d', function () { return arcTween(percentValue); });\n\n //iterate all trends\n diagram.trends.forEach(function (currentTrend, trendIndex) {\n //get previous trend\n let currentStartAngle = 0,\n currentEndAngle = 0,\n startPercent = getPercentValue(currentTrend.start),\n endPercent = getPercentValue(currentTrend.end),\n currentTrendArc = null;\n\n //set current angles\n currentStartAngle = startPercent / 100 * Math.PI;\n currentEndAngle = endPercent / 100 * Math.PI;\n\n //set current trend arc\n currentTrendArc = d3.arc().outerRadius(radius + trendOffset).innerRadius(radius).startAngle(currentStartAngle).endAngle(currentEndAngle);\n\n //check whether the trend is drawable\n if (currentTrend.start >= currentSerie.minRange && currentTrend.start <= currentSerie.maxRange && currentTrend.end >= currentSerie.minRange && currentTrend.end <= currentSerie.maxRange && currentTrend.end >= currentTrend.start) {\n //create trend arc\n pathG.append('path')\n .attr('transform', 'rotate(270,' + transX + ',0)')\n .style('fill', currentTrend.color)\n .style('fill-opacity', currentSerie.alpha)\n .attr('d', currentTrendArc)\n .on('mousemove', function (d, i) {\n //set hover\n d3.select(this).attr('fill-opacity', 1);\n\n //set tooltip content\n tooltipContent = (currentTrend.title || currentTrend.name) + ' starts from ' + e.formatNumber(currentTrend.start, currentSerie.numberFormat || currentSerie.labelFormat) + ' ends at ' + e.formatNumber(currentTrend.end, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //set hover\n d3.select(this).attr('fill-opacity', currentSerie.alpha);\n\n //hide tooltip\n diagram.hideTooltip();\n });\n }\n });\n\n //check whether the serie is sparkline\n if (!currentSerie.isSparkline) {\n //check whether the title text is not empty\n if (currentSerie.title !== '') {\n //create title text\n titleSVG = diagramG.append('text')\n .text(currentSerie.title)\n .style('fill', currentSerie.titleColor)\n .style('font-size', titleTextSize + 'px')\n .style('text-anchor', 'middle')\n .attr('x', transX)\n .attr('y', transY - radius - titleTextSize / 2);\n }\n\n //create min handle\n minHandleSVG = diagramG.append('text')\n .text(e.formatNumber(currentSerie.minRange, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', handleTextSize + 'px')\n .style('text-anchor', 'start')\n .attr('x', function (d) { return transX - radius; })\n .attr('y', transY + handleTextSize);\n\n //create max handle\n maxHandleSVG = diagramG.append('text')\n .text(e.formatNumber(currentSerie.maxRange, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', handleTextSize + 'px')\n .style('text-anchor', 'end')\n .attr('x', function (d) { return transX + radius; })\n .attr('y', transY + handleTextSize);\n\n //create value handle\n handleSVG = diagramG.append('text')\n .text(e.formatNumber(actualValue, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', valueTextSize + 'px')\n .style('text-anchor', 'middle')\n .attr('x', transX)\n .attr('y', transY);\n\n //create label\n labelSVG = diagramG.append('text')\n .text(currentSerie.labelFormat)\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', labelTextSize + 'px')\n .style('text-anchor', 'middle')\n .attr('x', transX)\n .attr('y', transY + valueTextSize / 2);\n }\n }\n\n //initializes dial guage\n function dialGauge() {\n //calculate needed variables\n size = Math.min(width, height);\n radius = size / 2;\n transX = width / 2;\n transY = height / 2;\n currentRange = currentSerie.maxRange - currentSerie.minRange;\n titleTextSize = size / 12;\n handleTextSize = size / 20;\n valueTextSize = size / 11;\n handlePath = getHandlePath(diagram.data);\n handleLine = d3.line().x(function (d) { return d.x; }).y(function (d) { return d.y; });\n\n //create back circle\n diagramG.append('circle')\n .attr('cx', transX)\n .attr('cy', transY)\n .attr('r', radius)\n .style('fill', currentSerie.backColor)\n .style('stroke', currentSerie.borderColor)\n .style('stroke-width', '0.5px');\n\n //create inner circle\n diagramG.append('circle')\n .attr('cx', transX)\n .attr('cy', transY)\n .attr('r', radius * 0.9)\n .style('fill', currentSerie.fillColor ? currentSerie.fillColor : 'rgb(255,255,255)')\n .style('stroke', d3.color(currentSerie.borderColor).darker(0.2))\n .style('stroke-width', '1px');\n\n //check whether the title text is not empty\n if (currentSerie.title !== '') {\n //create title text\n titleSVG = diagramG.append('text')\n .text(currentSerie.title)\n .style('fill', currentSerie.titleColor)\n .style('font-size', titleTextSize + 'px')\n .style('text-anchor', 'middle')\n .attr('x', transX)\n .attr('y', transY - (radius * 0.8) + titleTextSize)\n .attr('dy', titleTextSize / 2);\n }\n\n //create trends\n pathG = diagramG.append('g')\n .attr('transform', 'translate(0,' + (transY - transX) + ')');\n pathG.selectAll('.eve-gauge-trend')\n .data(diagram.trends)\n .enter().append('path')\n .attr('class', 'eve-gauge-trend')\n .style('fill', function (currentTrend) { return currentTrend.color; })\n .attr('transform', 'rotate(270,' + transX + ',0)')\n .on('mousemove', function (d, i) {\n //set hover\n d3.select(this).attr('fill-opacity', 1);\n\n //set tooltip content\n tooltipContent = (d.title || d.name) + ' starts from ' + e.formatNumber(d.start, currentSerie.numberFormat || currentSerie.labelFormat) + ' ends at ' + e.formatNumber(d.end, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //set hover\n d3.select(this).attr('fill-opacity', currentSerie.alpha);\n\n //hide tooltip\n diagram.hideTooltip();\n })\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attrTween('d', function (currentTrend) {\n return d3.arc().outerRadius(radius * 0.88).innerRadius(radius * 0.80).startAngle(convertToRadians(currentTrend.start)).endAngle(convertToRadians(currentTrend.end));\n });\n\n //calculate major ticks delta\n let majorDelta = currentRange / (currentSerie.majorTicks - 1);\n\n //iterate min and max by major delta\n for (let major = currentSerie.minRange; major <= currentSerie.maxRange; major += majorDelta) {\n //calculate minor delta\n let minorDelta = majorDelta / currentSerie.minorTicks;\n\n //iterate to create minor ticks\n for (let minor = major + minorDelta; minor < Math.min(major + majorDelta, currentSerie.maxRange) ; minor += minorDelta) {\n //create minor points\n p1 = convertToPoint(minor, 0.75);\n p2 = convertToPoint(minor, 0.85);\n\n //create minor tick line\n diagramG.append(\"line\")\n .attr(\"x1\", p1.x)\n .attr(\"y1\", p1.y)\n .attr(\"x2\", p2.x)\n .attr(\"y2\", p2.y)\n .style(\"stroke\", d3.color(currentSerie.borderColor).darker(0.3))\n .style(\"stroke-width\", \"1px\");\n }\n\n //create major points\n p1 = convertToPoint(major, 0.7);\n p2 = convertToPoint(major, 0.85);\n\n //create major tick line\n diagramG.append(\"line\")\n .attr(\"x1\", p1.x)\n .attr(\"y1\", p1.y)\n .attr(\"x2\", p2.x)\n .attr(\"y2\", p2.y)\n .style(\"stroke\", d3.color(currentSerie.borderColor).darker(0.5))\n .style(\"stroke-width\", \"2px\");\n\n //Create min and max handle\n if (major == currentSerie.minRange || major == currentSerie.maxRange) {\n //create minmax handle point\n let pHandle = convertToPoint(major, 0.63);\n\n //create handle text\n diagramG.append('text')\n .attr('x', pHandle.x)\n .attr('y', pHandle.y)\n .attr('dy', handleTextSize / 3)\n .style('text-anchor', major == currentSerie.minRange ? 'start' : 'end')\n .text(e.formatNumber(major, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('font-size', handleTextSize + 'px')\n .style('fill', currentSerie.labelFontColor);\n }\n }\n\n //create handle g\n handleSVG = diagramG.append('g').attr('class', 'eve-gauge-handle');\n\n //draw handle\n handleSVG.selectAll('path')\n .data([getHandlePath(currentSerie.minRange)])\n .enter().append('path')\n .attr('d', handleLine)\n .style('fill', baseColor)\n .style('stroke', d3.color(baseColor).darker(0.5))\n .style('fill-opacity', 0.7);\n\n //animate handle\n handlePath = getHandlePath(diagram.data);\n handleSVG.selectAll('path')\n .data([handlePath])\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attr('d', handleLine);\n\n //draw handle circle\n diagramG.append(\"circle\")\n .attr(\"cx\", transX)\n .attr(\"cy\", transY)\n .attr(\"r\", 0.12 * radius)\n .style(\"fill\", currentSerie.backColor)\n .style(\"stroke\", currentSerie.borderColor)\n .style(\"fill-opacity\", 1);\n\n //create label svg\n labelSVG = diagramG.append('text')\n .text(e.formatNumber(actualValue, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', valueTextSize + 'px')\n .style('text-anchor', 'middle')\n .attr(\"x\", width / 2)\n .attr(\"y\", transY + radius - valueTextSize - (valueTextSize / 2));\n\n //create label\n diagramG.append('text')\n .text(currentSerie.labelFormat)\n .style('fill', currentSerie.labelFontColor)\n .style('font-size', (valueTextSize / 2) + 'px')\n .style('text-anchor', 'middle')\n .attr('x', width / 2)\n .attr('y', transY + radius - valueTextSize);\n }\n\n //initializes digital gauge\n function digitalGauge() {\n //set title text size\n titleTextSize = headerHeight / 1.5;\n valueTextSize = width / 6; //> centerHeight ? width / 2.5 : centerHeight / 2.5;\n transY = headerHeight / 2 + titleTextSize / 2 - textOffset;\n transX = width / 2;\n valueHeight = height - headerHeight;\n\n //create base rectangle\n diagramG.append('rect')\n .attr('width', width)\n .attr('height', height)\n .style('fill', currentSerie.backColor)\n .style('stroke', currentSerie.borderColor)\n .style('stroke-width', '0.5px');\n\n //check whether the gauge has header\n if (hasHeader) {\n //create header rectangle\n diagramG.append('rect')\n .attr('width', width)\n .attr('height', headerHeight)\n .style('fill', d3.color(currentSerie.backColor).darker(0.2))\n .style('stroke', currentSerie.borderColor);\n\n //append title text\n diagramG.append('text')\n .text(currentSerie.title)\n .style('fill', currentSerie.titleColor)\n .style('font-family', \"Arial\")\n .style('font-size', '10px')\n .style('font-size', function (d) {\n var maxHeight = (headerHeight - 6) / this.getBBox().height * 10,\n maxWidth = (width - 6) / this.getComputedTextLength() * 10;\n titleTextSize = Math.min(maxHeight, maxWidth);\n transY = headerHeight / 2 + titleTextSize / 2 - textOffset;\n return titleTextSize + 'px';\n })\n .style('text-anchor', 'middle')\n .attr('x', transX)\n .attr('y', transY);\n }\n\n //create value label\n labelSVG = diagramG.append('text')\n .style('font-size', minFontSize + 'px')\n .text(e.formatNumber(diagram.data, currentSerie.numberFormat || currentSerie.labelFormat))\n .style('fill', baseColor)\n .style('font-family', \"Arial\")\n .style('font-size', function (d) {\n /*if (width > height)\n currentRadius = (Math.min(width, valueHeight) / 2) * 0.5;\n else\n currentRadius = (Math.min(width, valueHeight) / 2) * 0.5;\n\n //set value text size\n valueTextSize = Math.min(2 * currentRadius, (2 * currentRadius - 8) / Math.max(this.getComputedTextLength(), this.getBBox().height) * minFontSize);\n\n //check if there is label\n if (currentSerie.labelFormat)\n valueTextSize -= (valueTextSize / 2);\n\n //check whether the with is greater than the height\n if (width > valueHeight)\n return valueHeight + \"px\";\n */\n currentRadius = width / 2;\n valueTextSize = Math.min(2 * currentRadius, (2 * currentRadius - 8) / Math.max(this.getComputedTextLength(), this.getBBox().height) * minFontSize);\n if (valueTextSize > valueHeight)\n valueTextSize = valueHeight;\n\n if (e.getBrowserName() === \"Firefox\") {\n valueTextSize -= 10;\n if (valueTextSize < minFontSize)\n valueTextSize = minFontSize;\n }\n\n return valueTextSize + 'px';\n })\n .style('text-anchor', 'middle')\n .attr(\"x\", transX)\n .attr('y', function () {\n //if (width > valueHeight)\n // return valueHeight + headerHeight / 2;\n\n //return y\n return ((height - headerHeight) / 2) + (valueTextSize / 2) + minFontSize;\n });\n\n //create label text\n diagramG.append('text')\n .text(currentSerie.labelFormat)\n .style('fill', currentSerie.handleColor)\n .style('font-family', \"Arial\")\n .style('font-size', (valueTextSize / 2) + 'px')\n .style('text-anchor', 'middle')\n .attr('x', width / 2)\n .attr('y', (height / 2) + valueTextSize);\n }\n\n //initializes linear gauge\n function linear() {\n //set dimension\n element = document.getElementById(diagram.container);\n elementOffset = e.offset(element);\n width = elementOffset.width + diagram.margin.left;\n height = elementOffset.height + diagram.margin.top;\n\n //remove margins\n diagram.svg.remove();\n diagram.svg = d3.select('#' + diagram.innerContainer)\n .append('svg')\n .attr('id', diagram.container + '_svg')\n .attr('class', 'vis_svg')\n .attr('width', width - diagram.margin.left)\n .attr('height', height - diagram.margin.top);\n\n //set g\n diagramG = diagram.svg.append('g')\n .attr('transform', 'translate(0,0)')\n .attr('width', width)\n .attr('height', height + diagram.margin.top);\n\n\n //create base rectangle\n diagramG.append('rect')\n .attr('width', width)\n .attr('height', height)\n .style('fill', 'transparent')\n .attr('x', 0).attr('y', 0);\n //.attr('rx', 5).attr('ry', 5);\n\n //check range\n if (currentSerie.minRange < 0) {\n //set needed variables\n currentRange = currentSerie.maxRange - currentSerie.minRange;\n negativePercent = Math.abs(currentSerie.minRange) / currentRange;\n positivePercent = Math.abs(currentSerie.maxRange) / currentRange;\n bwp = Math.abs(value) / currentRange * 100;\n\n //check value direction\n if (value > 0) {\n //calculate envrionment\n posX = width * negativePercent;\n\n //create rectangle\n handleSVG = diagramG.append('rect')\n .style('fill', baseColor)\n .style('fill-opacity', currentSerie.alpha)\n .attr('y', 0)\n .attr('height', height)\n .attr('x', posX)\n .attr('width', width * bwp / 100);\n\n } else {\n //calculate envrionment\n posX = (width * negativePercent) - (width * bwp / 100);\n\n //create rectangle\n handleSVG = diagramG.append('rect')\n .style('fill', currentSerie.negativeColor)\n .style('fill-opacity', currentSerie.alpha)\n .attr('y', 0)\n .attr('height', height)\n .attr('x', posX)\n .attr('width', width * bwp / 100);\n }\n } else {\n //create rectangle\n handleSVG = diagramG.append('rect')\n .style('fill', baseColor)\n .style('fill-opacity', currentSerie.alpha)\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', width * percentValue / 100)\n .attr('height', height);\n }\n\n //create text\n labelSVG = diagramG.append('text')\n .style('fill', '#333333')\n .style('font-size', (currentSerie.labelFontSize === 'auto' ? 11 : currentSerie.labelFontSize) + 'px')\n .style('font-family', currentSerie.labelFontFamily)\n .style('font-style', currentSerie.labelFontStyle === 'bold' ? 'normal' : currentSerie.labelFontStyle)\n .style('font-weight', currentSerie.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .style('text-anchor', function () {\n //check label position\n if (currentSerie.labelPosition) {\n if (currentSerie.labelPosition === 'right')\n return 'end'\n else if (currentSerie.labelPosition === 'center')\n return 'middle';\n }\n return 'start';\n })\n .text(currentSerie.labelHidden ? '' : (valueIsNull ? '' : (e.formatNumber(diagram.data, currentSerie.numberFormat || currentSerie.labelFormat))))\n .attr('transform', function () {\n //set x and y\n bbox = this.getBBox();\n posY = bbox.height;\n posX = 0;\n\n //check label position\n if (currentSerie.labelPosition) {\n if (currentSerie.labelPosition === 'right')\n posX = width - diagram.margin.left;\n else if (currentSerie.labelPosition === 'center')\n posX = (width - diagram.margin.left) / 2;\n }\n\n //return translation\n return 'translate(' + posX + ',' + posY + ')';\n });\n }\n\n //initializes bullet gauge\n function bullet() {\n //check if diagram has marker value\n if (!diagram.marker)\n diagram.marker = 0;\n\n //set font size\n if (currentSerie.labelFontSize === 'auto')\n currentSerie.labelFontSize = 11;\n\n //iterate all trends to set cumulative max\n diagram.trends.forEach(function (currentTrend) {\n //check trend end value\n if (currentTrend.end > cumulativeMax)\n cumulativeMax = currentTrend.end;\n });\n\n //check values\n if (diagram.data > cumulativeMax)\n cumulativeMax = diagram.data;\n\n //check marker is greater than cumulative max\n if (diagram.marker > cumulativeMax)\n cumulativeMax = diagram.marker;\n\n //set max length\n if (!currentSerie.maxLength)\n currentSerie.maxLength = currentSerie.labelFormat.length;\n\n //check orientation\n if (currentSerie.orientation === 'vertical') {\n //set width offset\n widthOffset = diagram.plot.width / 5;\n\n //set label\n labelSVG = diagramG.append('text')\n .text(currentSerie.labelFormat)\n .style('fill', currentSerie.labelFontColor === 'auto' ? diagram.getAutoColor(baseColor) : currentSerie.labelFontColor)\n .style('font-size', (currentSerie.labelFontSize === 'auto' ? 11 : currentSerie.labelFontSize) + 'px')\n .style('font-family', currentSerie.labelFontFamily)\n .style('font-style', currentSerie.labelFontStyle === 'bold' ? 'normal' : currentSerie.labelFontStyle)\n .style('font-weight', currentSerie.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .style('text-anchor', 'middle')\n .attr('transform', function (d) {\n //get pos\n posY = currentSerie.labelFontSize === 'auto' ? 11 : currentSerie.labelFontSize;\n posX = (diagram.plot.width / 2);\n bbox = this.getBBox();\n labelOffset = bbox.height + 2;\n\n //return translation\n return 'translate(' + posX + ', ' + posY + ')';\n });\n\n //set bar height\n availableBarHeight = diagram.plot.height - labelOffset;\n\n //iterate all trends to set ranges\n diagram.trends.forEach(function (currentTrend) {\n //create ranges\n diagramG.append('rect')\n .attr('fill', currentTrend.color)\n .attr('fill-opacity', currentSerie.alpha)\n .attr('width', diagram.plot.width)\n .attr('height', function () {\n //calculate height\n currentTrendHeightPercent = getPercentRange(cumulativeMax, currentTrend.end - currentTrend.start);\n currentTrendHeight = availableBarHeight * currentTrendHeightPercent / 100;\n\n //return height\n return currentTrendHeight;\n })\n .attr('x', diagram.margin.left)\n .attr('y', function (d) {\n //calculate width\n currentTrendHeightPercent = getPercentRange(cumulativeMax, currentTrend.end - currentTrend.start);\n currentTrendHeight = availableBarHeight * currentTrendHeightPercent / 100;\n percentValue = getPercentRange(cumulativeMax, currentTrend.start);\n posY = availableBarHeight - (currentTrendHeight + (availableBarHeight * percentValue / 100));\n\n //return y\n return posY + labelOffset;\n })\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = (currentTrend.title || currentTrend.name) + ' starts from ' + e.formatNumber(currentTrend.start, currentSerie.numberFormat || currentSerie.labelFormat) + ' ends at ' + e.formatNumber(currentTrend.end, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n });\n });\n\n //set measure handle\n handleSVG = diagramG.append('rect')\n .attr('fill', baseColor)\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = e.formatNumber(diagram.data, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n })\n .attr('width', diagram.plot.width - widthOffset)\n .attr('height', 0)\n .attr('x', widthOffset / 2)\n .attr('y', diagram.plot.height)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .attr('height', function () {\n //calculate height\n percentValue = getPercentRange(cumulativeMax, diagram.data);\n currentHeight = availableBarHeight * percentValue / 100;\n return currentHeight;\n })\n .attr('y', function () { return availableBarHeight - currentHeight + labelOffset; });\n\n //set marker handle\n markerSVG = diagramG.append('rect')\n .attr('fill', '#333333')\n .attr('width', diagram.plot.width - widthOffset)\n .attr('height', 5)\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = e.formatNumber(diagram.marker, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n })\n .attr('x', widthOffset / 2)\n .attr('y', diagram.plot.height)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .attr('y', function () {\n //calculate y\n markerPercent = getPercentRange(cumulativeMax, diagram.marker);\n currentHeight = availableBarHeight * markerPercent / 100;\n posY = availableBarHeight - currentHeight + labelOffset;\n return posY < 0 ? 0 : posY;\n });\n } else {\n //set heigh offset\n heightOffset = diagram.plot.height / 5;\n\n //set label\n labelSVG = diagramG.append('text')\n .text(currentSerie.labelFormat)\n .style('fill', currentSerie.labelFontColor === 'auto' ? diagram.getAutoColor(baseColor) : currentSerie.labelFontColor)\n .style('font-size', (currentSerie.labelFontSize === 'auto' ? 11 : currentSerie.labelFontSize) + 'px')\n .style('font-family', currentSerie.labelFontFamily)\n .style('font-style', currentSerie.labelFontStyle === 'bold' ? 'normal' : currentSerie.labelFontStyle)\n .style('font-weight', currentSerie.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .style('text-anchor', 'start')\n .attr('transform', function (d) {\n //get pos\n bbox = this.getBBox();\n posX = 0;\n posY = diagram.plot.height / 2;\n\n //return translation\n return 'translate(' + posX + ', ' + posY + ')';\n });\n\n //set x start margin\n xStartMargin = (currentSerie.maxLength * (currentSerie.labelFontSize / 2)) + 1;\n availableBarWidth = diagram.plot.width - xStartMargin;\n\n //iterate all trends to set ranges\n diagram.trends.forEach(function (currentTrend) {\n //create ranges\n diagramG.append('rect')\n .attr('fill', currentTrend.color)\n .attr('fill-opacity', currentSerie.alpha)\n .attr('width', function (d) {\n //set width\n currentTrendWidthPercent = getPercentRange(cumulativeMax, currentTrend.end - currentTrend.start);\n currentTrendWidth = availableBarWidth * currentTrendWidthPercent / 100;\n return currentTrendWidth;\n })\n .attr('height', diagram.plot.height)\n .attr('x', function (d) {\n //calculate x pos\n bbox = this.getBBox();\n posX = xStartMargin + xPrevTrend;\n xPrevTrend += bbox.width;\n return posX;\n })\n .attr('y', 0)\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = (currentTrend.title || currentTrend.name) + ' starts from ' + e.formatNumber(currentTrend.start, currentSerie.numberFormat || currentSerie.labelFormat) + ' ends at ' + e.formatNumber(currentTrend.end, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n });\n });\n\n //set measure handle\n handleSVG = diagramG.append('rect')\n .attr('fill', baseColor)\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = e.formatNumber(diagram.data, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n })\n .attr('width', 0)\n .attr('height', diagram.plot.height - heightOffset)\n .attr('x', xStartMargin)\n .attr('y', heightOffset / 2)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .attr('width', function () {\n //calculate height\n percentValue = getPercentRange(cumulativeMax, diagram.data);\n currentWidth = availableBarWidth * percentValue / 100;\n return currentWidth;\n });\n\n //set measure handle\n markerSVG = diagramG.append('rect')\n .attr('fill', '#333333')\n .on('mousemove', function (d, i) {\n //set tooltip content\n tooltipContent = e.formatNumber(diagram.marker, currentSerie.numberFormat || currentSerie.labelFormat);\n\n //show tooltip\n diagram.showTooltip(tooltipContent);\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n })\n .attr('width', 5)\n .attr('height', diagram.plot.height - heightOffset)\n .attr('x', xStartMargin)\n .attr('y', heightOffset / 2)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .attr('x', function () {\n //calculate height\n markerPercent = getPercentRange(cumulativeMax, diagram.marker);\n currentWidth = availableBarWidth * markerPercent / 100;\n posX = currentWidth + xStartMargin;\n return posX > availableBarWidth ? availableBarWidth : posX;\n });\n }\n }\n\n //create diagram g\n let diagramG = null;\n\n //set g\n if (type !== 'linear') {\n diagramG = diagram.svg.append('g')\n .attr('width', width)\n .attr('height', height)\n .on(\"click\", function () {\n if (diagram.onClick)\n diagram.onClick();\n });\n }\n\n //initialize gauge\n switch (type) {\n case 'standard':\n standardGauge();\n break;\n case 'dial':\n dialGauge();\n break;\n case 'digital':\n digitalGauge();\n break;\n case 'bullet':\n bullet();\n break;\n case 'linear':\n linear();\n break;\n }\n\n //update diagram\n diagram.update = function (data, marker) {\n //check data\n if (arguments.length === 0)\n data = diagram.data;\n\n //set diagram data\n actualValue = data;\n oldPercentValue = percentValue;\n diagram.data = data;\n value = data;\n\n //check if old percent value > 100\n if (oldPercentValue > 100)\n oldPercentValue = 100;\n\n //set marker\n if (marker)\n diagram.marker = marker;\n\n //fix value\n if (diagram.data > currentSerie.maxRange)\n currentSerie.maxRange = diagram.data;\n\n //set percent value\n percentValue = getPercentValue(value);\n\n //check if new percent value > 100\n if (percentValue > 100)\n percentValue = 100;\n\n //check gauge type\n switch (type) {\n case 'standard':\n {\n //update text value\n handleSVG\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .text(e.formatNumber(value, currentSerie.numberFormat || currentSerie.labelFormat));\n\n //update gauge arc\n diagramG.selectAll('.eve-handle')\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attrTween('d', function () {\n return arcTween(percentValue, oldPercentValue);\n });\n }\n break;\n case 'dial':\n {\n //update text value\n labelSVG\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .text(e.formatNumber(value, currentSerie.numberFormat || currentSerie.labelFormat));\n\n //animate handle\n handlePath = getHandlePath(diagram.data);\n handleSVG.selectAll('path')\n .data([handlePath])\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attr('d', handleLine);\n }\n break;\n case 'digital':\n {\n //animate text\n labelSVG\n .text(e.formatNumber(diagram.data, currentSerie.numberFormat || currentSerie.labelFormat));\n }\n break;\n case 'linear':\n {\n //remove g\n diagramG.remove();\n linear();\n }\n break;\n case 'bullet':\n {\n //remove g\n diagramG.remove();\n diagramG = diagram.svg.append('g').attr('width', width).attr('height', height);\n xStartMargin = 0;\n xPrevTrend = 0;\n bullet();\n }\n break;\n }\n };\n\n //return abacus diagram\n return diagram;\n }", "function test_utilization_host() {}", "function drawGauge(range){\n g1 = new JustGage({\n id: \"g1\",\n title: \"Temperature reading\",\n value: 5,\n min: 0,\n max: range,\n gaugeWidthScale: 0.6,\n counter: true,\n titleFontColor: \"green\",\n titleFontFamily: \"Georgia\",\n titlePosition: \"below\",\n valueFontColor: \"blue\",\n valueFontFamily: \"Georgia\"\n });\n}", "function drawGoogleGauge() {\n var options = {\n width: 400, height: 120,\n redFrom: 90, redTo: 100,\n yellowFrom:75, yellowTo: 90,\n minorTicks: 5\n };\n\n google_gauge_Data = google.visualization.arrayToDataTable([\n ['Label', 'Value'],\n ['Temperature', 53],\n ]);\n google_chart = new google.visualization.Gauge(document.getElementById('chart_div'));\n\n google_chart.draw(google_gauge_Data, options);\n}", "function gauge(percentileData) {\n // Load the Visualization API and the piechart package\n google.load('visualization', '1.0', {'packages':['gauge']});\n\n // Set a callback to run when the Google Visualization API is loaded\n google.setOnLoadCallback(drawGauge);\n\n // Actually draw it!\n function drawGauge() {\n // Create and populate the data table. Storing 0 initially so we get fun animation\n data = google.visualization.arrayToDataTable([\n ['Label', 'Value'],\n ['%', 0]\n ]);\n\n options = {\n height: 175,\n width: 175,\n greenFrom: 0, greenTo: 33,\n yellowFrom: 33, yellowTo: 67,\n redFrom: 67, redTo: 100,\n minorTicks: 5,\n animation:{\n duration: 1000,\n easing: 'out',\n }\n };\n\n // Create and draw the visualization\n gauge = new google.visualization.Gauge($('#gauge')[0]);\n gauge.draw(data, options);\n\n // Populate data with real values, redraw gauge\n nationalPercentile = parseInt(percentileData.national);\n urbanPercentile = parseInt(percentileData.urban);\n suburbanPercentile = parseInt(percentileData.suburban);\n ruralPercentile = parseInt(percentileData.rural);\n\n if (choice === undefined) {\n choice = 0; \n } \n\n // In case someone clicks a button before the gauge loads\n updateGauge();\n }\n}", "function Gauge(el) {\n //Private Properties and Attributes\n\n let element, // Containing element for the info component\n data, // `.gauge__data` element\n needle, // `.gauge__needle` element\n value = 0.0, // Current gauge value from 0 to 1\n prop; // Style for transform\n\n //Private Methods and Functions\n\n let setElement = function (el) {\n // Keep a reference to the various elements and sub-elements\n element = el;\n data = element.querySelector(\".gauge__data\");\n needle = element.querySelector(\".gauge__needle\");\n };\n\n let setValue = function (x) {\n value = x;\n let turns = -0.5 + x * 0.5;\n data.style[prop] = \"rotate(\" + turns + \"turn)\";\n needle.style[prop] = \"rotate(\" + turns + \"turn)\";\n };\n\n //Object to be Returned\n\n function exports() {}\n\n //Public API Methods\n\n exports.element = function (el) {\n if (!arguments.length) {\n return element;\n }\n setElement(el);\n return this;\n };\n\n exports.value = function (x) {\n if (!arguments.length) {\n return value;\n }\n setValue(x);\n return this;\n };\n\n //nitialization\n\n let body = document.getElementsByTagName(\"body\")[0];\n [\n \"webkitTransform\",\n \"mozTransform\",\n \"msTransform\",\n \"oTransform\",\n \"transform\",\n ].forEach(function (p) {\n if (typeof body.style[p] !== \"undefined\") {\n prop = p;\n }\n });\n\n if (arguments.length) {\n setElement(el);\n }\n\n return exports;\n}", "function DoGaugeStuff()\n{\n\t// update gauge size based on page size\n\tSizeGauge();\n\n\t// grab rpms\n\tlet FL_RPM = (Number)($(\"#FL_RPM\").html());\n\tlet BL_RPM = (Number)($(\"#BL_RPM\").html());\n\tlet FR_RPM = (Number)($(\"#FR_RPM\").html());\n\tlet BR_RPM = (Number)($(\"#BR_RPM\").html());\n\n\t// get a speeed approximation\n\tlet speed = (FL_RPM + BL_RPM + FR_RPM + BR_RPM) / 4 * 6.5 * 0.001885;\n\n\t// update gauge\n\tdocument.getElementById(\"speedGauge\").setAttribute(\"data-value\", `${speed}`);\n}", "function colorforgauge(percent){\r\n if (percent < 20) {\r\n return \"rgb(12, 26, 182)\";\r\n } else if (percent < 40) {\r\n return \"rgb(100, 149, 192)\";\r\n } else if (percent < 60) {\r\n return \"rgb(245, 180, 1)\";\r\n } else if (percent < 80) {\r\n return \"rgb(207, 111, 2)\";\r\n } else {\r\n return \"rgb(255, 36, 40)\";\r\n }\r\n}", "static createWaterTemperatureGauge() {\r\n var gauge = new LinearGauge(this.createTemperatureGaugeOpts('waterTemperatureCanvas'));\r\n LivewindStore.storeGauge('waterTemperature', gauge);\r\n gauge.draw();\r\n }", "function gaugeChart(chart) {\n //declare gauge variables\n var plot = eve.charts.createPlot(chart),\n serie = chart.series[0],\n trendHeight = chart.trends.length > 0 ? serie.trendHeight : 0,\n size = Math.min(plot.width - chart.margin.left - chart.margin.right, plot.height - chart.margin.top - chart.margin.bottom),\n percentValue = getPercent(serie.value),\n minValue = plot.formatNumber(serie.min),\n maxValue = plot.formatNumber(serie.max),\n range = serie.max - serie.min,\n majorDelta = range / (serie.majorTicks - 1),\n radius, innerRadius, btx, bty, titleTextSize, handleTextSize, valueTextSize, labelTextSize,\n matchTrend = null,\n gaugeValueHandle = null,\n gaugeValueHandleCircle = null,\n gaugeValueText = null;\n\n //check serie to handle errors\n if (serie.type !== 'gauge') {\n throw new Error('Serie type mistmatch! When creating a gauge chart, serie type should be set as \"gauge\"...');\n return null;\n }\n\n //append balloon div into the document\n eve(document.body).append('<div id=\"' + chart.id + '_balloon\" class=\"eve-balloon\"></div>');\n\n //set balloon as eve object\n var balloon = eve('#' + chart.id + '_balloon');\n\n //set balloon style\n balloon.style('backgroundColor', chart.balloon.backColor);\n balloon.style('borderStyle', chart.balloon.borderStyle);\n balloon.style('borderColor', chart.balloon.borderColor);\n balloon.style('borderRadius', chart.balloon.borderRadius + 'px');\n balloon.style('borderWidth', chart.balloon.borderSize + 'px');\n balloon.style('color', chart.balloon.fontColor);\n balloon.style('fontFamily', chart.balloon.fontFamily);\n balloon.style('fontSize', chart.balloon.fontSize + 'px');\n balloon.style('paddingLeft', chart.balloon.padding + 'px');\n balloon.style('paddingTop', chart.balloon.padding + 'px');\n balloon.style('paddingRight', chart.balloon.padding + 'px');\n balloon.style('paddingBottom', chart.balloon.padding + 'px');\n if (chart.balloon.fontStyle == 'bold') balloon.style('fontWeight', 'bold'); else balloon.style('fontStyle', chart.balloon.fontStyle);\n\n //set this data\n this.value = serie.value;\n\n //calculate radius and text sizes by gauge behavior\n switch (serie.behavior) {\n case 'standard':\n {\n //set standard gauge variables\n radius = (size - trendHeight) / 2;\n innerRadius = serie.innerRadius == 0 ? (radius / 2) : serie.innerRadius;\n btx = (plot.width + chart.margin.left + chart.margin.right - trendHeight) / 2;\n bty = (plot.height + chart.margin.top + chart.margin.bottom + innerRadius) / 2;\n titleTextSize = radius / 4;\n handleTextSize = titleTextSize * .5;\n labelTextSize = titleTextSize * .4;\n valueTextSize = titleTextSize * .9;\n }\n break;\n case 'dial':\n {\n //set dial gauge variables\n radius = size / 2;\n btx = (plot.width + chart.margin.left + chart.margin.right) / 2;\n bty = (plot.height + chart.margin.top + chart.margin.bottom) / 2;\n titleTextSize = size / 12;\n handleTextSize = size / 20;\n labelTextSize = size / 20;\n valueTextSize = size / 11;\n }\n break;\n }\n\n //create arc functions\n var standardGaugeArc = d3.svg.arc().outerRadius(radius).innerRadius(innerRadius).startAngle(0).endAngle(Math.PI);\n var standardGaugeInnerArc = d3.svg.arc().outerRadius(radius).innerRadius(innerRadius).startAngle(0).endAngle(function (d) { return d / 100 * Math.PI });\n\n //get percent value\n function getPercent(value) { return Math.round((value - serie.min) / serie.max * 100); }\n\n //Create a tween for arc\n function standardGaugeTween(b) {\n var interpolated = d3.interpolate(0, b);\n return function (t) {\n return standardGaugeInnerArc(interpolated(t));\n }\n }\n\n //Converts value to degrees\n function convertToDegrees(val) {\n return val / range * 270 - (serie.min / range * 270 + 45);\n }\n\n //Converts value to radians\n function convertToRadians(val) {\n return convertToDegrees(val) * Math.PI / 180;\n }\n\n //Converts value to point\n function convertToPoint(val, factor) {\n return {\n x: btx - radius * factor * Math.cos(convertToRadians(val)),\n y: bty - radius * factor * Math.sin(convertToRadians(val))\n };\n }\n\n //Gets needle path\n function getNeedlePath(val) {\n //Declare variables\n var _delta = range / 13,\n _head = valueToPoint(val, 0.85),\n _head1 = valueToPoint(val - _delta, 0.12),\n _head2 = valueToPoint(val + _delta, 0.12),\n _tailValue = val - (range * (1 / (270 / 360)) / 2),\n _tail = valueToPoint(_tailValue, 0.28),\n _tail1 = valueToPoint(_tailValue - _delta, 0.12),\n _tail2 = valueToPoint(_tailValue + _delta, 0.12);\n\n //declare internal value to point function\n function valueToPoint(value, factor) {\n var point = convertToPoint(value, factor);\n point.x -= btx;\n point.y -= bty;\n return point;\n }\n\n //Return path\n return [_head, _head1, _tail2, _tail, _tail1, _head2, _head];\n }\n\n //formats value\n function formatValue(value, data) {\n //handle errors\n if (arguments.length === 0) return '';\n if (value == null || data == null) return '';\n\n //declare format variables\n var formatted = value;\n \n //convert value\n formatted = formatted.replaceAll('{{value}}', plot.formatNumber(data.value));\n\n //convert percent\n formatted = formatted.replaceAll('{{percent}}', '%' + data.percent);\n\n //convert max\n formatted = formatted.replaceAll('{{max}}', plot.formatNumber(data.max));\n\n //convert min\n formatted = formatted.replaceAll('{{min}}', plot.formatNumber(data.min));\n\n //check whether the data trend is not null\n if (data.trend != null) {\n //convert trend title\n formatted = formatted.replaceAll('{{trendTitle}}', data.trend.title);\n\n //convert trend start\n formatted = formatted.replaceAll('{{trendStart}}', plot.formatNumber(data.trend.start));\n\n //convert trend end\n formatted = formatted.replaceAll('{{trendEnd}}', plot.formatNumber(data.trend.end));\n }\n\n //return formatted content\n return formatted;\n };\n\n //set base object\n var base = this;\n\n //create canvas\n var canvas = d3.select(plot.container.reference).append('svg')\n .attr('width', plot.width).attr('height', plot.height);\n\n //inits standard gauge\n function initStandard() {\n //set min handle\n var minHandle = canvas.append('text')\n .text(minValue)\n .style('fill', serie.handleFontColor)\n .style('font-size', handleTextSize + 'px')\n .style('font-family', serie.handleFontFamily)\n .style('font-style', serie.handleFontStyle == 'bold' ? 'normal' : serie.handleFontStyle)\n .style('font-weight', serie.handleFontStyle == 'bold' ? 'bold' : 'normal')\n .style('text-anchor', 'start')\n .attr('x', function (d) { return btx - radius; })\n .attr('y', function (d) { return bty + this.getBBox().height; });\n\n //set max handle\n var maxHandle = canvas.append('text')\n .text(maxValue)\n .style('fill', serie.handleFontColor)\n .style('font-size', handleTextSize + 'px')\n .style('font-family', serie.handleFontFamily)\n .style('font-style', serie.handleFontStyle == 'bold' ? 'normal' : serie.handleFontStyle)\n .style('font-weight', serie.handleFontStyle == 'bold' ? 'bold' : 'normal')\n .style('text-anchor', 'end')\n .attr('x', function (d) { return btx + radius + trendHeight; })\n .attr('y', function (d) { return bty + this.getBBox().height; });\n\n //Create back circle\n var backCircle = canvas.append('path')\n .attr('transform', 'translate(' + btx + ',' + bty + ')rotate(270)')\n .style('fill', serie.gaugeBackColor)\n .style('stroke', serie.gaugeBorderColor)\n .style('stroke-width', serie.gaugeBorderSize + 'px')\n .attr('d', standardGaugeArc);\n\n //Set trends\n chart.trends.each(function (trend) {\n //Calculate trend angles\n var trendStartAngle = trend.start / serie.max * Math.PI;\n var trendEndAngle = trend.end / serie.max * Math.PI;\n var trendArc = d3.svg.arc().outerRadius(radius + trendHeight).innerRadius(radius).startAngle(trendStartAngle).endAngle(trendEndAngle);\n\n //Create trend circle\n var trendCircle = canvas.append('path')\n .attr('transform', 'translate(' + btx + ',' + bty + ')rotate(270)')\n .style('fill', trend.color)\n .attr('d', trendArc)\n .on('mousemove', function (d) {\n //set balloon content\n var balloonContent = trend.balloonFormat.replaceAll('{{title}}', trend.title).replaceAll('{{start}}', plot.formatNumber(trend.start))\n .replaceAll('{{end}}', plot.formatNumber(trend.end)).replaceAll('{{value}}', plot.formatNumber(base.value)).replaceAll('{{percent}}', percentValue);\n\n //set balloon border color\n balloon.style('borderColor', trend.color);\n\n //show balloon\n showBalloon(balloonContent);\n })\n .on('mouseout', function (d) {\n //hide bubble\n hideBalloon();\n });\n });\n\n //create value circle\n gaugeValueHandle = canvas.append('path')\n .attr('transform', 'translate(' + btx + ',' + bty + ')rotate(270)')\n .style('fill', serie.color)\n .on('mousemove', function (d) {\n //set balloon content\n var balloonData = {\n value: base.value,\n percent: percentValue,\n max: serie.max,\n min: serie.min,\n trend: matchTrend\n };\n var balloonContent = formatValue(chart.balloon.format, balloonData);\n\n //set balloon border color\n balloon.style('borderColor', serie.color);\n\n //show balloon\n showBalloon(balloonContent);\n })\n .on('mouseout', function (d) {\n //hide bubble\n hideBalloon();\n });;\n\n //create value handle\n gaugeValueText = canvas.append('text')\n .style('fill', serie.handleFontColor)\n .style('text-anchor', 'middle')\n .style('font-family', serie.handleFontFamily)\n .style('font-style', serie.handleFontStyle == 'bold' ? 'normal' : serie.handleFontStyle)\n .style('font-weight', serie.handleFontStyle == 'bold' ? 'bold' : 'normal')\n .style('font-size', valueTextSize + 'px');\n\n //check whether the gauge has label\n if (serie.label.trim() != '') {\n //set label\n canvas.append('text').text(serie.label)\n .style('fill', serie.labelFontColor)\n .style('font-family', serie.labelFontFamily)\n .style('text-anchor', 'middle')\n .style('font-style', serie.labelFontStyle == 'bold' ? 'normal' : serie.labelFontStyle)\n .style('font-weight', serie.labelFontStyle == 'bold' ? 'bold' : 'normal')\n .attr('x', (plot.width + trendHeight) / 2)\n .attr('y', bty + valueTextSize / 2);\n }\n };\n\n //inits dial gauge\n function initDial() {\n //create top circle\n var topCircle = canvas.append('circle').attr('cx', btx).attr('cy', bty).attr('r', radius)\n .style('fill', serie.gaugeBackColor).style('stroke', serie.gaugeBorderColor).style('stroke-width', serie.gaugeBorderSize + 'px');\n\n //create inner circle\n var innerCircle = canvas.append('circle').attr('cx', btx).attr('cy', bty).attr('r', radius * 0.9)\n .style('fill', serie.innerBackColor).style('stroke', serie.innerBorderColor).style('stroke-width', serie.innerBorderSize + 'px');\n\n //set trends\n chart.trends.each(function (trend) {\n //Calculate trend angles\n var trendStartAngle = convertToRadians(trend.start);\n var trendEndAngle = convertToRadians(trend.end);\n var trendArc = d3.svg.arc().outerRadius(radius * 0.88).innerRadius(radius * 0.8).startAngle(trendStartAngle).endAngle(trendEndAngle);\n\n //Create trend circle\n var trendCircle = canvas.append('path')\n .attr('transform', 'translate(' + btx + ',' + bty + ')rotate(270)')\n .style('fill', trend.color)\n .attr('d', trendArc)\n .on('mousemove', function (d) {\n //set balloon content\n var balloonContent = trend.balloonFormat.replaceAll('{{title}}', trend.title).replaceAll('{{start}}', plot.formatNumber(trend.start))\n .replaceAll('{{end}}', plot.formatNumber(trend.end)).replaceAll('{{value}}', plot.formatNumber(base.value)).replaceAll('{{percent}}', percentValue);\n\n //set balloon border color\n balloon.style('borderColor', trend.color);\n\n //show balloon\n showBalloon(balloonContent);\n })\n .on('mouseout', function (d) {\n //hide bubble\n hideBalloon();\n });\n });\n\n //set major ticks\n for (var major = serie.min; major <= serie.max; major += majorDelta) {\n //set minor delta\n var minorDelta = majorDelta / serie.minorTicks;\n\n //set minor ticks\n for (var minor = major + minorDelta; minor <= Math.min(major + majorDelta, serie.max) ; minor += minorDelta) {\n //create minor point\n var minorPoint1 = convertToPoint(minor, 0.75);\n var minorPoint2 = convertToPoint(minor, 0.85);\n\n //append minor point\n canvas.append('line')\n .attr('x1', minorPoint1.x).attr('y1', minorPoint1.y)\n .attr('x2', minorPoint2.x).attr('y2', minorPoint2.y)\n .style('stroke', serie.minorTickColor)\n .style('stroke-width', serie.minorTickSize + 'px');\n }\n\n //create major points\n var majorPoint1 = convertToPoint(major, 0.7);\n var majorPoint2 = convertToPoint(major, 0.85);\n\n //append major point\n canvas.append('line')\n .attr('x1', majorPoint1.x).attr('y1', majorPoint1.y)\n .attr('x2', majorPoint2.x).attr('y2', majorPoint2.y)\n .style('stroke', serie.majorTickColor)\n .style('stroke-width', serie.majorTickSize + 'px');\n\n //create min and max handles\n if (major == serie.min || major == serie.max) {\n //create handle point\n var handlePoint = convertToPoint(major, 0.63);\n\n //create handle text\n canvas.append('text')\n .attr('x', handlePoint.x)\n .attr('y', function (d) { return handlePoint.y + handleTextSize; })\n .attr('dy', handleTextSize / 3)\n .text(plot.formatNumber(major))\n .attr('text-anchor', major == serie.max ? 'end' : 'start')\n .style('fill', serie.handleFontColor)\n .style('font-family', serie.handleFontFamily)\n .style('font-style', serie.handleFontStyle == 'bold' ? 'normal' : serie.handleFontStyle)\n .style('font-weight', serie.handleFontStyle == 'bold' ? 'bold' : 'normal');\n }\n }\n\n //declare needle variables\n var midVal = (serie.min + serie.max) / 2,\n needlePath = getNeedlePath(midVal),\n needleLine = d3.svg.line().x(function (d) { return d.x; }).y(function (d) { return d.y; }).interpolate('basis');\n\n //set gauge handle\n gaugeValueHandle = canvas.append('g').selectAll('path')\n .data([needlePath]).enter().append('svg:path')\n .attr('d', needleLine)\n .style('fill', serie.handleColor)\n .style('stroke', serie.handleBorderColor)\n .style('fill-opacity', 0.7)\n .style('stroke-opacity', 0.7)\n .on('mousemove', function (d) {\n //set balloon content\n var balloonData = {\n value: base.value,\n percent: percentValue,\n max: serie.max,\n min: serie.min,\n trend: matchTrend\n };\n var balloonContent = formatValue(chart.balloon.format, balloonData);\n\n //set balloon border color\n balloon.style('borderColor', serie.handleColor);\n\n //show balloon\n showBalloon(balloonContent);\n })\n .on('mouseout', function (d) {\n //hide bubble\n hideBalloon();\n });;\n\n //create needle circle\n canvas.append('circle')\n .attr('cx', btx).attr('cy', bty)\n .attr('r', serie.handleCircleSize > radius ? 10 : serie.handleCircleSize)\n .style('fill', serie.handleCircleColor)\n .style('stroke', serie.handleCircleBorderColor);\n\n //create value handle\n gaugeValueText = canvas.append('text')\n .style('fill', serie.handleFontColor)\n .style('text-anchor', 'middle')\n .style('font-family', serie.handleFontFamily)\n .style('font-style', serie.handleFontStyle == 'bold' ? 'normal' : serie.handleFontStyle)\n .style('font-weight', serie.handleFontStyle == 'bold' ? 'bold' : 'normal')\n .style('font-size', valueTextSize + 'px');\n\n //check whether the gauge has label\n if (serie.label.trim() != '') {\n //set label\n canvas.append('text').text(serie.label)\n .style('fill', serie.labelFontColor)\n .style('font-family', serie.labelFontFamily)\n .style('text-anchor', 'middle')\n .style('font-size', labelTextSize + 'px')\n .style('font-style', serie.labelFontStyle == 'bold' ? 'normal' : serie.labelFontStyle)\n .style('font-weight', serie.labelFontStyle == 'bold' ? 'bold' : 'normal')\n .attr('x', btx)\n .attr('y', bty + valueTextSize * 2 + labelTextSize * 2);\n }\n };\n\n //hides balloon\n function hideBalloon() {\n /// <summary>\n /// Hides balloon.\n /// </summary>\n balloon.style('display', 'none');\n };\n\n //shows balloon\n function showBalloon(content) {\n /// <summary>\n /// Shows balloon with given content.\n /// </summary>\n /// <param name=\"content\"></param>\n /// <param name=\"data\"></param>\n\n //check whether the arguments\n if (content == null) hideBalloon();\n\n //check whther the balloon enabled\n if (!chart.balloon.enabled) hideBalloon();\n\n //set balloon content\n balloon.html(content);\n\n //set balloon postion and show\n balloon.style('left', (parseInt(d3.event.pageX) + 5) + 'px');\n balloon.style('top', (parseInt(d3.event.pageY) + 5) + 'px');\n balloon.style('display', 'block');\n };\n\n //update\n this.update = function (value) {\n //check whether the value is null\n if (value == null) return null;\n\n //set this value\n this.value = value;\n\n //set percent value\n percentValue = getPercent(value);\n\n //Iterate all trends\n chart.trends.each(function (trend) {\n //check value is in trend range\n if (base.value >= trend.start && base.value <= trend.end)\n matchTrend = trend;\n });\n\n //switch behavior\n switch (serie.behavior) {\n case 'standard':\n {\n //animate inner circle to visualize value\n gaugeValueHandle.transition().ease('linear').duration(chart.animationDuration)\n .attrTween('d', function () {\n return standardGaugeTween(percentValue);\n });\n\n //set value\n gaugeValueText.text(plot.formatNumber(value))\n .attr('x', (plot.width + trendHeight) / 2)\n .attr('y', bty);\n }\n break;\n case 'dial':\n {\n //animate needle\n gaugeValueHandle.transition().duration(chart.animationDuration)\n .attrTween('transform', function () {\n //set needle value\n var needleValue = value;\n\n //check range\n if (base.value > serie.max)\n needleValue = serie.max + 0.02 * range;\n else if (base.value < serie.min)\n needleValue = serie.min - 0.02 * range;\n\n //set target position\n var target = (convertToDegrees(needleValue) - 90);\n var current = this._current || target;\n\n //set this current\n this._current = target;\n\n //return transition\n return function (step) {\n //Get pos\n var pos = current + (target - current) * step;\n\n //Return transformation\n return 'translate(' + btx + ',' + bty + ')rotate(' + pos + ')';\n };\n });\n\n //set value\n gaugeValueText.text(plot.formatNumber(value))\n .attr('x', function (d) { return btx; })\n .attr('y', function (d) { return bty + (radius * 0.12) + this.getBBox().height + valueTextSize / 2; });\n }\n break;\n }\n };\n\n //switch behavior\n switch (serie.behavior) {\n case 'standard':\n initStandard();\n break;\n case 'dial':\n initDial();\n break;\n }\n\n //update gauge\n this.update(serie.value);\n }", "function init() {\n\t// Settings to provide to element\n\tvar settings = {\n\t\tsize: 300,\n\t\tclipWidth: 300,\n\t\tclipHeight: 300,\n\t\tringWidth: 60,\n\t\tmaxValue: 100,\n\t\ttransitionMs: 1000,\n\t};\n\n\t// ID of div to add element to\n\tvar targetID = '#speed-gauge';\n\tvar speedGauge = gauge(targetID, settings);\n\tspeedGauge.render();\n\n\n\t// ID of div to add element to\n\tvar targetID2 = '#battery-gauge';\n\tvar batteryGauge = gauge(targetID2, settings);\n\tbatteryGauge.render();\n\n\n/*\nDont need this since the gauge just needs '.render' above\n*/\n// \t// Repeat every 16 ms\n// \tsetInterval(function(){\n// \t\texampleElement.draw(targetID);\n// \t}, 16);\n\n\t// Data to be sent to the element\n\tvar data = 0;\n\n\t// Picks random setpoint and increments data util setpoint is reached\n\tvar setPoint = 0;\n\tvar increment = 1;\n\tfunction simulatePedal() {\n\t\tif (Math.abs(setPoint - data) < increment) { // reset setpoint\n\t\t\tsetPoint = Math.round(Math.random() * 100); // int from 0 to 100\n\t\t\tincrement = 3 * (Math.random() + 0.5); \t\t\t// float between 0.5 and 3\n\t\t\tconsole.log(\"Value :\\t\" + data +\n\t\t\t\t\t\t\t\t\t\"\\tSet Point :\\t\" + setPoint +\n\t\t\t\t\t\t\t\t\t\"\\tIncrement :\\t\" + increment);\t\t// debug\n\t\t} else if (data < setPoint) {\n\t\t\tdata += increment;\n\t\t} else {\n\t\t\tdata += -1*increment;\n\t\t}\n\t\treturn data;\n\t}\n\n\t// Update every 50 ms\n\tvar speedData = 0;\n\tvar batteryData = 0;\n\tsetInterval(function(){\n\t\t// Different ways to generate data\n\t\tbatteryData = (batteryData + 0.5) % 100; // count from 1 to 100\n\t\tspeedData = simulatePedal(); // updates data\n\t\tspeedGauge.update(speedData);\n\t\tbatteryGauge.update(100 - batteryData);\n\t}, 50);\n}", "function gaugeUpdate(gauge, opts){\n\t$('.val-min .metric-small', $('#'+gauge)).html(opts.minVal);\n\t$('.val-max .metric-small', $('#'+gauge)).html(opts.maxVal);\n\tcf_rGs[gauge].maxValue = opts.maxVal;\n\tcf_rGs[gauge].minValue = opts.minVal;\n\tcf_rGs[gauge].set(opts.newVal);\n}", "static createWindSpeedGustsGauge() {\r\n var gauge = new RadialGauge(this.createWindSpeedOptions('windSpeedGustsCanvas'));\r\n LivewindStore.storeGauge('windSpeedGusts', gauge);\r\n gauge.draw();\r\n }", "function renderGaugeChart() {\n var exposedObj = {}, elem = ctx.canvas, opts, areas, calibration, calibrations, range, width=elem.width, height=elem.height, i, j, gaugeDiameter, gaugeRadius, gaugeCenter, xMargin, tickValue, minorTickValue, gaugeShift, gaugeValueRadians, getShiftedRadians, getTarget, drawGauge, animateIt, animatedMove, animatedMovePosition;\n range = parseAttr(elem, \"data-range\") || [];\n range[0] = range && !isNaN(range[0]) ? +range[0] : 0;\n range[1] = range && !isNaN(range[1]) ? +range[1] : 100;\n \n opts = parseOptsWithStrings(elem, \"data-opts\");\n\n // Here areas will represent the colured segments of gauge in a form [upperLimit fillStyle] e.g. \"[30 'rgba(150, 100, 100, 0.6)'] [70 'rgba(255, 0, 0, 1)']\"\n areas = elem.getAttribute(\"data-areas\") !== null ? parseSetsWithStrings(elem.getAttribute(\"data-areas\")) : null;\n calibrations = elem.getAttribute(\"data-calibrations\") !== null ? parseSetsWithStrings(elem.getAttribute(\"data-calibrations\")) : null;\n\n // Tick Marks/Steps\n opts.majorTicks = !isNaN(opts.majorTicks) ? +opts.majorTicks : 10;\n opts.majorTicksWidth = !isNaN(opts.majorTicksWidth) ? +opts.majorTicksWidth : 2\n opts.majorTicksStyle = opts.majorTicksStyle || 'rgba(0, 0, 0, 0.6)';\n opts.majorTicksLengthRatio = !isNaN(opts.majorTicksLengthRatio) ? +opts.majorTicksLengthRatio : 0.8;\n \n opts.minorTicks = opts.minorTicks && !isNaN(opts.minorTicks) ? +opts.minorTicks : false; // Optional\n opts.minorTicksWidth = !isNaN(opts.minorTicksWidth) ? +opts.minorTicksWidth : 1\n opts.minorTicksStyle = opts.minorTicksStyle || 'rgba(50, 50, 50, 0.8)';\n opts.minorTicksLengthRatio = !isNaN(opts.minorTicksLengthRatio) ? +opts.minorTicksLengthRatio : 0.82;\n \n opts.gaugeBackground = opts.gaugeBackground || 'rgba(90, 100, 120, 0.5)';\n opts.calibrationRadiusRatio = !isNaN(opts.calibrationRadiusRatio) ? +opts.calibrationRadiusRatio : 1;\n \n gaugeDiameter = !isNaN(opts.widthRatio) ? (+opts.widthRatio * width) : (!isNaN(opts.heightRatio) ? (+opts.heightRatio * height) : (width * 0.95));\n gaugeRadius = gaugeDiameter / 2;\n xMargin = (width - gaugeDiameter) / 2;\n gaugeCenter = {h: width / 2, k: height * 0.95};\n\n gaugeShift = Math.PI * 0.04; // Margins to leave from both ends of semi circle for plotting\n gaugeValueRadians = Math.PI - (gaugeShift * 2);\n tickValue = (gaugeValueRadians) / opts.majorTicks;\n minorTickValue = opts.minorTicks && ( tickValue / (opts.minorTicks + 1) ) || false;\n\n // Helper Functions\n getShiftedRadians = function(val){return ( val / range[1] * gaugeValueRadians ) + gaugeShift} // Converts to radians, shifts and returns\n getTarget = function(){if(!isNaN(opts.target)){return +opts.target > range[1] ? range[1] : (+opts.target >= range[0] ? +opts.target : range[0])}return range[0];}\n\n // Drawing method\n drawGauge = function(shiftedRadTarget) {\n ctx = elem.getContext(\"2d\");\n ctx.clearRect(0, 0, width, height); // clear canvas\n\n // Drawing gauge background arc\n drawFilledArc(ctx, gaugeCenter, ((width / 2)-xMargin), (width < 100 ? 5 : 10), Math.PI, Math.PI * 2, opts.gaugeBackground);\n\n // Drawing gauge colored arcs\n if(areas){\n var startAngel = Math.PI + gaugeShift, endAngle;\n for(i=0; i < areas.length; i++) {\n var set = areas[i],\n startPoint = getPointOnCircle(gaugeCenter, gaugeRadius, startAngel, 0.88);\n \n endAngle = Math.PI + getShiftedRadians(+set[0]);\n \n var endPoint = getPointOnCircle(gaugeCenter, gaugeRadius, endAngle, 0.88);\n\n // Drawing colored arcs/areas applying gradient if desired\n var areasRadius = !isNaN(opts.areasRadiusRatio) ? ( gaugeRadius * 0.88 * (1 - +opts.areasRadiusRatio) ) : gaugeRadius * 0.18;\n if(typeof opts.gradientAreas != 'undefined' && opts.gradientAreas != \"false\") {\n var grd = ctx.createLinearGradient(startPoint.x, startPoint.y, endPoint.x, endPoint.y);\n grd.addColorStop(0, set[1]);\n grd.addColorStop(0.2, set[1]);\n grd.addColorStop(1, areas[i-1] && areas[i-1][1] || opts.gaugeBackground);\n drawFilledArc(ctx, gaugeCenter, gaugeRadius * 0.88, areasRadius, startAngel, endAngle, grd);\n } else {\n drawFilledArc(ctx, gaugeCenter, gaugeRadius * 0.88, areasRadius, startAngel, endAngle, set[1]);\n }\n \n startAngel = endAngle;\n }\n }\n\n // Drawing major ticks\n // Formula: x=h+rcosθ, y=k+rsinθ for point (x, y) on circle having center (h, k) and radius r for angle θ\n for (i = 0; i < opts.majorTicks + 1; i++)\n {\n var majorStep = (i * tickValue) + gaugeShift;\n drawCalibration(ctx, gaugeCenter, gaugeRadius, majorStep, 0.88, opts.majorTicksLengthRatio, 'tick', opts.majorTicksStyle, opts.majorTicksWidth);\n\n // Drawing calibration\n if(typeof opts.calibrate != \"undefined\" && opts.calibrate != \"false\") {\n var calibrationValue = (calibrations && typeof calibrations[0][i] != \"undefined\") ? calibrations[0][i] : Math.round( i == opts.majorTicks ? range[1] : ( i == 0 ? range[0] : range[1] / opts.majorTicks * i ) );\n var font = opts.calibrationFont || '10px sans-serif';\n var style = opts.calibrationStyle || 'rgba(0, 0, 0, 0.9)';\n drawCalibration(ctx, gaugeCenter, gaugeRadius, majorStep, opts.calibrationRadiusRatio, opts.calibrationRadiusRatio-0.1, calibrationValue, style, null, font);\n }\n\n // Calculating and plotting minor ticks for current major tick\n if(minorTickValue && i < opts.majorTicks) {\n for(j=0; j < opts.minorTicks; j++) {\n majorStep += minorTickValue\n drawCalibration(ctx, gaugeCenter, gaugeRadius, majorStep, 0.88, opts.minorTicksLengthRatio, 'tick', opts.minorTicksStyle, opts.minorTicksWidth);\n }\n }\n }\n\n // Drawing Gauge Title\n if(typeof opts.title != \"undefined\" && opts.title) {\n ctx.textAlign = 'center';\n ctx.font = opts.titleFont || '10px sans-serif';\n ctx.fillStyle = opts.titleStyle || '#000';\n ctx.fillText(opts.title, gaugeCenter.h, gaugeCenter.k - gaugeRadius * 0.4, gaugeDiameter);\n }\n\n // Drawing and Targetting gauge needle\n ctx.save();\n ctx.translate(gaugeCenter.h, gaugeCenter.k);\n ctx.rotate(shiftedRadTarget - Math.PI/2);\n ctx.translate(-gaugeCenter.h, -gaugeCenter.k);\n\n var needleWidthRatio = !isNaN(opts.needleWidthRatio) ? +opts.needleWidthRatio : 1;\n ctx.fillStyle = opts.needleFillStyle || 'rgba(220, 60, 20, 0.6)';\n ctx.strokeStyle = opts.needleStrokeStyle || 'rgba(200, 50, 20, 0.8)';\n ctx.beginPath();\n ctx.moveTo(gaugeCenter.h, gaugeCenter.k - gaugeRadius * 0.88 );\n ctx.bezierCurveTo(gaugeCenter.h + gaugeRadius * 0.04 * needleWidthRatio, gaugeCenter.k - gaugeRadius * 0.4, gaugeCenter.h + gaugeRadius * 0.03 * needleWidthRatio, gaugeCenter.k - gaugeRadius * 0.2, gaugeCenter.h + gaugeRadius * 0.02 * needleWidthRatio, gaugeCenter.k);\n ctx.lineTo(gaugeCenter.h - gaugeRadius * 0.02 * needleWidthRatio, gaugeCenter.k);\n ctx.bezierCurveTo(gaugeCenter.h - gaugeRadius * 0.03 * needleWidthRatio, gaugeCenter.k - gaugeRadius * 0.2, gaugeCenter.h - gaugeRadius * 0.04 * needleWidthRatio, gaugeCenter.k - gaugeRadius * 0.4, gaugeCenter.h, gaugeCenter.k - gaugeRadius * 0.88);\n ctx.fill();\n ctx.stroke();\n\n ctx.restore();\n\n // Drawing needle base\n ctx.fillStyle = opts.needleBaseFillStyle || 'rgba(200, 150, 40, 0.9)';\n ctx.strokeStyle = opts.needleBaseStrokeStyle || 'rgba(220, 160, 30, 0.5)';\n ctx.beginPath();\n var needleBaseRadius = needleWidthRatio > 0.7 ? gaugeRadius * 0.12 * needleWidthRatio : gaugeRadius * 0.12;\n ctx.arc(gaugeCenter.h, gaugeCenter.k, needleBaseRadius , Math.PI * 0.95, Math.PI * 0.05);\n ctx.fill();\n ctx.stroke();\n } // End - drawGauge\n \n animateIt = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.msRequestAnimationFrame || function (callback) { win.setTimeout(callback, 1000 / 60); };\n animatedMove = function() {\n var delta = opts.target - animatedMovePosition;\n animatedMovePosition += delta/10;\n if(animatedMovePosition != getTarget() && Math.abs(delta / range[1]) > 0.05) {\n drawGauge(getShiftedRadians(animatedMovePosition));\n animateIt(animatedMove);\n } else {\n drawGauge(getShiftedRadians(opts.target));\n }\n }\n\n // Exposed methods\n exposedObj.setTarget = function(val, doAnimate) {\n animatedMovePosition = getTarget();\n opts.target = !isNaN(+val) ? +val : getTarget();\n \n if(typeof doAnimate == \"undefined\" || doAnimate) {\n animateIt(animatedMove);\n } else {\n drawGauge(getShiftedRadians(opts.target));\n }\n }\n\n exposedObj.getTarget = getTarget;\n\n exposedObj.setTitle = function(title) { opts.title = title; drawGauge(getShiftedRadians(opts.target)); }\n \n exposedObj.redraw = function() { drawGauge(getShiftedRadians(opts.target)); }\n\n // Exposing object window object scope\n if(typeof opts.objectName != \"undefined\") {\n eval('win.' + opts.objectName + '=exposedObj;');\n }\n\n // First Time Drawing\n drawGauge(getShiftedRadians(getTarget()));\n }", "function test_candu_graphs_datastore_vsphere6() {}", "function gaugeSetup(lat,lng){\r\n\r\n var data2=\"\"\r\n for (i = 0; i < saved_data.Lon.length; i++) { \r\n if (lat == saved_data.Lat[i] && lng == saved_data.Lon[i]){\r\n data2 = saved_data.Hours[i]\r\n console.log(lat+\" \"+saved_data.Lat[i])\r\n break;\r\n }\r\n \r\n }\r\n convenience = 0\r\n\r\n //console.log(data2) // This works!\r\n\r\n if (data2 == \"24 hours daily\" \r\n || data2 == \"Open 24 Hours\" \r\n ){convenience = 5}\r\n else if (data2 == \"Open 24/7 is a pay lot\"\r\n || data2 == \"Open 24 Hours-Guests Only\"\r\n ){convenience = 4}\r\n else if (data2 == \"5AM-2AM M-Sat, 8AM-2AM Sun\"\r\n || data2 == \"Daily: 6AM-Midnight\"\r\n || data2 == \"Daily: 6Am-3AM\"\r\n ){convenience = 3}\r\n else if (data2 == \"5AM-2AM M-Sat, 8AM-2AM Sun\"\r\n || data2 == \"6 AM-11:45 PM 7 days a week\"\r\n || data2 == \"8 AM-7 PM M-Thur, 8 AM-5 PM F-Sun\"\r\n || data2 == \"9 AM-5 PM M-Sat\"\r\n || data2 == \"9 AM-5 PM M-Th, 9 AM-2 PM F-Sat\"\r\n || data2 == \"9:30 AM-5:30 PM M-Sat, 11AM-5PM Sun\"\r\n || data2 == \"9:30 AM-5:30 PM M-Sat, 11AM-5PM Sun\"\r\n ){convenience = 2}\r\n else {\r\n convenience = 1\r\n }\r\n\r\n console.log(`convenience number is ${convenience}`);\r\n\r\n return convenience\r\n }", "static clock_gears_perf() {\n const testName = 'clock_gears_perf';\n const expected = TestRig.perfExpected(testName);\n const startTime = Util.systemTime();\n const repeats = 10;\n for (let i=0; i<repeats; i++) {\n MiscellanyTest.clock_with_gears();\n }\n const duration = (Util.systemTime() - startTime)/repeats;\n setTestName(MiscellanyTest.groupName+testName);\n const s = TestRig.perfResult(duration, expected);\n const timeLimit = TestRig.getPerfLimit(expected);\n TestRig.reportTestResults(duration <= timeLimit, 'performance', s);\n}", "function drawMeter(gauge) {\n gauge.Set(\"chart.value.text.units.post\", \" %\")\n .Set(\"chart.value.text.boxed\", false)\n .Set(\"chart.value.text.size\", 14)\n .Set(\"chart.value.text.font\", \"Verdana\")\n .Set(\"chart.value.text.bold\", true)\n .Set(\"chart.value.text.decimals\", 2)\n .Set(\"chart.shadow.offsetx\", 5)\n .Set(\"chart.shadow.offsety\", 5)\n .Set(\"chart.scale.decimals\", 2)\n .Set(\"chart.title\", \"Credit Limit\")\n .Set(\"chart.radius\", 250)\n .Set(\"chart.centerx\", 50)\n .Set(\"chart.centery\", 250)\n .Draw();\n}", "function buildGauge(sample){\n // Enter weekly scrubs between 0-9\n // if sample is zero or one it goes to category 0-1\n // then, each category level shown by an arrow is calculated based on (sample-1)*20 +10\n // it covers all sample scrub range, e.g. sample #1279 with scrub freq of 9 /week is also shown correctly\n sample=(sample)? sample:1;\n var level = (sample-1)*20+10;\n\n // Trig to calc meter point\n var degrees = 180 - level, radius = .5;\n var radians = degrees * Math.PI / 180;\n var x = radius * Math.cos(radians);\n var y = radius * Math.sin(radians);\n var scrubrange=['8-9','7-8','6-7','5-6','4-5','3-4','2-3','1-2','0-1'];\n // Path: may have to change to create a better triangle\n var mainPath = 'M -.0 -0.025 L .0 .025 L ',\n pathX = String(x), space = ' ', pathY = String(y), pathEnd = ' Z';\n var path = mainPath.concat(pathX,space,pathY,pathEnd);\n const arcSize=50/9; //size of each arc\n var data = [{ type: 'scatter',\n x: [0], y:[0],\n marker: {size: 28, color:'850000'},\n showlegend: false,\n name: 'scrub/week',\n text: sample,\n hoverinfo: 'text+name'},\n { values: [arcSize, arcSize, arcSize, arcSize, arcSize, arcSize, arcSize, arcSize, arcSize, 50],\n rotation: 90,\n text:scrubrange,\n textinfo: 'text',\n textposition:'inside',\n marker: {colors:['rgba(127,179,130,1)','rgba(130,188,137,1)','rgba(132,191,123,1)','rgba(182,205,135,1)',\n 'rgba(211,229,143,1)','rgba(228,232,171,1)','rgba(232,231,200,1)','rgba(243,239,227,1)','rgba(247,243,234,1)','rgba(255, 255, 255, 0)']},\n labels: scrubrange,\n hoverinfo: 'label',\n hole: .5,\n type: 'pie',\n showlegend: false\n }];\n\n var layout = {\n shapes:[{\n type: 'path',\n path: path,\n fillcolor: '850000',\n line: {\n color: '850000'\n }\n }],\n title: '<b>Belly Button Washing Frequency</b> <br> Scrubs per Week',\n height: 500,\n width: 500,\n xaxis: {zeroline:false, showticklabels:false,\n showgrid: false, range: [-1, 1]},\n yaxis: {zeroline:false, showticklabels:false,\n showgrid: false, range: [-1, 1]}\n };\n\n Plotly.newPlot('gauge', data, layout);\n}", "static createAirTemperatureGauge() {\r\n var gauge = new LinearGauge(this.createTemperatureGaugeOpts('airTemperatureCanvas'));\r\n LivewindStore.storeGauge('airTemperature', gauge);\r\n gauge.draw();\r\n }", "function Gauge(myContainer, name, configuration) {\n this.name = name;\n this.myContainer = myContainer;\n\n var self = this; // some internal d3 functions do not \"like\" the \"this\" keyword, hence setting a local variable\n\n this.configure = function (configuration) {\n this.config = configuration;\n\n this.config.size = this.config.size * 0.9;\n\n this.config.raduis = this.config.size * 0.97 / 2;\n this.config.cx = this.config.cx;// + this.config.size / 4;\n this.config.cy = this.config.cy;// + this.config.size / 2;\n\n this.config.min = configuration.min || 0;\n this.config.max = configuration.max || 100;\n this.config.range = this.config.max - this.config.min;\n\n this.config.majorTicks = configuration.majorTicks || 5;\n this.config.minorTicks = configuration.minorTicks || 2;\n\n this.config.greenColor = configuration.greenColor || greenColor;\n this.config.orangeColor = configuration.orangeColor || orangeColor;\n this.config.defaultColor = configuration.defaultColor || defaultColor;\n this.config.yellowColor = configuration.yellowColor || yellowColor;\n this.config.redColor = configuration.redColor || redColor;\n };\n \n this.render = function (gauge_1, gauge_2, gauge_3) {\n this.body = this.myContainer//dashContainer//d3.select(\"#\" + this.placeholderName)\n .append(\"svg:svg\")\n .attr(\"class\", \"gauge\")\n .attr(\"x\", this.myContainer.x)//this.config.cx-this.config.size/4)\n .attr(\"y\", this.myContainer.y)//this.config.cy-this.config.size/4)\n .attr(\"width\", this.myContainer.width)//this.config.size)\n .attr(\"height\", this.myContainer.height)//this.config.size);\n\n var bandsContainer = this.body.append(\"svg:g\").attr(\"class\", \"bandsContainer\"); // for day/night changes\n \n this.redrawDimmableFace(xDim);//0);\n \n var pointerContainer = this.body.append(\"svg:g\").attr(\"class\", \"pointerContainer\");\n\n var arr = [];\n for(var i=0; i<arguments[count].length; i++){\n var json = {\n \"color\": \"\",\n \"value\": \"\",\n \"lineHeight\": \"\"\n }\n\n json.value = arguments[count][i];\n\n if(i == 0){\n json.color = \"#000\";\n json.lineHeight = 1.00;\n }else if(i == 1){\n json.color = \"#409dad\";\n json.lineHeight = 0.85;\n }else if(i == 2){\n json.color = \"#96c5f1\";\n json.lineHeight = 0.75;\n } \n\n arr.push(json);\n }\n\n if(!arguments[5]){ arr.splice(2, 1); }\n\n if(!arguments[6]){ arr.splice(1, 1);; }\n\n arguments[0] = arr;\n\n this.drawPointer(arguments[count]);\n // count++;\n };\n\n this.drawBands = function(bandsContainer) { \n for (var index in this.config.defaultZones) {\n this.drawBand(bandsContainer,this.config.defaultZones[index].from, this.config.defaultZones[index].to, self.config.defaultColor);\n }\n \n for (var index in this.config.greenZones) {\n this.drawBand(bandsContainer,this.config.greenZones[index].from, this.config.greenZones[index].to, self.config.greenColor);\n }\n\n for (var index in this.config.yellowZones) {\n this.drawBand(bandsContainer,this.config.yellowZones[index].from, this.config.yellowZones[index].to, self.config.yellowColor);\n }\n\n for (var index in this.config.orangeZones) {\n this.drawBand(bandsContainer,this.config.orangeZones[index].from, this.config.orangeZones[index].to, self.config.orangeColor);\n }\n\n for (var index in this.config.redZones) {\n this.drawBand(bandsContainer,this.config.redZones[index].from, this.config.redZones[index].to, self.config.redColor);\n }\n };\n\n this.redrawDimmableFace = function (value) {\n this.drawFace(value < 0.5 ? self.config.defaultColor : self.config.defaultColor, // facecolor\n value < 0.5 ? self.config.defaultColor : defaultColor);\n }\n\n this.drawTicks = function (ticksContainer,color) {\n\n var fontSize = Math.round(this.config.size / 16);\n var majorDelta = this.config.range / (this.config.majorTicks - 1);\n for (var major = this.config.min; major <= this.config.max; major += majorDelta) {\n var minorDelta = majorDelta / this.config.minorTicks;\n for (var minor = major + minorDelta; minor < Math.min(major + majorDelta, this.config.max); minor += minorDelta) {\n var minorpoint1 = this.valueToPoint(minor, 0.75);\n var minorpoint2 = this.valueToPoint(minor, 0.85);\n\n ticksContainer.append(\"svg:line\")\n .attr(\"x1\", minorpoint1.x)\n .attr(\"y1\", minorpoint1.y)\n .attr(\"x2\", minorpoint2.x)\n .attr(\"y2\", minorpoint2.y)\n .style(\"stroke\", color)\n .style(\"stroke-width\", \"1px\");\n }\n\n var majorpoint1 = this.valueToPoint(major, 0.7);\n var majorpoint2 = this.valueToPoint(major, 0.85);\n\n ticksContainer.append(\"svg:line\")\n .attr(\"x1\", majorpoint1.x)\n .attr(\"y1\", majorpoint1.y)\n .attr(\"x2\", majorpoint2.x)\n .attr(\"y2\", majorpoint2.y)\n .style(\"stroke\", color)\n .style(\"stroke-width\", \"2px\");\n\n if (major == this.config.min || major == this.config.max) {\n var point = this.valueToPoint(major, 0.63);\n\n ticksContainer.append(\"svg:text\")\n .attr(\"x\", point.x)\n .attr(\"y\", point.y)\n .attr(\"dy\", fontSize / 3)\n .attr(\"text-anchor\", major == this.config.min ? \"start\" : \"end\")\n .text(major)\n .style(\"font-size\", fontSize + \"px\")\n .style(\"fill\", color)\n .style(\"stroke-width\", \"0px\");\n }\n }\n };\n\n this.redraw = function (value) {\n //this.drawPointer(value);\n };\n\n this.dimDisplay = function (value) {\n this.redrawDimmableFace(value);\n };\n\n this.drawBand = function (bandsContainer, start, end, color) {\n if (0 >= end - start) return;\n\n bandsContainer.append(\"svg:path\")\n .style(\"fill\", color)\n .attr(\"d\", d3.svg.arc()\n .startAngle(this.valueToRadians(start))\n .endAngle(this.valueToRadians(end))\n .innerRadius(0.60 * this.config.raduis)\n .outerRadius(0.85 * this.config.raduis))\n .attr(\"transform\", function () {\n return \"translate(\" + self.config.cx + \", \" + self.config.cy + \") rotate(270)\";\n });\n };\n\n this.drawFace = function (colorFace,colorTicks) {\n var arc0 = d3.svg.arc()\n .startAngle(0) //this.valueToRadians(0))\n .endAngle(2 * Math.PI)\n .innerRadius(0.00 * this.config.raduis)\n .outerRadius(0.9 * this.config.raduis);\n\n var faceContainer = this.body.selectAll(\".faceContainer\");\n var bandsContainer = this.body.selectAll(\".bandsContainer\");\n var ticksContainer = this.body.selectAll(\".ticksContainer\");\n var pointerContainer = this.body.selectAll(\".pointerContainer\");\n var face = faceContainer.selectAll(\"path\");\n if (face == 0)\n {\n faceContainer\n .append(\"svg:path\")\n .attr(\"d\", arc0) //d3.svg.arc()\n .style(\"fill\", colorFace)\n .style(\"fill-opacity\", 0.7)\n .attr(\"transform\",\n \"translate(\" + self.config.cx + \", \" + self.config.cy + \")\");\n\n this.drawBands(bandsContainer);\n this.drawTicks(ticksContainer,colorTicks);\n var fontSize = Math.round(this.config.size / 9);\n faceContainer.append(\"svg:text\")\n .attr(\"x\", this.config.cx)\n .attr(\"y\", this.config.cy - this.config.size/6 - fontSize / 2 )\n .attr(\"dy\", fontSize / 2)\n .attr(\"text-anchor\", \"middle\")\n .text(this.config.label)\n .style(\"font-size\", fontSize + \"px\")\n .style(\"fill\", colorTicks)\n .style(\"stroke-width\", \"0px\");\n }\n else\n {\n face.style(\"fill\", colorFace);\n var facetxt = faceContainer.selectAll(\"text\");\n facetxt.style(\"fill\", colorTicks);\n var ptrtxt = pointerContainer.selectAll(\"text\");\n ptrtxt.style(\"fill\", colorTicks);\n var ticks = ticksContainer.selectAll(\"line\");\n ticks.style(\"stroke\", colorTicks);\n var texts = ticksContainer.selectAll(\"text\");\n texts.style(\"fill\", colorTicks);\n \n }\n };\n\n this.drawPointer = function (valArr) {\n\n var head = [];\n var head1 = [];\n var head2 = [];\n var tail = [];\n var tail1 = [];\n var tail2 = [];\n var data = {}; \n var delta = this.config.range / 13;\n\n for(var k =0;k<valArr.length;k++){\n var value = valArr[k].value;\n\n head.push(this.valueToPoint(value, valArr[k].lineHeight));\n head1.push(this.valueToPoint(value - delta, 0.35));\n head2.push(this.valueToPoint(value + delta, 0.35));\n\n var tailValue = value - (this.config.range * (1 / (270 / 360)) / 2);\n tail.push(this.valueToPoint(tailValue, 0.38));\n tail1.push(this.valueToPoint(tailValue - delta, 0.35));\n tail2.push(this.valueToPoint(tailValue + delta, 0.35));\n data[k] = [head[k], head1[k], tail2[k], tail[k], tail1[k], head2[k], head[k]];\n \n var line = d3.svg.line()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n })\n .interpolate(\"basis\");\n\n var pointerContainer = this.body.select(\".pointerContainer\");\n\n var pointer = pointerContainer.selectAll(\"path[k]\").data([data[k]]);\n pointer.enter().append(\"svg:path\").attr(\"d\", line).style(\"fill\", valArr[k].color).style(\"fill-opacity\", 1);\n\n pointer.transition()\n .attr(\"d\", line)\n //.ease(\"linear\")\n .duration(i>=0 ? 50 : 500);\n }\n };\n\n this.valueToDegrees = function (value) {\n return value / this.config.range * 270 - 45;\n };\n\n this.valueToRadians = function (value) {\n return this.valueToDegrees(value) * Math.PI / 180;\n };\n\n this.valueToPoint = function (value, factor) {\n value = parseFloat(value);\n var len = this.config.raduis * factor;\n var inRadians = this.valueToRadians(value);\n var point = {\n x: this.config.cx - len * Math.cos(inRadians),\n y: this.config.cy - len * Math.sin(inRadians)\n };\n\n return point;\n };\n\n // initialization\n this.configure(configuration);\n}", "function drawGuage() {\n\n // Create the data table.\n var net_data = google.visualization.arrayToDataTable([\n ['Label', 'Value'],\n ['Memory', 80],\n ['CPU', 55],\n ['Network', 68]\n ]);\n\n var earn_data = google.visualization.arrayToDataTable([\n ['Label', 'Value'],\n ['Gross', 80],\n ['Tax', 25],\n ['Net', 55]\n ]);\n\n\n // Set chart options\n var options_network_guage = {\n fontSize: 12,\n redFrom: 90,\n redTo: 100,\n yellowFrom:75,\n yellowTo: 90,\n minorTicks: 5,\n chartArea: {\n left: '5%',\n width: '90%',\n height: 350\n }\n };\n\n var options_earning_guage = {\n fontSize: 12,\n redFrom: 90,\n redTo: 100,\n yellowFrom:75,\n yellowTo: 90,\n minorTicks: 5,\n chartArea: {\n left: '5%',\n width: '90%',\n height: 350\n }\n };\n\n // Instantiate and draw our chart, passing in some options.\n var net_guage = new google.visualization.Gauge(document.getElementById('guage-network-chart'));\n net_guage.draw(net_data, options_network_guage);\n\n var earn_guage = new google.visualization.Gauge(document.getElementById('guage-earning-chart'));\n earn_guage.draw(earn_data, options_earning_guage);\n\n\n\n setInterval(function() {\n net_data.setValue(0, 1, 40 + Math.round(60 * Math.random()));\n net_guage.draw(net_data, options_network_guage);\n\n earn_data.setValue(0, 1, 40 + Math.round(60 * Math.random()));\n earn_guage.draw(earn_data, options_earning_guage);\n }, 13000);\n setInterval(function() {\n net_data.setValue(1, 1, 40 + Math.round(60 * Math.random()));\n net_guage.draw(net_data, options_network_guage);\n\n earn_data.setValue(1, 1, 40 + Math.round(60 * Math.random()));\n earn_guage.draw(earn_data, options_earning_guage);\n }, 5000);\n setInterval(function() {\n net_data.setValue(2, 1, 60 + Math.round(20 * Math.random()));\n net_guage.draw(net_data, options_network_guage);\n\n earn_data.setValue(2, 1, 60 + Math.round(20 * Math.random()));\n earn_guage.draw(earn_data, options_earning_guage);\n }, 26000);\n\n}", "function GetTestability(){}", "function levelAMeter(context, percent) {\n var gauge = new RGraph.CornerGauge(\"AdviceCanvas\", 0, 1, percent)\n .Set(\"chart.colors.ranges\", [[0.3, 1, \"red\"], [0.1, 0.3, \"yellow\"],\n [0, 0.1, \"green\"]]);\n drawMeter(gauge);\n}", "function TestGraphical(name) {\n goog.base(this, name || \"TestGraphical\");\n}", "function create_gene(prop) {\n let candle_values = [5, 10, 15, 240];\n let properites = {\n //here add the indicators and the ranges you want to handle\t\n //in this case my strategy wants to test RSI ranges\t\n demashort: randomExt.integer(30, 10),\n demalong: randomExt.integer(60, 20),\n treshold: randomExt.float(0.01, 1),\n \"candleSize\": candle_values[randomExt.integer(3, 0)],\n };\n //\tconsole.log(properites);\n if (prop === 'all')\n return properites;\n else {\n return properites[prop];\n }\n\n}", "function gaugeUpdate(gauge, opts){\n\tif(opts.minVal){\n\t\t$('.val-min .metric-small', $('#'+gauge)).html(opts.minVal);\t\t\n\t\tcf_rGs[gauge].minValue = opts.minVal;\n\t}\n\tif(opts.maxVal){\n\t\tcf_rGs[gauge].maxValue = opts.maxVal;\n\t\t$('.val-max .metric-small', $('#'+gauge)).html(opts.maxVal);\n\t}\n\tif(opts.newVal){\n\t\tcf_rGs[gauge].set(parseInt(opts.newVal));\n\t}\n}", "constructor(type) {\n\n // Properties\n this.name = \"No_Name\";\n this.id = -1;\n\n if((type.localeCompare(\"test\") === 0) || (type.localeCompare(\"requirement\") === 0)) {\n this.type = type;\n }else{\n throw \"unknown type of GraphNode\";\n }\n\n //Metrics\n this.areaMetric = -1;\n this.heightMetric = -1;\n this.colorMetric = -1;\n\n }", "function GetTestability() { }", "function GetTestability() { }", "function getDataGauge(sample_id) {\n var url_gauge = \"/wfreq/\" + sample_id;\n\n Plotly.d3.json(url_gauge, function (error, dataGaugue) {\n\n gaugeChart(dataGaugue);\n });\n}", "batteryGaugePoll() {\n if (this._batteryTimer) {\n return;\n }\n\n this._batteryTimer = setTimeout(async () => {\n await this.getBatteryLevel();\n this.batteryGaugePoll();\n }, BATTERY_POLL_TIMEOUT_MS);\n }", "thresholdMet() {}", "thresholdMet() {}", "function GaugeCharts(props) {\n const options = {\n title: {\n show: true,\n text: '',\n x: 'center',\n y: '8%',\n textStyle: {\n color: '#fff',\n fontWeight: 'normal',\n fontSize: 18,\n align: 'center'\n },\n },\n tooltip: {\n formatter: \"{a} <br/>{b} : {c}%\"\n },\n series: [{\n type: props.type,\n // center: ['50%', '25%'], // 默认全局居中\n radius: '55%',\n axisLine: {\n show: false,\n lineStyle: { // 属性lineStyle控制线条样式\n color: [\n [0.8, '#0193cf'],\n [1, 'rgba(1, 147, 207, 0.3)']\n ],\n width: 18\n }\n },\n splitLine: {\n show: false\n },\n axisTick: {\n show: false\n },\n axisLabel: {\n show: false\n },\n pointer: {\n show: false,\n length: '0',\n width: '0'\n },\n detail: {\n formatter: '{value}%',\n offsetCenter: [0, '5%']\n },\n data: [{\n value: 80,\n name: '',\n }],\n }]\n };\n\n options.title.text = props.options.name;\n options.series[0].data[0].name = props.options.total;\n options.series[0].data[0].value = props.options.finished != null ? props.options.finished : 0;\n\n const onChartReady = function(chart) {\n chart.hideLoading();\n }\n return (\n <ReactEcharts\n onChartReady={onChartReady}\n option={options} />\n );\n}", "function SimpleGauge(config) {\n _classCallCheck(this, SimpleGauge);\n\n if (!config.el) {\n throw new Error('The element must be valid.')\n }\n\n if (isNaN(config.height) || config.height <= 0) {\n throw new RangeError('The height must be a positive number.')\n }\n\n if (isNaN(config.sectionsCount) || config.sectionsCount <= 0) {\n throw new RangeError('The sections count must be a positive number.')\n }\n\n if (isNaN(config.width) || config.width <= 0) {\n throw new RangeError('The width must be a positive number.')\n }\n\n if (\n config.animationDelay !== undefined &&\n (isNaN(config.animationDelay) || config.animationDelay < 0)\n ) {\n throw new RangeError(\n 'The transition delay must be greater or equal to 0.'\n )\n }\n\n if (\n config.animationDuration !== undefined &&\n (isNaN(config.animationDuration) || config.animationDuration < 0)\n ) {\n throw new RangeError(\n 'The transition duration must be greater or equal to 0.'\n )\n }\n\n if (\n config.barWidth !== undefined &&\n (isNaN(config.barWidth) || config.barWidth <= 0)\n ) {\n throw new RangeError('The bar width must be a positive number.')\n }\n\n if (\n config.chartInset !== undefined &&\n (isNaN(config.chartInset) || config.chartInset < 0)\n ) {\n throw new RangeError('The chart inset must be greater or equal to 0.')\n }\n\n if (\n config.needleRadius !== undefined &&\n (isNaN(config.needleRadius) || config.needleRadius < 0)\n ) {\n throw new RangeError(\n 'The needle radius must be greater or equal to 0.'\n )\n }\n\n if (\n config.sectionsColors !== undefined &&\n config.sectionsColors.length !== config.sectionsCount\n ) {\n throw new RangeError(\n 'The sectionsColors length must match with the sectionsCount.'\n )\n }\n\n this._animationDelay =\n config.animationDelay !== undefined\n ? config.animationDelay\n : CONSTANTS.NEEDLE_ANIMATION_DELAY;\n this._animationDuration =\n config.animationDuration !== undefined\n ? config.animationDuration\n : CONSTANTS.NEEDLE_ANIMATION_DURATION;\n this._chartInset =\n config.chartInset !== undefined\n ? config.chartInset\n : CONSTANTS.CHAR_INSET;\n this._barWidth = config.barWidth || CONSTANTS.BAR_WIDTH;\n this._easeType = config.easeType || CONSTANTS.EASE_TYPE;\n this._el = config.el;\n this._height = config.height;\n this._needleRadius =\n config.needleRadius !== undefined\n ? config.needleRadius\n : CONSTANTS.NEEDLE_RADIUS;\n this._sectionsCount = config.sectionsCount;\n this._width = config.width;\n this._sectionsColors = config.sectionsColors;\n this._needleColor = config.needleColor;\n this.interval = config.interval || [0, 1];\n this.percent = config.percent !== undefined ? config.percent : 0;\n\n this._initialize();\n }", "function updateGauges() {\n if (i >= 0) {\t// initially use a faster interval and sweep the gauge\n {\n for (var key in gauges) {\n gauges[key].redraw(i);\n }\n if (i === 0) {\n clearInterval(interv0);\n interv0 = setInterval(updateGauges, 75);\n }\n i = i + 5;\n if (i > 100) {\n i = -1;\n clearInterval(interv0);\n interv0 = setInterval(updateGauges, 1000);\t// restore a normal interval\n }\n }\n } else {\n\t // pass a data array to dashboard.js's UpdateDashboard(values for named gauges)\n for (var key in gauges) {\n /*\n\t\t readings[key] = readings[key] + 10*Math.random()-5;\n\t\t if (readings[key]<0)\n\t\t\t readings[key] = 0;\n\t\t if (readings[key]>100)\n\t\t\t readings[key] = 100;\n\t\t\t */\n console.log(key);\n console.log(readings[key]);\n gauges[key].redraw(readings[key]);\n }\n }\n }", "drawGauge() {\n this.drawMarker(this.startMark);\n this.drawMarker(this.quarterMark);\n this.drawMarker(this.halfMark);\n this.drawMarker(this.threeQuarterMark);\n this.drawMarker(this.finishMark);\n this.drawNeedle(this.props.value);\n for (let i in this.pipLocations) {\n this.drawPip(this.pipLocations[i]);\n }\n }", "function Gauge(myContainer, name, configuration) {\n this.name = name;\n\tthis.myContainer = myContainer;\n\n var self = this; // some internal d3 functions do not \"like\" the \"this\" keyword, hence setting a local variable\n\n this.configure = function (configuration) {\n this.config = configuration;\n\n this.config.size = this.config.size * 0.9;\n\n this.config.raduis = this.config.size * 0.97 / 2;\n this.config.cx = this.config.cx;// + this.config.size / 4;\n this.config.cy = this.config.cy;// + this.config.size / 2;\n\n this.config.min = configuration.min || 0;\n this.config.max = configuration.max || 100;\n this.config.range = this.config.max - this.config.min;\n\n this.config.majorTicks = configuration.majorTicks || 5;\n this.config.minorTicks = configuration.minorTicks || 2;\n\n this.config.bezelColor = configuration.bezelColor || lightColor;\n this.config.bezelDimColor = configuration.bezelDimColor || greyColor;\n //this.config.dashColor = configuration.dashColor || blueColor; move to Dash\n //this.config.dimDashColor = configuration.dimDashColor || dimBlueColor; move to Dash\n this.config.greenColor = configuration.greenColor || greenColor;\n this.config.yellowColor = configuration.yellowColor || yellowColor;\n this.config.redColor = configuration.redColor || redColor;\n this.config.faceColor = configuration.faceColor || lightColor;\n this.config.dimFaceColor = configuration.dimFaceColor || darkGreyColor;\n this.config.lightColor = configuration.lightColor || \"#EEEEEE\";\n\t this.config.greyColor = configuration.greyColor || \"101010\";\n\t this.config.lightBlueColor = configuration.lightBlueColor || \"6085A0\";\n };\n \n this.render = function () {\n this.body = this.myContainer//dashContainer//d3.select(\"#\" + this.placeholderName)\n .append(\"svg:svg\")\n .attr(\"class\", \"gauge\")\n .attr(\"x\", this.myContainer.x)//this.config.cx-this.config.size/4)\n .attr(\"y\", this.myContainer.y)//this.config.cy-this.config.size/4)\n .attr(\"width\", this.myContainer.width)//this.config.size)\n .attr(\"height\", this.myContainer.height)//this.config.size);\n \n this.body.append(\"svg:circle\")\t// outer shell\n .attr(\"cx\", this.config.cx)\n .attr(\"cy\", this.config.cy)\n .attr(\"r\", this.config.raduis)\n .style(\"fill\", \"#ccc\")\n .style(\"stroke\", blackColor )\n .style(\"stroke-width\", \"0.5px\");\n\n this.body.append(\"svg:circle\")\t// bezel\n .attr(\"cx\", this.config.cx)\n .attr(\"cy\", this.config.cy)\n .attr(\"r\", 0.9 * this.config.raduis)\n .style(\"fill\", (xDim < 0.5 ? this.config.bezelColor : this.config.bezelDimColor))\n .style(\"stroke\", \"#e0e0e0\")\n .style(\"stroke-width\", \"2px\");\n\n var faceContainer = this.body.append(\"svg:g\").attr(\"class\", \"faceContainer\");\t// for day/night changes\n var bandsContainer = this.body.append(\"svg:g\").attr(\"class\", \"bandsContainer\");\t// for day/night changes\n var ticksContainer = this.body.append(\"svg:g\").attr(\"class\", \"ticksContainer\");\t// for day/night changes\n this.redrawDimmableFace(xDim);//0);\n\n var pointerContainer = this.body.append(\"svg:g\").attr(\"class\", \"pointerContainer\");\n this.drawPointer(0);\n pointerContainer.append(\"svg:circle\")\n .attr(\"cx\", this.config.cx)\n .attr(\"cy\", this.config.cy)\n .attr(\"r\", 0.12 * this.config.raduis)\n .style(\"fill\", \"#4684EE\")\n .style(\"stroke\", \"#666\")\n .style(\"opacity\", 1);\n };\n\n\tthis.drawBands = function(bandsContainer) { \n for (var index in this.config.greenZones) {\n this.drawBand(bandsContainer,this.config.greenZones[index].from, this.config.greenZones[index].to, self.config.greenColor);\n }\n\n for (var index in this.config.yellowZones) {\n this.drawBand(bandsContainer,this.config.yellowZones[index].from, this.config.yellowZones[index].to, self.config.yellowColor);\n }\n\n for (var index in this.config.redZones) {\n this.drawBand(bandsContainer,this.config.redZones[index].from, this.config.redZones[index].to, self.config.redColor);\n }\n\t};\n\n this.redrawDimmableFace = function (value) {\n this.drawFace(value < 0.5 ? self.config.faceColor : self.config.dimFaceColor,\t// facecolor\n\t\t\t value < 0.5 ? self.config.greyColor : lightBlueColor);\n }\n\n this.drawTicks = function (ticksContainer,color) {\n\n var fontSize = Math.round(this.config.size / 16);\n var majorDelta = this.config.range / (this.config.majorTicks - 1);\n for (var major = this.config.min; major <= this.config.max; major += majorDelta) {\n var minorDelta = majorDelta / this.config.minorTicks;\n for (var minor = major + minorDelta; minor < Math.min(major + majorDelta, this.config.max); minor += minorDelta) {\n var minorpoint1 = this.valueToPoint(minor, 0.75);\n var minorpoint2 = this.valueToPoint(minor, 0.85);\n\n\t\t ticksContainer.append(\"svg:line\")\n .attr(\"x1\", minorpoint1.x)\n .attr(\"y1\", minorpoint1.y)\n .attr(\"x2\", minorpoint2.x)\n .attr(\"y2\", minorpoint2.y)\n .style(\"stroke\", color)\n .style(\"stroke-width\", \"1px\");\n }\n\n var majorpoint1 = this.valueToPoint(major, 0.7);\n var majorpoint2 = this.valueToPoint(major, 0.85);\n\n\t\tticksContainer.append(\"svg:line\")\n .attr(\"x1\", majorpoint1.x)\n .attr(\"y1\", majorpoint1.y)\n .attr(\"x2\", majorpoint2.x)\n .attr(\"y2\", majorpoint2.y)\n .style(\"stroke\", color)\n .style(\"stroke-width\", \"2px\");\n\n if (major == this.config.min || major == this.config.max) {\n var point = this.valueToPoint(major, 0.63);\n\n\t\t ticksContainer.append(\"svg:text\")\n .attr(\"x\", point.x)\n .attr(\"y\", point.y)\n .attr(\"dy\", fontSize / 3)\n .attr(\"text-anchor\", major == this.config.min ? \"start\" : \"end\")\n .text(major)\n .style(\"font-size\", fontSize + \"px\")\n .style(\"fill\", color)\n .style(\"stroke-width\", \"0px\");\n }\n }\n };\n\n\n this.redraw = function (value) {\n this.drawPointer(value);\n };\n\n this.dimDisplay = function (value) {\n this.redrawDimmableFace(value);\n };\n\n this.drawBand = function (bandsContainer, start, end, color) {\n if (0 >= end - start) return;\n\n bandsContainer.append(\"svg:path\")\n .style(\"fill\", color)\n .attr(\"d\", d3.svg.arc()\n .startAngle(this.valueToRadians(start))\n .endAngle(this.valueToRadians(end))\n .innerRadius(0.70 * this.config.raduis)\n .outerRadius(0.85 * this.config.raduis))\n .attr(\"transform\", function () {\n return \"translate(\" + self.config.cx + \", \" + self.config.cy + \") rotate(270)\";\n });\n };\n\n this.drawFace = function (colorFace,colorTicks) {\n var arc0 = d3.svg.arc()\n .startAngle(0) //this.valueToRadians(0))\n .endAngle(2 * Math.PI)\n .innerRadius(0.00 * this.config.raduis)\n .outerRadius(0.9 * this.config.raduis);\n\n var faceContainer = this.body.selectAll(\".faceContainer\");\n var bandsContainer = this.body.selectAll(\".bandsContainer\");\n var ticksContainer = this.body.selectAll(\".ticksContainer\");\n var pointerContainer = this.body.selectAll(\".pointerContainer\");\n var face = faceContainer.selectAll(\"path\");\n if (face == 0)\n\t {\n faceContainer\n .append(\"svg:path\")\n .attr(\"d\", arc0) //d3.svg.arc()\n .style(\"fill\", colorFace)\n .style(\"fill-opacity\", 0.7)\n .attr(\"transform\",\n \"translate(\" + self.config.cx + \", \" + self.config.cy + \")\");\n\n\t\tthis.drawBands(bandsContainer);\n\t this.drawTicks(ticksContainer,colorTicks);\n var fontSize = Math.round(this.config.size / 9);\n faceContainer.append(\"svg:text\")\n .attr(\"x\", this.config.cx)\n .attr(\"y\", this.config.cy - this.config.size/6 - fontSize / 2 )\n .attr(\"dy\", fontSize / 2)\n .attr(\"text-anchor\", \"middle\")\n .text(this.config.label)\n .style(\"font-size\", fontSize + \"px\")\n .style(\"fill\", colorTicks)\n .style(\"stroke-width\", \"0px\");\n\t }\n else\n\t {\n face.style(\"fill\", colorFace);\n\t\tvar facetxt = faceContainer.selectAll(\"text\");\n\t\tfacetxt.style(\"fill\", colorTicks);\n var ptrtxt = pointerContainer.selectAll(\"text\");\n ptrtxt.style(\"fill\", colorTicks);\n\t\tvar ticks = ticksContainer.selectAll(\"line\");\n\t\tticks.style(\"stroke\", colorTicks);\n\t\tvar texts = ticksContainer.selectAll(\"text\");\n\t\ttexts.style(\"fill\", colorTicks);\n \n\t }\n\t};\n\n this.drawPointer = function (value) {\n var delta = this.config.range / 13;\n\n var head = this.valueToPoint(value, 0.85);\n var head1 = this.valueToPoint(value - delta, 0.12);\n var head2 = this.valueToPoint(value + delta, 0.12);\n\n var tailValue = value - (this.config.range * (1 / (270 / 360)) / 2);\n var tail = this.valueToPoint(tailValue, 0.28);\n var tail1 = this.valueToPoint(tailValue - delta, 0.12);\n var tail2 = this.valueToPoint(tailValue + delta, 0.12);\n\n var data = [head, head1, tail2, tail, tail1, head2, head];\n\n var line = d3.svg.line()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n })\n .interpolate(\"basis\");\n\n var pointerContainer = this.body.select(\".pointerContainer\");\n\n var pointer = pointerContainer.selectAll(\"path\").data([data]);\n\n pointer.enter()\n .append(\"svg:path\")\n .attr(\"d\", line)\n .style(\"fill\", \"#dc3912\")\n .style(\"stroke\", \"#c63310\")\n .style(\"fill-opacity\", 0.7);\n\n pointer.transition()\n .attr(\"d\", line)\n //.ease(\"linear\")\n .duration(i>=0 ? 50 : 500);\n\n var fontSize = Math.round(this.config.size / 10);\n pointerContainer.selectAll(\"text\")\n .data([value])\n .text(Math.round(value))\n .enter()\n .append(\"svg:text\")\n .attr(\"x\", this.config.cx)\n .attr(\"y\", this.config.cy + this.config.size/6 + fontSize)\n .attr(\"dy\", fontSize / 2)\n .attr(\"text-anchor\", \"middle\")\n .text(Math.round(value))\n .style(\"font-size\", fontSize + \"px\")\n .style(\"fill\", \"#000\")\n .style(\"stroke-width\", \"0px\");\n };\n\n this.valueToDegrees = function (value) {\n return value / this.config.range * 270 - 45;\n };\n\n this.valueToRadians = function (value) {\n return this.valueToDegrees(value) * Math.PI / 180;\n };\n\n this.valueToPoint = function (value, factor) {\n var len = this.config.raduis * factor;\n var inRadians = this.valueToRadians(value);\n var point = {\n x: this.config.cx - len * Math.cos(inRadians),\n y: this.config.cy - len * Math.sin(inRadians)\n };\n\n return point;\n };\n\n // initialization\n this.configure(configuration);\n }", "function Detaillinegauge(){\r\n\r\n\r\n\t// set the linegauge type\r\n\tlinegauge = anychart.bullet([{value: floodriskvalue}]);\r\n\t\r\n\t\r\n // Set chart ranges\r\n linegauge.range().from(0).to(100);\r\n linegauge.range(1).from(0).to(25);\r\n linegauge.range(2).from(25).to(50);\r\n linegauge.range(3).from(50).to(75);\r\n linegauge.range(4).from(75).to(100);\r\n \r\n \r\n\r\n\r\n // chart title\r\n linegauge.title(\"Flood Risk Area Percentage\");\r\n linegauge.layout('vertical');\r\n // Initiate chart drawing\r\n linegauge.container(\"container\");\r\n linegauge.draw();\r\n return linegauge\r\n\r\n}", "function testGyro() {\n toast({text: \"Testing Gyro\", duration: 3, type: \"success\"});\n var initialValue = 1001;\n var gyroValue = randomIntFromInterval(0, 360);\n setInterval(() => {\n initialValue++;\n NetworkTables.putValue(\"/SmartDashboard/Gyro\", gyroValue); \n gyroValue += 10;\n if (gyroValue > 360)\n gyroValue = 0;\n }, 20);\n}", "createGauge(name, options) {\n if (!this._isValidName(name)) {\n this._logger.warn(`Invalid metric name ${name}. Defaulting to noop metric implementation.`);\n return core_1.NOOP_GAUGE_METRIC;\n }\n const opt = Object.assign(Object.assign({ \n // Gauges are defined as non-monotonic by default\n monotonic: false, logger: this._logger }, types_1.DEFAULT_METRIC_OPTIONS), options);\n const gauge = new Metric_1.GaugeMetric(name, opt, () => {\n this._exportOneMetric(name);\n });\n this._registerMetric(name, gauge);\n return gauge;\n }", "function CreateGauge(elementOrID, spec)\n{\n var gaugeElement = elementOrID;\n if (elementOrID.nodeType != Node.ELEMENT_NODE) {\n gaugeElement = document.getElementById(elementOrID);\n }\n \tif (!gaugeElement.loaded) \n\t{\n\t\tgaugeElement.loaded = true;\n\t\tvar onchanged = spec.onchange || null;\n\t\ttry { onchanged = eval(onchanged); } catch (e) { onchanged = null; }\n\t\tgaugeElement.object = new Gauge(gaugeElement, spec.value || 0, spec.minValue || 0, spec.maxValue || 0, spec.onValue || 0, spec.warningValue || 0, spec.criticalValue || 0, spec.startAngle || 0, spec.stopAngle || 0, spec.pivotOffsetX || 0, spec.pivotOffsetY || 0, spec.pointerReach || 0, spec.interactive || false, spec.continuous || false, spec.imagePointer || null, spec.imageOff || null, spec.imageOn || null, spec.imageWarning || null, spec.imageCritical || null, onchanged);\n\t\treturn gaugeElement.object;\n\t}\n}", "function GetTestability() {}", "function GetTestability() {}", "function GetTestability() {}", "function guage(sample) {\n d3.json(\"samples.json\").then((data) => {\n\n // Create Variable for Hands Washed Guage\n var metadata = data.metadata;\n\n // Filter Variable\n var demographic = metadata.filter(value => value.id == sample);\n\n // Filter Variable\n var wfreq = demographic[0].wfreq; \n \n // Log to Console to Inspect\n console.log(wfreq)\n\n // Create Trace for Guage\n var traceGuage = [\n {\n type: \"indicator\",\n mode: \"gauge+number+delta\",\n value: wfreq,\n title: { text: \"Belly Button Scrubs Per Week\", font: { size: 24 }, },\n gauge: {\n steps: [\n { range: [0, 1], color: \"PaleGoldenRod\"},\n { range: [1, 2], color: \"Khaki\"},\n { range: [2, 4], color: \"Yellow\"},\n { range: [4, 8], color: \"YellowGreen\"},\n { range: [8,10], color: \"lime\"},\n // { range: [7,8], color: \"Green\"}\n ],\n axis: { range: [null, 10], tickwidth: 1, tickcolor: \"black\" },\n bar: { color: \"SlateGray\" },\n bgcolor: \"white\",\n borderwidth: 2,\n bordercolor: \"black\",\n }\n }\n\n ];\n \n var layout = {\n width: 450,\n height: 400,\n margin: { t: 25, r: 25, l: 25, b: 25 },\n paper_bgcolor: \"lavender\",\n font: { color: \"black\", family: \"Arial\" }\n };\n \n Plotly.newPlot('gauge', traceGuage, layout)\n });\n}", "function optionChanged(sample) {\n createChart(sample);\n createMetaData(sample);\n // createGauge(sample)\n}", "static createWindchillTemperatureGauge() {\r\n var gauge = new LinearGauge(this.createTemperatureGaugeOpts('windchillTemperatureCanvas'));\r\n LivewindStore.storeGauge('windchillTemperature', gauge);\r\n gauge.draw();\r\n }", "hasVillager(){\n let villagerFound = false;\n for(let unit of this.units){\n if(unit.getType() === \"Villager\"){\n villagerFound = true;\n }\n }\n\n return villagerFound;\n }", "generateTestStats() {\n const fieldTypes = [\n {field: \"postback_type_code\", method: \"randomPick\", params: [\"1\",\"2\",\"2\",\"3\",\"3\",\"4\",\"4\",\"4\",\"5\",\"6\",\"7\"]},\n {field: \"credit_card_earn\", method: \"financeAmount\"},\n {field: \"credit_card_sales\", method: \"randomNumber\"},\n {field: \"billet_earn\", method: \"financeAmount\"},\n {field: \"billet_sales\", method: \"randomNumber\"},\n {field: \"pending_count\", method: \"zeroToTen\"},\n {field: \"cancels_count\", method: \"zeroToTen\"},\n {field: \"refunds_count\", method: \"zeroToTen\"},\n {field: \"disputing_count\", method: \"zeroToTen\"}\n ]\n super.generateTestStats(fieldTypes)\n\n this.pending_value = this.pending_count * TestStats.financeAmount()\n this.cancels_value = this.cancels_count * TestStats.financeAmount()\n this.refunds_value = this.refunds_count * TestStats.financeAmount()\n this.disputing_value = this.disputing_count * TestStats.financeAmount()\n this.sales = this.billet_sales + this.credit_card_sales\n }", "static types(){\n return {\n GRASS: 'grass',\n AIR: 'air',\n DIRT: 'dirt',\n SAND: 'sand',\n ROCK: 'rock',\n WATER: 'water'\n };\n }", "function buildGauge(wfreq) {\n\n // Enter the washing frequency between 0 and 180\n var level = parseFloat(wfreq) * 20;\n\n // Trig to calc meter point\n var degrees = 180 - level, radius = 0.75;\n var radians = (degrees * Math.PI) / 180;\n var x = radius * Math.cos(radians);\n var y = radius * Math.sin(radians);\n\n // Path: https://plot.ly/javascript/gauge-charts/\n var mainPath = 'M -.0 -0.025 L .0 0.025 L ',\n pathX = String(x),\n space = ' ',\n pathY = String(y),\n pathEnd = ' Z';\n var path = mainPath.concat(pathX, space, pathY, pathEnd);\n\n var gaugeData = [\n { \n type: 'scatter',\n x: [0], \n y:[0],\n marker: {size: 12, color:'#404040'},\n showlegend: false,\n name: 'W-Frequency',\n text: level,\n hoverinfo: 'text+name'\n },\n { \n values: [50/9, 50/9, 50/9, 50/9, 50/9, 50/9, 50/9, 50/9, 50/9, 50],\n rotation: 90,\n text: [\"8-9\", \"7-8\", \"6-7\", \"5-6\", \"4-5\", \"3-4\", \"2-3\", \"1-2\", \"0-1\", \"\"],\n textinfo: 'text',\n textposition:'inside',\n marker: {\n colors: [\n '#DB2C11',\n '#F2402C',\n '#FF5D4B',\n '#FF6F61', \n '#F58376',\n '#FA8B7F',\n '#FDAB9B',\n '#FCC1B6',\n '#EADEDB',\n 'rgba(0,0,0,0)'\n ]\n },\n labels: [\"8-9\", \"7-8\", \"6-7\", \"5-6\", \"4-5\", \"3-4\", \"2-3\", \"1-2\", \"0-1\", \"\"],\n hoverinfo: \"label\",\n hole: .5,\n type: 'pie',\n showlegend: false\n }\n ];\n\n var gaugeLayout = {\n shapes:[\n {\n type: 'path',\n path: path,\n fillcolor: '#404040',\n line: {\n color: '#404040'\n }\n }\n ],\n title: `Belly Button Cleaning Frequency<br><i>Scrubs Per Week</i>`,\n height: 500,\n width: 500,\n xaxis: {zeroline:false, showticklabels:false, showgrid: false, range: [-1, 1]},\n yaxis: {zeroline:false, showticklabels:false, showgrid: false, range: [-1, 1]},\n paper_bgcolor: 'rgba(0,0,0,0)',\n plot_bgcolor: 'rgba(0,0,0,0)'\n };\n\n Plotly.plot('gauge', gaugeData, gaugeLayout);\n }", "function PropulsionUnit() {\n }", "function PropulsionUnit() {\n }", "getMeterProvider() {\n return (0, global_utils_1.getGlobal)(API_NAME) || NoopMeterProvider_1.NOOP_METER_PROVIDER;\n }", "addMetricsPlugins() {}", "unitsInitStatic()\n\t{\n\t\t//\n\t\t// Check edge collection.\n\t\t// Assert that it fails on document collection and succeeds on edge collection.\n\t\t//\n\t\tthis.staticUnitSet(\n\t\t\t'staticEdgeCollection',\n\t\t\t\"Check edge collection\",\n\t\t\tthis.test_classes.base,\n\t\t\t{\n\t\t\t\tedge: this.parameters.collection_edge,\n\t\t\t\tdocument: this.parameters.collection_document,\n\t\t\t\trequest: this.request\n\t\t\t},\n\t\t\ttrue\n\t\t);\n\t\t\n\t\t//\n\t\t// Check document collection.\n\t\t// Assert that it fails on edge collection and succeeds on document collection.\n\t\t//\n\t\tthis.staticUnitSet(\n\t\t\t'staticDocumentCollection',\n\t\t\t\"Check document collection\",\n\t\t\tthis.test_classes.base,\n\t\t\t{\n\t\t\t\tedge: this.parameters.collection_edge,\n\t\t\t\tdocument: this.parameters.collection_document,\n\t\t\t\trequest: this.request\n\t\t\t},\n\t\t\ttrue\n\t\t);\n\t\t\n\t}", "function test_timepicker_should_pass_correct_timing_on_service_order() {}", "function Testing() {\n this.voice = new Perlin();\n this.delay = new common.Repeater();\n this.panner = new Perlin();\n this.panSpeed = tombola.rangeFloat(0.01,1);\n this.p = tombola.rangeFloat(-1,1);\n}", "function miscFunc(){\n\tvar doors = 0;\n\tvar\trooms = 0;\n\tGJSONUnOrdered.forEach(function(elem){\n\t\tprop = elem.properties;\n\t\tlabel = prop.Label;\n\t\tif (label.substring(0,5) == \"Door:\"){\n\t\t\t\n\t\t\tdoors = doors + 1;\n\t\t}else if (prop.Label.substring(0,3) == \"37/\") {\n\t\t\t\n\t\t\tstr = label.slice(0, 2) + label.slice(3);\n\t\t\t\n\t\t\tif (str != prop.RoomRef){\n\t\t\t\tconsole.log(label + \", \", + prop.RoomRef + \", \" + prop.id);\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t/*expr = new RegExp(\"^37/\" + prop.Level +\"\\\\d\\\\d\\\\d$\");\n\t\t\tif (!expr.test(label)){\n\t\t\t\tconsole.log(label + \", \", + prop.Level + \", \" + prop.id);\n\t\t\t}*/\n\t\t}else{\n\t\t\tconsole.log(\"BAD LABEL\" + prop);\n\t\t}\n\t\t\n\t});\n\tconsole.log(\"TESTED\");\n}", "static createWindSpeedGauge() {\r\n var gauge = new RadialGauge(this.createWindSpeedOptions('windSpeedCanvas'));\r\n LivewindStore.storeGauge('windSpeed', gauge);\r\n gauge.draw();\r\n }", "function drawChart() {\n\n var data = google.visualization.arrayToDataTable([\n ['Label', 'Value'],\n ['TempDHT', 0],\n ['HumDHT', 0],\n\t\t ['SoilHum', 0],\n ['Fire', 0]\n ]);\n\n\n var optionsT = {\n width: 600, height: 300,\n redFrom: 90, redTo: 100,\n yellowFrom:71, yellowTo: 90,\n greenFrom:59, greenTo: 71,\n min: 0, max: 100,\n minorTicks: 5\n };\n \n\n var chart = new google.visualization.Gauge(document.getElementById('chart_div'));\n\n chart.draw(data, optionsT);\n\n // Update of Gauges \n setInterval(function() {\n data.setValue(0, 1, getDataField1());\n chart.draw(data, optionsT);\n }, 1000);\n setInterval(function() {\n data.setValue(1, 1, getDataField2());\n chart.draw(data, optionsT);\n }, 1000);\n setInterval(function() {\n data.setValue(2, 1, getDataField3()); \n chart.draw(data, optionsT);\n }, 1000);\n setInterval(function() {\n data.setValue(3, 1, getDataField4()); \n chart.draw(data, optionsT);\n }, 1000);\n \n // Update of digital sensors/actuators\n setInterval(function() {\n displayDigInfo1(getDataField7()); \n }, 1000);\n setInterval(function() {\n displayDigInfo2(getDataField5()); \n }, 1000);\n\n setInterval(function() {\n displayDigInfo3(getDataField8()); \n }, 1000);\n setInterval(function() {\n displayDigInfo4(getDataField6()); \n }, 1000); \n }", "buildEmergencyVillager(){\n if(this.gold >= 60){\n let villagerInfo = this.getUnitInfo(\"Villager\");\n var unit = new Unit(villagerInfo, this.startingX+10, this.startingY+10, this.game, this.isPlayer(), this, villagerInfo.health);\n this.units.push(unit);\n this.removeGold(60);\n }\n }", "function kumaGauge(element, options , method) {\r\n // This\r\n var _this = this;\r\n\r\n // The element\r\n _this.element = element;\r\n _this.$element = $(element);\r\n\r\n // The config\r\n _this.config = $.extend( {}, config, options );\r\n _this._config = config;\r\n\r\n _this.method = method;\r\n\r\n // The actual gauge\r\n _this.gauge = {};\r\n\r\n // Initialise\r\n _this.init();\r\n }", "function PerformanceTestCase() {\n}", "metricTypeMatching (unitType, unitTypeTo) {\n switch (unitType) {\n case 'kg':\n if (unitTypeTo !== 'g' && unitTypeTo !== 'kg') return false\n break;\n case 'g':\n if (unitTypeTo !== 'g' && unitTypeTo !== 'kg') return false\n break;\n case 'l':\n if (unitTypeTo !== 'ml' && unitTypeTo !== 'l') return false\n break;\n case 'ml':\n if (unitTypeTo !== 'ml' && unitTypeTo !== 'l') return false\n break;\n case 'db':\n if (unitTypeTo !== 'db') return false\n break;\n default:\n return false\n }\n return true\n }", "function initMetrics() {\n metrics.version = probe.metric({\n name: 'Varnish Version',\n value: 'N/A'\n });\n metrics.uptime = probe.metric({\n name: 'Uptime',\n value: 'N/A'\n });\n metrics.clientRequests = probe.metric({\n name: 'Client Requests',\n value: 'N/A'\n });\n metrics.cacheHits = probe.metric({\n name: 'Cache hits',\n value: 'N/A'\n });\n metrics.cacheHitpass = probe.metric({\n name: 'Cache Hits for pass',\n value: 'N/A'\n });\n metrics.cacheMisses = probe.metric({\n name: 'Cache misses',\n value: 'N/A'\n });\n metrics.backendBusy = probe.metric({\n name: 'Backend conn. busy',\n value: 'N/A'\n });\n metrics.backendFail = probe.metric({\n name: 'Backend failures',\n value: 'N/A',\n alert: {\n mode: 'threshold-avg',\n value: 5000,\n msg: 'Too many Backend failures',\n cmp: \">\"\n }\n });\n metrics.reqHeaderSize = probe.metric({\n name: 'Req. Header Size',\n value: 'N/A'\n });\n metrics.reqBodySize = probe.metric({\n name: 'Req. Body Size',\n value: 'N/A'\n });\n metrics.resHeaderSize = probe.metric({\n name: 'Res. Header Size',\n value: 'N/A'\n });\n metrics.resBodySize = probe.metric({\n name: 'Res. Body Size',\n value: 'N/A'\n });\n}", "function ApacheGaugeChart(\n type, model, svgEmbedId, \n isPerspective, legendPosition)\n{\n this.Init(type, model, svgEmbedId, isPerspective, legendPosition);\n}", "function buildGaugeChart(sample) {\n var url = `/metadata/${sample}`;\n d3.json(url).then(function(data) {\n \n console.log(data.WFREQ);\n var chart_data = [{domain: {x: [0, 1], y: [0, 1]}, value: data.WFREQ, title: {text: \"Belly Button Washing Frequency <hr> Number of scrubs per week\"},\n type: \"indicator\", mode: \"gauge+number\", gauge:\n {axis: {range: [null, 10]}, steps: [{range: [0-1], color: \"lightseagreen\"},\n {range: [1, 2], color: \"gray\"},\n {range: [2, 3], color: \"honeydew\"},\n {range: [3, 4], color: \"lavender\"}, \n {range: [4, 5], color: \"lightsalmon\"}, \n {range: [5, 6], color: \"lightpink\"}, \n {range: [6, 7], color: \"lightgoldenrodyellow\"},\n {range: [7, 8], color: \"lightcoral\"}, \n {range: [8, 9], color: \"lightskyblue\"},\n {range: [9, 10], color: \"lightslategrey\"} \n ]}}];\n\n var layout = {width: 600, height: 500, margin: {t: 0, b: 0}};\n Plotly.newPlot(\"gauge\",chart_data,layout);\n \n});\n }", "function Greenhouse() {\r\n const opts = {\r\n options: {\r\n chart: {\r\n fontFamily: chartFont,\r\n zoom: {\r\n enabled: false,\r\n },\r\n },\r\n dataLabels: {\r\n enabled: false\r\n },\r\n stroke: {\r\n width: 2,\r\n curve: 'smooth',\r\n },\r\n title: {\r\n text: 'Methane vs N₂O concentration growth',\r\n style: titleStyle\r\n },\r\n subtitle: {\r\n text: 'Source: Global Warming API',\r\n },\r\n colors: ['#008FFB', '#FF4560'],\r\n xaxis: {\r\n type: 'category',\r\n categories: res_df.greenhouse.category,\r\n tickAmount: 8,\r\n },\r\n yaxis: {\r\n title: {\r\n text: 'Concentration growth, %'\r\n },\r\n min: 100,\r\n max: Math.max(...res_df.greenhouse.methane.data.filter(filterNaN),\r\n ...res_df.greenhouse.nitrous.data.filter(filterNaN)) + 2,\r\n labels: {\r\n formatter: function (val) {\r\n return round(val);\r\n }\r\n }\r\n },\r\n annotations: {\r\n yaxis: [{\r\n y: 100,\r\n borderColor: '#000',\r\n label: {\r\n borderColor: '#000',\r\n style: {\r\n color: '#fff',\r\n background: '#000',\r\n },\r\n text: 'Minimal level',\r\n }\r\n }]\r\n },\r\n fill: {\r\n opacity: 1\r\n },\r\n tooltip: {\r\n y: {\r\n formatter: function (val, {dataPointIndex, series, seriesIndex, w}) {\r\n const v = w.config.series[seriesIndex].level[dataPointIndex],\r\n m = round(v - w.config.series[seriesIndex].min);\r\n\r\n return !filterNaN(val) ? 'No data' : `${val}% (${m}/${v} ppm)`;\r\n }\r\n }\r\n }\r\n },\r\n series: [{\r\n name: 'Methane growth',\r\n data: res_df.greenhouse.methane.data,\r\n level: res_df.greenhouse.methane.level,\r\n min: res_df.greenhouse.methane.min,\r\n }, {\r\n name: 'N₂O growth',\r\n data: res_df.greenhouse.nitrous.data,\r\n level: res_df.greenhouse.nitrous.level,\r\n min: res_df.greenhouse.nitrous.min,\r\n }]\r\n };\r\n\r\n return (\r\n <ReactApexChart options={opts.options} series={opts.series} type='line' height={400} />\r\n );\r\n}", "function db_addMeterBase(id, qc, name, description, customer, iron, diameter, digits, factor, change_limit, gps_lat, gps_long, gps_alt)\n{\n\tdb_addMeter(id, qc, name, description, customer, iron, diameter, digits, factor, change_limit, gps_lat, gps_long, gps_alt, 5000,\n\t\t\"time_0\", 0, 0, \n\t\t\"time_1\", 1, 1, \n\t\t\"time_2\", 2, 2, \n\t\t\"time_3\", 3, 3, \n\t\t\"time_4\", 4, 4); \n}", "function reportingTagsTests({ apiGET, apiPOST }) {\n it.todo(\"get reporting_tags for session\");\n it.todo(\"get reporting_tags for position\");\n it.todo(\"get reporting_tags for wage_chunk\");\n it.todo(\"create and delete reporting_tags for position\");\n it.todo(\"create and delete reporting_tags for wage_chunk\");\n}", "componentDidMount() {\n this.defineClassConstants();\n this.drawGauge();\n }", "static getAllTests() {\n return [\n CalculatorTest.test01,\n CalculatorTest.test02,\n CalculatorTest.test03,\n CalculatorTest.test04,\n CalculatorTest.test05,\n CalculatorTest.test06,\n CalculatorTest.test07,\n CalculatorTest.test08,\n CalculatorTest.test09\n ];\n }", "function buildGaugeChart(subID){\n let val = samples_data.metadata[subID].wfreq;\n\n console.log(val);\n\n var data = [\n {\n domain: { x: [0, 1], y: [0, 1] },\n value: val,\n title: { text: \"Belly Button Washing Frequency<br>Scrubs Per Week\", font: {size: 24} },\n type: \"indicator\",\n mode: \"gauge+number\",\n delta: { reference: 10 },\n gauge: {\n axis: { range: [0, 9], tickwidth: 1},\n bar: {color: 'grey'},\n steps: [\n { range: [0, 1], color: \"ghostwhite\" },\n { range: [1, 2], color: \"whitesmoke\" },\n { range: [2, 3], color: \"oldlace\" },\n { range: [3, 4], color: \"lightyellow\" },\n { range: [4, 5], color: \"moccasin\" },\n { range: [5, 6], color: \"darkseagreen\" },\n { range: [6, 7], color: \"mediumseagreen\" },\n { range: [7, 8], color: \"seagreen\" },\n { range: [8, 9], color: \"darkgreen\" }\n ]\n }\n }];\n \n var layout = { width: 600, \n height: 450, \n margin: { t: 0, b: 0 },\n xaxis: {title: {text: `Subject: ${samples_data.samples[subID].id}`, font: {size: 24}} }, \n};\n\n Plotly.react('gauge', data, layout);\n}", "get Specular() {}", "function runTests() {\n\ttestBeepBoop();\n\ttestGetDigits();\n}", "function testGetBase() {\n\n var yoke = new Yoke();\n // all resources are OK\n yoke.use(function (request) {\n request.response.end('OK');\n });\n\n new YokeTester(yoke).request('GET', '/', function(resp) {\n vassert.assertTrue(200 == resp.statusCode);\n vassert.testComplete();\n });\n}", "static createDailyRainGauge() {\r\n var gauge = new LinearGauge(this.createRainGaugeOpts('dailyRainCanvas'));\r\n LivewindStore.storeGauge('dailyRain', gauge);\r\n gauge.draw();\r\n }", "function Gas (runner, options) {\n\n if (!(web3.currentProvider.connection || web3.currentProvider.host)) {\n console.log('the provider use for the test does not support synchronous call but eth-gas-reporter requires it \\n falling back on the Spec reporter');\n mocha.reporters.Spec.call(this, runner);\n return;\n }\n Base.call(this, runner);\n\n const self = this\n let indents = 0\n let n = 0\n let failed = false;\n let startBlock\n let deployStartBlock\n let methodMap\n let deployMap\n let contractNameFromCodeHash;\n\n // Load config / keep .ethgas.js for backward compatibility\n let config;\n if (options && options.reporterOptions){\n config = options.reporterOptions\n } else {\n config = reqCwd.silent('./.ethgas.js') || {}\n }\n\n config.src = config.src || 'contracts'; // default contracts folder\n // TODO grab the contract srcpath from truffle / truffle config ?\n\n // Start getting this data when the reporter loads.\n stats.getGasAndPriceRates(config);\n\n // ------------------------------------ Helpers -------------------------------------------------\n const indent = () => Array(indents).join(' ')\n\n const methodAnalytics = (methodMap) => {\n let gasUsed = 0\n const endBlock = sync.blockNumber();\n\n while (startBlock <= endBlock) {\n let block = sync.getBlockByNumber(startBlock);\n\n if (block) {\n // Add to running tally for this test\n gasUsed += parseInt(block.gasUsed, 16);\n\n // Compile per method stats\n methodMap && block.transactions.forEach(tx => {\n const transaction = sync.getTransactionByHash(tx);\n const receipt = sync.getTransactionReceipt(tx);\n const code = sync.getCode(transaction.to);\n const hash = sha1(code);\n const contractName = contractNameFromCodeHash[hash];\n const id = stats.getMethodID(contractName, transaction.input)\n\n let threw = parseInt(receipt.status) === 0 || receipt.status === false;\n\n if (methodMap[id] && !threw) {\n methodMap[id].gasData.push(parseInt(receipt.gasUsed, 16))\n methodMap[id].numberOfCalls++\n }\n })\n }\n startBlock++\n }\n return gasUsed\n }\n\n const deployAnalytics = (deployMap) => {\n const endBlock = sync.blockNumber();\n\n while (deployStartBlock <= endBlock) {\n let block = sync.getBlockByNumber(deployStartBlock);\n\n block && block.transactions.forEach(tx => {\n const receipt = sync.getTransactionReceipt(tx);\n const threw = parseInt(receipt.status) === 0 || receipt.status === false;\n\n if (receipt.contractAddress && !threw) {\n const transaction = sync.getTransactionByHash(tx)\n\n const matches = deployMap.filter(contract => {\n return stats.matchBinaries(transaction.input, contract.binary);\n })\n\n if(matches && matches.length){\n const match = matches.find(item => item.binary !== '0x');\n\n if (match) {\n // We have to get code that might be linked here in\n // in order to match correctly at the method ids\n const code = sync.getCode(receipt.contractAddress);\n const hash = sha1(code);\n\n match.gasData.push(parseInt(receipt.gasUsed, 16));\n contractNameFromCodeHash[hash] = match.name;\n }\n }\n }\n })\n deployStartBlock++\n }\n }\n\n // ------------------------------------ Runners -------------------------------------------------\n runner.on('start', () => {\n ({ methodMap, deployMap, contractNameFromCodeHash } = stats.mapMethodsToContracts(artifacts, config.src))\n })\n\n runner.on('suite', suite => {\n ++indents\n log(color('suite', '%s%s'), indent(), suite.title)\n })\n\n runner.on('suite end', () => {\n --indents\n if (indents === 1) {\n log()\n }\n })\n\n runner.on('pending', test => {\n let fmt = indent() + color('pending', ' - %s')\n log(fmt, test.title)\n })\n\n runner.on('test', () => { deployStartBlock = sync.blockNumber() })\n\n runner.on('hook end', () => { startBlock = sync.blockNumber() + 1 })\n\n runner.on('pass', test => {\n let fmt\n let fmtArgs\n let gasUsedString\n deployAnalytics(deployMap)\n let gasUsed = methodAnalytics(methodMap)\n let showTimeSpent = config.showTimeSpent || false\n let timeSpentString = color(test.speed, '%dms')\n let consumptionString\n if (gasUsed) {\n gasUsedString = color('checkmark', '%d gas')\n\n if (showTimeSpent) {\n consumptionString = ' (' + timeSpentString + ', ' + gasUsedString + ')'\n fmtArgs = [test.title, test.duration, gasUsed]\n } else {\n consumptionString = ' (' + gasUsedString + ')'\n fmtArgs = [test.title, gasUsed]\n }\n\n fmt = indent() +\n color('checkmark', ' ' + Base.symbols.ok) +\n color('pass', ' %s') +\n consumptionString\n } else {\n if (showTimeSpent) {\n consumptionString = ' (' + timeSpentString + ')'\n fmtArgs = [test.title, test.duration]\n } else {\n consumptionString = ''\n fmtArgs = [test.title]\n }\n\n fmt = indent() +\n color('checkmark', ' ' + Base.symbols.ok) +\n color('pass', ' %s') +\n consumptionString\n }\n log.apply(null, [fmt, ...fmtArgs])\n })\n\n runner.on('fail', test => {\n failed = true;\n let fmt = indent() + color('fail', ' %d) %s')\n log()\n log(fmt, ++n, test.title)\n })\n\n runner.on('end', () => {\n stats.generateGasStatsReport(methodMap, deployMap, contractNameFromCodeHash)\n self.epilogue()\n });\n}", "function initializeDefaultMetrics() {\n var val = 0;\n metrics.set(\"bonusCollected\", val);\n metrics.set(\"bonusCreated\", val);\n metrics.set(\"playerProjectiles\", val);\n metrics.set(\"playerHit\", val);\n metrics.set(\"enemyProjectiles\", val);\n metrics.set(\"enemiesKilled\", val);\n metrics.set(\"enemiesCreated\", val);\n}", "function test_bottleneck_provider() {}", "function testTapeLength() {\n\tvar test = getTapeLength();\n\tconsole.log(\"tape length in meters: \" + test);\n}", "function SizeGauge()\n{\n\t// set up the speedo size\n\tlet gauge = document.getElementById(\"speedGauge\");\n\n\t// set height\n\tvar speedGaugeHeight = $(\"#speedGaugeDiv\").css('height');\n\tspeedGaugeHeight = speedGaugeHeight.substring(0, speedGaugeHeight.length - 2);\n\n\t// set width\n\tvar speedGaugeWidth = $(\"#speedGaugeDiv\").css('width');\n\tspeedGaugeWidth = speedGaugeWidth.substring(0, speedGaugeWidth.length - 2);\n\n\t// update attributes\n\tgauge.setAttribute(\"data-height\", `${speedGaugeHeight}`);\n\tgauge.setAttribute(\"data-width\", `${speedGaugeWidth}`);\n}", "function PerformanceReporter() {\n }", "function initDashboard() {\n \n tempGauge(city);\n percipGauge(city);\n generateChart();\n generate_prcp();\n addParagraph(city) \n}", "defineClassConstants() {\n\n //Obtaining a reference for the canvas\n this.context2d = this.gaugeCanvas.getContext('2d');\n\n //Internal Dimension definition\n this.internalXAxis = this.gaugeCanvas.width * 0.8;\n this.xAxisBuffer = this.gaugeCanvas.width * 0.1;\n this.rightSideEnd = this.internalXAxis + this.xAxisBuffer;\n\n //Style constants\n this.onePipInPixels = 25;\n this.pipWidth = 0.5;\n this.markerWidth = 1;\n this.needleWidth = 1.5;\n this.pipColour = '#cccccc';\n this.markerColour = '#000000';\n this.needleColour = '#ff0000';\n\n //Gauge conversion constants\n this.minVal = this.props.minVal;\n this.maxVal = this.props.maxVal;\n this.ratio = this.internalXAxis / (this.maxVal - this.minVal);\n\n //Define the quarterly marker values\n this.startMark = this.xAxisBuffer;\n this.quarterMark = (this.xAxisBuffer + this.internalXAxis * 0.25);\n this.halfMark = (this.xAxisBuffer + this.internalXAxis * 0.5);\n this.threeQuarterMark = (this.xAxisBuffer + this.internalXAxis * 0.75);\n this.finishMark = (this.internalXAxis + this.xAxisBuffer);\n\n //define pipLocations and store them in an array for iteration\n this.pipLocations = [];\n for (let i = this.xAxisBuffer; i <= this.rightSideEnd; i += this.onePipInPixels) {\n if ((i !== this.startMark)\n && (i !== this.quarterMark)\n && (i !== this.halfMark)\n && (i !== this.threeQuarterMark)\n && (i !== this.finishMark)) {\n this.pipLocations.push(i);\n }\n }\n\n }", "constructor() {\n super();\n this.registerAsType(DefaultPrometheusFactory.PrometheusCountersDescriptor, PrometheusCounters_1.PrometheusCounters);\n this.registerAsType(DefaultPrometheusFactory.PrometheusMetricsServiceDescriptor, PrometheusMetricsService_1.PrometheusMetricsService);\n }", "function gunnerChange() {\n var currentUnitPoints = parseInt(event.target.parentNode.childNodes[2].childNodes[0].innerHTML);\n var currentTotal = parseInt(totalPoints.innerText);\n if (event.target.value === \"Ion Rifle - 3pt\" && currentUnitPoints === 12) {\n ionFromRail(event, currentTotal, currentUnitPoints);\n } else if (event.target.value === \"Ion Rifle - 3pt\") {\n ionFromCarbine(event, currentTotal, currentUnitPoints);\n } else if (event.target.value === \"Rail Rifle - 5pt\" && currentUnitPoints === 7) {\n railFromCarbine(event, currentTotal, currentUnitPoints)\n } else if (event.target.value === \"Rail Rifle - 5pt\") {\n railFromIon(event, currentTotal, currentUnitPoints);\n } else if (event.target.value === \"Pulse Carbine w/ ML\" && currentUnitPoints === 12) {\n carbineFromRail(event, currentTotal, currentUnitPoints);\n } else {\n carbineFromIon(event, currentTotal, currentUnitPoints);\n }\n}", "function test_createBubbleChart() {\n var bubbleData = otuData;\n createBubbleChart(bubbleData, 940);\n}", "generate (data) {\n debug && console.log(Util.timestamp(), 'C3GaugeWrapper.generate:', this.containerId, data && data.length);\n let self = this;\n \n // Generate the chart\n self.chartConfig = _.extend({\n bindto : '#' + self.containerId,\n data : self.parseData(data, {\n type : 'gauge',\n onclick: function (d, element) {\n console.log('Default Data Click:', d, element);\n }\n }),\n color: {\n pattern : [ '#FF0000', '#F97600', '#F6C600', '#60B044' ],\n threshold: {\n values: [ 30, 60, 90, 100 ]\n }\n },\n legend : {\n show: false\n },\n padding: {\n top : 20,\n bottom: 20,\n left : 20,\n right : 20\n },\n onresize () {\n console.log('chart resize:', this);\n }\n }, self.config.chart);\n \n debug && console.log(Util.timestamp(), 'C3GaugeWrapper.generate chartConfig:', self.chartConfig, self.config);\n try {\n self.chart = c3.generate(self.chartConfig);\n \n if(self.chartConfig.callouts){\n self.generateCallouts(self.chartConfig.callouts);\n }\n } catch (e) {\n console.error('C3GaugeWrapper.generate failed:', e, self.chartConfig);\n }\n }", "function generateTest() {\n // TODO\n}", "function redrawGauge(pointerBike,pointerLanuv) {\n if (linearGauge) {\n linearGauge\n // draw max and min\n .draw(\"0\", \"65\")\n // draw steps between min and max (like steps on a ruler)\n .drawStep(10, \"#d9d9d9\", 5)\n .drawStep(20, \"#d9d9d9\", 5)\n .drawStep(30, \"#d9d9d9\", 5)\n .drawStep(40, \"#d9d9d9\", 5)\n .drawStep(50, \"#d9d9d9\", 5)\n .drawStep(60, \"#d9d9d9\", 5)\n // draw value for lanuv station\n .drawPointer((pointerLanuv>62) ? 62 : (pointerLanuv<0) ? 0 : pointerLanuv, \"#b38e00\", \"\" + Math.round(pointerLanuv * 100) / 100)\n // draw value for bike measurement\n .drawPointer((pointerBike>62) ? 62 : (pointerBike<0) ? 0 : pointerBike, \"#ffdb4d\", \"\" + Math.round(pointerBike * 100) / 100)\t\t\t\t;\n } else {\n linearGauge = new HyyanAF.LinearGauge(gauge,0,65)\n // draw max and min\n .draw(\"0\", \"65\")\n // draw steps between min and max (like steps on a ruler)\n .drawStep(10, \"#d9d9d9\", 5)\n .drawStep(20, \"#d9d9d9\", 5)\n .drawStep(30, \"#d9d9d9\", 5)\n .drawStep(40, \"#d9d9d9\", 5)\n .drawStep(50, \"#d9d9d9\", 5)\n .drawStep(60, \"#d9d9d9\", 5)\n // draw value for lanuv station\n .drawPointer((pointerLanuv>62) ? 62 : (pointerLanuv<0) ? 0 : pointerLanuv, \"#b38e00\", \"\" + Math.round(pointerLanuv * 100) / 100)\n // draw value for bike measurement\n .drawPointer((pointerBike>62) ? 62 : (pointerBike<0) ? 0 : pointerBike, \"#ffdb4d\", \"\" + Math.round(pointerBike * 100) / 100)\n ;\n }\n}", "function guageChart(selectedID) {\n d3.json(dataFile).then(function (dataSample) {\n var dataObj = dataSample.metadata.filter(data => data.id.toString() === selectedID)[0];\n console.log(\"----- Guage -------\")\n console.log(dataObj);\n console.log(\"----- freq -------\")\n var wfreq = dataObj.wfreq;\n console.log(`wfreq: ${wfreq}`);\n console.log(\"-------------------\") \n\n // Set the attributes for the gauge needle\n var traceN = {\n type: 'scatter',\n x: [0], y:[0],\n marker: {size: 30, color:'850000'},\n showlegend: false,\n name: 'Frequency',\n hoverinfo: 'text+name'\n };\n\n // Set the attributes for the nine sections for the gauge\n var traceD = {\n type: \"pie\", \n showlegend: false,\n hole: 0.6,\n rotation: 90,\n values:[180/9, 180/9, 180/9, 180/9, 180/9, 180/9, 180/9, 180/9, 180/9, 180],\n text: [\"0-1\", \"1-2\", \"2-3\", \"3-4\", \"4-5\", \"5-6\", \"6-7\", \"7-8\", \"8-9\", \"\"],\n direction: \"clockwise\",\n textinfo: \"text\",\n textposition: \"inside\",\n hoverinfo: \"label\",\n marker: {\n colors: [\"rgba(220, 20, 20, 0.6)\", \"rgba(255, 165, 0, 0.6)\", \"rgba(255, 255, 0, 0.6)\", \n \"rgba(144, 238, 144, 0.6)\", \"rgba(154, 55, 180, 0.6)\",\"rgba(154, 90, 120, 0.6)\", \n \"rgba(4, 215, 120, 0.6)\", \"rgba(94, 225, 90, 0.6)\", \"rgba(24, 225, 5, 0.6)\", \"white\"]\n },\n };\n var freq = parseInt(wfreq);\n console.log(`'freq : ${wfreq}`)\n\n var degrees = 9-freq, radius = .5;\n var radians = degrees * Math.PI / 10;\n var x = radius * Math.cos(radians);\n var y = radius * Math.sin(radians);\n\n console.log(`degrees: ${degrees}`);\n console.log(`radians: ${radians}`);\n console.log(`x: ${x}`);\n console.log(`y: ${y}`);\n\n // var path = path = (degrees < 45 || degrees > 135) ? 'M -0.0 -0.025 L 0.0 0.025 L `X` `Y` Z' : 'M -0.025 -0.0 L 0.025 0.0 L `X` `Y` Z'\n // var path1 = (degrees < 45 || degrees > 135) ? 'M -0.0 -0.025 L 0.0 0.025 L ' : 'M -0.025 -0.0 L 0.025 0.0 L ';\n // Path: may have to change to create a better triangle\n var mainPath = \"M -0.0 -0.025 L 0.0 0.025 L \" // path1, \n // var mainPath = path1,\n pathX = String(x), \n space = ' ',\n pathY = String(y),\n pathEnd = ' Z';\n var path = mainPath.concat(pathX,space,pathY,pathEnd);\n\n console.log(`path: ${path}`);\n\n // Trig to calc meter point\n var layout = {\n height : 550,\n width: 550,\n shapes:[{\n type: 'path',\n path: path,\n fillcolor: '850000',\n line: {\n color: '850000',\n width: 8\n }\n }],\n title: `<b> Belly Button Washing Frequency </b> <br> Scrubs per week`,\n xaxis: {zeroline:false, showticklabels:false, showgrid: false, range: [-1, 1]},\n yaxis: {zeroline:false, showticklabels:false, showgrid: false, range: [-1, 1]}\n };\n\n // Define the data for the plot\n var data = [traceN, traceD];\n Plotly.newPlot(\"gauge\", data, layout);\n });\n}", "function main(){\n\n\n\n function testdoc(){\n let cd = new ChargingDock();\n\n let d1 = new Device(\"phone\",3000,10000);\n let d2 = new Device(\"laptop\",3000,15000);\n let d3 = new Device(\"laptop\",5000,15000);\n let d4 = new Device(\"tablet\",3000,15000);\n\n d1.use(90);\n d2.use(120);\n d3.use(90);\n d4.use(240);\n\n cd.plug(d1);\n cd.plug(d2);\n cd.plug(d3);\n cd.plug(d4);\n\n cd.chargeAll(60);\n\n cd.unplug(0);\n cd.unplug(1);\n\n }\n\n\n\n}" ]
[ "0.6679624", "0.66052204", "0.64913577", "0.64172804", "0.6097033", "0.59254885", "0.5911811", "0.57202566", "0.5657047", "0.5610527", "0.5512909", "0.5429407", "0.53891844", "0.53369075", "0.5314558", "0.5246025", "0.5242088", "0.52318966", "0.52155524", "0.52080446", "0.51900566", "0.51844615", "0.5160379", "0.5138007", "0.51285315", "0.50917315", "0.50868964", "0.5075035", "0.50647026", "0.50427943", "0.50426245", "0.5028412", "0.5018896", "0.50153244", "0.50153244", "0.5009142", "0.49933457", "0.4988167", "0.4988167", "0.49873683", "0.49852708", "0.49757957", "0.4963631", "0.49416408", "0.4936522", "0.4932193", "0.4930706", "0.4928614", "0.49241617", "0.49241617", "0.49241617", "0.49229658", "0.49228764", "0.49113858", "0.49103066", "0.4902431", "0.48990896", "0.4892312", "0.48865998", "0.48865998", "0.48717055", "0.4860853", "0.4840265", "0.4838093", "0.48365468", "0.48271114", "0.4814081", "0.48134446", "0.48073375", "0.48065987", "0.47990626", "0.47927064", "0.47870874", "0.47867733", "0.47861487", "0.47816035", "0.47731584", "0.47568542", "0.47536033", "0.47526398", "0.4748963", "0.47426385", "0.47374505", "0.47162655", "0.47129706", "0.47059283", "0.4704694", "0.46929315", "0.4687233", "0.4686598", "0.4681256", "0.4676382", "0.46759912", "0.46664098", "0.46637523", "0.46631452", "0.46613732", "0.46567777", "0.4650764", "0.4635644", "0.46349317" ]
0.0
-1
WISKI/KIWISbased gauges (currently grca & cvc) see notes for individual discrapncies for parsing grand river json data, see ~line 65 of accessed 20191204 also cf variable definitions in doesn't appear to accept a date parameter suggests that historical data is available elsewhere
async function getGrandJSON (stationData, needCors=true) { let id = stationData.gaugeID, url = `https://apps.grandriver.ca/waterdata/kiwischarts/wiskiData/RF_Charts_UpperGrand/${id}.json`, headers={'Spot-ID': stationData.slug}; if (needCors) {url = `${cors}${url}`;} return await fetch(url, {headers: headers}) .then ( async (res) => { console.log(res.headers.get('Content-Type')) return res.json() }) .then ( (json) => { console.log(json); return json[0].data} ) .catch(function(error){console.log(error);}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRelevantData(region, active, mapDate){\n var relevantData;\n switch(active){\n case \"Cumulative Fatalities\":\n relevantData = {\"English\": [region.properties.coronadata[mapDate].fatalities], \"Deutsch\": [region.properties.coronadata[mapDate].fatalities]};\n relevantData[\"English\"].push(\"Fatalities: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].fatalities));\n relevantData[\"English\"].push(\"Recovered: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].recovered));\n relevantData[\"English\"].push(\"Mortality Rate: \" + (region.properties.coronadata[mapDate].mortalityRate * 100).toFixed(3).toString() + \"%\");\n relevantData[\"Deutsch\"].push(\"Todesfälle: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].fatalities));\n relevantData[\"Deutsch\"].push(\"Genesen: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].recovered));\n relevantData[\"Deutsch\"].push(\"Sterblichkeitsrate: \" + (region.properties.coronadata[mapDate].mortalityRate * 100).toFixed(3).toString() + \"%\");\n return relevantData;\n case \"ICU-Occupancy\":\n relevantData = {\"English\": [100 * region.properties.coronadata[mapDate].its_belegt / (region.properties.coronadata[mapDate].its_belegt + region.properties.coronadata[mapDate].its_freie_betten)], \"Deutsch\": [100 * region.properties.coronadata[mapDate].its_belegt / (region.properties.coronadata[mapDate].its_belegt + region.properties.coronadata[mapDate].its_freie_betten)]};\n relevantData[\"English\"].push(\"ICU-Occupancy: \" + (100 * region.properties.coronadata[mapDate].its_belegt / (region.properties.coronadata[mapDate].its_belegt + region.properties.coronadata[mapDate].its_freie_betten)).toFixed(3) + \"%\");\n relevantData[\"English\"].push(\"Covid patients in ICU: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_covid_patienten));\n relevantData[\"English\"].push(\"Unoccupied ICU beds: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_freie_betten));\n relevantData[\"English\"].push(\"Unoccupied ventilators: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_freie_betten));\n relevantData[\"Deutsch\"].push(\"Intensivbettenbelegung: \" + (100 * region.properties.coronadata[mapDate].its_belegt / (region.properties.coronadata[mapDate].its_belegt + region.properties.coronadata[mapDate].its_freie_betten)).toFixed(3) + \"%\");\n relevantData[\"Deutsch\"].push(\"Coronapatienten auf Intensivstation: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_covid_patienten));\n relevantData[\"Deutsch\"].push(\"Freie Intensivbetten: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_freie_betten));\n relevantData[\"Deutsch\"].push(\"Freie Beatmungsgeräte: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].its_freie_betten));\n return relevantData;\n case \"7-Day-Incidence\":\n relevantData = {\"English\": [region.properties.coronadata[mapDate].incidentRate], \"Deutsch\": [region.properties.coronadata[mapDate].incidentRate]};\n relevantData[\"English\"].push(\"7-Day-Incidence: \" + region.properties.coronadata[mapDate].incidentRate.toFixed(3));\n relevantData[\"English\"].push(\"Cases (7 Days): \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].last7));\n relevantData[\"English\"].push(\"Population: \" + formatNumberWithSpaces(region.properties.population));\n relevantData[\"Deutsch\"].push(\"7-Tages-Inzidenz: \" + region.properties.coronadata[mapDate].incidentRate.toFixed(3));\n relevantData[\"Deutsch\"].push(\"Neue Fälle (7 Tage): \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].last7));\n relevantData[\"Deutsch\"].push(\"Einwohner: \" + formatNumberWithSpaces(region.properties.population));\n return relevantData;\n case \"New Cases(21 Days)\":\n relevantData = {\"English\": [region.properties.coronadata[mapDate].active], \"Deutsch\": [region.properties.coronadata[mapDate].active]};\n relevantData[\"English\"].push(\"New Cases(21 Days): \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].active));\n relevantData[\"English\"].push(\"Population: \" + formatNumberWithSpaces(region.properties.population));\n relevantData[\"English\"].push(\"Ratio: \" + (region.properties.coronadata[mapDate].active/region.properties.population * 100).toFixed(5) + \"%\");\n relevantData[\"Deutsch\"].push(\"Neue Fälle (21 Tage): \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].active));\n relevantData[\"Deutsch\"].push(\"Einwohner: \" + formatNumberWithSpaces(region.properties.population));\n relevantData[\"Deutsch\"].push(\"Verhältnis: \" + (region.properties.coronadata[mapDate].active/region.properties.population * 100).toFixed(5) + \"%\");\n return relevantData;\n case \"Cumulative Cases\":\n relevantData = {\"English\": [region.properties.coronadata[mapDate].confirmed], \"Deutsch\": [region.properties.coronadata[mapDate].confirmed]};\n relevantData[\"English\"].push(\"Total Cases: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].confirmed));\n relevantData[\"English\"].push(\"Population: \" + formatNumberWithSpaces(region.properties.population));\n relevantData[\"English\"].push(\"Ratio: \" + (region.properties.coronadata[mapDate].confirmed/region.properties.population * 100).toFixed(3) + \"%\");\n relevantData[\"Deutsch\"].push(\"Fälle Gesamt: \" + formatNumberWithSpaces(region.properties.coronadata[mapDate].confirmed));\n relevantData[\"Deutsch\"].push(\"Einwohner: \" + formatNumberWithSpaces(region.properties.population));\n relevantData[\"Deutsch\"].push(\"Verhältnis: \" + (region.properties.coronadata[mapDate].confirmed/region.properties.population * 100).toFixed(3) + \"%\");\n return relevantData;\n default:\n return [0,\"\",\"\",\"\"];\n }\n }", "function getYTDGuageStats(myGuageID){\n var currentYear=new Date().getFullYear();\n var beginDate= new Date(currentYear,0,1);\n var nDays=parseInt((new Date()-beginDate)/1000/60/60/24);\n myGuageIDuageID=\"09180500\";\n\n //var guageQuery = 'https://waterservices.usgs.gov/nwis/dv/?format=json&indent=on&sites=09180500&period=P5D&siteStatus=all';\n var guageQuery='https://waterservices.usgs.gov/nwis/dv/?format=json&indent=on&sites='+myGuageID+'&period=P'+nDays+'D&siteStatus=all';\n return guageQuery;\n}", "function wellParse(xml) {\n var data = $.parseXML(xml),\n $xml = $(xml),\n $record = $xml.find(\"WATER_LEVEL\");\n $($record).each(function() {\n var level = $(this).find(\"WATER_DEPTH\").text();\n var date = $(this).find(\"DATE_TIME\").text();\n var msmt = $(this).find(\"MEASUREMENT_METHOD\").text();\n \n //you could pad the min and max with some percent of the range \n if (parseFloat(level) < valmin) {\n valmin = parseFloat(level) - (parseFloat(level) * 0.1)\n }\n if (parseFloat(level) > valmax) {\n valmax = parseFloat(level) + (parseFloat(level) * 0.1)\n }\n\n if (msmt == \"Automatic Data Recorder\") { \n var insert = [new Date(date), level, null]\n dataArray.push(insert); \n } else {\n var insert = [new Date(date), null, level]\n dataArray.push(insert);\n }\n });\n \n hg.updateOptions({\n file: dataArray,\n labels: [\"Date\", \"ADR Level\", \"Manual Level\"],\n rollPeriod: 0,\n valueRange: [valmax, valmin],\n ylabel: \"ft below land surface\",\n xRangePad: 10,\n zoomCallback: function(minDate, maxDate) {\n //This happens when you do a zoom action on the hydrograph\n var min = new Date(minDate);\n var max = new Date(maxDate);\n $(\"#startdate\").val(formatDate(min));\n $(\"#enddate\").val(formatDate(max));\n },\n series: {\n 'Manual Level': {\n strokeWidth: 0.0,\n drawPoints: true,\n pointSize: 3,\n color: \"rgba(0, 43, 163, 0.78)\",\n fillAlpha: 0.2\n },\n 'ADR Level': {\n strokeWidth: 1.5,\n color: \"#279ff4\"\n }\n },\n visibility: [true, false]\n });\n \n hg.resetZoom();\n \n //sets the input date boxes to the dates when you first load the data into the hydrograph\n var start = new Date(hg.xAxisRange()[0])\n $(\"#startdate\").val(formatDate(start))\n var end = new Date(hg.xAxisRange()[1])\n $(\"#enddate\").val(formatDate(end));\n}", "function loadBoroughfloodinclayer(boroughfloodincdata){\r\nvar boroughfloodincjson = JSON.parse(boroughfloodincdata);\r\nvar features = []; \r\nfeatures = boroughfloodincjson.features; \r\nvar jproperties = boroughfloodincjson.features.map(function (el) { return el.properties; });\r\nvar i;\r\n//arrange data to anychart data format\r\nif (boroughfloodincarray = []){\r\nfor (i = 0; i < jproperties.length; i++) { \r\n\tboroughfloodincarray.push(Object.values(jproperties[i]));}\r\n}\r\nif (boroughfloodinc = []){\r\nfor (i = 0; i < boroughfloodincarray.length; i++) { \r\n\tboroughfloodinc.push([boroughfloodincarray[i][0],boroughfloodincarray[i][2],boroughfloodincarray[i][3]]);\r\n\t\r\n}\r\n}\r\n\r\n\r\n//layout child old data\r\nif (KingstonuponThamesCO = []){\r\nKingstonuponThamesCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nKingstonuponThamesCO.push([boroughfloodincarray[0][4].toString(),boroughfloodincarray[0][5].toString(),boroughfloodincarray[0][15].toString()]);}\r\n\r\n\r\nif (CroydonCO = []){\r\nCroydonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nCroydonCO.push([boroughfloodincarray[1][4].toString(),boroughfloodincarray[1][5].toString(),boroughfloodincarray[1][15].toString()]);}\r\n\r\nif (BromleyCO = []){\r\nBromleyCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nBromleyCO.push([boroughfloodincarray[2][4].toString(),boroughfloodincarray[2][5].toString(),boroughfloodincarray[2][15].toString()]);}\r\n\r\nif (HounslowCO = []){\r\nHounslowCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHounslowCO.push([boroughfloodincarray[3][4].toString(),boroughfloodincarray[3][5].toString(),boroughfloodincarray[3][15].toString()]);}\r\n\r\nif (EalingCO = []){\r\nEalingCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nEalingCO.push([boroughfloodincarray[4][4].toString(),boroughfloodincarray[4][5].toString(),boroughfloodincarray[4][15].toString()]);}\r\n\r\nif (HaveringCO = []){\r\nHaveringCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHaveringCO.push([boroughfloodincarray[5][4].toString(),boroughfloodincarray[5][5].toString(),boroughfloodincarray[5][15].toString()]);}\r\n\r\nif (HillingdonCO = []){\r\nHillingdonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHillingdonCO.push([boroughfloodincarray[6][4].toString(),boroughfloodincarray[6][5].toString(),boroughfloodincarray[6][15].toString()]);}\r\n\r\nif (HarrowCO = []){\r\nHarrowCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHarrowCO.push([boroughfloodincarray[7][4].toString(),boroughfloodincarray[7][5].toString(),boroughfloodincarray[7][15].toString()]);}\r\n\r\nif (BrentCO = []){\r\nBrentCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nBrentCO.push([boroughfloodincarray[8][4].toString(),boroughfloodincarray[8][5].toString(),boroughfloodincarray[8][15].toString()]);}\r\n\r\nif (BarnetCO = []){\r\nBarnetCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nBarnetCO.push([boroughfloodincarray[9][4].toString(),boroughfloodincarray[9][5].toString(),boroughfloodincarray[9][15].toString()]);}\r\n\r\nif (LambethCO= []){\r\nLambethCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nLambethCO.push([boroughfloodincarray[10][4].toString(),boroughfloodincarray[10][5].toString(),boroughfloodincarray[10][15].toString()]);}\r\n\r\nif (SouthwarkCO= []){\r\nSouthwarkCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nSouthwarkCO.push([boroughfloodincarray[11][4].toString(),boroughfloodincarray[11][5].toString(),boroughfloodincarray[11][15].toString()]);}\r\n\r\nif (LewishamCO= []){\r\nLewishamCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nLewishamCO.push([boroughfloodincarray[12][4].toString(),boroughfloodincarray[12][5].toString(),boroughfloodincarray[12][15].toString()]);}\r\n\r\nif (GreenwichCO= []){\r\nGreenwichCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nGreenwichCO.push([boroughfloodincarray[13][4].toString(),boroughfloodincarray[13][5].toString(),boroughfloodincarray[13][15].toString()]);}\r\n\r\nif (BexleyCO= []){\r\nBexleyCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nBexleyCO.push([boroughfloodincarray[14][4].toString(),boroughfloodincarray[14][5].toString(),boroughfloodincarray[14][15].toString()]);}\r\n\r\nif (EnfieldCO= []){\r\nEnfieldCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nEnfieldCO.push([boroughfloodincarray[15][4].toString(),boroughfloodincarray[15][5].toString(),boroughfloodincarray[15][15].toString()]);}\r\n\r\nif (WalthamForestCO= []){\r\nWalthamForestCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nWalthamForestCO.push([boroughfloodincarray[16][4].toString(),boroughfloodincarray[16][5].toString(),boroughfloodincarray[16][15].toString()]);}\r\n\r\nif (RedbridgeCO= []){\r\nRedbridgeCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nRedbridgeCO.push([boroughfloodincarray[17][4].toString(),boroughfloodincarray[17][5].toString(),boroughfloodincarray[17][15].toString()]);}\r\n\r\nif (SuttonCO= []){\r\nSuttonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nSuttonCO.push([boroughfloodincarray[18][4].toString(),boroughfloodincarray[18][5].toString(),boroughfloodincarray[18][15].toString()]);}\r\n\r\nif (RichmonduponThamesCO= []){\r\nRichmonduponThamesCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nRichmonduponThamesCO.push([boroughfloodincarray[19][4].toString(),boroughfloodincarray[19][5].toString(),boroughfloodincarray[19][15].toString()]);}\r\n\r\nif (MertonCO= []){\r\nMertonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nMertonCO.push([boroughfloodincarray[20][4].toString(),boroughfloodincarray[20][5].toString(),boroughfloodincarray[20][15].toString()]);}\r\n\r\nif (WandsworthCO= []){\r\nWandsworthCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nWandsworthCO.push([boroughfloodincarray[21][4].toString(),boroughfloodincarray[21][5].toString(),boroughfloodincarray[21][15].toString()]);}\r\n\r\nif (HammersmithandFulhamCO= []){\r\nHammersmithandFulhamCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHammersmithandFulhamCO.push([boroughfloodincarray[22][4].toString(),boroughfloodincarray[22][5].toString(),boroughfloodincarray[22][15].toString()]);}\r\n\r\nif (KensingtonandChelseaCO= []){\r\nKensingtonandChelseaCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nKensingtonandChelseaCO.push([boroughfloodincarray[23][4].toString(),boroughfloodincarray[23][5].toString(),boroughfloodincarray[23][15].toString()]);}\r\n\r\nif (WestminsterCO= []){\r\nWestminsterCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nWestminsterCO.push([boroughfloodincarray[24][4].toString(),boroughfloodincarray[24][5].toString(),boroughfloodincarray[24][15].toString()]);}\r\n\r\nif (WestminsterCO= []){\r\nWestminsterCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nWestminsterCO.push([boroughfloodincarray[24][4].toString(),boroughfloodincarray[24][5].toString(),boroughfloodincarray[24][15].toString()]);}\r\n\r\nif (CamdenCO= []){\r\nCamdenCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nCamdenCO.push([boroughfloodincarray[25][4].toString(),boroughfloodincarray[25][5].toString(),boroughfloodincarray[25][15].toString()]);}\r\n\r\nif (TowerHamletsCO= []){\r\nTowerHamletsCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nTowerHamletsCO.push([boroughfloodincarray[26][4].toString(),boroughfloodincarray[26][5].toString(),boroughfloodincarray[26][15].toString()]);}\r\n\r\nif (IslingtonCO= []){\r\nIslingtonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nIslingtonCO.push([boroughfloodincarray[27][4].toString(),boroughfloodincarray[27][5].toString(),boroughfloodincarray[27][15].toString()]);}\r\n\r\nif (HackneyCO= []){\r\nHackneyCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHackneyCO.push([boroughfloodincarray[28][4].toString(),boroughfloodincarray[28][5].toString(),boroughfloodincarray[28][15].toString()]);}\r\n\r\nif (HaringeyCO= []){\r\nHaringeyCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nHaringeyCO.push([boroughfloodincarray[29][4].toString(),boroughfloodincarray[29][5].toString(),boroughfloodincarray[29][15].toString()]);}\r\n\r\nif (NewhamCO= []){\r\nNewhamCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nNewhamCO.push([boroughfloodincarray[30][4].toString(),boroughfloodincarray[30][5].toString(),boroughfloodincarray[30][15].toString()]);}\r\n\r\nif (BarkingandDagenhamCO= []){\r\nBarkingandDagenhamCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nBarkingandDagenhamCO.push([boroughfloodincarray[31][4].toString(),boroughfloodincarray[31][5].toString(),boroughfloodincarray[31][15].toString()]);}\r\n\r\nif (CityofLondonCO= []){\r\nCityofLondonCO.unshift([\"Child AGE %\",\"Old AGE %\",\"Working AGE %\"]);\r\nCityofLondonCO.push([boroughfloodincarray[32][4].toString(),boroughfloodincarray[32][5].toString(),boroughfloodincarray[32][15].toString()]);}\r\n\r\nif (boroughfloodinclayer){\r\n\t\tmymap.removeLayer(boroughfloodinclayer);\r\n\t}\r\n\t\r\nif (pumpstationlayer){\r\n\tmymap.removeLayer(pumpstationlayer);\r\n}\r\nif (floodrisklayer){\r\n\tmymap.removeLayer(floodrisklayer);\r\n}\r\n\r\n// REMOVING PREVIOUS INFO BOX\r\nif (legend != undefined) {\r\nlegend.remove();\r\n}\r\n\r\nboroughfloodinclayer=L.geoJson(boroughfloodincjson, {style: FloodIncBostyle,onEachFeature: onEachfloodincboFeature}).addTo(mymap);\r\n// change the map zoom so that all the data is shown\r\nmymap.fitBounds(boroughfloodinclayer.getBounds());\r\n\r\nlegend = L.control({position: 'bottomright'});\r\n\r\nlegend.onAdd = function (mymap) {\r\n\r\n\tvar div = L.DomUtil.create('div', 'info legend'),\r\n\t\tgrades = [407,290,229,165,100 ],\r\n\t\tlabels = [],\r\n\t\tfrom, to;\r\n\r\n\tfor (var i = 0; i < grades.length; i++) {\r\n\t\tfrom = grades[i];\r\n\t\tto = grades[i + 1];\r\n\r\n\t\tlabels.push(\r\n\t\t\t'<i style=\"background:' + getFloodIncBoColor(from + 1) + '\"></i> ' +\r\n\t\t\tfrom + (to ? '&ndash;' + to : '+'));\r\n\t}\r\n\r\n\tdiv.innerHTML = labels.join('<br>');\r\n\treturn div;\r\n};\r\n\r\nlegend.addTo(mymap);\r\nanychart.onDocumentReady(chartfloodinc);\r\n}", "function _getBadgeDateStatistics() {\n\n var limit = 8;\n var contract = {\n \"function\": \"sm_getBadgeDateStatistics\",\n \"args\": JSON.stringify([gWalletAddress])\n }\n\n return neb.api.call(getAddressForQueries(), gdAppContractAddress, gNasValue, gNonce, gGasPrice, gGasLimit, contract);\n\n}", "function getGes (data,symbol){\n var base= data.base\nvar symbol=symbol\nvar str= JSON.stringify(data.rates)\nvar geo= str.replace(/[^a-z]|\\s+|\\r?\\n|\\r/gmi, \" \").trim().replace( /(?!\\s+$)\\s+/g, \" \" ).replace(/[“”‘’]/g,'').split(\" \");;\nconsole.log(geo);\ngeoesx=geo\nrednerHTML(geo,base,symbol)\n}", "function BuildsHistory()\n{\n var BuildN2ReleaseDate =\n {\n 7601: \"15.03.2011\", // SP1\n 9600: \"27.08.2013\", // RTM: August 27, 2013, GA: October 17, 2013\n 9841: \"01.10.2014\",\n 9860: \"21.10.2014\",\n 9879: \"12.11.2014\",\n 9926: \"23.01.2015\",\n 10041: \"18.03.2015\",\n 10049: \"31.03.2015\",\n 10061: \"22.04.2015\",\n 10074: \"26.04.2015\",\n 10122: \"20.05.2015\",\n 10125: \"25.05.2015\",\n 10130: \"29.05.2015\",\n 10134: \"05.06.2015\",\n 10135: \"05.06.2015\",\n 10147: \"18.06.2015\",\n 10158: \"30.06.2015\",\n 10159: \"30.06.2015\",\n 10162: \"02.07.2015\",\n 10166: \"09.07.2015\",\n 10240: \"15.07.2015\", // Windows 10 RTM\n 10525: \"08.08.2015\",\n 10532: \"28.08.2015\",\n 10547: \"18.09.2015\",\n 10565: \"12.10.2015\",\n 10576: \"29.10.2015\",\n 10586: \"05.11.2015\", // th1\n 11082: \"17.12.2015\",\n 11099: \"13.01.2016\",\n 11102: \"20.01.2016\",\n 14251: \"27.01.2015\",\n 14257: \"04.02.2016\",\n 14267: \"18.02.2016\",\n 14271: \"24.02.2016\",\n 14279: \"04.03.2016\",\n 14291: \"18.03.2016\",\n 14295: \"25.03.2016\",\n 14316: \"06.04.2016\",\n 14328: \"22.04.2016\",\n 14332: \"27.04.2016\",\n 14342: \"11.05.2016\",\n 14352: \"27.05.2016\",\n 14361: \"08.06.2016\",\n 14366: \"15.06.2016\",\n 14367: \"17.06.2016\",\n 14371: \"22.06.2016\",\n 14372: \"24.06.2016\",\n 14376: \"29.06.2016\",\n 14379: \"01.07.2016\",\n 14383: \"08.07.2016\",\n 14385: \"10.07.2016\",\n 14388: \"13.07.2016\",\n 14390: \"15.07.2016\",\n 14393: \"19.07.2016\", //\n 14901: \"12.08.2016\",\n 14905: \"17.08.2016\",\n 14915: \"31.08.2016\",\n 14926: \"14.09.2016\",\n 14931: \"22.09.2016\",\n 14936: \"28.09.2016\",\n 14942: \"07.10.2016\",\n 14946: \"13.10.2016\",\n 14951: \"20.10.2016\" \n };\n\n ///////////////////////////////////////////////////////////////////////////////\n var R500 = false; // Developer hint: is set true when run at developer Thinkpad\n ///////////////////////////////////////////////////////////////////////////////\n\n //\n // Input:\n // regObj - myStdReg class object created by the caller\n // path - Registry path which contains necessary values\n // bObj - Build object created by the caller\n // Function gets necessary data from the Registry using\n // methods of the class myStdReg and set bObj properties.\n // Updated bObj is returned to the caller. \n // Function is called some times from the main function\n // BuildsHistory() and returns updated object.\n // \n function SetBuildObjectProperties( regObj, path, bObj )\n {\n var HKLM = 0x80000002;// HKEY_LOCAL_MACHINE\n var res, props;\n\n bObj.BuildLabEx = regObj.RegReadStringValue( HKLM, path, \"BuildLabEx\" );\n bObj.BuildNumber = parseInt( bObj.BuildLabEx.split( \".\" )[ 0 ] );\n bObj.InstallDate = regObj.RegReadDWORDValue( HKLM, path, \"InstallDate\" );\n bObj.InstallDateString = regObj.RegDateToDate( bObj.InstallDate ).DateToDDMMYYYY(); \n if ( bObj.BuildNumber > 9600 )\n {\n bObj.InstallTime = regObj.RegReadQWORDValue( HKLM, path, \"InstallTime\" );\n }\n bObj.ProductName = regObj.RegReadStringValue( HKLM, path, \"ProductName\" );\n bObj.ProductId = regObj.RegReadStringValue( HKLM, path, \"ProductId\" );\n res = regObj.RegReadStringValue( HKLM, path, \"BuildBranch\" ); \n if ( typeof( res ) == \"string\" ) { bObj.BuildBranch = res; } \n res = regObj.RegReadStringValue( HKLM, path, \"ReleaseId\" );\n if ( typeof( res ) == \"string\" ) { bObj.ReleaseId = res; }\n res = regObj.RegReadDWORDValue( HKLM, path, \"UBR\" ); \n if ( typeof( res ) == \"number\" ) { bObj.UBR = res; } \n \n return bObj;\n }\n\n // \n // Function counts duration of the Windows 10 build installation on base of \n // the two Build objects.\n // New - current Build object in the sorted array of the builds objects\n // Old - previous Build object in the sorted array of the builds objects\n // New.InstallDate - indicates End of the installation of the current build\n // Old.UpgradeDate - indicates Start of the installation of the current build \n // \n function CountDuration( New, Old )\n {\n var Seconds = New.InstallDate - Old.UpgradeDate;\n var Minutes = Math.round( Seconds / 60 );\n return Minutes.toString();\n }\n\n function ReorderProperties( obj )\n {\n var tmp = {};\n tmp.BuildNumber = obj.BuildNumber;\n tmp.BuildLabEx = obj.BuildLabEx;\n tmp.RegPath = obj.RegPath;\n tmp.InstallDateString = obj.InstallDateString;\n if ( obj.UpgradeDateString != null )\n {\n tmp.UpgradeDateString = obj.UpgradeDateString;\n }\n if ( typeof( obj.InstallDuration ) == \"string\" )\n {\n tmp.InstallDuration = obj.InstallDuration;\n tmp.ExplainDuration = obj.ExplainDuration;\n }\n tmp.InstallDate = obj.InstallDate;\n if ( obj.UpgradeDate != null )\n {\n tmp.UpgradeDate = obj.UpgradeDate;\n } \n if ( tmp.BuildNumber > 9600 )\n {\n tmp.InstallTime = obj.InstallTime;\n }\n tmp.ProductName = obj.ProductName;\n tmp.ProductId = obj.ProductId;\n if ( tmp.BuildNumber >= 10122 )\n {\n tmp.BuildBranch = obj.BuildBranch;\n }\n if ( tmp.BuildNumber >= 10565 )\n {\n tmp.ReleaseId = obj.ReleaseId;\n }\n if ( tmp.BuildNumber >= 10122 )\n {\n tmp.UBR = obj.UBR;\n }\n tmp.BuildWasReleased = obj.BuildWasReleased;\n tmp.InstallOnTheFlight = obj.InstallOnTheFlight;\n return tmp;\n }\n\n var myRegObj = new myStdReg();// create service object to work with Registry\n\n var HKLM = 0x80000002;// HKEY_LOCAL_MACHINE\n\n var bObj = {}, builds = [], rc, res;\n\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Verify if we are running at developer computer:\n // in this case will need to correct time zone for the string dates\n // less then 14.01.2016 as all previous dates were saved in the \n // time zone which differs current one.\n //\n var path = \"HARDWARE\\\\DESCRIPTION\\\\System\\\\MultifunctionAdapter\\\\0\\\\DiskController\\\\0\\\\DiskPeripheral\\\\0\";\n var MyId = myRegObj.RegReadStringValue( HKLM, path, \"Identifier\" );\n\n R500 = ( MyId == \"9f9c4a4c-80d01f2a-A\" ); // is true until developer SSD is alive... \n\n if ( R500 )\n {\n WScript.StdErr.WriteLine( \"*** Running at developer computer ***\" );\n }\n ////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n //\n // Step 1, we will set some of the current Build object properties. \n // HKLM\\SYSTEM\\Setup, value with the name CloneTag contains date of uninstallation\n // of the previous build and build number of the previous build. Though it seems\n // that time stamp of the previous build uninstallation is also timestamp for the \n // current build installation, we will use another source to get precise value \n // of this date together with some more properties of the current build object.\n //\n\n var regPath1 = \"SYSTEM\\\\Setup\";\n var regPath2 = \"SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"; \n\n bObj = SetBuildObjectProperties( myRegObj, regPath2, {} );\n bObj.RegPath = regPath2;\n builds[ 0 ] = bObj;\n\n //\n // Step 2, we will enumerate all builds present in HKLM\\SYSTEM\\Setup. \n // They are pesented by subkeys with a names like \n // \"Source OS (Updated on 3/31/2015 14:44:13)\". Thus we will enumerate\n // subkeys of HKLM\\SYSTEM\\Setup, then filer those subkeys which\n // corresponds to the builds and create objects for them.\n //\n\n var key = regPath1, path, p, needKey = \"Source OS (Updated on \";\n var needKeyL = needKey.length, tmp1, tmp2, tmp3, rc;\n \n res = myRegObj.RegEnumSubKeys( HKLM, regPath1 );\n\n for ( var i = 0; i < res.length; i++ ) // In this loop we filter out \n { // unnecessary subkeys. \n p = res[ i ].indexOf( needKey ); // Try to detect if we need subkey\n if ( p > - 1 ) // Yes, subkey presents Build and\n { // we will create Build object\n bObj = new Object; // and set object properties\n\n bObj.RegPath = regPath1 + \"\\\\\" + res[ i ];\n\n p += needKeyL;\n\n // get date field from subkey and save it in tmp1\n tmp1 = res[ i ].substr( p, res[ i ].indexOf( \")\", p ) - 1 );\n tmp1 = tmp1.substr( 0, tmp1.length - 1 ).strip();\n\n /////////////////////////////////////////////////////////////////////\n if ( R500 //&& res[ i ].BuildNumber < 10586 )\n && tmp1.indexOf( \"2015\" ) > - 1 \n && tmp1.indexOf( \"12/16/2015\" ) == - 1 )\n {\n WScript.StdErr.WriteLine( tmp1 + \"\\n\" ); \n /*\n This is \"What-For\" R500 variable was defined: set correct\n time zone for the Upgrade Dates presented by the Strings \n like \"Source OS (Updated on 7/16/2015 09:58:26)\"\n */\n tmp1 += \" UTC+03\"; // set correct time zone\n }\n /////////////////////////////////////////////////////////////////////\n\n tmp3 = new Date( tmp1 );\n bObj.UpgradeDate = Math.round( tmp3.getTime() / 1000 );\n bObj.UpgradeDateString = tmp3.DateToDDMMYYYY();\n\n path = key + \"\\\\\" + res[ i ]; // prepare path for reading values\n bObj = SetBuildObjectProperties( myRegObj, path, bObj );\n builds[ builds.length ]= bObj; \n }\n }\n \n //\n // Step 3, define Sort function for the array of the builds \n // and sort that array by the key = ( BuildNumber, InstallDate )\n //\n builds.sort( function( a, b )\n {\n if ( a.BuildNumber < b.BuildNumber ) return 1;\n if ( a.BuildNumber > b.BuildNumber ) return -1;\n if ( a.InstallDate < b.InstallDate ) return 1;\n if ( a.InstallDate > b.InstallDate ) return -1; \n return 0;\n } );\n\n builds.sort(); // \n\n //\n // Step 4, now we can count Installation duration as a value\n // of ( previous object UpgradeDate - current object InstallDate )\n //\n for ( var i = 0; i < builds.length; i++ )\n {\n tmp1 = BuildN2ReleaseDate[ builds[ i ].BuildNumber ];\n builds[ i ].BuildWasReleased = tmp1;\n tmp2 = builds[ i ].InstallDateString.split( \" \" )[ 0 ];\n builds[ i ].InstallOnTheFlight = ( tmp1 == tmp2 );\n\n if ( i > 0 )\n {\n builds[ i ].InstallDuration = CountDuration( builds[ i ], builds[ i - 1 ] ); \n builds[ i ].ExplainDuration = builds[ i ].InstallDuration + \" minutes = (\" + \n builds[ i ].InstallDate.toString() + \"-\" + builds[ i - 1 ].UpgradeDate.toString() + \")/60\";\n }\n\n //\n // Step 5, reorder objects properties\n //\n builds[ i ] = ReorderProperties( builds[ i ] );\n }\n // all Builds presentaion objects were\n return builds; // created. Return to the caller an array\n} // of the objects created.", "function processGrowData(data) {\n // The order of GROW variables returned is not consistent\n // So we need to check if the variable names match\n // Before assigning them to their javascript variables\n if (data['Data'][0]['VariableCode'] == 'Thingful.Connectors.GROWSensors.air_temperature') {\n air_temperature = data['Data'][0]['Data'];\n } else if (data['Data'][0]['VariableCode'] == 'Thingful.Connectors.GROWSensors.calibrated_soil_moisture') {\n soil_moisture = data['Data'][0]['Data'];\n } else {\n light = data['Data'][0]['Data'];\n }\n\n if (data['Data'][1]['VariableCode'] == 'Thingful.Connectors.GROWSensors.air_temperature') {\n air_temperature = data['Data'][1]['Data'];\n } else if (data['Data'][1]['VariableCode'] == 'Thingful.Connectors.GROWSensors.calibrated_soil_moisture') {\n soil_moisture = data['Data'][1]['Data'];\n } else {\n light = data['Data'][1]['Data'];\n }\n\n if (data['Data'][2]['VariableCode'] == 'Thingful.Connectors.GROWSensors.air_temperature') {\n air_temperature = data['Data'][2]['Data'];\n } else if (data['Data'][2]['VariableCode'] == 'Thingful.Connectors.GROWSensors.calibrated_soil_moisture') {\n soil_moisture = data['Data'][2]['Data'];\n } else {\n light = data['Data'][2]['Data'];\n }\n window.grow_air_temperature = air_temperature;\n window.grow_soil_moisture = soil_moisture;\n drawGrowChart(air_temperature, soil_moisture, light);\n}", "function DataUrl() \n{ \n var url = \"json.php?bucket=m\";\n url += \"&customer=\";\n if (params['customer'])\n {\t\n url += params['customer'];\n }\n url += \"&product=\";\n if (params['product'])\n {\t\n url += params['product'];\n }\n url += \"&os=\";\n if (params['os'])\n {\t\n url += params['os'];\n }\n url += \"&software1=\";\n if (params['software1'])\n {\n url += params['software1'];\n }\n url += \"&software2=\";\n if (params['software2'])\n {\n url += params['software2'];\n }\n url += \"&software3=\";\n if (params['software3'])\n {\n url += params['software3'];\n }\n url += \"&from=\";\n url += Math.floor(lookback);\n return url; \n}", "function gVizloaded() {\n\nconsole.log(\"google visualization is loaded!\");\n\n\n//the url is split on the question mark \"?\"\n//if there's a question mark and something on the other side, its a 2 item array\n//if the length is greater than 1 there's something in the url\n//if its 1 or less than 1, then there's nothing in the url and default year is added\n\n\n\tvar mURL = History.getState().cleanUrl;\n\tvar mqueryArray = mURL.split(\"?\");\n\n//default year is 1990 but if the length of the queryarray exceeds 1, \n//default year becomes the queryarray split, and the second half is taken\n\n\tvar mdefaultYear = \"1990\";\n\n\tif (mqueryArray.length > 1) {\n\n\t\tmdefaultYear = mqueryArray[1].split(\"=\")[1];\n\t}\n\n\n\n//$ is a jquery function, refers back to index page, when the button is clicked, new data is shown\n//as it starts with a \".\"\" grab by class name\n\n\n$(\".btn-success\").on(\"click\", displayNewData);\n\n//here, the hash # says to grab by id, ie the year\n//the round parenthesis () indicates that click is a function and not a property (as it might be since it comes after a \".\")\n\n$(\"#year_\"+mdefaultYear).click();\n\n\n}", "function getGrainsDisplay( date , grain ){\n var formatMap = {\n 'day': 'D',\n 'week': '[W]WW',\n 'month': 'MMM',\n 'quarter': '[Q]QQ',\n 'year': 'YYYY'\n };\n return date.format( formatMap[grain] );\n }", "function getDataGauge(sample_id) {\n var url_gauge = \"/wfreq/\" + sample_id;\n\n Plotly.d3.json(url_gauge, function (error, dataGaugue) {\n\n gaugeChart(dataGaugue);\n });\n}", "function guage(sample) {\n d3.json(\"samples.json\").then((data) => {\n\n // Create Variable for Hands Washed Guage\n var metadata = data.metadata;\n\n // Filter Variable\n var demographic = metadata.filter(value => value.id == sample);\n\n // Filter Variable\n var wfreq = demographic[0].wfreq; \n \n // Log to Console to Inspect\n console.log(wfreq)\n\n // Create Trace for Guage\n var traceGuage = [\n {\n type: \"indicator\",\n mode: \"gauge+number+delta\",\n value: wfreq,\n title: { text: \"Belly Button Scrubs Per Week\", font: { size: 24 }, },\n gauge: {\n steps: [\n { range: [0, 1], color: \"PaleGoldenRod\"},\n { range: [1, 2], color: \"Khaki\"},\n { range: [2, 4], color: \"Yellow\"},\n { range: [4, 8], color: \"YellowGreen\"},\n { range: [8,10], color: \"lime\"},\n // { range: [7,8], color: \"Green\"}\n ],\n axis: { range: [null, 10], tickwidth: 1, tickcolor: \"black\" },\n bar: { color: \"SlateGray\" },\n bgcolor: \"white\",\n borderwidth: 2,\n bordercolor: \"black\",\n }\n }\n\n ];\n \n var layout = {\n width: 450,\n height: 400,\n margin: { t: 25, r: 25, l: 25, b: 25 },\n paper_bgcolor: \"lavender\",\n font: { color: \"black\", family: \"Arial\" }\n };\n \n Plotly.newPlot('gauge', traceGuage, layout)\n });\n}", "_computeChartData(data, gitVersionsData)\n {\n const gitReleases = gitVersionsData.gitVersions.releases;\n let result = {};\n\n for (const key in data)\n {\n const row = data[key];\n const date = new Date(row.date);\n let version = row['Git version'];\n const users = +row.users;\n\n if (row.date === undefined)\n continue;\n\n if (!(date in result))\n result[date] =\n {\n date: date,\n recommended: 0,\n outdated: 0,\n vulnerable: 0,\n unknown: 0,\n };\n\n while (version.split('.').length < 3)\n version += '.0';\n\n const versionMajor = version.split('.')[0];\n\n if (versionMajor == '0' || versionMajor == '1')\n {\n result[date].vulnerable += users;\n continue;\n }\n\n if (!(version in gitReleases))\n {\n // If an unknown version was found, show the “unknown” dataset\n if (this.config.datasets.indexOf('unknown') === -1)\n this.config.datasets.push('unknown');\n\n result[date].unknown += users;\n continue;\n }\n\n if ('vulnerableSince' in gitReleases[version]\n && gitReleases[version].vulnerableSince < date)\n {\n result[date].vulnerable += users;\n continue;\n }\n\n if ('outdatedSince' in gitReleases[version]\n && gitReleases[version].outdatedSince < date)\n {\n result[date].outdated += users;\n continue;\n }\n\n result[date].recommended += users;\n }\n\n // Turn dictionary with date as key into a plain array\n return Object.keys(result).map(key => result[key]);\n }", "function GetGasData() {\n // Data of today\n var yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n var day = yesterday.getDate();\n var month = yesterday.getMonth()+ 1; //needed to fix month\n var year = yesterday.getFullYear();\n // calculated day of yesterday in dd-mm-yyyy format\n var daybefore = day + \"-\" + month + \"-\" + year;\n\n // get meter info\n var url = 'php/api.php?action=getRrdData&loggerName=gas_quantity&rra=10yrdays&from='+ daybefore;\n$.ajax({\n \"url\":url,\n \"dataType\":\"JSON\",\n \"method\":\"POST\",\n \"data\":{\n \"command\":\"GAS\"\n },\n \"success\":function(resp) {\n if (resp.success) {\n console.log('Get gas values');\n // get data\n dashboard.fillDataGas(resp.return);\n //dashboard.refresh()\n } else {\n console.log('error geting data gas'+ resp);\n }\n },\n \"failure\":function(resp) {\n console.log('Failure geting data gas');\n },\n \"error\":function(resp) {\n console.log('Error' + resp);\n }\n});\n }", "function jd_data(njd){\n // funzione per il calcolo della data dal numero del giorno giuliano.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) novembre 2011.\n // restituisce i valori numerici gg/mm/yy.\n // il valore gg è in giorni e ore decimali. Moltiplicare la parte decimale di qq. x24.per avere le ore.\n // njd=numero del giorno giuliano.\n \n var I=parseInt(njd+0.50);\n var F=(njd+0.50)-I;\n var A=0;\n var B=0;\n\n if (I>=2229160){A=parseInt((I-1867216.25)/36524.25); B=I+1+A-parseInt(A/4);}\nelse {B=I;}\n\nvar C=B+1524;\nvar D=parseInt((C-122.1)/365.25);\nvar E=parseInt(365.25*D);\nvar G=parseInt((C-E)/30.6001);\n\n// recupero del giorno.\n\nvar giorno=C-E+F-parseInt(30.6001*G); // giorno con ore decimali.\n giorno=giorno; // toFixed(6)\n\n // recupero del mese.\n\nvar mese=0;\n\n if (G<13.5) {mese=G-1; }\nelse if (G>13.5) {mese=G-13; }\n\n // recupero dell'anno.\n\nvar anno=0;\n\n if (mese>2.5) {anno=D-4716; }\nelse if (mese<2.5) {anno=D-4715; }\n\n njd=jdHO(njd); // riporta il giorno giuliano (njd), alle ore 0(zero) del giorno.\n\nvar gio_sett=(njd+1.5)%7; // recupera il resto: calcola il numero del giorno della settimana (0=domenica, 1=lunedì....)\nvar gio_sett_n=gio_sett; // giorno della settimana numerico.\n \nvar gio_sett_en=\"\"; // giorno della settimana in inglese.\n\n if(gio_sett==0){gio_sett=\"Do\"; gio_sett_en=\"Su\"; }\nelse if(gio_sett==1){gio_sett=\"Lu\"; gio_sett_en=\"Mo\"; }\nelse if(gio_sett==2){gio_sett=\"Ma\"; gio_sett_en=\"Tu\"; }\nelse if(gio_sett==3){gio_sett=\"Me\"; gio_sett_en=\"We\"; }\nelse if(gio_sett==4){gio_sett=\"Gi\"; gio_sett_en=\"Th\"; }\nelse if(gio_sett==5){gio_sett=\"Ve\"; gio_sett_en=\"Fr\"; }\nelse if(gio_sett==6){gio_sett=\"Sa\"; gio_sett_en=\"Sa\"; }\n\nvar data_calendario=new Array(giorno,mese,anno,gio_sett,gio_sett_en,gio_sett_n);\n // array 0 1 2 3 4 5 \n\nreturn data_calendario;\n\n\n}", "function dataLoaded(BIRDS) {\n\n\t//Turning json object into array of arrays\n\tvar birdData = BIRDS.Data;\n\tvar birdName = birdData[0].Name;\n\tvar dataArray = [];\n\tvar dataHeaders = [\"Year\",\"Number Struck\"];\n\tdataArray.push(dataHeaders);\n\tfor(var i=1;i<birdData.length;i++){\n\t\tvar currObj = birdData[i];\n\t\t\n\t\t//Something strange is happening with date formatting, so the formatted date is not being passed to the array\n\t\t//for now\n\t\tvar currDate = new Date(currObj.Year);\n\t\tconsole.log(currDate);\n\t\t\n\t\tvar currArray = [currObj.Year,currObj.Value];\n\t\tdataArray.push(currArray);\n\t}\n\t\n\tvar data = google.visualization.arrayToDataTable(dataArray);\n\tvar options = {\n\t\ttitleTextStyle : {\n\t\t\tfontName: 'Georgia',\n\t\t\tfontSize: 22,\n\t\t},\n\t\tbackgroundColor : {\n\t\t\tfill : '#fdf9f3',\n\t\t},\n\t\tlegend : {\n\t\t\tposition : 'none',\n\t\t},\t\n\t\theight : 400,\n\t\twidth : 820,\n\t\t//chartArea : {\n\t\t//\tleft: 30\n\t\t//},\n\t\tvAxis : {\n\t\t\ttitle : 'Number',\n\t\t\tbaselineColor : '#000',\n\t\t\t//gridlines : {\n\t\t\t//\tcolor : '#fdf9f3'\n\t\t\t//}\n\t\t},\n\t\thAxis : {\n\t\t\ttitle : 'Year',\n\t\t\tticks: ['1990','1995','2000','2005','2010']\n\t\t},\n\t\tcolors : ['#50a6c2', '#af593d']\n\t};\n\tvar chart = new google.visualization.ColumnChart(document.getElementById('data'));\n\tchart.draw(data, options);\n}", "function updateGauges() {\n if (i >= 0) {\t// initially use a faster interval and sweep the gauge\n {\n for (var key in gauges) {\n gauges[key].redraw(i);\n }\n if (i === 0) {\n clearInterval(interv0);\n interv0 = setInterval(updateGauges, 75);\n }\n i = i + 5;\n if (i > 100) {\n i = -1;\n clearInterval(interv0);\n interv0 = setInterval(updateGauges, 1000);\t// restore a normal interval\n }\n }\n } else {\n\t // pass a data array to dashboard.js's UpdateDashboard(values for named gauges)\n for (var key in gauges) {\n /*\n\t\t readings[key] = readings[key] + 10*Math.random()-5;\n\t\t if (readings[key]<0)\n\t\t\t readings[key] = 0;\n\t\t if (readings[key]>100)\n\t\t\t readings[key] = 100;\n\t\t\t */\n console.log(key);\n console.log(readings[key]);\n gauges[key].redraw(readings[key]);\n }\n }\n }", "function getModisData(args){\r\n \r\n var defaultArgs = {\r\n 'startYear': null,\r\n 'endYear': null,\r\n 'startJulian' : null,\r\n 'endJulian' : null,\r\n 'daily':true,\r\n 'maskWQA':false,\r\n 'zenithThresh' :90,\r\n 'useTempInCloudMask': true,\r\n 'addLookAngleBands' : false,\r\n 'resampleMethod' : 'bicubic'};\r\n \r\n \r\n var args = prepArgumentsObject(arguments,defaultArgs);\r\n \r\n \r\n var a250C;var t250C;var a500C;var t500C;var a1000C;var t1000C;\r\n var a250CV6;var t250CV6;var a500CV6;var t500CV6;var a1000CV6;var t1000CV6;\r\n var viewAngleBandNames;\r\n //Find which collections to pull from based on daily or 8-day\r\n if(args.daily === false){\r\n a250C = modisCDict.eightDaySR250A;\r\n t250C = modisCDict.eightDaySR250T;\r\n a500C = modisCDict.eightDaySR500A;\r\n t500C = modisCDict.eightDaySR500T;\r\n a1000C = modisCDict.eightDayLST1000A;\r\n t1000C = modisCDict.eightDayLST1000T;\r\n \r\n viewAngleBandNames = compositeViewAngleBandNames;\r\n }\r\n else{\r\n a250C = modisCDict.dailySR250A;\r\n t250C = modisCDict.dailySR250T;\r\n a500C = modisCDict.dailySR500A;\r\n t500C = modisCDict.dailySR500T;\r\n a1000C = modisCDict.dailyLST1000A;\r\n t1000C = modisCDict.dailyLST1000T;\r\n \r\n viewAngleBandNames = dailyViewAngleBandNames;\r\n }\r\n \r\n //Pull images from each of the collections \r\n var a250 = ee.ImageCollection(a250C)\r\n .filter(ee.Filter.calendarRange(args.startYear,args.endYear,'year'))\r\n .filter(ee.Filter.calendarRange(args.startJulian,args.endJulian))\r\n .select(modis250SelectBands,modis250BandNames);\r\n \r\n \r\n var t250 = ee.ImageCollection(t250C)\r\n .filter(ee.Filter.calendarRange(args.startYear,args.endYear,'year'))\r\n .filter(ee.Filter.calendarRange(args.startJulian,args.endJulian))\r\n .select(modis250SelectBands,modis250BandNames);\r\n \r\n // var af = ee.Image(a250.first());\r\n // var tf = ee.Image(t250.first());\r\n // var abit1 = af.select(['QC_250m']).bitwiseAnd(Math.pow(2,1));\r\n // var tbit1 = tf.select(['QC_250m']).bitwiseAnd(Math.pow(2,1));\r\n // var abit8 = af.select(['QC_250m']).bitwiseAnd(Math.pow(2,8));\r\n // var tbit8= tf.select(['QC_250m']).bitwiseAnd(Math.pow(2,8));\r\n // Map.addLayer(abit1,{min:0,max:2},'abit1')\r\n // Map.addLayer(tbit1,{min:0,max:2},'tbit1')\r\n // Map.addLayer(abit8,{min:0,max:2},'abit8')\r\n // Map.addLayer(tbit8,{min:0,max:2},'tbit8')\r\n // Map.addLayer(a250.count(),{min:0,max:16},'aCount')\r\n // Map.addLayer(t250.count(),{min:0,max:16},'tCount')\r\n // Map.addLayer(a250.select(modis250SelectBands,modis250BandNames),{},'a')\r\n // Map.addLayer(t250.select(modis250SelectBands,modis250BandNames),{},'t')\r\n function get500(c){\r\n var images = ee.ImageCollection(c)\r\n .filter(ee.Filter.calendarRange(args.startYear,args.endYear,'year'))\r\n .filter(ee.Filter.calendarRange(args.startJulian,args.endJulian));\r\n \r\n //Mask pixels above a certain zenith\r\n if(args.daily === true){\r\n if(args.maskWQA === true){print('Masking with QA band:',c)}\r\n images = images\r\n .map(function(img){\r\n img = img.mask(img.mask().and(img.select(['SolarZenith']).lt(args.zenithThresh*100)));\r\n if(args.maskWQA === true){\r\n \r\n img = maskCloudsWQA (img);\r\n }\r\n return img;\r\n });\r\n }\r\n if(args.addLookAngleBands){\r\n images = images.select(ee.List(modis500SelectBands).cat(viewAngleBandNames),ee.List(modis500BandNames).cat(viewAngleBandNames));\r\n }else{\r\n images = images.select(modis500SelectBands,modis500BandNames);\r\n }\r\n return images;\r\n } \r\n \r\n var a500 = get500(a500C);\r\n var t500 = get500(t500C);\r\n \r\n\r\n //If thermal collection is wanted, pull it as well\r\n if(args.useTempInCloudMask === true){\r\n var t1000 = ee.ImageCollection(t1000C)\r\n .filter(ee.Filter.calendarRange(args.startYear,args.endYear,'year'))\r\n .filter(ee.Filter.calendarRange(args.startJulian,args.endJulian))\r\n .select([0,8,9],['temp','Emis_31','Emis_32']);\r\n \r\n var a1000 = ee.ImageCollection(a1000C)\r\n .filter(ee.Filter.calendarRange(args.startYear,args.endYear,'year'))\r\n .filter(ee.Filter.calendarRange(args.startJulian,args.endJulian))\r\n .select([0,8,9],['temp','Emis_31','Emis_32']); \r\n }\r\n \r\n //Now all collections are pulled, start joining them\r\n //First join the 250 and 500 m Aqua\r\n var a;var t;var tSelectOrder;var tStdNames;\r\n a = joinCollections(a250,a500,false);\r\n \r\n //Then Terra\r\n t = joinCollections(t250,t500,false);\r\n \r\n //If temp was pulled, join that in as well\r\n //Also select the bands in an L5-like order and give descriptive names\r\n if(args.useTempInCloudMask === true){\r\n a = joinCollections(a,a1000,false);\r\n t = joinCollections(t,t1000,false);\r\n \r\n // tSelectOrder = wTempSelectOrder;\r\n // tStdNames = wTempStdNames;\r\n }\r\n //If no thermal was pulled, leave that out\r\n // else{\r\n // tSelectOrder = woTempSelectOrder;\r\n // tStdNames = woTempStdNames;\r\n // }\r\n \r\n a = a.map(function(img){return img.set({'platform':'aqua'})});\r\n t = t.map(function(img){return img.set({'platform':'terra'})});\r\n \r\n //Join Terra and Aqua \r\n var joined = ee.ImageCollection(a.merge(t))//.select(tSelectOrder,tStdNames);\r\n \r\n \r\n \r\n \r\n var dailyPiece;var tempPiece;var anglePiece;\r\n if(args.daily){dailyPiece = 'Daily'}else{dailyPiece = 'Composite'}\r\n if(args.useTempInCloudMask){tempPiece = 'temp'}else{tempPiece = 'noTemp'}\r\n if(args.addLookAngleBands){anglePiece = 'Angle'}else{anglePiece = 'NoAngle'}\r\n var multKey = tempPiece+anglePiece+dailyPiece;\r\n var mult = multModisDict[multKey];\r\n var multImage = mult[0];\r\n var multNames = mult[1];\r\n // print(multKey,multImage,multNames);\r\n \r\n joined = joined.map(function(img){return img.multiply(multImage).float().select(multNames)\r\n .copyProperties(img,['system:time_start','system:time_end','system:index'])\r\n .copyProperties(img);\r\n });\r\n if(['bilinear','bicubic'].indexOf(args.resampleMethod) > -1){\r\n print('Setting resampling method',args.resampleMethod);\r\n joined = ee.ImageCollection(joined).map(function(img){return img.resample(args.resampleMethod) });\r\n }\r\n else if(args.resampleMethod === 'aggregate'){\r\n print('Setting to aggregate instead of resample ');\r\n joined = joined.map(function(img){return img.reduceResolution(ee.Reducer.mean(), true, 64)});\r\n }\r\n return joined.set(args);\r\n \r\n }", "function DataUrl() \n{ \n var url = \"json.php?bucket=m\";\n url += \"&publisher=\";\n if (params['publisher']) \n {\t\n url += params['publisher'];\n }\n url += \"&advertiser=\";\n if (params['advertiser']) \n {\t\n url += params['advertiser'];\n }\n url += \"&adunit=\";\n if (params['adunit']) \n {\t\n url += params['adunit'];\n }\n url += \"&from=\";\n url += Math.floor(lookback);\n return url; \n}", "function provinceData(prov){\n\n // Filter data by province name\n go.provData= go.json.filter(e => e.prname == prov);\n\n // sort filtered data by date and store in data array\n data = go.provData.sort((a,b)=>{\n let date1 = new Date(a.date);\n let date2 = new Date(b.date)\n return date1 - date2;\n });\n\n // get and store values for the charts from filtered data array\n dates = data.map(d => d.date);\n values = data.map(v => v.numtoday);\n totalCases = data.map(t => t.numtotal);\n\n index = data.length-1;\n\n // log(data);\n // log(\"Dates Array: \" + dates);\n // log(\"Values Array: \" + values);\n // log(\"Total Cases Array: \" + totalCases)\n \n // update stats placeholders with most recent info\n $(\"#date\").text(data[data.length-1].date);\n $(\"#dailyStat\").html(data[data.length-1].numtoday.toLocaleString('en-US'));\n $(\"#totalStat\").html(data[data.length-1].numtotal.toLocaleString('en-US'));\n}", "function buildGauge(ID) {\n \n // Use d3 to get the data from URL.\n d3.json(url).then(function(data) {\n console.log(data);\n\n\n // Grab values from the response json object to Build Table\n var metadata = data.metadata;\n console.log(metadata);\n\n // Use filter to filter Meta data by Subject ID in the Metadata\n // and setting it to a new variable\n var metaFilter = metadata.filter(row => row.id == ID);\n console.log(metaFilter)\n\n // for the Filtered data set the index to 0 \n // since we will always be picking data for 1 subject ID \n // that is selected in the dropdown menu\n var finaldata = metaFilter[0];\n console.log(finaldata)\n \n var washData = finaldata.wfreq;\n console.log(washData);\n\n var subjectid = finaldata.id;\n console.log(subjectid);\n \n \n var data3 = [\n \n {\n type: \"indicator\",\n mode: \"gauge+number+needle\",\n value: washData,\n title: { text: `Belly Button Washing Frequency for ID - ${subjectid}`, font: { size: 20 } },\n \n // delta: { reference: 400, increasing: { color: \"RebeccaPurple\" } },\n gauge: {\n axis: { range: [null, 9], tickwidth: 1, tickcolor: \"darkblue\" },\n bar: { color: \"yellow\"},\n bgcolor: \"white\",\n borderwidth: 2,\n bordercolor: \"gray\",\n steps: [\n { range: [0, 1], color: \"#F1F7E9\", labels: \"0-1\"},\n { range: [1, 2], color: \"#E0EECE\" },\n { range: [2, 3], color: \"#D8EAC0\" },\n { range: [3, 4], color: \"#C9E2A8\" },\n { range: [4, 5], color: \"#C1DD9B\" },\n { range: [5, 6], color: \"#A2CD69\" },\n { range: [6, 7], color: \"#92C450\" },\n { range: [7, 8], color: \"#86BB3F\" },\n { range: [8, 9], color: \"#709D35\" },\n \n ],\n labels:[\"0-1\", \"1-2\"],\n \n needle: {\n // Needle circle radius as the percentage of the chart area width\n radiusPercentage: 5,\n // Needle width as the percentage of the chart area width\n widthPercentage: 5,\n // Needle length as the percentage of the interval between inner radius (0%) and outer radius (100%) of the arc\n lengthPercentage: 100,\n // The color of the needle\n color: 'rgba(0, 0, 0, 1)'\n }\n \n }\n }\n ];\n \n var layout3 = {\n width: 470,\n height: 400,\n margin: { t: 15, r: 15, l: 15, b: 15 },\n // paper_bgcolor: \"lavender\",\n font: { color: \"darkblue\", family: \"Arial\" }\n };\n \n // Plot Gauge Chart\n Plotly.newPlot('gauge', data3, layout3);\n });\n}", "function getCountryDetails($, fundTicker)\n{\n\tlet countryArr = []; \n\tlet getGeoId = $('#fund-geographical-breakdown').val();\n\t\n\tif(getGeoId!==undefined)\n\t{\n\t\tlet json = JSON.parse(getGeoId);\n\t\tlet jsonVals = json.attrArray;\n\t\tfor(let i=0; i<jsonVals.length; i++)\n\t\t{\n\t\t\tlet countries = [];\n\t\t\tlet countryname = jsonVals[i].name.value;\n\t\t\tlet countryweight = jsonVals[i].weight.value.split('%');\n\t\t\tlet geoKey = fundTicker+\",\"+countryname;\n\t\t\tlet date = new Date();\n\t\t\tcountries.push(geoKey);\n\t\t\tcountries.push(fundTicker);\n\t\t\tcountries.push(countryname);\n\t\t\tcountries.push(countryweight[0]);\n\t\t\tcountries.push(date);\n\t\t\tcountryArr.push(countries);\n\t\t}\n\n\t\tcountryArr.sort((a,b) => b[2] - a[2]);\n\t\tlet top10Countries = countryArr.slice(0,10);\n\t\n\t\treturn top10Countries;\n\t}\n}", "function getPricing(trigger) {\n var url = \"https://api.myjson.com/bins/47axv\";\n return getData(url, displayPricing, trigger);\n}", "function gasCall() {\n $.ajax({\n \"async\": true,\n \"crossDomain\": true,\n \"method\": \"GET\",\n \"url\": \"https://data.colorado.gov/resource/xyh2-p9cg.json?%24%24app_token=gNqVzSHJ7pWovzVu8pRHdiMHe&%24select=avg(allgradesgasprice)&%24where=date%20between%20'2017-01-01T12%3A00%3A00'%20and%20'2017-12-31T11%3A59%3A59'\"\n }).done(function(response) {\n \tlet holdThis;\n [{\n \"avg_allgradesgasprice\": holdThis\n }] = response;\n gasAve.Y0 = holdThis;\n displayAve();\n });\n\n function displayAve() {\n console.log(`gasAve is ${gasAve.Y0}`);\n }\n }", "function getData() {\n // data downloaded from the USGS at http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/ on 4/4/16\n // month.geojson represents recorded earthquakes between 03/04/2016 and 04/04/2016\n // week.geojson represents recorded earthquakes betwen 03/28/2016 and 04/04/2016\n var url = \"data/week.geojson\";\n return esriRequest(url, {\n responseType: \"json\"\n });\n }", "function Greenhouse() {\r\n const opts = {\r\n options: {\r\n chart: {\r\n fontFamily: chartFont,\r\n zoom: {\r\n enabled: false,\r\n },\r\n },\r\n dataLabels: {\r\n enabled: false\r\n },\r\n stroke: {\r\n width: 2,\r\n curve: 'smooth',\r\n },\r\n title: {\r\n text: 'Methane vs N₂O concentration growth',\r\n style: titleStyle\r\n },\r\n subtitle: {\r\n text: 'Source: Global Warming API',\r\n },\r\n colors: ['#008FFB', '#FF4560'],\r\n xaxis: {\r\n type: 'category',\r\n categories: res_df.greenhouse.category,\r\n tickAmount: 8,\r\n },\r\n yaxis: {\r\n title: {\r\n text: 'Concentration growth, %'\r\n },\r\n min: 100,\r\n max: Math.max(...res_df.greenhouse.methane.data.filter(filterNaN),\r\n ...res_df.greenhouse.nitrous.data.filter(filterNaN)) + 2,\r\n labels: {\r\n formatter: function (val) {\r\n return round(val);\r\n }\r\n }\r\n },\r\n annotations: {\r\n yaxis: [{\r\n y: 100,\r\n borderColor: '#000',\r\n label: {\r\n borderColor: '#000',\r\n style: {\r\n color: '#fff',\r\n background: '#000',\r\n },\r\n text: 'Minimal level',\r\n }\r\n }]\r\n },\r\n fill: {\r\n opacity: 1\r\n },\r\n tooltip: {\r\n y: {\r\n formatter: function (val, {dataPointIndex, series, seriesIndex, w}) {\r\n const v = w.config.series[seriesIndex].level[dataPointIndex],\r\n m = round(v - w.config.series[seriesIndex].min);\r\n\r\n return !filterNaN(val) ? 'No data' : `${val}% (${m}/${v} ppm)`;\r\n }\r\n }\r\n }\r\n },\r\n series: [{\r\n name: 'Methane growth',\r\n data: res_df.greenhouse.methane.data,\r\n level: res_df.greenhouse.methane.level,\r\n min: res_df.greenhouse.methane.min,\r\n }, {\r\n name: 'N₂O growth',\r\n data: res_df.greenhouse.nitrous.data,\r\n level: res_df.greenhouse.nitrous.level,\r\n min: res_df.greenhouse.nitrous.min,\r\n }]\r\n };\r\n\r\n return (\r\n <ReactApexChart options={opts.options} series={opts.series} type='line' height={400} />\r\n );\r\n}", "function gLoaded(){\n\t\t\n\t\tconsole.log(\"google loaded\");\n\t\t\n\t\t// instead of loading data from a static JSON file I'm going to laod it from a google fusion table\n\t\t// we do this by using the URL with our fusion table ID\n\t\t// I have also changed the range of data that is charted by refining the query in the URL \n\t\t// I did this by adding the following instructions in SQL WHERE+DATE>'1989-12-01'\n\t\t\n\t\t$.get(\"https://www.googleapis.com/fusiontables/v1/query?sql=SELECT+*+FROM+12A0eKUXKb4TCFhngfaGqaMEH6uECY1iBhd3VOBAV+WHERE+DATE>'1989-12-01'&key=AIzaSyDsBrSpJRliKgi913vr9FWTy8oL57c42bA\", mDataLoaded, \"json\");\n\t\t\n\t}", "function buildData(jData, FIPS, TYPE){\r\n\r\nvar flatdata = [];\r\njData.forEach(function(cty) {\r\n cty.d.forEach(function(d1) {\r\n flatdata.push({\r\n fips : cty.s.substr(7,3),\r\n month : d1.k.substr(0,3),\r\n\t year : +d1.k.substr(3,4),\r\n ui : +d1.v\r\n });\r\n });\r\n});\r\n\r\n\r\nvar maxYr = d3.max(flatdata, function(d) { return +d.year;} ); //This is the maximum year, the currrent year\r\nvar prevYr = maxYr - 1; //This is the previous year, current year - 1\r\n \r\nvar maxData = flatdata.filter(function(d) { //This is the data series for the current year\r\n if((d.fips == FIPS) && (d.year == maxYr) && (d.month != \"Ann\")) { return d;} \r\n });\r\n\r\nvar prevData = flatdata.filter(function(d) { //This is the data series for the previous year\r\n if((d.fips == FIPS) && (d.year == prevYr) && (d.month != \"Ann\")) { return d;} \r\n });\r\n\r\n\r\nif(TYPE == \"5Yr\") {\r\n var statData = flatdata.filter(function(d) { \r\n if((d.fips == FIPS) && (d.year >= (prevYr - 6)) && (d.year < prevYr) && (d.month != \"Ann\")) { return d;} \r\n });\r\n} else {\r\n\t var statData = flatdata.filter(function(d) { \r\n if((d.fips == FIPS) && (d.year >= 2009) && (d.year <= 2012) && (d.month != \"Ann\")) { return d;} \r\n })\r\n}\r\n\r\n//Assembling the range data\r\n\r\n\r\nvar summaryMet = d3.rollup(statData, v => ({\r\n min_ui: d3.min(v, d => d.ui),\r\n max_ui: d3.max(v, d => d.ui),\r\n min_yr : d3.min(v, d => d.year),\r\n max_yr : d3.max(v, d => d.year)\r\n\t\t}),\r\n\t\td => d.month); \r\n\r\nvar summaryArr = Array.from(summaryMet);;\r\n\r\nvar summaryFlat = [];\r\nsummaryArr.forEach(function(d) {\r\n\tsummaryFlat.push({\r\n\t\tfips : FIPS,\r\n\t\tmonth : d[0],\r\n\t\tmin_ui : d[1].min_ui,\r\n\t\tmax_ui : d[1].max_ui,\r\n\t\tmin_yr : d[1].min_yr,\r\n\t\tmax_yr : d[1].max_yr\r\n\r\n\t});\r\n});\r\n\r\nreturn([summaryFlat,maxData,prevData]);\r\n} //End buildData", "function wkt_make_geogcs(P) {\n var geogcs = {\n NAME: wkt_get_geogcs_name(P),\n DATUM: wkt_make_datum(P),\n PRIMEM: ['Greenwich', 0], // TODO: don't assume greenwich\n UNIT: ['degree', 0.017453292519943295] // TODO: support other units\n };\n return geogcs;\n}", "function createBarChart(geojson_file, attr, chs_a, chds_t, chbh_t, chco_t){\n\tvar context = {\n\t\tgetChartURL: function(feature) {\n\t\t\tvar values = \"\";\n\t\t\tattr.forEach(function(item, index){\n\t\t\t\tif(index != attr.length - 1)\n\t\t\t\t\tvalues += feature.attributes[item] + ',';\n\t\t\t\telse\n\t\t\t\t\tvalues += feature.attributes[item]\n\t\t\t});\n\n\t\t\tvar charturl = 'http://chart.apis.google.com/chart?cht=bvg&chs=' + chs_a[0] + 'x' + chs_a[1] + '&chds=' + chds_t + '&chbh=' + chbh_t + '&chd=t:' + values + '&chco=' + chco_t + '&chf=bg,s,ffffff00';\n\n\t\t\t// hide x,y axis\n\t\t\tcharturl += '&chxt=x,y&chxs=0,000000,10,0,_,000000|1,000000,10,0,_,000000&chxl=0%3a||1%3a|';\n\n\t\t\treturn charturl;\n\t\t}\n\t};\n\n\tvar template = {\n\t\tfillOpacity: 1.0,\n\t\texternalGraphic: \"${getChartURL}\",\n\t\tgraphicWidth: chs_a[0],\n\t\tgraphicHeight: chs_a[1],\n\t\tstrokeWidth: 0\n\t};\n\n\tvar style = new OpenLayers.Style(template, {context: context});\n\tvar styleMap = new OpenLayers.StyleMap({'default': style, 'select': {fillOpacity: 0.7}});\n\n\tvar vectors = new OpenLayers.Layer.GML(\"Siting Frenquency\",\n\t \"site.json\", {\n\t \tformat: OpenLayers.Format.GeoJSON,\n\t \tstyleMap: styleMap,\n\t \tisBaseLayer: false,\n\t \tprojection: new OpenLayers.Projection(\"EPSG:4326\")\n\t });\n\n\treturn vectors;\n}", "function newdata() {\n\n var date, hour\n\n date = globaldata[e]['date']\n hour = globaldata[e]['hour']\n\n // console.log(date, hour)\n\n return [date, hour];\n}", "function u2016(feature) {\n return {\n fillColor: getColor(feature.properties.temps_field_10),\n weight: 2,\n opacity: 1,\n color: 'white',\n dashArray: '3',\n fillOpacity: 0.7\n };\n}", "function getData2(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'countyObject.droughtLevels' + year + '[' + i + '] += parseInt(datum.'\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'countyObject.dataCount' + year + '++;\\n'\r\n return result;\r\n }", "parseHistoricalComparisons(data, comparisonCurrency) {\n let results = {};\n data.forEach(year => {\n for (let rate in year.rates) {\n if (rate === comparisonCurrency) {\n results[year.date] = year.rates[rate];\n }\n }\n });\n return results;\n }", "function getGEO(input){\n // grab 2018 cencus data\n d3.json(`/sqlsearch/${input}`).then(function(data){\n\n var info2 = data\n // get lat and lon out of Json and then group for Weather api\n globalLat = info2.lat[0]\n globalLon = info2.lng[0]\n var both = globalLat+\",\"+ globalLon\n // send to weather api\n getWeather(both)\n })\n}", "function loadDefaultData() {\n var data = {};\n data['Argentina'] = genEntry('Argentina', {'want': true});\n data['Australia'] = genEntry('Australia', {'want': true});\n data['Austria'] = genEntry('Austria', {'visit' : ['Jun 2018']});\n data['Bahamas'] = genEntry('Bahamas', {'visit': ['Feb 2003']});\n data['Belgium'] = genEntry('Belgium', {'visit': ['Aug 2019', 'Dec 2013']});\n data['Bosnia and Herzegovina'] = genEntry('Bosnia and Herzegovina', {'visit': ['Jun 2018']});\n data['Brazil'] = genEntry('Brazil', {'want' : true});\n data['Cambodia'] = genEntry('Cambodia', {'want': true});\n data['Canada'] = genEntry('Canada', {'visit' : ['Sep 2018', 'May 2017', 'June 2008']});\n data['Chile'] = genEntry('Chile', {'want': true});\n data['China'] = genEntry('China', {'want': true});\n data['Croatia'] = genEntry('Croatia', {'visit' : ['Jun 2018', 'Mar 2016']});\n data['Czech Republic'] = genEntry('Czech Republic', {'visit' : ['Jun 2018']});\n data['Denmark'] = genEntry('Denmark', {'want': true});\n data['Egypt'] = genEntry('Egypt', {'want': true});\n data['France'] = genEntry('France', {'visit' : ['Aug 2019', 'May 2015','Aug 2013']});\n data['Germany'] = genEntry('Germany', {'visit' : ['Dec 2013']});\n data['Greece'] = genEntry('Greece', {'want': true});\n data['Hong Kong'] = genEntry('Hong Kong', {'visit' : ['Nov 2018', 'Oct 2016', 'Jun 2015', 'May 2015', 'Dec 2012', 'Dec 2011', 'Dec 2009', 'Feb 2009', 'Feb 2008', 'Feb 2006', 'Feb 2004']});\n data['Hungary'] = genEntry('Hungary', {'visit' : ['Jun 2018']});\n data['Iceland'] = genEntry('Iceland', {'visit': ['Mar 2017']});\n data['Indonesia'] = genEntry('Indonesia', {'visit': ['Nov 2018']});\n data['Ireland'] = genEntry('Ireland', {'want': true});\n data['Israel'] = genEntry('Israel', {'plan': 'Feb 2020', 'visit': ['Nov 2019', 'Feb 2019', 'Oct 2018', 'Aug 2018', 'Apr 2018']});\n data['India'] = genEntry('India', {'want': true});\n data['Italy'] = genEntry('Italy', {'visit' : ['June 2012']});\n data['Japan'] = genEntry('Japan', {'visit' : ['Apr 2019', 'Jun 2015']});\n data['Jordan'] = genEntry('Jordan', {'visit': ['Apr 2018']});\n data['Laos'] = genEntry('Laos', {'want': true});\n data['Macao'] = genEntry('Macao', {'visit' : ['Feb 2009']});\n data['Malaysia'] = genEntry('Malaysia', {'visit': ['Apr 2019']});\n data['Mexico'] = genEntry('Mexico', {'visit': ['Jul 2019']});\n data['Monaco'] = genEntry('Monaco', {'visit': ['May 2019']});\n data['Morocco'] = genEntry('Morocco', {'want': true});\n data['Myanmar'] = genEntry('Myanmar', {'want': true});\n data['Nepal'] = genEntry('Nepal', {'want': true});\n data['Netherlands'] = genEntry('Netherlands', {'visit' : ['Dec 2013']});\n data['New Zealand'] = genEntry('New Zealand', {'visit' : ['Jan 2015']});\n data['Norway'] = genEntry('Norway', {'visit': ['Apr 2016']});\n data['Peru'] = genEntry('Peru', {'visit' : ['Oct 2019']});\n data['Portugal'] = genEntry('Portugal', {'visit': ['Aug 2019']});\n data['Russia'] = genEntry('Russia', {'want': true});\n data['Sint Maarten (Dutch part)'] = genEntry('Sint Maarten (Dutch part)', {'visit' : ['Feb 2003']});\n data['Singapore'] = genEntry('Singapore', {'visit': ['Oct 2016']});\n data['Slovakia'] = genEntry('Slovakia', {'visit': ['Jun 2018']});\n data['Slovenia'] = genEntry('Slovenia', {'want': true});\n data['South Korea'] = genEntry('South Korea', {'visit': ['Oct 2016']});\n data['Spain'] = genEntry('Spain', {'visit' : ['Aug 2019', 'May 2015']});\n data['Sweden'] = genEntry('Sweden', {'visit': ['Mar 2016']});\n data['Switzerland'] = genEntry('Switzerland', {'want': true});\n data['Taiwan'] = genEntry('Taiwan', {'visit' : ['Dec 2011']});\n data['Thailand'] = genEntry('Thailand', {'want' : true});\n data['Turkey'] = genEntry('Turkey', {'visit' : ['Jun 2018']});\n data['United Kingdom'] = genEntry('United Kingdom', {'live': 'Aug-Dec 2013', 'visit' : ['Mar 2016', 'June 2012'] });\n data['United States'] = genEntry('United States', {'live': 'Present'});\n data['Vatican City'] = genEntry('Vatican City', {'visit': ['Jun 2012']});\n data['Vietnam'] = genEntry('Vietnam', {'visit': ['Oct 2016']});\n data['Virgin Islands, U.S.'] = genEntry('Virgin Islands, U.S.', {'visit' : ['Feb 2003']});\n return data;\n}", "function getAllergyRPCString(model, logger) {\n logger.debug({AllergiesVistaWriterModel: model});\n var allergies = {\n '\"GMRAGNT\"': model.allergyName,\n '\"GMRATYPE\"': '',\n '\"GMRANATR\"': model.natureOfReaction,\n '\"GMRAORIG\"': model.enteredBy,\n '\"GMRAORDT\"': null,\n '\"GMRAOBHX\"': model.historicalOrObserved\n };\n\n //Set GMRACMTS\n if (model.comment !== '') {\n allergies['\"GMRACMTS\",0'] = '1';\n allergies['\"GMRACMTS\",1'] = model.comment;\n }\n\n //Set GMRATYPE\n if (allergies['\"GMRANATR\"'] === allergiesConstants.GMRANATR_PHARMACOLGICAL) {\n allergies['\"GMRATYPE\"'] = allergiesConstants.GMRATYPE_DRUG;\n } else {\n allergies['\"GMRATYPE\"'] = allergiesConstants.GMRATYPE_OTHER;\n }\n\n //Set GMRAORDT\n var currentTime = new Date();\n allergies['\"GMRAORDT\"'] = filemanDateUtil.getFilemanDateTime(currentTime);\n\n //Set GMRASYMP\n allergies['\"GMRASYMP\",0'] = _.size(model.symptoms).toString();\n\n _.each(model.symptoms, function (symptom, index) {\n var fileManDT = '';\n var displayDate = '';\n\n if (!nullChecker.isNullish(symptom.dateTime)) {\n var sympDT = paramUtil.convertWriteBackInputDate(symptom.dateTime);\n fileManDT = filemanDateUtil.getFilemanDateTime(sympDT.toDate());\n displayDate = sympDT.format('MMM DD,YYYY@HH:mm');\n }\n\n allergies['\"GMRASYMP\",' + (index + 1)] = symptom.IEN + '^' + symptom.name + '^' + fileManDT + '^' + displayDate + '^';\n });\n\n //Set GMRACHT\n var eventDateTimeMoment = paramUtil.convertWriteBackInputDate(model.eventDateTime);\n var eventFilemanYear = filemanDateUtil.getFilemanDateWithArgAsStr(eventDateTimeMoment.format(paramUtil.WRITEBACK_INPUT_DATE_FORMAT));\n\n if (eventFilemanYear !== -1) {\n allergies['\"GMRACHT\",0'] = '1';\n allergies['\"GMRACHT\",1'] = eventFilemanYear + '.' + eventDateTimeMoment.format(paramUtil.WRITEBACK_INPUT_TIME_FORMAT);\n }\n\n // let's persist the observed date and severity regardless of the allergy type,\n // observed or historical.\n // if they are specified, lets write it.\n if (model.observedDate) {\n var observedDate = getVistaFormattedDateString(model.observedDate);\n if (observedDate !== -1) {\n allergies['\"GMRARDT\"'] = observedDate;\n }\n }\n\n if (model.severity) {\n allergies['\"GMRASEVR\"'] = model.severity;\n }\n\n return allergies;\n}", "function loadOccAvailData__ThisYear(data) {\n\n let parsed_data = JSON.parse(data);\n \n //Factors for RevPar vs Rev Graph\n let occ = [];\n let mon = [];\n let avail = [];\n\n let occ_pid_1 = []; let occ_pid_2 = []; let occ_pid_all = [];\n /*--------------------------------------------*/ let mon_pid_all = [];\n let avail_pid_1 = []; let avail_pid_2 = []; let avail_pid_all = [];\n\n if(parsed_data.length === 0){\n document.write('no data');\n }else{\n \n //Data Splitter\n dataSplittor_Occ__ThisYear(parsed_data, occ_pid_1, avail_pid_1, occ_pid_2, avail_pid_2, occ_pid_all, avail_pid_all, mon_pid_all);\n //Data Loader\n dataLoader_Occ__ThisYear(occ, avail, mon, occ_pid_1, avail_pid_1, occ_pid_2, avail_pid_2, occ_pid_all, avail_pid_all, mon_pid_all);\n }\n \n}", "function COVID19Stats(){\n\t\t\n\t\t\t// These varibles are private\n\t\t\tvar covidStatsObject = {};\n\t\t\t\n\t\t\t//Call to read in the address and turn this into a report\n\t\t\tcovidStatsObject.update = function (){\n\t\t\t\tvar country = get_name_value(\"country\", \"United Kingdom\");\n\t\t\t\tupdateStats(country);\n\t\t\t}\n \n covidStatsObject.sortBy = function (sortBy){\n var numb = get_name_value(\"numb\", 5);\n if (numb >2 && numb <11){\n clearTable();\n sort(sortBy, numb);\n }else{\n alert(\"Please enter a number between 3 and 10.\")\n }\n\t\t\t}\n \n covidStatsObject.stats = function(){\n //if (timerId) clearInterval(timerId);\n timerId = setInterval(worldStats, 6e4); \n worldStats();\n }\n\t\t\t\n\t\t\t//return the intialised object\n\t\t\treturn covidStatsObject;\n\t\t}", "function getvillagedata(start_date, end_date, aggregator_ids, village_ids, crop_ids, mandi_ids) {\n show_progress_bar();\n $.get( \"/loop/village_wise_data/\", {'start_date':start_date, 'end_date':end_date, 'aggregator_ids[]':aggregator_ids, 'village_ids[]':village_ids, 'crop_ids[]':crop_ids, 'mandi_ids[]':mandi_ids})\n .done(function(data) {\n data_json = JSON.parse(data);\n hide_progress_bar();\n fillvillagetable(data_json);\n });\n}", "function buildGaugeChart(sample) {\n var url = `/metadata/${sample}`;\n d3.json(url).then(function(data) {\n \n console.log(data.WFREQ);\n var chart_data = [{domain: {x: [0, 1], y: [0, 1]}, value: data.WFREQ, title: {text: \"Belly Button Washing Frequency <hr> Number of scrubs per week\"},\n type: \"indicator\", mode: \"gauge+number\", gauge:\n {axis: {range: [null, 10]}, steps: [{range: [0-1], color: \"lightseagreen\"},\n {range: [1, 2], color: \"gray\"},\n {range: [2, 3], color: \"honeydew\"},\n {range: [3, 4], color: \"lavender\"}, \n {range: [4, 5], color: \"lightsalmon\"}, \n {range: [5, 6], color: \"lightpink\"}, \n {range: [6, 7], color: \"lightgoldenrodyellow\"},\n {range: [7, 8], color: \"lightcoral\"}, \n {range: [8, 9], color: \"lightskyblue\"},\n {range: [9, 10], color: \"lightslategrey\"} \n ]}}];\n\n var layout = {width: 600, height: 500, margin: {t: 0, b: 0}};\n Plotly.newPlot(\"gauge\",chart_data,layout);\n \n});\n }", "function getHistoricalSignalData(){\n\t\t//cross origin request not working, returning blank responseText, so just using local copy\n\t\t// return $.ajax({\n\t // url: 'http://gaesample1-1175.appspot.com',\n\t // type: 'GET',\n\t // success: function(res) {\n\t // \t\tvar x = res.responseText;\n\t // \t\thistoricalSignalData = JSON.parse(getBody(x));\n // \t\t}\n\t\t// });\n\t\thistoricalSignalData = historical_signals;\n\n}", "function getData() {\n let covidApiEndpoint = 'https://disease.sh/v3/covid-19/countries/?q=yesterday';\n\n httpRequest(covidApiEndpoint, storeData);\n}", "function getOvertimeGraphYValues(data, metric, advertiser) {\n\n // \"cpi\": \"spend/installs\",\n // \"arpu\": \"revenue/installs\",\n // \"cpt\": \"spend/trials\",\n // \"arp_trial\": \"revenue/trials\",\n // \"roas\": \"( (revenue/spend) - 1 ) * 100 \",\n // \"trials_per_user\": \"( (trials/installs) - 1 ) * 100 \",\n // \"subs_per_trial\": \"( (subs/trials) - 1 ) * 100 \",\n\n advertiser_series = [];\n\n data.advertiser.map((d, i) => {\n if (d === advertiser){\n // console.log(\"series \", series);\n // console.log(\"advertiser \", advertiser);\n // console.log(\"value \", data[series][i]);\n if(metric === \"spend\" || metric === \"ltv_subs_revenue\"){\n // console.log(\"spend or revenue\", data[metric][i]);\n advertiser_series.push( parseFloat(data[metric][i].toFixed(2)) );\n // advertiser_series.push( data[metric][i].toFixed(2) );\n // advertiser_series.push( (data[\"spend\"][i] / data[metric_divisor_lookup[metric]][i]).toFixed(2) );\n } \n else if(metric === \"cpi\" || metric === \"arpu\" || metric === \"cpt\" || metric === \"arp_trial\"){\n advertiser_series.push( parseFloat((data[metrics_info[metric].numerator][i] / data[metrics_info[metric].divisor][i]).toFixed(2)) );\n // advertiser_series.push( (data[\"spend\"][i] / data[metric_divisor_lookup[metric]][i]).toFixed(2) );\n }\n else if(metric === \"roas\" || metric === \"total_roas\" || metric === \"total_roas_gc\"){ // roas or total_roas\n\n let numeratorVal = 0;\n \n metrics_info[metric].numerator.map( numeratorMetric => {\n \n let value_to_add = 0;\n\n if(numeratorMetric === \"gc_revenue\"){\n\n // get the index into the GC array based on the date\n // sometimes the GC data is missing dates, so we need to make sure\n // we're not indexing into it incorrectly\n let index_for_gc = gc_data[\"date\"].indexOf(data[\"date\"][i]);\n\n if(displayAggregateAdvertisers && advertiser === \"Aggregate Paid\" && index_for_gc !== -1){\n\n value_to_add = gc_data[\"gc_revenue\"][index_for_gc];\n\n if(value_to_add === undefined){\n value_to_add = 0;\n }\n \n }\n }\n else{\n value_to_add = data[numeratorMetric][i];\n }\n \n numeratorVal += value_to_add;\n \n });\n\n advertiser_series.push( parseFloat(( ( (numeratorVal / data[metrics_info[metric].divisor][i]) - 1) * 100 ).toFixed(2)) );\n // advertiser_series.push( parseFloat(( ((data[metrics_info[metric].numerator][i] / data[metrics_info[metric].divisor][i]) - 1) * 100 ).toFixed(2)) );\n // advertiser_series.push( (data[\"ltv_subs_revenue\"][i] / data[metric_divisor_lookup[metric]][i]).toFixed(2) );\n }\n else if(metric === \"trials_per_user\" || metric === \"subs_per_trial\"){ // trials_per_user OR subs_per_trial\n advertiser_series.push( parseFloat(( (data[metrics_info[metric].numerator][i] / data[metrics_info[metric].divisor][i]) * 100 ).toFixed(2)) );\n // advertiser_series.push( (data[\"ltv_subs_revenue\"][i] / data[metric_divisor_lookup[metric]][i]).toFixed(2) );\n }\n else if(metric === \"yaxis_placeholder\"){ // trials_per_user OR subs_per_trial\n advertiser_series.push(0);\n // advertiser_series.push(( (data[metrics_info[metric].numerator][i] / data[metrics_info[metric].divisor][i]) * 100 ).toFixed(2) );\n // advertiser_series.push( (data[\"ltv_subs_revenue\"][i] / data[metric_divisor_lookup[metric]][i]).toFixed(2) );\n }\n else{\n advertiser_series.push(data[metric][i]);\n }\n\n }\n });\n\n return advertiser_series;\n\n}", "function bands(input) {\n\n var bandName;\n if (input === undefined) {\n bandName = \"Judah & the Lion\";\n } else {\n bandName = input;\n }\n\n //Setting the Bandsintown API query URL \n var queryURL = \"https://rest.bandsintown.com/artists/\" + bandName + \"/events?app_id=codingbootcamp&tracker_count=10\";\n\n request(queryURL, function (error, response, body) {\n\n if (!error && response.statusCode === 200){\n\n var jsData = JSON.parse(body);\n for (i = 0; i < jsData.length; i++) {\n var dTime = jsData[i].datetime;\n var month = dTime.substring(5, 7);\n var day = dTime.substring(8, 10);\n var year = dTime.substring(0, 4);\n var dateFormat = month + \"-\" + day + \"-\" + year;\n\n logged(\"\\n---------\\n\");\n logged(\"Band:\" + bandName);\n logged(\"Date: \" + dateFormat);\n logged(\"Venue: \" + jsData[i].venue.name);\n logged(\"City: \" + jsData[i].venue.city);\n logged(\"Country: \" + jsData[i].venue.country);\n logged(\"\\n---------\\n\");\n\n }\n }\n });\n}", "function getData(error, response) {\n if (error) throw error;\n\n // make json format from the data\n data = JSON.parse(response[0].responseText);\n\n // list for all the countries\n var countryArray = [];\n\n for(var i = 0; i < 30; i ++){\n countryArray.push(data.structure.dimensions.series[0].values[i][\"name\"])\n }\n\n // and a list with all the elements from api request\n var oecdArray = [];\n\n // place the values in the list\n for(var i = 0; i < countryArray.length; i ++){\n for(var j = 0; j < 4; j ++){\n var linking = i + \":\" + j + \":0\";\n oecdArray.push(data.dataSets[0].series[linking].observations);\n }\n }\n\n var values = [];\n\n // digging a little bit further so we skip non-values\n for(var i = 0; i < oecdArray.length; i ++){\n values.push(oecdArray[i][0][0]);\n }\n\n // list for all the internet access values\n var internetArray = [];\n\n // internet value is on 0th position in oecdArray\n for (var i = 0; i < values.length; i += 4){\n internetArray.push(values[i]);\n }\n\n // also for the voting turn out values\n var votesArray = [];\n\n // voting rate is on 1th position\n for(var i = 1; i < values.length; i += 4){\n votesArray.push(values[i]);\n }\n\n // share of people with secondary degree\n var secDegreeArray = [];\n\n // which is on the 2th position\n for(var i = 2; i < values.length; i += 4){\n secDegreeArray.push(values[i]);\n }\n\n // and one for the perception of corruption\n var perceptionArray = [];\n\n // which is on 3th position\n for(var i = 3; i < values.length; i += 4){\n perceptionArray.push(values[i]);\n }\n\n // making a dict for indexing later on\n // var wellBeingDict = [];\n\n // linking keys and values in dictionary\n for(var i = 0; i < 30; i++){\n wellBeingDict.push({\n country: countryArray[i],\n internet: internetArray[i],\n votes: votesArray[i],\n education: secDegreeArray[i],\n perception: perceptionArray[i]\n });\n }\n\n var w = 1200;\n var h = 600;\n var padding = 50;\n\n // create scale for width with extent returning the boundary as an array\n var xScale = d3.scaleLinear()\n .domain(d3.extent(wellBeingDict, function(d) {return d.perception}))\n .nice() // ensure scatters are within the range\n .range([0, w - padding]);\n\n // also for height\n var yScale = d3.scaleLinear()\n .domain([0, 100])\n .range([h - padding, 0]);\n\n // for the radius of a point\n var rScale = d3.scaleLinear()\n .domain(d3.extent(wellBeingDict, function(d) {return d.education}))\n .range([4, 20]);\n\n // and a function for sequential coloring (colorblind-friendly)\n var color = d3.scaleSequential(d3.interpolateRgb(\"#edf8fb\",\"#006d2c\"))\n .domain([d3.min(wellBeingDict, function(d) {return d.education}),\n d3.max(wellBeingDict, function(d) {return d.education})]);\n\n // function for creating x-axis later on\n var xAxis = d3.axisBottom()\n .scale(xScale);\n\n // and for y-axis\n var yAxis = d3.axisLeft()\n .scale(yScale);\n\n // update options\n var update = [\"Perception of corruption on x axis (%)\",\n \"Share of households with internet broadband access on x axis (%)\"];\n\n // creating tip box to show value\n var tip = d3.tip()\n .attr('class', 'd3-tip')\n .offset([-20, 0])\n .html(function(d, i) {\n return \"Country: \" + d.country\n + \"<br>\" + \"Share of households with internet broadband access: \" + d.internet + \"<br>\" +\n \" Voter turnout: \" + d.votes + \"<br>\" + \"Labour force withsecondary education: \" + d.education + \"<br>\" +\n \" Perception of corruption: \" + d.perception});\n\n // creating legend\n var legend = d3.legendColor()\n .labelFormat(d3.format(\".0f\"))\n .scale(color)\n .shapePadding(5)\n .shapeWidth(50)\n .shapeHeight(20)\n .labelOffset(12);\n\n // creating selection menu\n var select = d3.select('body')\n .append('select')\n \t.attr('class','select')\n .on('change',updateX)\n\n var options = select\n .selectAll('option')\n \t.data(update)\n .enter()\n \t.append('option')\n \t.text(function (d) {return d;})\n .classed('selected', function(d) {return d === xAxis;})\n .on('click', function(d) {\n xAxis = d;\n updateX();\n });\n\n // creating a canvas to draw my scatterplot on\n var svg = d3.select(\"body\")\n .append(\"svg\")\n .attr(\"width\", w)\n .attr(\"height\", h);\n\n // boxes with value's\n svg.call(tip);\n\n // drawing x-axis\n svg.append(\"g\")\n .attr(\"class\", \"axis\")\n .attr(\"transform\", \"translate(50,\" + (h - padding) + \")\")\n .call(xAxis)\n\n // adding label\n svg.append(\"text\")\n .attr(\"transform\", \"translate(1000, 585)\")\n .attr(\"class\", \"textClass\")\n .style(\"text-anchor\", \"middle\")\n .text(\"Perception of corruption (%)\");\n\n // drawing y-axis\n svg.append(\"g\")\n .attr(\"class\", \"axis\")\n .attr(\"transform\", \"translate(\" + padding + \")\")\n .call(yAxis)\n\n // adding label\n svg.append(\"text\")\n .attr(\"transform\", \"translate(15, 50) rotate(-90)\")\n .attr(\"class\", \"textClass\")\n .style(\"text-anchor\", \"end\")\n .text(\"Voter turnout (%)\");\n\n // placing legend\n svg.append(\"g\")\n .attr(\"transform\", \"translate(1100, 0)\")\n .call(legend);\n\n // drawing the scatters\n svg.selectAll(\"circle\")\n .data(wellBeingDict)\n .enter()\n .append(\"circle\")\n .attr(\"class\", \"point\")\n .attr(\"transform\", \"translate(50, 0)\")\n .attr(\"cx\", d => xScale(d.perception))\n .attr(\"cy\", d => yScale(d.votes))\n .attr(\"r\", d => rScale(d.education))\n .on('mouseover', tip.show)\n .on('mouseout', tip.hide)\n .style(\"fill\", d => color(d.education));\n\n function updateX() {\n\n // update axis and scale\n var independent = this.independent\n xScale.domain(d3.extent(wellBeingDict, function(d) {return d[independent]})).nice()\n xAxis.scale(xScale)\n\n // place new x-axis\n d3.select('#xAxis')\n .transition()\n .duration(750)\n .call(xAxis)\n\n // draw new scatters\n d3.selectAll('circle')\n .transition()\n .duration(750)\n .delay(function (d,i) {\n return i * 50\n })\n .attr('cx',function (d) {\n return xScale(d[independent])\n });\n\n };\n }", "async function compareToGrowthRate () {\n //first clear out any previous circles on the map\n clearMap();\n //fetch data from factbook\n let response = await fetch(`${FACTBOOK_URL}/factbook.json`);\n let jsonData = await response.json();\n //iterate through each country to get necessary data\n Object.entries(jsonData.countries).forEach(c => {\n console.log(jsonData.countries[c[0]].data.economy);\n //skip over world data\n if(c[0] == 'world') {\n return;\n }\n //these if statements ensure that the data I need exists in the country I'm on\n if (jsonData.countries[c[0]].data.economy.unemployment_rate == undefined) {\n return;\n }\n if (jsonData.countries[c[0]].data.economy.gdp.real_growth_rate == undefined){\n return;\n }\n if (jsonData.countries[c[0]].data.economy.gdp.real_growth_rate.annual_values == undefined) {\n return;\n }\n if (jsonData.countries[c[0]].data.economy.unemployment_rate.annual_values == undefined) {\n return;\n }\n if (jsonData.countries[c[0]].data.geography.geographic_coordinates == undefined) {\n return;\n }\n //calculate ratio of real growth rate to unemployment rate ratio\n let num = (jsonData.countries[c[0]].data.economy.gdp.real_growth_rate.annual_values[0].value)/(jsonData.countries[c[0]].data.economy.unemployment_rate.annual_values[0].value);\n //intialize latitude and logitude\n let lat = 'fail';\n let lon = 'fail';\n //these if statements ensure that the latitude/longitude are in the right hemispheres\n if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere === 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere === 'E') {\n lat = jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere === 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere !== 'E') {\n lat = jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere !== 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere === 'E') {\n lat = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else {\n lat = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = -1 *jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n //these if statements create a circle based on the calculated ratio\n if (num > 1.5) {\n console.log(\"good\");\n let circle = L.circle([lat, lon], {\n radius: 500000,\n color: 'green',\n fillColor: '#0f0',\n fillOpacity: 0.5\n })\n circle.bindPopup('In ' + c[0] + ', the ratio of real growth rate to unemployment rate is ' + num + '.');\n circle.addTo(map); \n //adds new circle to array of circles\n circles.push(circle);\n }\n\n else if (num > 0) {\n console.log(\"medium\");\n let circle = L.circle([lat, lon], {\n radius: 250000,\n color: 'yellow',\n fillColor: '#ff0',\n fillOpacity: 0.5,\n })\n circle.bindPopup('In ' + c[0] + ', the ratio of real growth rate to unemployment rate is ' + num + '.');\n circle.addTo(map); \n \n circles.push(circle);\n }\n\n else {\n console.log(\"bad\");\n let circle = L.circle([lat, lon], {\n radius: 125000,\n color: 'red',\n fillColor: '#f00',\n fillOpacity: 0.5,\n })\n circle.bindPopup('In ' + c[0] + ', the ratio of real growth rate to unemployment rate is ' + num + '.');\n circle.addTo(map); \n\n circles.push(circle);\n\n }\n });\n}", "function postFlowAction$CollectGQInformation() {\n /* retrieve data */\n try\n {\n var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress');\n var workPage = pega.ui.ClientCache.find('pyWorkPage');\n var gqCategory = locationAddress.get('GQCategory') ? locationAddress.get('GQCategory').getValue(): \"\";\n\n var gqTypeCode = locationAddress.get(\"GQTypeCode\");\n var cpGqTypeCode = (gqTypeCode)? gqTypeCode.getValue() : \"\";\n var gqType = \"\";\n if( cpGqTypeCode != \"\" )\n {\n var gqList = pega.ui.ClientCache.find(\"D_GQTypeOptions.pxResults\");\n if(gqList)\n {\n var iterGQList = gqList.iterator();\n while(iterGQList.hasNext())\n {\n var cpCurItem = iterGQList.next();\n var name = cpCurItem.get(\"Name\");\n var cpName = (name)? name.getValue() : \"\";\n var code = cpCurItem.get(\"Code\");\n var cpCode = (code)? code.getValue() : \"\";\n if((name == gqCategory) && (cpCode == cpGqTypeCode))\n {\n gqType = cpCurItem.get(\"Value\") ? cpCurItem.get(\"Value\").getValue() : \"\";\n locationAddress.put('GQTypes',gqType);\n break;\n }\n }\n }\n }\n else\n {\n locationAddress.put('GQTypes',\"\");\n }\n\n if (gqCategory === \"\") { /* If a value has not been chosen.*/\n /* GQCategory is required */\n locationAddress.get('GQCategory').addMessage(ALMCensus.Messages.Msg_GQCategoryRequired);\n }\n /* Validate fields required. */\n else if (cpGqTypeCode == \"\") { /* If a value has not been chosen.*/\n /* GQTypeCode is required - as is GQTypes which gets set from it. */\n locationAddress.get('GQTypeCode').addMessage(ALMCensus.Messages.Msg_GQTypesRequired);\n }\n\n\n\n /* Branching logic. */\n if (gqType === \"703: Domestic Violence Shelters\") {\n workPage.put('NextStep', 'SetLocationAddress');\n } else {\n workPage.put('NextStep', 'AttemptContact');\n }\n }\n catch(Err)\n {\n alert(\"Error in CollectGQInformation Post Action ==> <\" + Err.message + \">\");\n }\n}", "function generateChartData(){\n\n // retrieve the data from one of the JSON files based on the OS the user has selected\n // the index is the same index as what the API returns:\n // 0 == chart_formated_data\n // 1 == chart_formated_data_aggregate\n // 2 == daterange_pandas_tabledata()\n // 3 can be generated from #1 == daterange_pandas_comparison_chart()\n // 4 == giftcard_revenue()\n // so this one uses index 0, which means it's grabbing all the data for the chart from a specific OS\n \n // grab a reference to the data file we want to filter\n let data_to_use = getDataBlobAtIndex(0);\n \n // need to find the indexes where A) the date is between the dates selected with the date picker\n // AND B) the advertiser has been selected by the user\n // this will allow us to filter out all data we don't need\n let indexes_to_keep = [];\n\n for(let i=0; i < data_to_use.date.length; i++){\n\n let d_date = data_to_use.date[i];\n let d_advertiser = data_to_use.advertiser[i];\n\n if( (datepicker_start_date <= d_date && d_date <= datepicker_end_date ) && advertisers_chosen.includes(d_advertiser) ){\n indexes_to_keep[i] = true;\n }\n else{\n indexes_to_keep[i] = false;\n }\n\n }\n\n // create a new dictionary to load data into\n let data_filtered = {};\n\n // get the keys of the dictionary so we can iterate through them and load the new dictionary with the same keys\n let data_keys = Object.keys(data_to_use);\n\n // load the \"data_filtered\" dictionary with only the data we want from each key's list of data\n for (key of data_keys){\n data_filtered[key] = data_to_use[key].filter((d,i) => {\n return indexes_to_keep[i];\n // we could use this line of code and eliminate the need for creating the \"indexes_to_keep\" list.\n // but it would be slightly more confusing as to what we are doing and only save a little time.\n // return (datepicker_start_date <= data_to_use.date[i] && data_to_use.date[i] <= datepicker_end_date ) && advertisers_chosen.includes(data_to_use.advertiser[i])\n });\n }\n\n return data_filtered;\n\n}", "function gaugechart(personId) {\n //create a metaData object like above \n var metaData = jsonData.metadata.filter((x) => x.id === parseInt(personId))[0];\n //console.log(metaData) -- doing this to make sure it prints out what I need\n //now grab washing frequency from metaData\n var washFreq = metaData.wfreq;\n //create my data for the gauge chart\n //grabbed my editing here: https://plotly.com/javascript/gauge-charts/\n var data = [\n {\n domain: { x: [0, 1], y: [0, 1] },\n value: washFreq,\n title: { text: \"Belly Button Washing Frequency\" },\n type: \"indicator\",\n mode: \"gauge+number\",\n gauge: {\n axis: {tickwidth: 1, tickcolor: \"black\" },\n bar: { color: \"darkgrey\" },\n bgcolor: \"white\",\n borderwidth: 1,\n bordercolor: \"gray\",\n steps: [\n { range: [0, 1], color: \"white\" },\n { range: [1,3], color: \"lightgreen\"},\n { range: [3, 100], color: \"green\" }]\n },\n }\n ];\n // create my layout\n var layout = { width: 600, height: 500, margin: { t: 0, b: 0 } };\n // plot my gauge chart; the id is gauge in my html\n Plotly.newPlot('gauge', data, layout);\n}", "function getFlights(){\n fetch(url_opensky)\n .then(function(response){return response.json();})\n .then(function(data){\n var alt_min;\n var alt_max;\n\n // from https://opensky-network.org/apidoc/rest.html\n console.log(\"Nb Vols :: \" + unixTimeToFormat(data.time) + \" :: \"+data.states.length);\n\n jsonFlightData = {\n \"type\":\"geojson\",\n \"data\":{\n \"type\": \"FeatureCollection\",\n \"features\":[]\n }\n };\n\n for( var i=0; i< data.states.length; i++ ){\n jsonFlightData.data.features.push(\n {\n \"type\":\"flight\",\n \"geometry\":{\n \"type\": \"Point\",\n \"coordinates\":[data.states[i][5], data.states[i][6]]\n },\n \"properties\":{\n \"icao\": data.states[i][0],\n \"callsign\": data.states[i][1],\n \"origin\": data.states[i][2],\n \"timePosition\": data.states[i][3],\n \"lastContact\": data.states[i][4],\n \"altitude\": data.states[i][7],\n \"onGround\": data.states[i][8],\n \"velocity\": data.states[i][9],\n \"heading\": data.states[i][10],\n \"verticalRate\": data.states[i][11],\n \"sensors\": data.states[i][12],\n \"baroAltitude\": data.states[i][13],\n \"squawk\": data.states[i][14],\n \"spi\": data.states[i][15],\n \"positionSource\": data.states[i][16]\n }\n });\n\n if(alt_min == undefined){\n alt_min = data.states[i][7];\n }\n if(alt_max == undefined){\n alt_max = data.states[i][7];\n }\n\n if( data.states[i][7] < alt_min && alt_min != undefined ){\n alt_min = data.states[i][7];\n }\n if( data.states[i][7] > alt_max && alt_max != undefined ){\n alt_max = data.states[i][7];\n }\n }\n // console.log(jsonFlightData);\n console.log(\"alt_min :: \"+alt_min);\n console.log(\"alt_max :: \"+alt_max);\n\n });\n}", "function fetchDataFromApi(request, requestedFields) {\n console.log(\"In fetch data method\");\n \n var otherEndpointFields = [];\n var gamesFields = requestedFields;\n var nonGameFieldsRequested = false;\n \n //remove fields not inside the games endpoint from requested Fields and add them to the other list\n for(var i = 0; i < gamesFields.length; i++){\n if(gamesFields[i] == \"url\"){\n nonGameFieldsRequested = true;\n otherEndpointFields.push(gamesFields[i]);\n gamesFields.splice(i,1);\n }\n }\n \n console.log(\"otherEndpointFields: \" + JSON.stringify(otherEndpointFields));\n \n //modify the data from the request to put it in an acceptable form for IGDB API\n var fields = \"\";\n for(var i = 0; i < gamesFields.length; i++){\n if(i + 1 != gamesFields.length){\n fields += gamesFields[i] + \",\";\n }\n else{\n fields += gamesFields[i];\n }\n }\n \n console.log(\"fields: \" + fields);\n \n var beginningTime = convertDate(request.dateRange.startDate);\n console.log(\"beginningTime: \" + beginningTime);\n var endingTime = convertDate(request.dateRange.endDate);\n console.log(\"endingTime: \" + endingTime);\n \n \n var load = \"fields \" + fields + \"; sort popularity desc; where rating > 0 & first_release_date > \" + beginningTime + \" & first_release_date < \";\n \n load += endingTime + \";\" + \"limit 20;\";\n \n console.log(\"payload: \" + load);\n \n \n var url = \"https://api-v3.igdb.com/games\";\n \n //make HTTP query\n var responseString = UrlFetchApp.fetch(url, {\n headers: {\n 'user-key': 'add user-key here',\n 'Accept': 'application/json'\n }, method: 'post',\n payload: load,\n muteHttpExceptions : true \n });\n \n //adds in metrics from other endpoints if any are requested\n if(nonGameFieldsRequested){\n responseString = addOtherFields(responseString, otherEndpointFields, request.fields);\n }\n \n console.log(responseString);\n return JSON.parse(responseString);\n \n}", "function setVirusIconScaleByCases(currentDate, region, icon){\n germanyData.forEach(element => {\n if(currentDate != null){\n //reformat date of slider to match format in data\n var newDateFormat = currentDate.toString().substring(6,10)+\"-\"+currentDate.toString().charAt(1)+currentDate.toString().substring(3,5);\n \n if((element.region_name == region) && (element.year_week == newDateFormat)){\n\n if((element.rate_14_day_per_100k !== undefined) && (element.rate_14_day_per_100k >0)){\n //update value for popup\n updateVirusValue(region, element.rate_14_day_per_100k);\n //scale icon to make surface area fit the case value\n scaleIcon(icon, Math.sqrt((element.rate_14_day_per_100k/Math.PI))/10);\n } else {\n scaleIcon(icon, 0);\n }\n }\n else if((element.region_name == region) && (element.year_week == undefined)){\n scaleIcon(icon, 0);\n } \n else if(newDateFormat.includes(\"2019\")){\n scale_to_zero();\n }\n }\n});\n}", "function preLoadData(date, progs) {\n try {\n for (let i = 1; i < progs.length; i++) {\n let datePlus = \"+\" + [progs[i]].toString();\n loadJSON(getDatePlus(date, datePlus, \"YYYY-MM-DD\"));\n }\n } catch (error) {\n console.error(errorAPI);\n }\n }", "function tsg_tmg_data(TSG_DEC,anno,njd){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy). dicembre 2009\n // TSG_DEC: Tempo siderale a Greenwich in ore decimali.\n // restituisce il valore numerico TMG in ore decimali.\n // calcolo effettuato per la data indicata nel parametro njd.\n // njd non sono necessarie le ore\n // funzione da utilizzare nelle effemeridi. \n\n var valore_jda=calcola_jd_anno(anno); // giorno giuliano 0.0 gennaio dell'anno indicato.\n\n // calcolare il valore di B\n\n var S=valore_jda-2415020; // 0.0 gennaio 1900.\n var T=S/36525;\n var R=6.6460656+(2400.051262*T)+(0.00002581*T*T);\n var U=R-(24*(anno-1900));\n var B=24-U;\n\n B=ore_24(B); // intervallo 0-24 ore.\n\n// valore di B\n\nvar valore_jd=njd; // valore del giorno giuliano per la data indicata nel parametro.\nvar num_day=Math.floor(valore_jd-valore_jda);\n\nvar TO=(num_day*0.0657098)-B;\n TO= ore_24(TO)*1; // intervallo 0-24 ore.\n\nvar TMG=TSG_DEC-TO; // valore del tempo medio a Greenwich\n\n TMG= ore_24(TMG)*1; // intervallo 0-24 ore.\n\nTMG=TMG*0.997270;\n\nreturn TMG;\n}", "async getCitationHistory(){\n //<== Html selectors ==>\n const citationDateClassName = \".gsc_oci_g_t\";\n const citationValClassName = \".gsc_oci_g_a\";\n // <== Logic ==>\n\n const page = this.page;\n const datesLst = await page.$$eval(citationDateClassName, (options) =>\n options.map((option) => option.textContent\n ));\n const valLst = await page.$$eval(citationValClassName, (options) =>\n options.map((option) => option.textContent\n ));\n\n this.json.yearscitation = [];\n var totalCitations = 0\n for (var i in valLst){\n const date = datesLst[i];\n totalCitations+= parseInt(valLst[i], 10)\n this.json.yearscitation.push(\n {\n [date]:valLst[i],\n }\n )\n }\n this.json.totalCitations = totalCitations\n\n }", "function getGrowData() {\n start = document.getElementById('start_date').value; \n end = document.getElementById('end_date').value; \n sensor_id = document.getElementById('sensor_id').value;\n params = {\n start: start, \n end: end, \n sensor_id: sensor_id\n }\n $.getJSON('http://flask-env.hhxgagpxbh.eu-west-1.elasticbeanstalk.com/api/indiv_grow_data', params, processGrowData);\n}", "async function getWOJSON (stationData, needCors = true) {\n let start = moment().subtract(4, 'days').format('YYYY-MM-DD'),\n end = moment().format('YYYY-MM-DD'),\n headers = {'Origin': \"localhost\", 'X-Spot-ID': stationData.slug}\n params = `?param1=47&start_date=${start}&end_date=${end}&station=${stationData[\"gaugeID\"]}`;\n let url = `https://wateroffice.ec.gc.ca/services/real_time_graph/json/inline${params}`;\n if (needCors) {url = `${cors}${url}`;}\n // console.log(url);\n // let target = `${url}${params}`;\n return await fetch(url, {headers: headers})\n .then ( async (res) => {\n // console.log(res.headers.get('Content-Type'))\n return res.json()\n })\n .then ( (json) => { // console.log(json);\n return json[\"47\"].provisional} )\n .catch(function(error){console.log(error);});\n}", "function calGFinancial(stockItem) {\n const item = stockItem.fData;\n try {\n const peg =\n stockItem.per /\n ((100 * item[item.length - 1].eps) / item[item.length - 2].eps);\n const niGrowth2yr =\n (item[item.length - 1].incomeDif +\n item[item.length - 2].incomeDif +\n item[item.length - 3].incomeDif) /\n 3;\n const niGrowth1yr =\n (item[item.length - 1].incomeDif + item[item.length - 2].incomeDif) / 2;\n return {\n peg: peg,\n niGrowth1yr: niGrowth1yr,\n niGrowth2yr: niGrowth2yr\n };\n } catch (e) {\n return {\n peg: NaN,\n niGrowth1yr: NaN,\n niGrowth2yr: NaN\n };\n }\n}", "function wellParse(fc) {\n \n var lastDate\n \n for (var i = 0; i < fc.features.length; i++){\n \n var level = fc.features[i].properties.Water_Level\n var dateText = fc.features[i].properties.Time_Stamp\n var msmt = fc.features[i].properties.Msmnt_Type\n //make date object from text date\n var dateN = new Date(dateText);\n \n if (msmt !== \"UNKNOWN\" && level !== \"0\"){\n \n //first row, lastDate will be undefined, so go ahead and push to DataArray\n if (typeof lastDate === 'undefined') {\n \n pushData(level,dateN,msmt)\n \n if (msmt === \"Automatic Data Recorder\"){\n lastDate = dateN\n }\n \n } else if (msmt === \"Automatic Data Recorder\") {\n \n //make a date object that is the lastDate, plus an additional day. will compare to date\n //why the heck is this now date minus 1 instead of plus one?\n var nextDay = new Date(lastDate)\n nextDay.setDate(lastDate.getDate()-1)\n \n while (formatDate(dateN) !== formatDate(nextDay)){\n \n //push a NaN value with date to the array\n pushData(NaN,new Date(nextDay),\"Automatic Data Recorder\") \n //increase the nextDay, will compare again until it breaks the while loop when nextDay matches current date\n nextDay.setDate(nextDay.getDate()-1)\n }\n \n //push the actual XML row after filled missing dates with above while loop\n pushData(level,dateN,msmt)\n lastDate = dateN \n \n } else {\n //will take care of adding in the manual measurements, but don't have to worry about filling these missing dates\n pushData(level,dateN,msmt) \n }\n }\n \n }\n\tsetTimeout(drawGraph,1000)\n}", "function getBeerData() {\n let data = FooBar.getData();\n beers = JSON.parse(data).beertypes;\n //This is for Section 5: \n beerInfo();\n}", "function preProcessIGData(data, metric, period) {\n\n let stringified;\n\n if (metric.toString() === \"audience_gender_age\" && data) {// This metric has dots in keys, which are not allowed\n stringified = JSON.stringify(data);\n stringified = stringified.replace(/F./g, \"F\").replace(/M./g, \"M\").replace(/U./g, \"U\");\n data = JSON.parse(stringified);\n }\n\n if (metric.toString() === \"audience_city\" && data) {// This metric has dots in keys, which are not allowed\n stringified = JSON.stringify(data);\n stringified = stringified.replace( /\\./g , \" \" ); //replace all dots, remember\n data = JSON.parse(stringified);\n }\n\n\n if (period !== \"lifetime\")\n data = data.slice(0,-1);\n\n return data;\n}", "function stock_data(cur_exch, stockData){\n\t//console.log(stockData);\n\tswitch(cur_exch){\n\t\tcase 'NASDAQ':\n\t\t\tvar price = stockData.exchange_stock_data[0].csi_price;\n\t\t\tvar priceChng = stockData.exchange_stock_data[0].graph_data.price_change;\n\t\t\tvar pctChng = stockData.exchange_stock_data[0].graph_data.percent_change;\n\t\t\t$('.price').html(Number(price).toFixed(2));\n\t\t\tconvert_num(Number(priceChng).toFixed(2),Number(pctChng).toFixed(2));\n\t\t\tbreak;\n\t\tcase 'AMEX':\n\t\t\tvar price = stockData.exchange_stock_data[1].csi_price;\n\t\t\tvar priceChng = stockData.exchange_stock_data[1].graph_data.price_change;\n\t\t\tvar pctChng = stockData.exchange_stock_data[1].graph_data.percent_change;\n\t\t\t$('.price').html(Number(price).toFixed(2));\n\t\t\tconvert_num(Number(priceChng).toFixed(2),Number(pctChng).toFixed(2));\n\t\t\tbreak;\n\t\tcase 'NYSE':\n\t\t\tvar price = stockData.exchange_stock_data[2].csi_price;\n\t\t\tvar priceChng = stockData.exchange_stock_data[2].graph_data.price_change;\n\t\t\tvar pctChng = stockData.exchange_stock_data[2].graph_data.percent_change;\n\t\t\t$('.price').html(Number(price).toFixed(2));\n\t\t\tconvert_num(Number(priceChng).toFixed(2),Number(pctChng).toFixed(2));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}//END OF FUNCTION\n}//END OF FUNCTION", "function getData(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'counties[county_index].droughtLevels' + year + '[' + i + '] += parseInt(datum.';\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'counties[county_index].dataCount' + year + '++;\\n'\r\n return result;\r\n }", "function parseLDLAPIResultData(json) {\n // json.ret.day_10w = new Date(json.ret.day_10w);\n // json.ret.better_than_pct = (100 - parseInt(json.ret.rank_pct)) + '%';\n json.ret.completegoalrate = Math.round(100*(json.ret.completegoalday/json.ret.lifetime));\n json.ret.firstday_parsed = parseDate(json.ret.firstday);\n json.ret.dt_10w_parsed = parseDate(json.ret.dt_10w);\n json.ret.dt_100w_parsed = parseDate(json.ret.dt_100w);\n // console.log(json);\n return json;\n }", "function parseAllGRIBs(inData) {\n // create the object to keep all the data in\n var weatherDB = new weatherDBObject();\n\n // loop through all the grib parts in the file\n var gribCount = 1;\n var starttime = +new Date();\n while (inData.byteLength > 0) {\n if (gribCount % 10 == 0) {\n\n var currentTime = +new Date();\n starttime = currentTime;\n }\n dbg(2, \" Starting GRIB Block \" + gribCount);\n gribCount++;\n var sect0 = new DataView(inData, 0, 16);\n // Make sure this is a grib file\n // first 4 characters should be GRIB. Must be a meteorological file (byte 7 = 0) and version 2 (byte 8 = 2). Max length supported is 2^32 (top 32 if length =0)\n\n if (sect0.getUint8(0) == 0x47 && sect0.getUint8(1) == 0x52 && sect0.getUint8(2) == 0x49 && sect0.getUint8(3) == 0x42 && sect0.getUint8(6) == 0x0 && sect0.getUint8(7) == 0x2 && sect0.getUint32(8) == 0) {\n\n // get the length of the grub file\n var griblength = sect0.getUint32(12);\n\n // trim off this grib\n var grib = inData.slice(0, griblength);\n inData = inData.slice(griblength);\n // at this point grib contains one of the multiple gribs in the source file\n // there is a separate grib for each parameter and pressure (alt)\n parseGRIB(grib, weatherDB);\n if (weatherDB.status < 0) {\n // error found, return\n return (weatherDB);\n }\n\n } else {\n // alert(\"ERROR: Not a grib file this parser understands\");\n dbg(0, \"ERROR: Not a grib file this parser understands\");\n weatherDB.statusMsg = \"ERROR: Not a grib file this parser understands\";\n weatherDB.status = -1;\n\t\t\tthrow error;\n return (weatherDB);\n }\n }\n // just keep the unique, sorted values for lats, longs, pressures, & params.\n weatherDB.lats = arrayUnique(weatherDB.lats);\n weatherDB.lats.sort(function (a, b) {\n return a - b\n });\n weatherDB.longs = arrayUnique(weatherDB.longs);\n weatherDB.longs.sort(function (a, b) {\n return a - b\n });\n weatherDB.pressures = arrayUnique(weatherDB.pressures);\n weatherDB.pressures.sort(function (a, b) {\n return a - b\n });\n weatherDB.params = arrayUnique(weatherDB.params);\n weatherDB.params.sort();\n weatherDB.status = 100; // say the data is valid\n return weatherDB;\n}", "function getOccupancy(station_number) {\n document.getElementById(\"availability\").style.display = \"inline-block\";\n var jqxhr = $.getJSON(\"http://127.0.0.1:5000/station_details?station_number=\" + station_number + \"\\\"\", null, function(data){\n var station_details = data.stations;\n _.forEach(station_details, function(station){\n var content = \"<b><u>Station:</u></b> <br><br> Address: \" + station.station_address + \"<br><br>\" + \"<b><u>Currently there are: </u></b><br><br> Bikes available: \" + station.bikes_available +\"<br>\" + \"Bike stands available: \" + station.bike_stands_available + \"<br>\";\n document.getElementById(\"availability\").innerHTML = content;\n })\n });\n\t\n\tfunction drawChart(data) {\n\t\t//var array = JSON.parse(data_array);\n\t\tvar data_array_bikes = data.daily_average_bikes;\n\t\tvar data_array_stands = data.daily_average_stands;\n\t\tvar data_daily = new google.visualization.DataTable(data_array_bikes);\n\n\t\tdata_daily.addColumn('string', 'Day');\n\t\tdata_daily.addColumn('number', 'Bikes');\n\t\tdata_daily.addColumn('number', 'Stands');\n\n\t\tdata_daily.addRows([\n\t\t\t['Monday', data_array_bikes[0], data_array_stands[0]],\n\t\t\t['Tuesday', data_array_bikes[1], data_array_stands[1]],\n\t\t\t['Wednesday', data_array_bikes[2], data_array_stands[2]],\n\t\t\t['Thursday', data_array_bikes[3], data_array_stands[3]],\n\t\t\t['Friday', data_array_bikes[4], data_array_stands[4]],\n\t\t\t['Saturday', data_array_bikes[5], data_array_stands[5]],\n\t\t\t['Sunday', data_array_bikes[6], data_array_stands[6]]\n\t\t]);\n\t\t\n\t\t//Set chart options\n\t\tvar options = {'title':'Daily Averages:', 'width': 500, 'height': 400};\n\t\t\n\t\t//instantiate and draw our chart, passing in some options\n\t\tvar chart = new google.visualization.BarChart(document.getElementById('daily_div'));\n\t\tchart.draw(data_daily, options);\n\t}\n\n\tvar jqxhr2 = $.getJSON(\"http://127.0.0.1:5000/charts_daily?station_number=\" + station_number + \"\\\"\", null, function(data) {\n\t\tgoogle.charts.setOnLoadCallback(drawChart(data));\n\t});\n\t\n\tfunction drawHourly(data) {\n\t\tvar hourly_bikes_array = data.hourly_average_bikes;\n\t\tvar hourly_stands_array = data.hourly_average_stands;\n\t\tvar data_hourly = new google.visualization.DataTable(hourly_bikes_array);\n\t\t\n\t\tdata_hourly.addColumn('string', 'Hour');\n\t\tdata_hourly.addColumn('number', 'Bikes');\n\t\tdata_hourly.addColumn('number', 'Stands');\n\t\t\n\t\tvar labels = ['12am-1am', '1am-2am', '2am-3am', '3am-4am', '4am-5am', '5am-6am', '6am-7am', '7am-8am', '8am-9am', '9am-10am', '10am-11am',\n\t\t'11am-12pm', '12pm-1pm', '1pm-2pm', '2pm-3pm', '3pm-4pm', '4pm-5pm', '5pm-6pm', '6pm-7pm', '7pm-8pm', '8pm-9pm', '9pm-10pm', '10pm-11pm', '11pm-12am'];\n\t\t\n\t\tvar i;\n\t\tfor (i = 0; i < 25; i++) {\n\t\t\tdata_hourly.addRows([\n\t\t\t\t[labels[i], hourly_bikes_array[i], hourly_stands_array[i]]\n\t\t\t]);\n\t\t};\t\n\t\t\n\t\tvar options = {'title': 'Hourly Averages', 'width': 500, 'height': 400};\n\t\t\n\t\tvar chart = new google.visualization.BarChart(document.getElementById(\"hourly_div\"));\n\t\tchart.draw(data_hourly, options);\n\t}\n\tvar day = 'Mon';\n console.log(day);\n\tvar jqxhr3 = $.getJSON(\"http://127.0.0.1:5000/charts_hourly?station_number=\" + station_number + \"?day=\" + day + \"\\\"\", null, function(data) {\n\t\tgoogle.charts.setOnLoadCallback(drawHourly(data));\n\t});\n}", "function getdata() {\n faxianSearchInfo.addition_search.first_start_time_or = getMonthStartDate()\n faxianSearchInfo.addition_search.last_start_time_or = getMonthEndDate()\n}", "function getGoldToday() {\n return (0, _property.get)(\"_guzzlrGoldDeliveries\");\n}", "async function compareToPopulationGrowthRate () {\n //first clear out any previous circles on the map\n clearMap();\n //fetch data from factbook\n let response = await fetch(`${FACTBOOK_URL}/factbook.json`);\n let jsonData = await response.json();\n //iterate through each country to get necessary data\n Object.entries(jsonData.countries).forEach(c => {\n //skip over world data\n if(c[0] == 'world') {\n return;\n }\n //these if statements ensure that the data I need exists in the country I'm on\n if (jsonData.countries[c[0]].data.economy.unemployment_rate == undefined) {\n return;\n }\n if (jsonData.countries[c[0]].data.people.population_growth_rate == undefined){\n return;\n }\n if (jsonData.countries[c[0]].data.economy.unemployment_rate.annual_values == undefined) {\n return;\n }\n if (jsonData.countries[c[0]].data.geography.geographic_coordinates == undefined) {\n return;\n }\n //calculate ratio of population growth rate to unemployment rate ratio\n let num = (jsonData.countries[c[0]].data.people.population_growth_rate.growth_rate)/(jsonData.countries[c[0]].data.economy.unemployment_rate.annual_values[0].value);\n //intialize latitude and logitude\n let lat = 'fail';\n let lon = 'fail';\n //these if statements ensure that the latitude/longitude are in the right hemispheres\n if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere === 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere === 'E') {\n lat = jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere === 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere !== 'E') {\n lat = jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else if (jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.hemisphere !== 'N' && jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.hemisphere === 'E') {\n lat = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n else {\n lat = -1 * jsonData.countries[c[0]].data.geography.geographic_coordinates.latitude.degrees;\n lon = -1 *jsonData.countries[c[0]].data.geography.geographic_coordinates.longitude.degrees;\n }\n\n //these if statements create a circle based on the calculated ratio\n if (num > 0.3) {\n console.log(\"good\");\n let circle = L.circle([lat, lon], {\n radius: 500000,\n color: 'green',\n fillColor: '#0f0',\n fillOpacity: 0.5\n })\n circle.addTo(map); \n circle.bindPopup('In ' + c[0] + ', the ratio of population growth rate to unemployment rate is ' + num + '.');\n //adds new circle to array of circles\n circles.push(circle);\n }\n\n else if (num > 0) {\n console.log(\"medium\");\n let circle = L.circle([lat, lon], {\n radius: 250000,\n color: 'yellow',\n fillColor: '#ff0',\n fillOpacity: 0.5,\n })\n circle.addTo(map); \n circle.bindPopup('In ' + c[0] + ', the ratio of population growth rate to unemployment rate is ' + num + '.');\n circles.push(circle);\n }\n\n else {\n console.log(\"bad\");\n let circle = L.circle([lat, lon], {\n radius: 125000,\n color: 'red',\n fillColor: '#f00',\n fillOpacity: 0.5,\n })\n circle.bindPopup('In ' + c[0] + ', the ratio of population growth rate to unemployment rate is ' + num + '.');\n circle.addTo(map); \n\n circles.push(circle);\n }\n });\n}", "updateCurrentGeojson(periodObj) {\n var self = this;\n this.currentGeojson = [];\n this.geojsonLayerSources.forEach(function(disease) {\n if (self.periodFilter(periodObj, disease.beginDate, disease.endDate, disease.duration)) {\n self.currentGeojson.push(disease.featuresCollection)\n }\n });\n\n // Update the map display\n this.updateReferences();\n }", "function getdata() {\n\n var url = `/sunburst`;\n d3.json(url).then(function(sunnyb) {\n\n ids = sunnyb.ids\n lbl = sunnyb.labels\n par = sunnyb.parents\n val = (sunnyb.values).map(Number)\n weat = sunnyb.weather\n\n draw();\n})\n}", "function load(year, country){\n var start = year + '01010000';\n var end = (year +1) + '01010000';\n var q = $q.defer();\n\n console.log('-------x-------', country, countries[country]);\n\n var params = {\n securityToken: setup.token,\n documentType: 'A72', // 'A75',\n processType: 'A16',\n In_Domain: countries[country],\n periodStart: start,\n periodEnd: end\n }\n;\n var url = setup.entsoeURL + '/api?' + querystring.stringify(params);\n console.log(url);\n\n const options = {\n url: url,\n headers: {\n 'Content-type': 'application/json'\n }\n };\n\tconsole.log(url);\n request.get(url, function(error, response, xml) {\n if (error) {\n console.log(error);\n } else {\n parseString(xml, function(err, data) {\n if(err){\n console.log(err);\n }\n if (data && data['GL_MarketDocument']) {\n var timeSeries = data['GL_MarketDocument'].TimeSeries\n console.log(timeSeries[0].Period);\n var start = moment(timeSeries[0].Period[0].timeInterval[0].start[0]);\n console.log('start', start.format('YYYYMMDDHHmm'));\n var values = [];\n timeSeries.forEach(item => {\n var value = {\n x: start.unix() *1000,\n y: parseFloat(item.Period[0].Point[0].quantity[0])\n }\n values.push(value);\n start.add(1, 'W');\n //result[psrName] = parseFloat(value);\n// console.log(value, item.Period[0].resolution);\n })\n var chart = {\n key: 'Fill level',\n country: country,\n periodStart: start.format('YYYYMMDDHHmm'),\n periodEnd: end,\n source: url.replace(setup.token,'...entsoe token...'),\n cachedate: new Date(),\n values: values\n }\n q.resolve(chart);\n } else {\n console.log(JSON.stringify(data, null, 2));\n q.resolve(data);\n }\n })\n }\n })\n return q.promise;\n}", "function u2017(feature) {\n return {\n fillColor: getColor(feature.properties.temps_field_11),\n weight: 2,\n opacity: 1,\n color: 'white',\n dashArray: '3',\n fillOpacity: 0.7\n };\n}", "function convertToGeoJson(data) {\n var lat = data.coord.lat;\n var lon = data.coord.lon;\n var pm10Value = getPM10Value(pm10Measures,lat,lon);\n\n var pm10Index = getPM10Index(pm10Value);\n var windIndex = getWindIndex(data.wind.speed * 3.6);\n var grasslandIndex = getGrasslandIndex(lat, lon);\n var weatherIndex = getWeatherIndex(data.weather[0].id);\n\n //new season index\n var seasonIndex = getSeasonIndex();\n\n var score = pm10Index + windIndex + grasslandIndex + weatherIndex + seasonIndex;\n var riskRating = getRiskRating(score).rating;\n var feature = {\n type: \"Feature\",\n properties: {\n city: data.name,\n temp: data.main.temp,\n weather: data.weather[0].main,\n windSpeed: data.wind.speed * 3.6,\n pm10: pm10Value,\n riskScore: score,\n riskRating: riskRating,\n icon: mapMarkers[riskRating],\n coordinates: [lon, lat]\n },\n geometry: {\n type: \"Point\",\n coordinates: [lon, lat]\n }\n };\n // Set the custom marker icon\n map.data.setStyle(function(feature) {\n return {\n icon: {\n url: feature.getProperty('icon'),\n anchor: new google.maps.Point(25, 25),\n scaledSize: new google.maps.Size(30,30)\n }\n };\n });\n // returns object\n return feature;\n}", "function getTestJSONData() {\n return JSON.parse(ActiveSpreadsheetApp.getRangeByName(\"LastReportJSON\").getDisplayValue());\n}", "function loadOccAvailData__2020(data) {\n\n let parsed_data = JSON.parse(data);\n \n //Factors for RevPar vs Rev Graph\n let occ = [];\n let mon = [];\n let avail = [];\n\n let occ_pid_1 = []; let occ_pid_2 = []; let occ_pid_all = [];\n /*--------------------------------------------*/ let mon_pid_all = [];\n let avail_pid_1 = []; let avail_pid_2 = []; let avail_pid_all = [];\n\n if(parsed_data.length === 0){\n document.write('no data');\n }else{\n \n //Data Splitter\n dataSplittor_Occ__2020(parsed_data, occ_pid_1, avail_pid_1, occ_pid_2, avail_pid_2, occ_pid_all, avail_pid_all, mon_pid_all);\n //Data Loader\n dataLoader_Occ__2020(occ, avail, mon, occ_pid_1, avail_pid_1, occ_pid_2, avail_pid_2, occ_pid_all, avail_pid_all, mon_pid_all);\n }\n \n}", "function loadPage1Data()\n{\n var coverage = parseInt(gdata.SI[0].CovPeriod) + parseInt(gdata.SI[0].UL_Temp_trad_LA.data[0].Age);\n var coverage1 = 100 - parseInt(gdata.SI[0].UL_Temp_trad_LA.data[0].Age);\n $(\".BasicSA\").html(formatCurrency(gdata.SI[0].BasicSA));\n $(\".coverage\").html(coverage);\n $(\".coverage1\").html(coverage1);\n}", "function getDataForChart(date) {\n // Get data for char\n $.ajax({\n url: exchange_rate_js_vars.ajaxurl,\n type: \"POST\",\n data: {\n action: ACTION.GET_ALL_RATE_HISTORY,\n startDate: date.startDate,\n endDate: date.endDate\n },\n dataType: \"json\",\n success: function (res) {\n drawChart(res.data);\n }\n })\n }", "function getData(){\n Plotly.d3.json('/country/scores', function (error, happydatabar) { //happydatabar is the main array string for all our array data from country/scores route\n if (error) return console.warn(error);\n buildbarcharts(happydatabar); // call buildbardcharts function where the bar charts will be plotted\n }); \n }", "function queryNWISgraphRDG(e) {\r\n var usgsSiteID;\r\n var currentEvent = fev.vars.currentEventName;\r\n var siteInstrumentArray = [\r\n e.layer.feature.properties.site_id,\r\n e.layer.feature.properties.instrument_id,\r\n ];\r\n var popupContent =\r\n '<table class=\"table table-hover table-striped table-condensed\">' +\r\n '<caption class=\"popup-title\">Rapid Deployment Gage | ' +\r\n currentEvent +\r\n \"</caption>\" +\r\n '<tr><td><strong>STN Site Number: </strong></td><td><span id=\"siteName\">' +\r\n e.layer.feature.properties.site_no +\r\n \"</span></td></tr>\" +\r\n '<tr><td><strong>Status: </strong></td><td><span id=\"status\">' +\r\n e.layer.feature.properties.status +\r\n \"</span></td></tr>\" +\r\n '<tr><td><strong>City: </strong></td><td><span id=\"city\">' +\r\n (e.layer.feature.properties.city == \"\" ||\r\n e.layer.feature.properties.city == null ||\r\n e.layer.feature.properties.city == undefined\r\n ? \"<i>No city recorded</i>\"\r\n : e.layer.feature.properties.city) +\r\n \"</span></td></tr>\" +\r\n '<tr><td><strong>County: </strong></td><td><span id=\"county\">' +\r\n e.layer.feature.properties.county +\r\n \"</span></td></tr>\" +\r\n '<tr><td><strong>State: </strong></td><td><span id=\"state\">' +\r\n e.layer.feature.properties.state +\r\n \"</span></td></tr>\" +\r\n '<tr><td><strong>Latitude, Longitude (DD): </strong></td><td><span class=\"latLng\">' +\r\n e.layer.feature.properties.latitude_dd.toFixed(4) +\r\n \", \" +\r\n e.layer.feature.properties.longitude_dd.toFixed(4) +\r\n \"</span></td></tr>\" +\r\n // '<tr><td><strong>STN data page: </strong></td><td><span id=\"sensorDataLink\"><b><a target=\"blank\" href=' + sensorPageURLRoot + e.layer.feature.properties.site_id + '&Sensor=' + e.layer.feature.properties.instrument_id + '\\>Sensor data page</a></b></span></td></tr>' +\r\n '<tr><td><strong>Site and Sensor Detail: </strong></td><td><span id=\"sensorData\"><button type=\"button\" class=\"btn btn-sm sensor-data-btn\" title=\"Click to view site and sensor details\" value=\"' +\r\n siteInstrumentArray +\r\n '\">View Details</button></span></td></tr>' +\r\n \"</table>\" +\r\n '<div id=\"RDGgraphContainer\" style=\"width:100%; height:250px;display:none;\"></div>' +\r\n '<div id=\"RDGdataLink\" style=\"width:100%;display:none;\"><b><span class=\"rdg-nwis-info\" style=\"color:red;\"> - Provisional Data Subject to Revision -</span><br><span class=\"rdg-nwis-info\">Additional parameters available at NWISWeb</span><br><a class=\"nwis-link\" id=\"rdgNWISLink\" target=\"_blank\" href=\"https://usgs.gov\"></a></b></div>' +\r\n '<div id=\"noDataMessage\" style=\"width:100%;display:none;\"><b><span>No NWIS Data Available for Graph</span></b></div>';\r\n\r\n e.layer.bindPopup(popupContent).openPopup();\r\n\r\n $.getJSON(\r\n stnServicesURL + \"/Sites/\" + e.layer.feature.properties.site_id + \".json\",\r\n function (data) {\r\n //USGS UD must be minimum 8 characters long, max 15\r\n if (data.usgs_sid.length >= 8 && data.usgs_sid.length <= 15) {\r\n //sensor type is RDG, and there is a usgs id. proceed with retrieving and displaying graph.\r\n usgsSiteID = data.usgs_sid;\r\n //hardcode usgsid that does have RDG data, for testing\r\n //usgsSiteID = '365423076051300';\r\n\r\n var timeQueryRange = \"\";\r\n //check if event has a blank end date - in that case set end of time query to current date\r\n if (fev.vars.currentEventEndDate_str == \"\") {\r\n //use moment.js lib to get current system date string, properly formatted\r\n fev.vars.currentEventEndDate_str = moment().format(\"YYYY-MM-DD\");\r\n console.log(\r\n \"Selected event is active, so end date is today, \" +\r\n fev.vars.currentEventEndDate_str\r\n );\r\n }\r\n\r\n //if there is no valid date string for start or end, there is no way to retrieve data - display NA message. Otherwise proceed.\r\n if (\r\n fev.vars.currentEventStartDate_str == \"\" ||\r\n fev.vars.currentEventEndDate_str == \"\"\r\n ) {\r\n $(\"#noDataMessage\").show();\r\n } else {\r\n //set timeQueryRange to the event start date and end date\r\n timeQueryRange =\r\n \"&startDT=\" +\r\n fev.vars.currentEventStartDate_str +\r\n \"&endDT=\" +\r\n fev.vars.currentEventEndDate_str;\r\n //set the URL for the NWIS RDG page, with time period specified\r\n var rdgNWIS_URL =\r\n \"https://waterdata.usgs.gov/nwis/uv?site_no=\" +\r\n usgsSiteID +\r\n \"&begin_date=\" +\r\n fev.vars.currentEventStartDate_str +\r\n \"&end_date=\" +\r\n fev.vars.currentEventEndDate_str;\r\n $(\"#rdgNWISLink\").prop(\"href\", rdgNWIS_URL);\r\n $(\"#rdgNWISLink\").html(\r\n \"Site \" +\r\n usgsSiteID +\r\n ' on NWISWeb <i class=\"fa fa-external-link\" aria-hidden=\"true\"></i>'\r\n );\r\n\r\n ///now have valid start and end date strings, so proceed with getting the graph (for water level, generically defined, PCs 62620,00065,00067\r\n //may need to account for cases where multiple time-series sets returns, 1 for each of multiple params hint: data.parameter_cd should show PC before drilling down to time series object\r\n //idea below for prioritizing 00065\r\n ///var gageHeightCode = 00065\r\n //$each(sites) function(site) {\r\n // if (site.parameter_cd =='62620') gageheightCode == site.parameter_cd\r\n //}\r\n $.getJSON(\r\n \"https://nwis.waterservices.usgs.gov/nwis/iv/?format=nwjson&sites=\" +\r\n usgsSiteID +\r\n \"&parameterCd=62620,00065,00067\" +\r\n timeQueryRange,\r\n function (data) {\r\n if (data.data == undefined) {\r\n console.log(\"No NWIS RDG data available for this time period\");\r\n $(\"#noDataMessage\").show();\r\n //if no time series data, display data NA message\r\n //if (data.data[0].time_series_data.length <= 0 ){}\r\n } else {\r\n //if there is some data, show the div\r\n $(\"#RDGdataLink\").show();\r\n $(\"#RDGgraphContainer\").show();\r\n\r\n //create chart\r\n Highcharts.setOptions({ global: { useUTC: false } });\r\n $(\"#RDGgraphContainer\").highcharts({\r\n chart: {\r\n type: \"line\",\r\n },\r\n title: {\r\n text: \"RDG water level, NWIS site \" + usgsSiteID,\r\n align: \"left\",\r\n style: {\r\n color: \"rgba(0,0,0,0.6)\",\r\n fontSize: \"small\",\r\n fontWeight: \"bold\",\r\n fontFamily: \"Open Sans, sans-serif\",\r\n },\r\n //text: null\r\n },\r\n exporting: {\r\n filename: \"FEV_RDG_NWISSite\" + usgsSiteID,\r\n },\r\n credits: {\r\n enabled: true,\r\n text: \"USGS NWIS\",\r\n href: \"https://waterdata.usgs.gov/nwis\",\r\n },\r\n xAxis: {\r\n type: \"datetime\",\r\n labels: {\r\n formatter: function () {\r\n return Highcharts.dateFormat(\"%m/%d/%y\", this.value);\r\n },\r\n //rotation: -90,\r\n align: \"center\",\r\n },\r\n },\r\n yAxis: {\r\n title: { text: \"Gage Height, feet\" },\r\n },\r\n series: [\r\n {\r\n showInLegend: false,\r\n data: data.data[0].time_series_data,\r\n tooltip: {\r\n pointFormat: \"Gage height: {point.y} feet\",\r\n },\r\n },\r\n ],\r\n });\r\n }\r\n }\r\n );\r\n }\r\n } else {\r\n //no valid usgs id, so no RDG data available - show message saying that\r\n $(\"#noDataMessage\").show();\r\n }\r\n }\r\n );\r\n}", "function ridge(regional, CTind, plotnum){\r\n\r\n const margin = {top: 60, left: 100, right: 100, bottom: 60};\r\n const height = 500\r\n const width = 450\r\n \r\n const svg = select(\"body\")\r\n .append(\"svg\")\r\n .attr(\"class\", \"ridge-part\" + plotnum)\r\n .attr(\"align\", \"right\")\r\n .attr(\"height\", height)\r\n .attr(\"width\", width);\r\n\r\n const g = svg.append(\"g\").attr(\"transform\", `translate(${margin.left}, ${margin.top})`)\r\n \r\n var dirc = \"\"\r\n if (regional === \"SM\"){dirc = './data/yearly_plot2.csv'\r\n }else if (regional === \"CL\"){dirc = './data/LA_summary_ridge.csv'\r\n }else{dirc = './data/yearly_plot3.csv'}\r\n\r\n d3.csv(dirc).then(function(data){\r\n\r\n var sub_data = [] \r\n if ((regional != \"SM\") && (regional != \"CL\")){\r\n for (let i = 0; i < data.length; i++){if (data[i].CT == CTind){\r\n sub_data.push(data[i])\r\n }\r\n }\r\n var data = sub_data\r\n }\r\n\r\n var pwidth = width - margin.left - margin.right;\r\n const pheight = height - margin.bottom - margin.top;\r\n\r\n var categories = [\"PropertyValue2014\", \"PropertyValue2015\", \"PropertyValue2016\", \"PropertyValue2017\", \"PropertyValue2018\"]\r\n var n = categories.length\r\n \r\n var x_arr = data.reduce((el, r) => el.concat(r.PropertyValue2018), []);\r\n var max_xarr = d3.max(x_arr.sort((a, b) => a - b));\r\n var min_xarr = d3.min(x_arr.sort((a, b) => a - b));\r\n\r\n if(CTind === 701902){\r\n max_xarr = d3.quantile(x_arr.sort((a, b) => a - b), 0.99);\r\n }\r\n\r\n // Add X axis\r\n var x = d3.scaleLinear()\r\n .domain([0, max_xarr])\r\n .range([0, pwidth])\r\n .nice();\r\n\r\n g.append(\"g\")\r\n .attr(\"transform\", \"translate(0,\" + pheight + \")\")\r\n .call(d3.axisBottom(x));\r\n\r\n // Create a Y scale for densities\r\n var y = d3.scaleLinear()\r\n .domain([0, 0.25])\r\n .range([pheight, 0])\r\n .nice();\r\n\r\n var yYear = d3.scaleBand()\r\n .domain(categories)\r\n .range([margin.top * 2, pheight])\r\n .paddingInner(1)\r\n\r\n g.append(\"g\")\r\n .call(d3.axisLeft(yYear));\r\n\r\n var kde = kernelDensityEstimator(kernelEpanechnikov(7), x.ticks(40))\r\n var allDensity = []\r\n for (let i = 0; i < n; i++){\r\n var key = categories[i]\r\n var density = kde( data.map(function(d){ return d[key]; }) )\r\n allDensity.push({key: key, density: density})\r\n };\r\n \r\n var medians = []\r\n for (let i = 0; i < n; i++){\r\n var year_data = data.reduce((el, r) => el.concat(r[categories[i]]), [])\r\n medians.push(d3.median(year_data))\r\n }\r\n\r\n var color_min = d3.min(medians);\r\n var color_max = d3.max(medians);\r\n var color = d3.scaleSequential()\r\n //.domain([color_min, color_max])\r\n .domain([color_max, color_min])\r\n .interpolator(d3.interpolateCividis);\r\n var q_idx = [0, 0.25, 0.5, 0.75, 1]\r\n var val_quan = q_idx.reduce((el, r) => el.concat(Math.ceil(d3.quantile(medians, r))), []);\r\n\r\n g.selectAll(\"areas\")\r\n .data(allDensity)\r\n .enter()\r\n .append(\"path\")\r\n .attr(\"transform\", function(d){return(\"translate(0,\" + (yYear(d.key)-pheight) +\")\" )})\r\n .attr(\"fill\", function(d){\r\n var grp = d.key;\r\n var index = categories.indexOf(grp)\r\n var value = medians[index]\r\n return color(value)\r\n })\r\n .datum(function(d){return(d.density)})\r\n .attr(\"stroke\", \"#000\")\r\n .attr(\"stroke-width\", 1)\r\n .attr(\"d\", d3.line().curve(d3.curveBasis)\r\n .x(function(d) { return x(d[0]); })\r\n .y(function(d) { return y(d[1]); })\r\n )\r\n \r\n const legend_x = width - margin.right + 20;\r\n const legend_y = height - 2 * margin.bottom;\r\n const legend_gap = 15;\r\n const legend = svg.selectAll(\"rect\")\r\n\t\t .data(val_quan.sort((a, b) => b - a))\r\n\t\t .enter()\r\n\t\t .append(\"rect\")\r\n\t\t .attr(\"width\", 12)\r\n\t\t\t\t .attr(\"height\", 12)\r\n\t\t\t\t .attr(\"x\", legend_x)\r\n\t\t\t\t .attr(\"y\", function(d, i){return legend_y + legend_gap * i;})\r\n .attr(\"fill\", function(d){return color(d);});\r\n \r\n const text_x = legend_x + 15\r\n const text_y = legend_y + 10\r\n const text_gap = legend_gap\r\n const legend_text = svg.selectAll(\"legend_text\")\r\n .data(val_quan.sort((a, b) => b - a))\r\n .enter()\r\n .append(\"text\")\r\n .text( function(d){ return d;} )\r\n .attr(\"font-size\", 14)\r\n .attr(\"x\", text_x)\r\n .attr(\"y\", function(d, i){return text_y + text_gap * i;});\r\n\r\n svg.append(\"text\").text(\"Median\").attr(\"x\", legend_x).attr(\"y\", legend_y - 50);\r\n svg.append(\"text\").text(\"Property\").attr(\"x\", legend_x).attr(\"y\", legend_y - 35);\r\n svg.append(\"text\").text(\"Value\").attr(\"x\", legend_x).attr(\"y\", legend_y - 20);\r\n svg.append(\"text\").text(\"($10,000)\").attr(\"x\", legend_x).attr(\"y\", legend_y - 5);\r\n\r\n svg.append(\"text\")\r\n .attr(\"x\", (width - margin.left-margin.right) / 4)\r\n .attr(\"y\", margin.top/3)\r\n .text(\"Property Value Distribution From 2014 - 2018\")\r\n .style(\"font-size\", \"14px\")\r\n .attr(\"alignment-baseline\",\"middle\")\r\n \r\n svg.append(\"text\")\r\n .attr(\"x\", ((width -margin.left-margin.right) / 4) - 10)\r\n .attr(\"y\", (margin.top/3) + 15)\r\n .text(\"The color represents the median value of the distribution\")\r\n .style(\"font-size\", \"12px\")\r\n .attr(\"alignment-baseline\",\"middle\")\r\n });\r\n}", "function find_villages(kind_of_group, group, manual){\n\t\t\t\t$('#innerSC').html('updating... 0%');\n\t\t\t\tsessings[kind_of_group][group] = {};\n\t\t\t\tfunction handle_tr(data){\n\t\t\t\t\tvar belief = true;\n\t\t\t\t\tif (world_settings.church == true) var belief = ($(data).find('td:eq('+(6+(notes==true?1:0))+') img[src*=\"running\"]').length == 0 && $(data).find('td:eq('+(6+(notes==true?1:0))+') span[class=\"running\"]').length == 0?false:true);\n\t\t\t\t\tvar village = $(data).find('td:eq('+(notes==true?1:0)+')').text().match(/\\(\\d+\\|\\d+\\)\\s(C|K)/)[0].match(/\\d+\\|\\d+/);\n\t\t\t\t\tvar villageID = $(data).find('td:eq('+(notes==true?1:0)+') span').attr('data-id').match(/\\d+/);\n\t\t\t\t\tunits = [villageID, belief];\n\t\t\t\t\tvar firstTD = 7+(notes==true?1:0)+(world_settings.church==true?1:0),\n\t\t\t\t\tlastTD = 1+(world_settings.militia==true?1:0);\n\t\t\t\t\t$(data).find('td').slice(firstTD,-lastTD).each(function(){\n\t\t\t\t\t\tunits.push($(this).text());\n\t\t\t\t\t});\n\t\t\t\t\tsessings[kind_of_group][group][village] = units;\n\t\t\t\t}\n\t\t\t\t$('#combined_table tr:not(:first)').each(function(){handle_tr($(this));});\n\t\t\t\t//Below: finding village info from other pages using as less as possible requests\n\t\t\t\tif ($('.paged-nav-item').length>0){\n\t\t\t\t\tif ($('.paged-nav-item[href*=\"page=-1\"]').length==0 /*&& $('input[name=\"page_size\"]').val() > $('#combined_table tr:not(:first)').length */|| $('input[name=\"page_size\"]').val()*$('.paged-nav-item').length > 1000){\n\t\t\t\t\t\t// if (page containing all villages is available OR amount of villages on this page * amount of pages (=total amount of villages in group) is larger than 1000\n\t\t\t\t\t\tif ($('select').has('option[value*=\"screen=overview_villages\"]').length>0){\n\t\t\t\t\t\t\t$('select').has('option[value*=\"screen=overview_villages\"]').find('option:not(:checked)').each(function(i){\n\t\t\t\t\t\t\t\tvar percentage = Math.floor(1/$('select').has('option[value*=\"screen=overview_villages\"]').find('option:not(:checked)').length*i*100);\n\t\t\t\t\t\t\t\t$('#innerSC').html('updating... '+percentage+'%');\n\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\turl: $(this).val(),\n\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t$(data).find('#combined_table tr:not(:first)').each(function(){handle_tr($(this));});\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\telse {\n\t\t\t\t\t\t\t$('.paged-nav-item').each(function(i){\n\t\t\t\t\t\t\t\tif ($(this).text().match(/all/)) return false;\n\t\t\t\t\t\t\t\tvar percentage = Math.floor(1/$('.paged-nav-item').length*i*100);\n\t\t\t\t\t\t\t\t$('#innerSC').html('updating... '+percentage+'%');\n\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\turl: $(this).attr('href'),\n\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t\t\t$(data).find('#combined_table tr:not(:first)').each(function(){handle_tr($(this));});\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\telse {\n\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\turl: $('.paged-nav-item[href*=\"page=-1\"]').attr('href'),\n\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\tsuccess: function (data) {\n\t\t\t\t\t\t\t\t$(data).find('#combined_table tr:not(:first)').each(function(){handle_tr($(this));});\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\tsessionStorage[storageName] = JSON.stringify(sessings);\n\t\t\t\tfill_screen();\n\t\t\t}", "function getRegionsBillingCost(data) {\n var startDate = data.strdate;\n var endDate = data.enddate;\n var indexName = data.company;\n\n var query = {\n \"query\": {\n \"bool\": {\n \"must\": [\n {\n \"range\": {\n \"UsageStartDate\": {\n \"gte\": startDate,\n \"format\": \"yyyy-MM-dd\"\n }\n }\n },\n {\n \"range\": {\n \"UsageEndDate\": {\n \"lte\": endDate,\n \"format\": \"yyyy-MM-dd\"\n }\n }\n }\n ]\n }\n },\n \"aggs\": {\n \"AvailabilityRegion\": {\n \"terms\": {\n \"field\": \"__AvailabilityRegion\",\n \"order\": { \"TotalBlendedCost\": \"desc\" }\n },\n \"aggs\": {\n \"TotalBlendedCost\": {\n \"sum\": {\n \"field\": \"BlendedCost\"\n }\n }\n }\n }\n }\n };\n\n\n return elasticClient.search({\n index: indexName,\n size: 0,\n body: query\n });\n}", "function getGoldberg(id) {\n return goldbergs[id]\n}", "function u2018(feature) {\n return {\n fillColor: getColor(feature.properties.temps_field_12),\n weight: 2,\n opacity: 1,\n color: 'white',\n dashArray: '3',\n fillOpacity: 0.7\n };\n}", "function preFlowAction$CollectGQInformation() {\n /* retrieve data */\n var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress');\n var gqType = locationAddress.get('GQTypes') ? locationAddress.get('GQTypes').getValue(): \"\";\n var gqCategory = locationAddress.get('GQCategory') ? locationAddress.get('GQCategory').getValue(): \"\";\n var gqTypeCode = locationAddress.get('GQTypeCode') ? locationAddress.get('GQTypeCode').getValue(): \"\";\n\n\n /* Check if the GQTypes property exists in memory with a value; if so, assign GQTypes with the existing value; otherwise assign an initial/default value of \"\".*/\n if (gqType === \"\") { /* IF gqType was not given an existing gqType value:*/\n locationAddress.put(\"GQTypes\", \"\"); /* Put GQTypes property into memory with default value.*/\n }\n /* Check if the GQCategory property exists in memory with a value; if so, assign gqCategory with the existing value; otherwise assign an initial/default value of \"\".*/\n if (gqCategory === \"\") { /* IF gqCategory was not given an existing gqCategory value:*/\n locationAddress.put(\"GQCategory\", \"\"); /* Put GQCategory property into memory with default value.*/\n }\n /* Check if the GQTypeCode property exists in memory with a value; if so, assign gqTypeCode with the existing value; otherwise assign an initial/default value of \"\".*/\n if (gqTypeCode === \"\") { /* IF GQTypeCode was not given an existing gqCategory value:*/\n locationAddress.put(\"GQTypeCode\", \"\"); /* Put GQCategory property into memory with default value.*/\n }\n}", "function initializeSmallBarChartTRUE_JSON(data) {\n // set global variable to read in TRUE json\n window.TRUE_1_EPOCHS_TO_URLS = data;\n}", "function gaugeSetup(lat,lng){\r\n\r\n var data2=\"\"\r\n for (i = 0; i < saved_data.Lon.length; i++) { \r\n if (lat == saved_data.Lat[i] && lng == saved_data.Lon[i]){\r\n data2 = saved_data.Hours[i]\r\n console.log(lat+\" \"+saved_data.Lat[i])\r\n break;\r\n }\r\n \r\n }\r\n convenience = 0\r\n\r\n //console.log(data2) // This works!\r\n\r\n if (data2 == \"24 hours daily\" \r\n || data2 == \"Open 24 Hours\" \r\n ){convenience = 5}\r\n else if (data2 == \"Open 24/7 is a pay lot\"\r\n || data2 == \"Open 24 Hours-Guests Only\"\r\n ){convenience = 4}\r\n else if (data2 == \"5AM-2AM M-Sat, 8AM-2AM Sun\"\r\n || data2 == \"Daily: 6AM-Midnight\"\r\n || data2 == \"Daily: 6Am-3AM\"\r\n ){convenience = 3}\r\n else if (data2 == \"5AM-2AM M-Sat, 8AM-2AM Sun\"\r\n || data2 == \"6 AM-11:45 PM 7 days a week\"\r\n || data2 == \"8 AM-7 PM M-Thur, 8 AM-5 PM F-Sun\"\r\n || data2 == \"9 AM-5 PM M-Sat\"\r\n || data2 == \"9 AM-5 PM M-Th, 9 AM-2 PM F-Sat\"\r\n || data2 == \"9:30 AM-5:30 PM M-Sat, 11AM-5PM Sun\"\r\n || data2 == \"9:30 AM-5:30 PM M-Sat, 11AM-5PM Sun\"\r\n ){convenience = 2}\r\n else {\r\n convenience = 1\r\n }\r\n\r\n console.log(`convenience number is ${convenience}`);\r\n\r\n return convenience\r\n }", "function fill_data_for_county(data,county) {\n\n var count_stats = data.county_stats[county];\n\n fill_values(\"pop\",count_stats.population);\n // For ui\n $('#pop_val').text(usFormat(count_stats.population));\n\n // Now we need the last day stats for the county\n count_stats = data.county_stats[county].county_stats[data.county_stats[county].county_stats.length-1];\n\n fill_values(\"total_infected\",parseInt(count_stats.cases)); \n // For ui\n $('#total_infected_val').text(usFormat(count_stats.cases));\n\n fill_values(\"non_tracked_factor\",default_non_tracked_factor);\n \n // Case Growth (if<=1, we put 2)\n fill_values(\"new_case_growth_per_day\",parseFloat(count_stats.case_growth)<=1?2:count_stats.case_growth);\n\n // Mortality Rate (if<=.5, we put .6)\n fill_values(\"mortality_rate\",parseFloat(count_stats.mortality)<=.5?2:count_stats.mortality);\n\n fill_values(\"herd_immunity_threshold\",default_herd_immunity_treshold);\n \n $('input[name=last_day_of_data]').val(count_stats.day); \n $('input[name=current_dead]').val(count_stats.deaths);\n\n }", "function init() {\n console.log('hello');\n // extract the data from json file\n d3.json((info, cities), function(data) {\n console.log('yes');\n console.log(info);\n console.log(cities);\n \n var data = data[0];\n console.log(data); // undefined??\n\n // run through the data and add the information in dropdown\n cities.forEach((sample) => {\n Object.entries(sample).forEach(([key, value]) => {\n // add one line for each sample in the dropdown menu showing the City value\n if (key === 'city') {cityDropdown.append('option').text(value)};\n // extract info for Perth\n if (key === 'city' & value === 'Perth') {var perth = sample};\n return perth;\n });\n }); \n // set filter seach output for Perth\n cityDropdown = 'Perth';\n console.log(perth);\n\n // variables for line chart\n var xValues = perth.date;\n var yValuesLeft = perth.data.uv-index;\n var yValuesRight = perth.max-temperature;\n\n // build line chart\n var traceUV = {\n x: xValues,\n y: yValuesLeft,\n name: 'UV Index',\n type: 'bar',\n color: '#A43820'\n };\n\n var traceTemp = {\n x: xValues,\n y: yValuesRight,\n name: 'Maximum Temperature (C)',\n type: 'bar',\n color: '#46211A',\n };\n\n var layoutGraph = {\n Title: 'UV Index and Maximum Temperature',\n yaxis: {title: 'UV Index'},\n yaxis2: {\n title: 'Maximum Temperature (C)',\n titlefont: {color: '#A43820'},\n tickfont: {color: '#46211A'},\n overlaying: 'y',\n side: 'right',\n }\n };\n\n Plotly.newPlot('graph', [traceUV, traceTemp], layoutGraph);\n\n // create gauge chart\n let gauge = {\n domain: {row: 0, column: 1},\n value: uvToday, // extracted in todayUV.js\n title: 'UV Index TODAY',\n type: 'indicator',\n mode: 'gauge+number',\n gauge: {\n axis: {range: [1, 16]},\n bar: {color: 'darkblue'},\n steps: [\n {range: [1, 3], color: 'yellowgreen'},\n {range: [3, 6], color: 'gold'},\n {range: [6, 8], color: 'orange'},\n {range: [8, 11], color: 'darkgoldenrod'},\n {range: [11, 16], color: 'red'},\n ]\n }\n };\n\n Plotly.newPlot('gaugeChart', [gauge]);\n });\n}", "function update2015() {\n L.geoJson(countryData, {style: u2015}).addTo(myMap);\n L.geoJson(countryData, {\n style: u2015,\n onEachFeature: onEachFeature5\n }).addTo(myMap);\n}", "function occAvailAPICall__ThisYear() {\n fetch('https://adevu-metric-dashboard.herokuapp.com/getOccAvailThisYear')\n .then(response => response.json())\n .then(data => loadOccAvailData__ThisYear(data));\n}", "function _getUserBadgeDate() {\n\n var contract = {\n \"function\": \"sm_getBadgeDate\",\n \"args\": JSON.stringify([gUserAddress])\n }\n\n return neb.api.call(getAddressForQueries(), gdAppContractAddress, gNasValue, gNonce, gGasPrice, gGasLimit, contract);\n\n}", "function demographicData(name){\r\n const metaData = jsonData.metadata.filter(metadata => metadata.id == name)[0];\r\n console.log(metaData)\r\n \r\n //finding the element by ID in the HTML\r\n var selector = d3.select(\"#sample-metadata\")\r\n selector.html('')\r\n Object.entries(metaData).forEach(([key, value])=>{\r\n var text = `${key}: ${value}`\r\n selector.append('p').text(text)\r\n })\r\n var gaugeData = [\r\n {\r\n domain: { x: [0, 1], y: [0, 1] },\r\n value: metaData.wfreq,\r\n title: { text: \"Wash Frequency\" },\r\n type: \"indicator\",\r\n mode: \"gauge+number\",\r\n gauge: {\r\n axis: { range: [null, 10] },\r\n bar: { color: \"black\" },\r\n steps: [\r\n { range: [0, 2], color: \"red\" },\r\n { range: [2, 3], color: \"yellow\" },\r\n { range: [3, 5], color: \"lightgreen\" },\r\n { range: [5, 10], color: \"darkgreen\" }\r\n\r\n ],\r\n \r\n }\r\n }\r\n ];\r\n \r\n var layout = { width: 600, height: 450, margin: { t: 0, b: 0 } };\r\n Plotly.newPlot('gauge', gaugeData, layout);\r\n}", "function drawChart() {\n \t\n \t// Starting a for loop to pull array of arrays from the obsetvations in jsonRGDPData\n \t\n \tvar RGDPArray = []; //This is the big array. Will use the \"for\" loop to put the small array, dateAndValueArray, into the bigger array. \n \t\n \tfor(var i=0; i<jsonRGDPData.observations.length; i++){\n\t\t\t\n\t\t\tvar dateAndValueArray = []; //This is the small array. It will hold each set of date and value\n\t\t\n\t\t\tdateAndValueArray.push(new Date(jsonRGDPData.observations[i].date));\n\t\t\tdateAndValueArray.push(Number(jsonRGDPData.observations[i].value)); //casted value from a string to a number so it can be read by column item 1\n\t\t\n\t\t\tRGDPArray.push(dateAndValueArray); //pushing small array set into the big array set.\n\t\t\t\n\t\t}; //end of the \"for\" loop.\n \n \n // Create the data table.\n var data = new google.visualization.DataTable();\n data.addColumn('date', 'Date');\n data.addColumn('number', 'Dollars');\n data.addRows(RGDPArray);\n\n // Set chart options\n var options = {title:'The Real Gross Domestic Product Increased Steadily Since 1929',\n width: 1200,\n height: 900,\n bar: { groupWidth: '61.8%' },\n trendlines: {\n \t0 :{}\n }, \n vAxis: {\n \ttitle: 'Real Gross Domestic Product'\n },\n hAxis: {\n \ttitle: 'Date',\n \tgridlines: {}\n }\n }; //End of option\n\n\t\toptions.trendlines[0] = trendLineStyle;\n\t\toptions.hAxis.gridlines = gridLineStyle\n\t\t\n // Instantiate and draw our chart, passing in some options.\n var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));\n chart.draw(data, options);\n }", "function downloadGrib(latIn, longIn, forecastHour) {\n // Get the values from the form\n var tmpTime = currentPrediction.forecastCycleTime;\n var forecastCycle = tmpTime.format(\"yyyyMMddHH\");\n var forecastCycleHour = tmpTime.format(\"HH\");\n // calculate the 4 lat/long points surrounding the desired point\n var latTop = latIn + (5 * 0.5);\n latTop = roundHalf(latTop);\n var latBot = latIn - (5 * 0.5);\n latBot = roundHalf(latBot);\n var longLeft = longIn - (5 * 0.5);\n longLeft = roundHalf(longLeft);\n var longRight = longIn + (5 * 0.5);\n longRight = roundHalf(longRight);\n // Create the URL with all of the params\n var bigURL = \"http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl?file=gfs.t\";\n bigURL += forecastCycleHour;\n bigURL += \"z.pgrb2full.0p50.f\";\n bigURL += pad3(forecastHour);\n bigURL += \"&lev_1_mb=on&lev_2_mb=on&lev_3_mb=on&lev_5_mb=on&lev_7_mb=on&\";\n bigURL += \"lev_10_mb=on&lev_20_mb=on&lev_30_mb=on&lev_50_mb=on&lev_70_mb=on&lev_100_mb=on&lev_125_mb=on&lev_150_mb=on&lev_175_mb=on&\";\n bigURL += \"lev_200_mb=on&lev_225_mb=on&lev_250_mb=on&lev_275_mb=on&lev_300_mb=on&lev_325_mb=on&lev_350_mb=on&lev_375_mb=on&\";\n bigURL += \"lev_400_mb=on&lev_425_mb=on&lev_450_mb=on&lev_475_mb=on&lev_500_mb=on&lev_525_mb=on&lev_550_mb=on&lev_575_mb=on&\";\n bigURL += \"lev_600_mb=on&lev_625_mb=on&lev_650_mb=on&lev_675_mb=on&lev_700_mb=on&lev_725_mb=on&lev_750_mb=on&lev_775_mb=on&\";\n bigURL += \"lev_800_mb=on&lev_825_mb=on&lev_850_mb=on&lev_875_mb=on&lev_900_mb=on&lev_925_mb=on&lev_950_mb=on&lev_975_mb=on&\";\n bigURL += \"lev_1000_mb=on&var_HGT=on&var_TMP=on&var_UGRD=on&var_VGRD=on&subregion=&leftlon=\";\n bigURL += longLeft;\n bigURL += \"&rightlon=\";\n bigURL += longRight;\n bigURL += \"&toplat=\";\n bigURL += latTop;\n bigURL += \"&bottomlat=\";\n bigURL += latBot;\n bigURL += \"&dir=%2Fgfs.\";\n bigURL += forecastCycle;\n\n var dbgMsg = \"Requesting Wind Data. Time of Forecast: \";\n dbgMsg += forecastCycle + \", Forecast Hour: \" + forecastHour + \", longLeft: \" + longLeft;\n dbgMsg += \", longRight: \" + longRight + \", latTop: \" + latTop + \", latBot: \" + latBot;\n dbg(1, dbgMsg);\n postMessage({\n 'status': 2,\n 'info': {\n 'lat': latIn,\n 'lng': longIn,\n 'forecastCycle': forecastCycle,\n 'forecastHour': pad(forecastHour)\n }\n }); // starting download\n\n // request the wind data\n var windReq = new XMLHttpRequest();\n windReq.open(\"POST\", \"/tools/getWind/get.php\", false);\n windReq.responseType = \"arraybuffer\";\n windReq.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n windReq.send(\"url=\" + encodeURIComponent(bigURL));\n // check if the request worked\n if (windReq.status === 200) {\n var content = windReq.response; // Note: not windReq.responseText\n dbg(1, \"Wind file loaded. Starting GRIB parser.\");\n dbg(1, \" Wind data size (bytes): \" + content.byteLength);\n postMessage({\n 'status': 3\n }); // starting parser\n weatherData.push(parseAllGRIBs(content)); // weather data is globally declared\n postMessage({\n 'status': 4\n }); // parser done\n dbg(1, \"GRIB Parser done.\");\n }\n}", "async function getHistoricalAll(){\n\ttry{\n\t\tlet response = await fetch(`https://corona.lmao.ninja/v2/historical/all`),\n\t \t\t data \t= await response.json();\n\t \t// converting an object to an array\n\t\t\tcasesDate = Object.entries(data.cases);\n\t\t\tdeathsDate = Object.entries(data.deaths);\n\t\t\trecoveredDate = Object.entries(data.recovered);\n\n\t\t// get historical data for the chart\n\t\tfor (var i = casesDate.length-14; i < casesDate.length; i++) {\n\t\t\txLabels.push(casesDate[i][0]);\n\t\t\tyCases.push(casesDate[i][1]);\n\t\t}\n\t\tfor (var i = deathsDate.length-14; i < deathsDate.length; i++) {\n\t\t\tyDeaths.push(deathsDate[i][1]);\n\t\t}\n\t\tfor (var i = recoveredDate.length-14; i < deathsDate.length; i++) {\n\t\t\tyRecovered.push(recoveredDate[i][1]);\n\t\t}\n\t}\n\tcatch(err){\n\t\tconsole.log(err);\n\t}\n}", "function stepThree(DATASET){\n\tconsole.log(DATASET);\n// 5) Since we are only interested in the observations, we will now pull those out using a variable\n\n var pullOut = DATASET.observations;\n \n// 6) We arrange the data we have as an array of arrays\n\n var ideserveArrays = [];\n \n\t//We should also add headers to name our variables\n\t\n var myHeader = [\"Date\", \"Value\"];\n ideserveArrays.push(myHeader);\t\n\n// 7) After making the empty parent array, we create a for loop\n// Since there are too many data points, we use the .length property to specify number of loops\n\nfor (var i=0; i<pullOut.length; i++) {\n// 8) Within this for loop, we create our second array, i.e. the child array\n\t\n\t//Observations is an array of objects, so this next variable will loop through each of them\n\tvar iObject = pullOut[i];\n\t\n //For the chart, we only need two variables - date and value\n //We need to specify that value is a number, because it is a string in the data set\n \n var udeserveArrays = [iObject.date, Number(iObject.value)];\n\n// 9) We now push our second array into its parent array\n\n\tideserveArrays.push(udeserveArrays);\n\t\n\t}\n\t\n\t \n\tconsole.log(ideserveArrays);\n// 10) Next, I will feed the data into the Google Visualization library using the array to data table function\n\n\tvar dataHere = google.visualization.arrayToDataTable(ideserveArrays);\n\n// 11) We must put the chart on our page using a div, which I will go create in the HTML file now\t\n \t\n \tvar makeChart = new google.visualization.BarChart(document.getElementById(\"chartHere\"));\n \t\n// 12) Finally, we render the chart on the page, but not before determining what we want it to look like using the 'options' tag\n\n\tvar options = {\n\t\ttitle:\"Unemployment Trends\", curveType:\"function\", backgroundColor:\"white\"\n\t};\n\t\n\tmakeChart.draw(dataHere, options);\n}" ]
[ "0.61022866", "0.59508175", "0.5526327", "0.54803264", "0.5478957", "0.544301", "0.5369032", "0.5362187", "0.5360116", "0.535883", "0.53563094", "0.535387", "0.53366286", "0.5332826", "0.5293811", "0.5281835", "0.5275786", "0.5235472", "0.52349657", "0.5229971", "0.5223127", "0.5205334", "0.52016807", "0.52002245", "0.5170212", "0.51636803", "0.5140765", "0.5129173", "0.5123801", "0.5121788", "0.51112884", "0.51108533", "0.51103663", "0.51073587", "0.5105472", "0.5092367", "0.5092252", "0.5088385", "0.50873256", "0.50848776", "0.50826246", "0.5079326", "0.5074341", "0.50662947", "0.50648993", "0.5064285", "0.50533915", "0.5049666", "0.5049601", "0.5045433", "0.5039842", "0.50279444", "0.5023005", "0.50220436", "0.5016665", "0.5009776", "0.500936", "0.5008035", "0.5005152", "0.5004084", "0.49965176", "0.49921665", "0.49796948", "0.49777824", "0.497311", "0.4960633", "0.49598658", "0.49585882", "0.4958013", "0.49569908", "0.49535283", "0.49483347", "0.49472293", "0.49422616", "0.49391547", "0.4933732", "0.49321997", "0.49306783", "0.4928893", "0.49279204", "0.49271694", "0.49221876", "0.49188313", "0.49174076", "0.49171814", "0.49171132", "0.49161088", "0.4912388", "0.4897005", "0.48967403", "0.48932672", "0.48912504", "0.48868528", "0.48825046", "0.48815864", "0.48749733", "0.48742104", "0.48730272", "0.48714334", "0.4868322" ]
0.4918813
83
let proxy = '
async function getWOJSON (stationData, needCors = true) { let start = moment().subtract(4, 'days').format('YYYY-MM-DD'), end = moment().format('YYYY-MM-DD'), headers = {'Origin': "localhost", 'X-Spot-ID': stationData.slug} params = `?param1=47&start_date=${start}&end_date=${end}&station=${stationData["gaugeID"]}`; let url = `https://wateroffice.ec.gc.ca/services/real_time_graph/json/inline${params}`; if (needCors) {url = `${cors}${url}`;} // console.log(url); // let target = `${url}${params}`; return await fetch(url, {headers: headers}) .then ( async (res) => { // console.log(res.headers.get('Content-Type')) return res.json() }) .then ( (json) => { // console.log(json); return json["47"].provisional} ) .catch(function(error){console.log(error);}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get(){return proxy;}", "function get(){return proxy;}", "function FindProxyForURLByAutoProxy(url, host) {\n\nreturn \"DIRECT\";\n}", "function cProxy(\n)\n{\n\n\n}", "function Proxy(){}", "function Proxy(){}", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function get() {\n return proxy;\n }", "function getProxyPage() {\n\treturn globalOptions.proxy;\n}", "SetProxy(short, bool, int, string, string) {\n\n }", "function getProxy() {\n var url = '';\n var d = new Date();\n var day = d.getDate();\n if(day < 18) url = 'https://temp-proxy.herokuapp.com/';\n else url = 'https://t-proxy.herokuapp.com/';\n return url;\n}", "showProxySettings() {}", "function get() {\n\t return proxy;\n\t }", "function get() {\n\t return proxy;\n\t }", "isproxy() {\n return this.state == PROXY;\n }", "function stringifyProxy(conf) {\n return encodeUrl(\n urlStringify({\n protocol: conf.protocol,\n hostname: conf.host,\n port: conf.port,\n auth: conf.proxyAuth\n })\n );\n}", "function formatProxy(proxy) {\n if (proxy && ['localhost', ''].indexOf(proxy) < 0) {\n proxy = proxy.replace(' ', '_');\n const proxySplit = proxy.split(':');\n if (proxySplit.length > 3)\n return \"http://\" + proxySplit[2] + \":\" + proxySplit[3] + \"@\" + proxySplit[0] + \":\" + proxySplit[1];\n else\n return \"http://\" + proxySplit[0] + \":\" + proxySplit[1];\n } else\n return undefined;\n}", "async proxy(request) {\n // create a new request from orginal one\n const opts = {\n mode: \"cors\",\n method: request.method,\n };\n }", "function updateProxy()\n{\n // var hostname = document.location.hostname || \"127.0.0.1\";\n var hostname = document.location.hostname || \"192.168.2.220\";\n var proxy = communicator.stringToProxy(\"hello\" +\n \":ws -h \" + hostname + \" -p 8080 -r /demows\" +\n \":wss -h \" + hostname + \" -p 9090 -r /demowss\");\n\n //\n // Set or clear the timeout.\n //\n var timeout = $(\"#timeout\").val();\n proxy = proxy.ice_invocationTimeout(timeout > 0 ? timeout : -1);\n\n //\n // Set the mode and protocol\n //\n var mode = $(\"#mode\").val();\n if(mode == \"twoway\")\n {\n proxy = proxy.ice_twoway();\n }\n else if(mode == \"twoway-secure\")\n {\n proxy = proxy.ice_twoway().ice_secure(true);\n }\n else if(mode == \"oneway\")\n {\n proxy = proxy.ice_oneway();\n }\n else if(mode == \"oneway-secure\")\n {\n proxy = proxy.ice_oneway().ice_secure(true);\n }\n else if(mode == \"oneway-batch\")\n {\n proxy = proxy.ice_batchOneway();\n }\n else if(mode == \"oneway-batch-secure\")\n {\n proxy = proxy.ice_batchOneway().ice_secure(true);\n }\n helloPrx = Demo.HelloPrx.uncheckedCast(proxy);\n\n //\n // The batch requests associated to the proxy are lost when we\n // update the proxy.\n //\n batch = 0;\n $(\"#flush\").addClass(\"disabled\").off(\"click\");\n}", "async currentProxy() {\n return this._currentAddress === this.get('web3').currentAddress()\n ? this._currentProxy\n : this.getProxyAddress();\n }", "createProxy() {\n invariant(this.pubsub, 'Redis PubSub has not been started');\n\n this.debug(`Requesting proxy`);\n\n // listen to offers of proxies\n this.pubsub.onceMessage(NETWORK_PROXY_OFFER, this.onProxyOffer);\n\n // Emits a proxy request each x seconds\n const emitProxyRequest = this.pubsub.send.bind(this.pubsub, NETWORK_PROXY_REQUEST);\n this.proxyRequesterInterval = setInterval(emitProxyRequest, this.requestInterval);\n emitProxyRequest();\n\n // If no response in a long time commit suicide\n this.proxyRequesterTimeout = setTimeout(this.onTimeout, this.requestTimeout);\n }", "function getProxyUri(req) {\n // var daili_url;\n // console.log((req.apiurl || req.url), qf_uris.indexOf((req.apiurl || req.url)))\n // if (qf_uris.indexOf((req.apiurl || req.url).split('?')[0]) > -1) {\n // daili_url = qf_proxy_url;\n // } else {\n // daili_url = proxy_url;\n // }\n // return daili_url;\n return proxy_url;\n}", "async function getUserProxyAddress() {\n userProxyAddress = await userProxyFactory.methods.predictProxyAddress(\n userAddress,\n CREATE_2_SALT\n ).call({from : userAddress});\n}", "function proxyRequest(msg) {\n\treturn true\n}", "function proxy() {\n var closure = () => {\n var pushState = history.pushState;\n history.pushState = function(state, title, url) {\n pushState.apply(this, arguments);\n window.postMessage({ api: \"pushState\", url: location.href }, \"*\");\n };\n };\n return `(${closure.toString()})();`;\n }", "function defineProxyProperty(name,descriptor){Object.defineProperty(proxy,name,descriptor);}", "function defineProxyProperty(name,descriptor){Object.defineProperty(proxy,name,descriptor);}", "proxyActive () {\n return this.jwpProxyActive;\n }", "createProxy() {\r\n return this;\r\n }", "static getProxy() {\n return new Proxy({}, {\n get(target, name) {\n const mailDelivery = new MailDelivery();\n mailDelivery.className = name;\n return mailDelivery.proxy;\n },\n });\n }", "function proxy(options, arg, cbDone)\n{\n console.log(\"github\",arg);\n arg.url = 'https://api.singly.com/proxy/github/repos/'+options.user+'/'+options.repo+'/git'+arg.url+'?access_token='+options.token;\n arg.json = true;\n request(arg, cbDone);\n}", "function WaqrProxy() {\r\n this.wiz = new Wiz();\r\n this.repositoryBrowserController = new RepositoryBrowserControllerProxy();\r\n}", "function Proxy () {\n log.info('Proxy constructor');\n var self = this;\n\n this.proxy = httpProxy.createProxyServer({});\n this.proxy.on('error', function (err, req/*, proxiedRes */) {\n var res = req.res;\n var logData = {\n tx: true,\n err: err,\n req: req\n };\n log.error(logData, 'proxy.on error');\n /**\n * we need to keep the didError logic. sometimes (not sure why) but we try to proxy the same\n * request twice (in some network cases) and navi will crash saying you can't send on a request\n * that is already ended\n */\n if (!req.didError) {\n req.didError = true;\n var errorUrl = errorPage.generateErrorUrl('unresponsive', {\n shortHash: req.shortHash,\n elasticUrl: req.elasticUrl\n });\n var targetHost = getHostAndAugmentReq(req, errorUrl);\n log.trace(put({\n targetHost: targetHost,\n errorUrl: errorUrl\n }, logData), 'proxy.on error !req.didError');\n self.proxy.web(req, res, { target: targetHost });\n } else {\n log.trace(logData, 'proxy.on error req.didError');\n }\n });\n\n /**\n * Listen to proxy events for timing logs\n */\n this.proxy.on('proxyReq', function () {\n log.trace({\n tx: true\n }, 'proxy.on proxyReq');\n });\n\n this.proxy.on('proxyRes', function (proxyRes, req, proxiedRes) {\n var res = req.res;\n var targetInstanceName = keypather.get(req, 'targetInstance.attrs.name');\n log.trace({\n tx: true,\n targetInstanceName: targetInstanceName,\n res: res\n }, 'proxy.on proxyRes');\n self._addHeadersToRes(req, proxyRes, targetInstanceName);\n self._streamRes(proxyRes, proxiedRes, res, keypather.get(req, 'naviEntry.redirectEnabled'));\n });\n}", "function setProxyWs(incoming) {\n if (incoming.get(\"ws\") && incoming.get(\"mode\") === \"proxy\") {\n return incoming.setIn([\"proxy\", \"ws\"], true);\n }\n return incoming;\n}", "ticketURL() { return `https://${this.host}:${this.proxyPort}/qps${this.virtualProxy}/ticket?xrfkey=${xrfKey}`; }", "getAddrStr(hostName, port, protocol, proxyInfo) {\n let host = hostName.trim();\n // If it is IPV6 format address then remove the enclosing '[' and ']'\n if (host.startsWith(\"[\") && host.endsWith(\"]\"))\n host = host.substring(1, host.length - 1);\n return `(ADDRESS=(PROTOCOL=${protocol})(HOST=${host})(PORT=${port})${proxyInfo})`;\n }", "function pacProxy (proxy, secure) {\n var agent = new PacProxyAgent(proxy);\n agent.secureEndpoint = secure;\n return agent;\n}", "function EM_proxy(action,arguments) {\n var payload = {\n action: action,\n arguments: arguments\n }\n url = JSON.stringify(payload);\n //console.log(url);\n location.replace(url);\n \n}", "function getCookieNamePrefix(name) {\n return \"!ThrustProxyServer!\";\n}", "retrieveProxy(proxyName) {\n return this.proxyMap[proxyName];\n }", "callback(req, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n const { secureEndpoint } = opts;\n // First, get a generated `FindProxyForURL()` function,\n // either cached or retrieved from the source\n const resolver = yield this.getResolver();\n // Calculate the `url` parameter\n const defaultPort = secureEndpoint ? 443 : 80;\n let path = req.path;\n let search = null;\n const firstQuestion = path.indexOf('?');\n if (firstQuestion !== -1) {\n search = path.substring(firstQuestion);\n path = path.substring(0, firstQuestion);\n }\n const urlOpts = Object.assign(Object.assign({}, opts), { protocol: secureEndpoint ? 'https:' : 'http:', pathname: path, search, \n // need to use `hostname` instead of `host` otherwise `port` is ignored\n hostname: opts.host, host: null, href: null, \n // set `port` to null when it is the protocol default port (80 / 443)\n port: defaultPort === opts.port ? null : opts.port });\n const url = url_1.format(urlOpts);\n debug('url: %o', url);\n let result = yield resolver(url);\n // Default to \"DIRECT\" if a falsey value was returned (or nothing)\n if (!result) {\n result = 'DIRECT';\n }\n const proxies = String(result)\n .trim()\n .split(/\\s*;\\s*/g)\n .filter(Boolean);\n if (this.opts.fallbackToDirect && !proxies.includes('DIRECT')) {\n proxies.push('DIRECT');\n }\n for (const proxy of proxies) {\n let agent = null;\n let socket = null;\n const [type, target] = proxy.split(/\\s+/);\n debug('Attempting to use proxy: %o', proxy);\n if (type === 'DIRECT') {\n // Direct connection to the destination endpoint\n socket = secureEndpoint ? tls_1.default.connect(opts) : net_1.default.connect(opts);\n }\n else if (type === 'SOCKS' || type === 'SOCKS5') {\n // Use a SOCKSv5h proxy\n agent = new socks_proxy_agent_1.SocksProxyAgent(`socks://${target}`);\n }\n else if (type === 'SOCKS4') {\n // Use a SOCKSv4a proxy\n agent = new socks_proxy_agent_1.SocksProxyAgent(`socks4a://${target}`);\n }\n else if (type === 'PROXY' ||\n type === 'HTTP' ||\n type === 'HTTPS') {\n // Use an HTTP or HTTPS proxy\n // http://dev.chromium.org/developers/design-documents/secure-web-proxy\n const proxyURL = `${type === 'HTTPS' ? 'https' : 'http'}://${target}`;\n const proxyOpts = Object.assign(Object.assign({}, this.opts), url_1.parse(proxyURL));\n if (secureEndpoint) {\n agent = new https_proxy_agent_1.HttpsProxyAgent(proxyOpts);\n }\n else {\n agent = new http_proxy_agent_1.HttpProxyAgent(proxyOpts);\n }\n }\n try {\n if (socket) {\n // \"DIRECT\" connection, wait for connection confirmation\n yield once_1.default(socket, 'connect');\n req.emit('proxy', { proxy, socket });\n return socket;\n }\n if (agent) {\n const s = yield agent.callback(req, opts);\n req.emit('proxy', { proxy, socket: s });\n return s;\n }\n throw new Error(`Could not determine proxy type for: ${proxy}`);\n }\n catch (err) {\n debug('Got error for proxy %o: %o', proxy, err);\n req.emit('proxy', { proxy, error: err });\n }\n }\n throw new Error(`Failed to establish a socket connection to proxies: ${JSON.stringify(proxies)}`);\n });\n }", "function proxyHandler(args, handler) {\n console.log(\"proxy(\" + args[1] + \",\" + args[2] + \")\");\n }", "function Proxy(proxy_options) {\n this.options = process_options(proxy_options);\n //this.processor_class = processor_class ? new Processor(processor_class) : null;\n\n var that = this;\n\n var https_opts = {\n key: fs.readFileSync('www.github.com.key'),\n cert: fs.readFileSync('www.github.com.crt'),\n ca: fs.readFileSync('ca.crt'),\n SNICallback: getCredentialsContext\n };\n\n\n // HTTPS Virtual Server.\n\n var virtual_server_https = https.createServer(https_opts, function (request, response) {\n sys.log(\"http message to be handled.\")\n handle_request(that, request, response, \"https\");\n });\n\n virtual_server_https.addListener('error', function(err) {\n sys.log(\"error on virtual_server_https\");\n sys.log(err);\n });\n virtual_server_https.listen(this.options.virtual_server_https_port);\n if(this.options.verbose) console.log('https virtual server'.blue + ' started '.green.bold + 'on port '.blue + (\"\"+this.options.virtual_server_https_port).yellow);\n\n\n // HTTP Virtual Server\n var virtual_server_http = http.createServer(function(request, response) {\n sys.log(\"http message to be handled.\")\n handle_request(that, request, response, \"http\");\n });\n virtual_server_http.addListener('error', function(err) {\n sys.log(\"error on virutal_server_http\");\n sys.log(err);\n });\n\n // Handle connect request (for https), the client is attempting to upgrade to a https connection.\n virtual_server_http.addListener('upgrade', function(req, socket, upgradeHead) {\n sys.log(\"attempting to upgrade the connection.\")\n var proxy = net.createConnection(that.options.virtual_server_https_port, 'localhost');\n\n proxy.on('connect', function() {\n socket.write( \"HTTP/1.0 200 Connection established\\r\\nProxy-agent: Netscape-Proxy/1.1\\r\\n\\r\\n\");\n });\n\n // connect pipes\n proxy.on( 'data', function(d) { socket.write(d) });\n socket.on('data', function(d) { try { proxy.write(d) } catch(err) {}});\n\n proxy.on( 'end', function() { socket.end(); });\n socket.on('end', function() { proxy.end(); });\n\n proxy.on( 'close',function() { socket.end(); });\n socket.on('close',function() { proxy.end(); });\n\n proxy.on( 'error',function() { socket.end(); });\n socket.on('error',function() { proxy.end(); });\n });\n\n\n virtual_server_http.listen(this.options.virtual_server_http_port);\n if(this.options.verbose) console.log('http virtual server '.blue + 'started '.green.bold + 'on port '.blue + (\"\"+this.options.virtual_server_http_port).yellow);\n}", "baseUrl(){\n return `https://www.warcraftlogs.com:443/${this.version}`\n }", "function revealProxy() {\n\t\tif (\n\t\t\t\t!completeData.forPrint.detected_anonymizers.tor\n\t\t\t\t&& !completeData.forPrint.detected_anonymizers.vpn\n\t\t\t\t&&\n\t\t\t\t(\n\t\t\t\t\tcompleteData.forPrint.proxy.hostname.dns != undefined\n\t\t\t\t\t\t? completeData.forPrint.proxy.hostname.dns.indexOf(\"vpn\") == -1\n\t\t\t\t\t\t: true\n\t\t\t\t)\n\t\t\t\t&&\n\t\t\t\t(\n\t\t\t\t\tcompleteData.forPrint.nmap.data.hostname != undefined\n\t\t\t\t\t\t? completeData.forPrint.nmap.data.hostname.indexOf(\"vpn\") == -1\n\t\t\t\t\t\t: true\n\t\t\t\t)\n\t\t\t\t&&\n\t\t\t\t(\n\t\t\t\t\tcompleteData.forPrint.proxy.webproxy\n\t\t\t\t\t|| completeData.forPrint.proxy.proxy_headers\n\t\t\t\t\t|| completeData.forPrint.nmap.open_proxy_ports\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.proxy.hostname.dns\n\t\t\t\t\t\t&& completeData.forPrint.proxy.hostname.dns.indexOf(\"proxy\") > -1\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.nmap.data.hostname\n\t\t\t\t\t\t&& completeData.forPrint.nmap.data.hostname.indexOf(\"proxy\") > -1\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.proxy.useragent.backend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.useragent.frontend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.useragent.backend != completeData.forPrint.proxy.useragent.frontend\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.proxy.timezone.backend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.timezone.frontend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.timezone.backend != completeData.forPrint.proxy.timezone.frontend\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.proxy.language.backend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.language.frontend\n\t\t\t\t\t\t&& completeData.forPrint.proxy.language.backend != completeData.forPrint.proxy.language.frontend\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.proxy.webrtc.ip.length > 0\n\t\t\t\t\t\t&& completeData.forPrint.proxy.webrtc.ip.public != completeData.forPrint.http.ip\n\t\t\t\t\t)\n\t\t\t\t\t||\n\t\t\t\t\t(\n\t\t\t\t\t\tcompleteData.forPrint.visitor_information.real_ip\n\t\t\t\t\t\t&& completeData.forPrint.visitor_information.real_ip != completeData.forPrint.http.ip\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t)\n\t\t{\n\t\t\tcompleteData.forPrint.detected_anonymizers.proxy = true;\n\t\t}\n\t}", "function usingProxy() {\n return !!process.argv.filter(function (arg) {\n return arg.indexOf('--proxy') === 0;\n }).length;\n}", "function FindProxyForURL(url, host) {\n host = host.toLowerCase();\n if (\n dnsDomainIs(host, \"gnulug.org\")\n || dnsDomainIs(host, \"open-nsm.net\")\n || shExpMatch(host, \"192.17.239.*\")\n )\n return \"SOCKS 127.0.0.1:50000\"; // (IP:port)\n\n if (\n dnsDomainIs(host, \"draconyx.net\")\n )\n return \"PROXY 127.0.0.1:80\"\n\n //if (dnsDomainIs(host, \"test.com\"))\n // return \"SOCKS 127.0.0.1:1234\"; // (IP:port)\n\n return \"DIRECT\";\n}", "callback(req, opts) {\n const { proxy, secureProxy } = this;\n const parsed = url_1.default.parse(req.path);\n if (!parsed.protocol) {\n parsed.protocol = 'http:';\n }\n if (!parsed.hostname) {\n parsed.hostname = opts.hostname || opts.host || null;\n }\n if (parsed.port == null && typeof opts.port) {\n parsed.port = String(opts.port);\n }\n if (parsed.port === '80') {\n // if port is 80, then we can remove the port so that the\n // \":80\" portion is not on the produced URL\n delete parsed.port;\n }\n // Change the `http.ClientRequest` instance's \"path\" field\n // to the absolute path of the URL that will be requested.\n req.path = url_1.default.format(parsed);\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.auth) {\n req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`);\n }\n // create a socket connection to the proxy server\n let socket;\n if (secureProxy) {\n debug('Creating `tls.Socket`: %o', proxy);\n socket = tls_1.default.connect(proxy);\n }\n else {\n debug('Creating `net.Socket`: %o', proxy);\n socket = net_1.default.connect(proxy);\n }\n // At this point, the http ClientRequest's internal `_header` field\n // might have already been set. If this is the case then we'll need\n // to re-generate the string since we just changed the `req.path`.\n if (req._header) {\n let first;\n let endOfHeaders;\n debug('Regenerating stored HTTP header string for request');\n req._header = null;\n req._implicitHeader();\n if (req.output && req.output.length > 0) {\n // Node < 12\n debug('Patching connection write() output buffer with updated header');\n first = req.output[0];\n endOfHeaders = first.indexOf('\\r\\n\\r\\n') + 4;\n req.output[0] = req._header + first.substring(endOfHeaders);\n debug('Output buffer: %o', req.output);\n }\n else if (req.outputData && req.outputData.length > 0) {\n // Node >= 12\n debug('Patching connection write() output buffer with updated header');\n first = req.outputData[0].data;\n endOfHeaders = first.indexOf('\\r\\n\\r\\n') + 4;\n req.outputData[0].data =\n req._header + first.substring(endOfHeaders);\n debug('Output buffer: %o', req.outputData[0].data);\n }\n }\n return socket;\n }", "callback(req, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n const { proxy, secureProxy } = this;\n // Create a socket connection to the proxy server.\n let socket;\n if (secureProxy) {\n debug('Creating `tls.Socket`: %o', proxy);\n socket = tls_1.default.connect(proxy);\n }\n else {\n debug('Creating `net.Socket`: %o', proxy);\n socket = net_1.default.connect(proxy);\n }\n const headers = Object.assign({}, proxy.headers);\n const hostname = `${opts.host}:${opts.port}`;\n let payload = `CONNECT ${hostname} HTTP/1.1\\r\\n`;\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.auth) {\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;\n }\n // The `Host` header should only include the port\n // number when it is not the default port.\n let { host, port, secureEndpoint } = opts;\n if (!isDefaultPort(port, secureEndpoint)) {\n host += `:${port}`;\n }\n headers.Host = host;\n headers.Connection = 'close';\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n const proxyResponsePromise = parse_proxy_response_1.default(socket);\n socket.write(`${payload}\\r\\n`);\n const { statusCode, buffered } = yield proxyResponsePromise;\n if (statusCode === 200) {\n req.once('socket', resume);\n if (opts.secureEndpoint) {\n const servername = opts.servername || opts.host;\n if (!servername) {\n throw new Error('Could not determine \"servername\"');\n }\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,\n servername }));\n }\n return socket;\n }\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n const fakeSocket = new net_1.default.Socket();\n fakeSocket.readable = true;\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s) => {\n debug('replaying proxy buffer for failed request');\n assert_1.default(s.listenerCount('data') > 0);\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n return fakeSocket;\n });\n }", "callback(req, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n const { proxy, secureProxy } = this;\n // Create a socket connection to the proxy server.\n let socket;\n if (secureProxy) {\n debug('Creating `tls.Socket`: %o', proxy);\n socket = tls_1.default.connect(proxy);\n }\n else {\n debug('Creating `net.Socket`: %o', proxy);\n socket = net_1.default.connect(proxy);\n }\n const headers = Object.assign({}, proxy.headers);\n const hostname = `${opts.host}:${opts.port}`;\n let payload = `CONNECT ${hostname} HTTP/1.1\\r\\n`;\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.auth) {\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;\n }\n // The `Host` header should only include the port\n // number when it is not the default port.\n let { host, port, secureEndpoint } = opts;\n if (!isDefaultPort(port, secureEndpoint)) {\n host += `:${port}`;\n }\n headers.Host = host;\n headers.Connection = 'close';\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n const proxyResponsePromise = parse_proxy_response_1.default(socket);\n socket.write(`${payload}\\r\\n`);\n const { statusCode, buffered } = yield proxyResponsePromise;\n if (statusCode === 200) {\n req.once('socket', resume);\n if (opts.secureEndpoint) {\n const servername = opts.servername || opts.host;\n if (!servername) {\n throw new Error('Could not determine \"servername\"');\n }\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,\n servername }));\n }\n return socket;\n }\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n const fakeSocket = new net_1.default.Socket();\n fakeSocket.readable = true;\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s) => {\n debug('replaying proxy buffer for failed request');\n assert_1.default(s.listenerCount('data') > 0);\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n return fakeSocket;\n });\n }", "callback(req, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n const { proxy, secureProxy } = this;\n // Create a socket connection to the proxy server.\n let socket;\n if (secureProxy) {\n debug('Creating `tls.Socket`: %o', proxy);\n socket = tls_1.default.connect(proxy);\n }\n else {\n debug('Creating `net.Socket`: %o', proxy);\n socket = net_1.default.connect(proxy);\n }\n const headers = Object.assign({}, proxy.headers);\n const hostname = `${opts.host}:${opts.port}`;\n let payload = `CONNECT ${hostname} HTTP/1.1\\r\\n`;\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.auth) {\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;\n }\n // The `Host` header should only include the port\n // number when it is not the default port.\n let { host, port, secureEndpoint } = opts;\n if (!isDefaultPort(port, secureEndpoint)) {\n host += `:${port}`;\n }\n headers.Host = host;\n headers.Connection = 'close';\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n const proxyResponsePromise = parse_proxy_response_1.default(socket);\n socket.write(`${payload}\\r\\n`);\n const { statusCode, buffered } = yield proxyResponsePromise;\n if (statusCode === 200) {\n req.once('socket', resume);\n if (opts.secureEndpoint) {\n const servername = opts.servername || opts.host;\n if (!servername) {\n throw new Error('Could not determine \"servername\"');\n }\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,\n servername }));\n }\n return socket;\n }\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n const fakeSocket = new net_1.default.Socket();\n fakeSocket.readable = true;\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s) => {\n debug('replaying proxy buffer for failed request');\n assert_1.default(s.listenerCount('data') > 0);\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n return fakeSocket;\n });\n }", "function proxySite(res, url) {\n request({\n url: url\n }, function (error, response, body) {\n response.headers['Access-Control-Allow-Origin'] = '*';\n res.writeHead(response.statusCode, response.headers);\n res.write(body);\n res.end();\n });\n}", "function corsUrl(url) {\n return CORS_PROXY + url;\n // config.corsproxy.url() + url;\n // + config.corsproxy.query + encodeURIComponent(url);\n}", "function defineProxyProperty(name, descriptor) {\n\t Object.defineProperty(proxy, name, descriptor);\n\t }", "function defineProxyProperty(name, descriptor) {\n\t Object.defineProperty(proxy, name, descriptor);\n\t }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function defineProxyProperty(name, descriptor) {\n Object.defineProperty(proxy, name, descriptor);\n }", "function FindProxyForURL(url, host) {\n // *.mendix.test and *.mendixcloud.test go through Socks5 proxy\n if (shExpMatch(host, \"*.sprintr.com\") || shExpMatch(host, \"*.mendixcloud.com\"))\n return \"SOCKS5 localhost:1080\";\n // all other requests go directly to the WWW:\n return \"DIRECT\";\n}", "function connect(req, socket, head){\n\t\t\t// Check auth\n if (self._token) {\n if (!req.headers['proxy-authorization'] || req.headers['proxy-authorization'] !== self._token) {\n\t\t\t\t\twinston.error('[Master] Error: Wrong proxy credentials for CONNECT method');\n\t\t\t\t\tsocket.write('HTTP/1.1 407\\r\\nConnection: close\\r\\nProxy-Authenticate: Basic realm=\"scrapoxy\"\\r\\n\\r\\n');\n return socket.end();\n }\n }\n\t\t\t\n\t\t\t// Decrypt target\n\t\t\tparseTarget(req.url, (err, target) => {\n\t\t\t\tif (err) {\n\t\t\t\t\twinston.error('Error (parsing): ', err);\n\t\t\t\t\treturn socket.end();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// Trigger scaling if necessary\n\t\t\t\tself._manager.requestReceived();\n\t\n\t\t\t\t// Get domain\n\t\t\t\tconst uri = domain.convertHostnamePathToUri(target.hostname, target.url);\n\t\t\t\tconst basedomain = domain.getBaseDomainForUri(uri);\n\t\n\t\t\t\t// Find instance\n\t\t\t\tconst forceName = req.headers['x-cache-proxyname'],\n\t\t\t\t\tinstance = self._manager.getNextRunningInstanceForDomain(basedomain, forceName);\n\t\n\t\t\t\tif (!instance) {\n\t\t\t\t\twinston.error('[Master] Error: No running instance found');\n\t\t\t\t\tsocket.write('HTTP/1.1 500 Error: No running instance found\\r\\n\\r\\n');\n return socket.end();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t// Build Connect request for Instance\n\t\t\t\tconst proxyOpts = {\n\t\t\t\t\thost: instance.proxyParameters.hostname,\n\t\t\t\t\tport: instance.proxyParameters.port,\n\t\t\t\t\tmethod: 'CONNECT',\n\t\t\t\t\theaders: req.headers, //Useless...\n \tpath: req.url\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\t // Update headers\n \t\tinstance.updateRequestHeaders(proxyOpts.headers);\n\n\t\t\t\t\n\t\t\t\tvar proxy_connect_request = http.request(proxyOpts);\n\t\t\t\t\n\t\t\t\t// Start timer\n \tconst start = process.hrtime();\n\t\t\t\t\n\t\t\t\tproxy_connect_request.on('connect', function (routing_req, routing_socket, routing_head) {\n\t\t\t\t\tsocket.on('error', (err) => {\n\t\t\t\t\t\twinston.error('Error (socket): ', err);\n\t\t\t\t\t\trouting_socket.end();\n\t\t\t\t\t});\n\t\t\t\n\t\t\t\t\trouting_socket.on('error', (err) => {\n\t\t\t\t\t\twinston.error('Error (routing_socket): ', err);\n\t\t\t\t\t\tsocket.write('HTTP/1.1 500 Error (routing_socket): Target closed connection\\r\\n\\r\\n');\n\t\t\t\t\t\tsocket.end();\n\t\t\t\t\t});\n\t\t\t\t\tsocket.write('HTTP/1.1 200 Connection established\\r\\n\\r\\n');\n\t\t\t\t\trouting_socket.pipe(socket);\n\t\t\t\t\tsocket.pipe(routing_socket);\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tsocket.on('end', function () {\n\t\t\t\t\t\t// Stop timer and record duration when Tunnel connexion is closed\n\t\t\t\t\t\tconst duration = process.hrtime(start);\n\t\t\t\t\t\tself._stats.requestEnd(\n\t\t\t\t\t\t\tduration,\n\t\t\t\t\t\t\tsocket._bytesDispatched,\n\t\t\t\t\t\t\tsocket.bytesRead\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinstance.incrRequest();\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t// Log errors\n\t\t\t\tproxy_connect_request.on('error',\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\twinston.error('[Master] Error: request error from client (%s %s on instance %s):', req.method, req.url, instance.toString(), err);\n\t\t\t\t\t\tsocket.write('HTTP/1.1 500 Error: request error from client\\r\\n\\r\\n');\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\n\t\t\t\t// End Connect Request\n\t\t\t\tproxy_connect_request.end();\n\t\t\t\t\n\t\t\t\t\n\t\t\t});\n\t\t\t\n\t\t\tfunction parseTarget(url, callback) {\n\t\t\t\tif (!url) return callback('No URL found');\n\t\t\t\n\t\t\t\tconst part = url.split(':');\n\t\t\t\tif (part.length !== 2) {\n\t\t\t\t\treturn callback(`Cannot parse target: ${url}`);\n\t\t\t\t}\n\t\t\t\n\t\t\t\tconst hostname = part[0],\n\t\t\t\t\tport = parseInt(part[1]);\n\t\t\t\n\t\t\t\tif (!hostname || !port) {\n\t\t\t\t\treturn callback(`Cannot parse target (2): ${url}`);\n\t\t\t\t}\n\t\t\t\n\t\t\t\tcallback(null, {hostname, port});\n\t\t\t}\n\t\t\t\n\t\t}", "getServerUrl() {\n const {\n host,\n port\n } = this.serverConfig;\n return `//${host || 'localhost'}:${port}`;\n }", "function proxy(client_req, client_res) {\n client_res.setHeader('Access-Control-Allow-Origin', '*') // Avoid CORS issues\n const options = {\n hostname: CONFIG.FES_HOST,\n port: CONFIG.FES_PORT,\n path: client_req.url,\n method: client_req.method,\n headers: client_req.headers\n }\n console.log(`Proxy: ${options.hostname}:${options.port}${options.path}`)\n const proxy = http.request(options, (res) => {\n client_res.writeHead(res.statusCode, res.headers)\n res.pipe(client_res, {\n end: true\n })\n })\n client_req.pipe(proxy, {\n end: true\n })\n client_req.on('error', (error) => {\n console.log(`ERROR: ${client_req.url}: ${error.message}`)\n })\n proxy.on('error', (error) => {\n console.log(`ERROR: ${client_req.url}: ${error.message}`)\n })\n proxy.on('finish', () => {\n console.log(`End: ${client_req.url}`);\n })\n}", "static get prefix() {\n if (JSONStorage.#$prefix) return JSONStorage.#$prefix;\n let base = document.getElementsByTagName(\"base\")[0].href;\n let origin = window.location.origin;\n\n if (!origin) {\n origin = window.location.protocol + \"//\" + window.location.hostname + (window.location.port ? \":\" + window.location.port : \"\")\n };\n\n JSONStorage.#$prefix = base.slice(origin.length).replace(\n /\\/\\d{4}-\\d\\d-\\d\\d\\/.*/,\n \"\"\n ).replace(/^\\W+|\\W+$/gm, \"\").replace(/\\W+/g, \"_\") || window.location.port;\n\n return JSONStorage.#$prefix\n }", "function RecorderProxy() {\n this.active = null;\n}", "getHostName() {\n // UNIMPLEMENTED: complete this function!\n\n return `${this.url}`;\n }", "function start_server () {\n var server = new msp.Proxy();\n server.listen(8050);\n log('Proxying from http://:8050');\n}", "function ProxyManager() {\n throw \"can not instantiate ProxyManager - use only static methods\";\n }", "function defineProxyPropertyWithValue(name,value){var _ref=Object.getOwnPropertyDescriptor(current,name)||{};var _ref$enumerable=_ref.enumerable;var enumerable=_ref$enumerable===undefined?false:_ref$enumerable;var _ref$writable=_ref.writable;var writable=_ref$writable===undefined?true:_ref$writable;defineProxyProperty(name,{configurable:true,enumerable:enumerable,writable:writable,value:value});}", "function defineProxyPropertyWithValue(name,value){var _ref=Object.getOwnPropertyDescriptor(current,name)||{};var _ref$enumerable=_ref.enumerable;var enumerable=_ref$enumerable===undefined?false:_ref$enumerable;var _ref$writable=_ref.writable;var writable=_ref$writable===undefined?true:_ref$writable;defineProxyProperty(name,{configurable:true,enumerable:enumerable,writable:writable,value:value});}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function generatePortNumber()\n{\n\tvar proxyport = Math.floor(Math.random() * 16383) + 49152;\n\treturn proxyport;\n}", "function proxy(req, res) {\n var queryString = req.originalUrl.split('?')[1];\n var path = '/v1' + req.path + (queryString ? '?' + queryString : '');\n console.log(\n req.method + ' ' + req.path + ' proxied to ' +\n options.mlHost + ':' + options.mlHttpPort + path);\n var mlReq = http.request({\n hostname: options.mlHost,\n port: options.mlHttpPort,\n method: req.method,\n path: path,\n headers: req.headers,\n auth: getAuth(options, req.session)\n }, function(response) {\n\n res.statusCode = response.statusCode;\n\n // [GJo] (#67) forward all headers from MarkLogic\n for (var header in response.headers) {\n res.header(header, response.headers[header]);\n }\n\n response.on('data', function(chunk) {\n res.write(chunk);\n });\n response.on('end', function() {\n res.end();\n });\n });\n\n if (req.body !== undefined) {\n mlReq.write(JSON.stringify(req.body));\n mlReq.end();\n }\n\n mlReq.on('error', function(e) {\n console.log('Problem with request: ' + e.message);\n });\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}", "function proxify(localUrl, webUrl){\n app.get(localUrl, (req, res) => {\n var tokens = webUrl.match(/:(\\w+)/ig)\n var remote = (tokens || []).reduce((a, t) => {\n return a.replace(new RegExp(t, 'ig'), req.params[t.substr(1)])\n }, webUrl)\n req.pipe( request(remote + querify(req.query)) ).pipe(res)\n })\n }", "function httpsProxyFromEnvironment() {\n if (process.env.https_proxy) {\n return process.env.https_proxy;\n }\n if (process.env.HTTPS_PROXY) {\n return process.env.HTTPS_PROXY;\n }\n return undefined;\n}", "function prox(){\n //varrer os inputs e armazenar em object\n console.log('bt proximo clicado');\n}" ]
[ "0.7247983", "0.7247983", "0.7098122", "0.7023845", "0.6945621", "0.6945621", "0.6484944", "0.6484944", "0.6484944", "0.6484944", "0.6484944", "0.6484944", "0.6484944", "0.6484944", "0.64196134", "0.639069", "0.63671565", "0.6364022", "0.62437576", "0.62437576", "0.6135823", "0.6111912", "0.61082274", "0.6025908", "0.59804535", "0.59288335", "0.58603466", "0.5855193", "0.5827068", "0.5819777", "0.57349026", "0.5708165", "0.5708165", "0.56824666", "0.56795526", "0.5632705", "0.5630869", "0.5550576", "0.55384165", "0.5529761", "0.5528866", "0.5519366", "0.5517218", "0.5512356", "0.54769814", "0.5461867", "0.54526824", "0.54478663", "0.5446279", "0.54425585", "0.5435769", "0.54253405", "0.5386415", "0.5382595", "0.5363095", "0.5363095", "0.5363095", "0.53619784", "0.53603137", "0.53488743", "0.53488743", "0.5345385", "0.5345385", "0.5345385", "0.5345385", "0.5345385", "0.5345385", "0.5345385", "0.5345385", "0.529031", "0.5276904", "0.5256774", "0.52510816", "0.52366114", "0.5225477", "0.5218959", "0.52156216", "0.5213984", "0.5212511", "0.5212511", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.51945984", "0.5186888", "0.5183297", "0.5175583", "0.5175583", "0.5175583", "0.5175583", "0.5175583", "0.5175583", "0.5175583", "0.5168882", "0.5160574", "0.5159044" ]
0.0
-1
Handle insert of a new document.
handleInsert() { if (!this.props.error) { const doc = this.props.docs[this.props.docs.length - 1]; for (const element of doc.elements) { this.addGridColumn(null, element.currentKey, element.currentType, []); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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}", "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}", "insert(document) {\n document._id = id_1.id();\n return new this.model(document).save();\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 }", "async insertDoc(document) {\n let collection = await this.collection()\n\n await collection.insertOne(document)\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 insert(type, data) {\n db.collection(type).insertOne(data, function(err, res) {\n if (err) throw err;\n //if succesfully inserted log the details of data and client\n console.log(\"Document inserted of type \" + type + ' from userId ' + data.userId);\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 }", "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 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 handleNewClick() {\n const newDoc = stubNewDocument()\n addUpdate(newDoc)\n appendToExtendedData([newDoc])\n }", "insert() {\n // Prepare collection with bundle schema.\n this.collection.simpleSchema = () => {\n return this.schema;\n };\n return this.collection.insert.apply(this.collection, arguments);\n }", "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 handleAdd() {\n let newId = docs.length + 1;\n setDocs([\n ...docs,\n {\n id: newId,\n title: `Boleto ${newId}`,\n description: `Descrição do boleto ${newId}`\n }\n ]);\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 }", "insert() { }", "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}", "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 DocumentCreated(doc) {\n ReceiveUpdate(doc);\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}", "_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 onNewData(data) {\n try {\n data = JSON.parse(data);\n db.collection('log', function( err, collection ) {\n if (err) console.log(err);\n\n collection.insert(data, { safe: true }, function(err, result) {\n if ( err ) console.log(err);\n });\n });\n } catch (err) {\n console.log(\"Read error: \" + err);\n }\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}", "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 insertRecord(req, res) {\n\n if(req.file) {\n\tvar post = new BlogPost();\n post.title = req.body.title;\n post.content = req.body.content;\n post.url = req.body.url;\n post.description = req.body.description;\n post.image = req.file.location;\n post.author = req.user.username;\n \n post.save((err, doc) => {\n if (!err) {\n res.redirect('post/blogPost');\n }\n });\n } else {\n res.render('create-post', {content: req.body}); // reload create post a pass content back in\n \n }\n\n}", "function insertRecord(req,res){\n var animal = new Animal()\n animal.name = req.body.name;\n animal.age = req.body.age;\n animal.description = req.body.description;\n //save the record\n animal.save((err, doc) => {\n //error check the entry\n if(!err){\n res.redirect('animal/list')\n } else{\n console.log('Error inserting record: '+ err)\n }\n });\n}", "function collectionInsert (test, expect, coll /*, index*/) {\n var clientSideId = coll.insert({name: 'foo'}, expect(function (err1, id) {\n test.equal(id, clientSideId);\n var o = coll.findOne(id);\n test.isTrue(isObject(o));\n test.equal(o.name, 'foo');\n }));\n}", "Insert() {\n\n }", "function commitSample( db, doc ) {\n db.post( doc )\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 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 insert(data){\n MongoClient.connect(url, function(err, db) {\n if (err) throw err;\n var dbo = db.db(DATABASE_NAME);\n dbo.collection(COLLECTION_NAME).insertOne(data, function(err, res) {\n if (err) throw err;\n console.log(\"insert complete\");\n db.close();\n });\n });\n}", "function insertTodb(token, callback) {\n console.log(\"token\", token)\n //var Ttoken = new Token(token)\n //var savedtoken = Ttoken.save()\n MongoClient.connect(url, function (err, db) {\n //console.log(db)\n var collection = db.db('data').collection('documents');\n collection.insertOne(\n token\n , function (err, result) {\n assert.equal(err, null);\n console.log(\"Inserted \" + result.result.n + \" documents into the collection \", result.ops[0]._id);\n callback(result.ops[0]._id);// is there a better way?\n\n });\n }); \n\n \n}", "add(doc){const idx=this.size();if(isString(doc)){this._addString(doc,idx);}else {this._addObject(doc,idx);}}", "function doNewDocument() {\n // close old document first\n var doc = mindmapModel.getDocument();\n doCloseDocument();\n\n var presenter = new mindmaps.NewDocumentPresenter(eventBus,\n mindmapModel, new mindmaps.NewDocumentView());\n presenter.go();\n }", "function InsertNode() {}", "function guardarPedido2() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreAmbientador.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadAmbientador.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function 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}", "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 insertBook(authorForename, authorSurname, bookName, stockPrice, sellingPrice, stockAmount, synopsis, genres, image){\n let bookObj = {authorForename:authorForename, authorSurname: authorSurname, bookName:bookName, stockPrice:stockPrice, sellingPrice:sellingPrice, stockAmount:stockAmount, synopsis:synopsis, genres: genres, image:image};\n Book.collection.insertOne(bookObj, function(err){\n if(err){console.log(err);}\n });\n}", "handleInsert(data) {\n // need to move to bookmarked selection before modal inserts, due to an IE11 bug\n const editor = this.getElement().getEditor().getInstance();\n editor.selection.moveToBookmark(this.getBookmark());\n\n const attributes = this.buildAttributes(data);\n const sanitise = createHTMLSanitiser();\n const linkText = sanitise(data.Text);\n this.insertLinkInEditor(attributes, linkText);\n this.close();\n\n return Promise.resolve();\n }", "_appendChild(collectionPath, data) {\n this.editorSession.transaction(tx => {\n const node = tx.create(data);\n documentHelpers.append(tx, collectionPath, node.id);\n });\n }", "function insertIntoMongoDB(req, res) {\n let author = new Author();\n author.authorName = req.body.authorName;\n author.authorId = req.body.authorId;\n author.authorEmail = req.body.authorEmail;\n author\n .save()\n .then((authorSaved) => res.send(authorSaved).status(201))\n .catch((err) => res.send(err).status(400));\n}", "function storeNote(req, res, callback) {\n console.log('store note db connection',req.body);\n db.insert(req.body, function (err, newDoc) {\n if (callback) {\n callback(err, newDoc);\n }\n })\n}", "function guardarPedido3() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: Precio,\n Medida: medida,\n NombreProducto: NombreJabonManos.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonManos.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "onInsert(callback) {\n return this.__internal.addInsertCallback(callback)\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 }", "insert() {\r\n var sql = 'INSERT INTO post (id, title, text) VALUES (?,?,?)'\r\n var params = [this.id, this.title, this.text]\r\n db.run(sql, params, function (err, result) {\r\n if (err) {\r\n throw err // TODO: useful error handling here...\r\n return\r\n }\r\n });\r\n }", "function insertOne(callback, Property) {\n PropertyModel.create(Property)\n .then((data) => console.log(\"INSERTED ONE DOCUMENT\"));\n\n}", "function pet_insert() {\n\tdb.transaction(pet_insert_db, errorDB, successDB);\n}", "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 }", "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 agenda_insert() {\n\tdb.transaction(agenda_insert_db, errorDB, successDB);\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 insertNewData(){\n let datSave = {\n \"line\":1,\n \"machines\":[{\"id\":1,\"name\":\"oven 01\"},{\"id\":2,\"name\":\"creamer 01\"}],\n \"webserviceurl\":\"http://mv-webservice.test\",\n \"machid\": '2001'\n }\n\n db.insert(datSave, function(err, newDocs){\n\n });\n}", "function guardarPedido5() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonRey,\n Medida: medida,\n NombreProducto: NombreJabonRey.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonRey.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "async insertSubDocument(ownerId, pathHierarchy, data) {\n let [document, subDocument] = await getSubDocumentHelper(\n this._model,\n ownerId,\n pathHierarchy,\n );\n\n const result = DocUtils.insert(subDocument, data);\n await document.save();\n // TODO: check which return option is faster (both work)\n return clearBuffers(result._doc);\n // return this.getSubDocument(ownerId, [...pathHierarchy, result.id]);\n }", "function pushData(e){\n e.preventDefault();\n //Values\n const link = document.querySelector('.movie-link').value;\n if(link != '' && id != ''){\n db.collection(\"movie\").add({\n link: link,\n id: id,\n timestamp:today\n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id);\n })\n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\n }\n else console.log('Missing')\n \n \n \n\n}", "function guardar() {\n let txtnombre = document.getElementById('name').value;\n let txtapellido = document.getElementById('surename').value;\n\n db.collection('Alumnos')\n .add({\n first: txtnombre,\n last: txtapellido,\n asistencia: 'No tomada'\n })\n .then(function(docRef) {\n console.log('Document written with ID: ', docRef.id);\n document.getElementById('name').value = '';\n document.getElementById('surename').value = '';\n })\n .catch(function(error) {\n console.error('Error adding document: ', error);\n });\n}", "function 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 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}", "insert(doc, callback) {\n doc = EJSON.clone(doc);\n\n assertHasValidFieldNames(doc);\n\n // if you really want to use ObjectIDs, set this global.\n // Mongo.Collection specifies its own ids and does not use this code.\n if (!hasOwn.call(doc, '_id')) {\n doc._id = LocalCollection._useOID ? new MongoID.ObjectID() : Random.id();\n }\n\n const id = doc._id;\n\n if (this._docs.has(id)) {\n throw MinimongoError(`Duplicate _id '${id}'`);\n }\n\n this._saveOriginal(id, undefined);\n this._docs.set(id, doc);\n\n const queriesToRecompute = [];\n\n // trigger live queries that match\n Object.keys(this.queries).forEach(qid => {\n const query = this.queries[qid];\n\n if (query.dirty) {\n return;\n }\n\n const matchResult = query.matcher.documentMatches(doc);\n\n if (matchResult.result) {\n if (query.distances && matchResult.distance !== undefined) {\n query.distances.set(id, matchResult.distance);\n }\n\n if (query.cursor.skip || query.cursor.limit) {\n queriesToRecompute.push(qid);\n } else {\n LocalCollection._insertInResults(query, doc);\n }\n }\n });\n\n queriesToRecompute.forEach(qid => {\n if (this.queries[qid]) {\n this._recomputeResults(this.queries[qid]);\n }\n });\n\n this._observeQueue.drain();\n\n // Defer because the caller likely doesn't expect the callback to be run\n // immediately.\n if (callback) {\n Meteor.defer(() => {\n callback(null, id);\n });\n }\n\n return id;\n }", "function nodeInserted(e)\r\n{\r\n // our own modifications should not trigger this.\r\n // (we don't want our regular expression objects getting confused)\r\n // (we want better control over when we recurse)\r\n \r\n //GM_log(\"Inserted: \" + e.target);\r\n \r\n if (!moddingDOM)\r\n go(e.target);\r\n}", "function replay_insert(zdoc, path, index, val) {\n return zdoc_write_op(zdoc, full_insert_op, path, index, val);\n}", "function nodeInserted(e)\n{\n // our own modifications should not trigger this.\n // (we don't want our regular expression objects getting confused)\n // (we want better control over when we recurse)\n\n //GM_log(\"Inserted: \" + e.target);\n\n if (!moddingDOM && enabled)\n go(e.target);\n}", "function testInsert( Lib, args ) {\n\n return makeTest(Lib, args, ( couch, nock, deferred ) => {\n\n nock.post('/test')\n .reply(201, { id: 1, rev: 1, });\n\n couch.insert({})\n .then(deferred.resolve.bind(deferred));\n });\n }", "function insertNewCustomerDataInput(data) {\n client.createDocument(collectionUrlcustomerBTDetail, data, (err, created) => {\n if (err) {\n console.log(JSON.stringify(err));\n }\n else {\n console.log(JSON.stringify(created));\n }\n });\n}", "function DB_insertNewData(collection, data) {\n return db.collection(collection).doc(data.id).set(data);\n }", "async function insert_article(article,sentiment,text){\n \n var conn = await connect(); \n var existingArticle= await conn.collection(\"mentalhealthresources\").findOne({article});\n \n if (existingArticle !=null){\n throw new Error(\"Mental Health Resource Article already exists!\"); \n }\n \n await conn.collection('mentalhealthresources').insertOne({article, sentiment, text}); \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 }", "function insert() {\r\n let query = \"command=insert\"; //https://eia2-michel.herokuapp.com/command=insert&name=peter&punkte=100\r\n query += \"&name=\" + HabosHaihappen.spielerName;\r\n query += \"&punkte=\" + HabosHaihappen.highscore;\r\n sendRequest(query, handleInsertResponse);\r\n }", "function insertToMongoDB(review, callback) {\n mongodb.MongoClient.connect(addr, function(error, db){\n if (error) throw error;\n var userInfo = db.db(\"cis550\").collection(\"userInfo\");\n userInfo.insert(review, function(err, res){\n if(err) throw err;\n console.log('data inserted');\n callback(res);\n db.close();\n });\n });\n}", "insertOne({collectionName, object}) {\n\n this.logger.info('<- received insertOne ' + object)\n\n const collection = this.db.collection(collectionName)\n\n return new Promise((resolve, reject) => {\n collection.insertOne(object, (err, r) => {\n if(err) reject(r)\n resolve(r)\n })\n })\n\n }", "async insertObjectInternal(collection, obj) {\n await this.handleApiResult(this.getServerInstance().promiseTimeout(this.getServerInstance().postInCollection(collection, obj, false)));\n }", "function EditLogItemInsert () {}", "handleFiles(files) {\n Songs.collection.insert(files, function(err, docs) {\n if(err) {\n console.log(\"FAILURE: \", err)\n } else {\n console.log(\"SUCCESS:\", docs)\n }\n })\n }", "insertPlace(data) {\n let _this = this\n return new Promise((resolve, reject) => {\n let db = this.client.db(_this.DB);\n let collection = db.collection(_this.COLLECTION_PLACE);\n collection.insertOne(data, (err, docs) => {\n if (err) reject(err)\n else resolve(docs)\n })\n })\n }", "async insertWord(word, def) {\n if (!this.isConnected) {\n await this.connect();\n }\n const doc = {\n word: word,\n def: def\n };\n let result = null;\n try {\n result = this.coll.updateOne(\n { 'word': word },\n { $set: doc },\n { upsert: true }\n )\n } catch (e) {\n console.log(e);\n }\n return result;\n }", "async insertMany(documents = []) {\n\t\ttry {\n\t\t\tawait this.model.insertMany(documents)\n\t\t\treturn 'Documents created successfuly'\n\t\t} catch (error) {\n\t\t\tthrow new BadRequest({ data: { reason: error.message } })\n\t\t}\n\t}", "function checkAndInsert(fileObj) {\n // Check filters. This is called in deny functions, too, but we call here to catch\n // server inserts and to catch client inserts early, allowing us to call `onInvalid` on\n // the client and save a trip to the server.\n if (!self.allowsFile(fileObj)) {\n return FS.Utility.handleError(callback, 'FS.Collection insert: file does not pass collection filters');\n }\n\n // Set collection name\n fileObj.collectionName = self.name;\n\n // Insert the file into db\n // We call cloneFileRecord as an easy way of extracting the properties\n // that need saving.\n if (callback) {\n fileObj._id = self.files.insert(FS.Utility.cloneFileRecord(fileObj), function(err, id) {\n if (err) {\n if (fileObj._id) {\n delete fileObj._id;\n }\n } else {\n // Set _id, just to be safe, since this could be before or after the insert method returns\n fileObj._id = id;\n // Pass to uploader or stream data to the temp store\n beginStorage(fileObj);\n }\n callback(err, err ? void 0 : fileObj);\n });\n } else {\n fileObj._id = self.files.insert(FS.Utility.cloneFileRecord(fileObj));\n // Pass to uploader or stream data to the temp store\n beginStorage(fileObj);\n }\n return fileObj;\n }", "function guardar(){\n let nombre = document.getElementById('nombre').value;\n\n\n db.collection(\"users\").add({\n first: nombre,\n\n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id);\n document.getElementById('nombre').value = \"\";\n\n })\n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\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 }", "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 }", "function onItemInserted(e) {\n if (! isEnabledOnThisPage())\n return;\n\n //info(\"event: DOMNodeInserted of item into stream\");\n //debug(\"onItemInserted: DOMNodeInserted for item id=\" + e.target.id + \" class='\" + e.target.className);\n updateItem($(e.target));\n\n // We call this manually because otherwise it only happens on interactive\n // folding/unfolding.\n updateContentPaneButtonsThrottled();\n}", "function guardar(){\nvar no_titulo = document.getElementById('no_titulo').value;\nvar nombre_contribuyente = document.getElementById('nombre_contribuyente').value;\nvar direccion = document.getElementById('direccion').value;\nvar fecha = document.getElementById('fecha').value;\nvar observaciones = document.getElementById('observaciones').value;\n\nif( document.getElementById('no_titulo').value === '' ){\n submitOK = \"false\";\n alert('NO HA INGRESADO NINGÚN TÍTULO DE AGUA POTABLE');\n}\n\nif( document.getElementById('nombre_contribuyente').value === '' ){\n submitOK = \"false\";\n alert('NO HA INGRESADO NINGÚN NOMBRE DEL CONTRIBUYENTE');\n}\n\ndb.collection(\"titulodeagua\").add({\n no_titulo: no_titulo,\n nombre_contribuyente: nombre_contribuyente,\n direccion: direccion,\n fecha: fecha,\n observaciones: observaciones\n})\n.then(function(docRef) {\n console.log(\"DOCUMENTO ESCRITO CON ID: \", docRef.id);\n document.getElementById('no_titulo').value = '';\n document.getElementById('nombre_contribuyente').value = '';\n document.getElementById('direccion').value = '';\n document.getElementById('fecha').value = '';\n document.getElementById('observaciones').value = '';\n})\n.catch(function(error) {\n console.error(\"ERROR AL AGREGAR DOCUMENTO: \", error);\n});\n}", "insert() {\n return true;\n }", "function insertDocs(docArray) {\n docArray.forEach(function(doc) {\n db.insert(doc, doc._id, function(err, body) {\n if (!err)\n console.log(body);\n else\n console.error(err);\n });\n });\n}", "saveTest() {\n // run the editors save method\n this.$refs.textEditor.saveEditorData()\n // save the document\n db.collection('tests').add({\n title: this.title,\n type: this.department,\n description: (this.$refs.textEditor.htmlForEditor === undefined ? '' : this.$refs.textEditor.htmlForEditor),\n editorImages: this.$refs.textEditor.images\n })\n .then(docRef => {\n console.log(\"Document written with ID: \", docRef.id);\n alert(`New test: ` + this.title + ` saved!`)\n })\n .catch(error => {\n console.error(\"Error adding document: \", error);\n return // dont leave the page if save fails\n })\n // return to tests page\n this.$router.push({ path: '/view-tests' })\n }", "function makeInsertTestForDocType(name, pre, documentGenerator, additionalTags) {\n if (typeof(additionalTags) === \"undefined\") {\n additionalTags = [];\n }\n\n var opsList = [];\n for (var i = 0; i < 1000; i++) {\n opsList.push({op: \"insert\", doc: documentGenerator(i)});\n }\n addTest({\n type: \"Insert\",\n name: name + \".InsertDoc\",\n pre: pre,\n ops: opsList,\n tags: kInsertTags.concat(additionalTags)\n });\n }", "static create(mappingObject,deleted,username,callback){\n\n const document = {\n _id: {\n template: mappingObject._id.template,\n lang: mappingObject._id.lang,\n version: mappingObject.version\n },\n templateFullName: mappingObject.templateFullName,\n rml: mappingObject.rml,\n status: mappingObject.status,\n edition: {\n username: mappingObject.edition.username,\n date: mappingObject.edition.date,\n comment: mappingObject.edition.comment\n },\n deleted\n };\n\n\n if (deleted){\n document.deletion = {\n username,\n date: new Date()\n };\n }\n\n this.insertOne(document, (err, docs) => {\n\n if (err) {\n return callback(err);\n }\n\n callback(null, docs[0]);\n });\n }", "async addContent(name, contentText) {\n //TODO\n allWords = await this.words(contentText);\n docCount++;\n await db.collection(docContent_table).insertOne(\n {_id: docCount,docN: name, content: contentText}\n );\n for(let [word,offsets] of allWords){\n await db.collection(docs_table).updateOne(\n {_id: {word, name}},\n {\n $inc: {score: 1},\n $setOnInsert: {\n words: word,\n docs: name,\n offset: offsets\n }\n },\n {upsert: true}\n );\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 insertFood({name,price}){\n FoodCollection.insert({name,price, createdAt:new Date()})\n}", "function addBook(event) {\n\n // 2: YOUR CODE HERE\n\n // Hint: Once you've added the book to your database, call populateTableUI with the added book's title\n // Check out the Table.put() method and what it returns at: https://dexie.org/docs/Table/Table.put()\n db.books.add(event)\n\n//ran ---> addBook(\n\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 }", "static create(title,markdown, username, visible, callback) {\n\n\n const creationDate = new Date();\n if (!markdown){\n markdown = '';\n }\n\n //_id is automatically generated\n const document = {\n postId: this.idFromTitle(title),\n title,\n lastEdition: {\n username,\n time: creationDate\n },\n creation: {\n username,\n time: creationDate\n },\n markdown,\n visible\n };\n\n this.insertOne(document, (err, docs) => {\n\n if (err) {\n return callback(err);\n }\n\n callback(null, docs[0]);\n });\n\n\n }", "function saveVandals(msg){\n\t\n\t\n\tif (msg.comment.match(/vandal/) && msg.namespace === \"article\"){\n\t\tdb.collection('wikiCollectionCapped', function(err, collection){\n\t\t//db.collection('newWikisCapped', function(err, collection){\n\t\t\tdoc = {\n\t\t\t\t\"time\": new Date().getTime(),\n\t\t\t\t\"date\": new Date(),\n\t\t\t\t\"date2\": new Date().toUTCString(),\n\t\t\t\t\"page\": msg.page,\n\t\t\t\t\"url\": msg.url,\n\t\t\t\t\"user\": msg.user,\n\t\t\t\t//\"comment\": msg.comment\n\t\t\t\t\"delta\": msg.delta,\n\t\t\t\t\"scraped\": 0\n\t\t\t};\n\t\t\t\t\n\t\t\t\tcollection.insert(doc, function(){\n\t\t\t\t\t\n\t\t\t\t\tconsole.log('Got a record, boss!');\n\t\t\t\t\t\n\t\t\t\t});\t\n\t\t\t\t\n\t\t\t \n\t\t\t});\n\n\t}\n\n \n}", "function insertNewBook(id, title, author, subject, photoURL, vendorURL, favorite) {\r\n bookCardHTML = Handlebars.templates.bookCard({\r\n id: id,\r\n title: title,\r\n author: author,\r\n subject: subject,\r\n photoURL: photoURL,\r\n vendorURL: vendorURL,\r\n favorite: favorite\r\n });\r\n\r\n var bookCardContainer = document.querySelector('#books');\r\n bookCardContainer.insertAdjacentHTML('beforeend', bookCardHTML);\r\n}" ]
[ "0.69414127", "0.6929364", "0.6872966", "0.66930574", "0.656246", "0.6424797", "0.64042634", "0.6333291", "0.62218034", "0.61909056", "0.6152626", "0.6147623", "0.61099786", "0.60916394", "0.6008806", "0.59175307", "0.59063315", "0.58923393", "0.5890585", "0.5887075", "0.58804476", "0.58668303", "0.5851573", "0.58453566", "0.58281285", "0.58160836", "0.5786498", "0.5779287", "0.5774872", "0.57607245", "0.57552934", "0.57488376", "0.5703749", "0.5671844", "0.5665911", "0.5644782", "0.56206095", "0.5599408", "0.5597331", "0.5595778", "0.5578903", "0.55761343", "0.5563856", "0.55625683", "0.55592245", "0.5557556", "0.5553765", "0.55526465", "0.555084", "0.5535828", "0.55332524", "0.55160594", "0.5511519", "0.5507823", "0.55056685", "0.55010223", "0.5494272", "0.5484276", "0.5482345", "0.546496", "0.54551023", "0.5447821", "0.54455006", "0.5444348", "0.5443832", "0.5392982", "0.5387969", "0.53775674", "0.53755057", "0.53744936", "0.5367554", "0.5366312", "0.5358", "0.53550804", "0.53524894", "0.53511566", "0.53376794", "0.53129035", "0.5312243", "0.53098613", "0.5292696", "0.5289705", "0.5287996", "0.5287578", "0.52868253", "0.52866364", "0.5281331", "0.5277017", "0.52729833", "0.52695686", "0.52674913", "0.5265164", "0.5265164", "0.5265164", "0.52522945", "0.5248383", "0.5245533", "0.52368313", "0.52329016", "0.52285284" ]
0.59198755
15
When the component is updated, handle any changes to the paths.
handleBreadcrumbChange() { // the state may get an intermediate // update before data are ready. if (!this.gridApi) { return; } const params = this.props.table; if (params.path.length === 0) { this.topLevel = true; const headers = this.createColumnHeaders(this.hadronDocs, [], []); this.gridApi.gridOptionsWrapper.gridOptions.context.path = []; this.gridApi.setColumnDefs(headers); this.gridApi.setRowData(this.createRowData(this.hadronDocs, this.props.start)); } else if (params.types[params.types.length - 1] === 'Object' || params.types[params.types.length - 1] === 'Array') { this.topLevel = false; const headers = this.createColumnHeaders(this.hadronDocs, params.path, params.types); headers.push(this.createObjectIdHeader()); if (headers.length <= 3) { headers.push(this.createPlaceholderHeader( params.types[params.types.length - 1] === 'Array', params.path) ); } this.gridApi.gridOptionsWrapper.gridOptions.context.path = params.path; this.gridApi.setRowData(this.createRowData(this.hadronDocs, 1)); this.gridApi.setColumnDefs(headers); } this.gridApi.refreshCells({force: true}); if (this.gridApi) { this.addFooters(); } /* Use this call to open cell for editing so that we're guaranteed the cell has already been created before we start editing it. */ if (params.editParams) { const strColId = '' + params.editParams.colId; this.gridApi.ensureColumnVisible(strColId); this.gridApi.setFocusedCell(params.editParams.rowIndex, strColId); this.gridApi.startEditingCell({rowIndex: params.editParams.rowIndex, colKey: strColId}); } else if (params.path.length && params.types[params.types.length - 1] === 'Array') { this.gridApi.ensureColumnVisible('0'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updatePath(newPath) {\n return this.props.convertPathToUrl(newPath)\n .then(\n url => this.setState({path: url})\n )\n .catch(\n e => this.setState({path: null})\n )\n ;\n }", "_updateCurrentPath() {\n let current = this.currentWidget;\n let newValue = '';\n if (current && current instanceof DocumentWidget) {\n newValue = current.context.path;\n }\n this._currentPathChanged.emit({\n newValue: newValue,\n oldValue: this._currentPath\n });\n this._currentPath = newValue;\n }", "get pathChanged() {\n return this._pathChanged;\n }", "get pathChanged() {\n return this._pathChanged;\n }", "__handleItemPath(path, value) {\n let itemsPath = path.slice(6); // 'items.'.length == 6\n\n let dot = itemsPath.indexOf('.');\n let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot); // If path was index into array...\n\n if (itemsIdx == parseInt(itemsIdx, 10)) {\n let itemSubPath = dot < 0 ? '' : itemsPath.substring(dot + 1); // If the path is observed, it will trigger a full refresh\n\n this.__handleObservedPaths(itemSubPath); // Note, even if a rull refresh is triggered, always do the path\n // notification because unless mutableData is used for dom-repeat\n // and all elements in the instance subtree, a full refresh may\n // not trigger the proper update.\n\n\n let instIdx = this.__itemsIdxToInstIdx[itemsIdx];\n let inst = this.__instances[instIdx];\n\n if (inst) {\n let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : ''); // This is effectively `notifyPath`, but avoids some of the overhead\n // of the public API\n\n inst._setPendingPropertyOrPath(itemPath, value, false, true);\n\n inst._flushProperties();\n }\n\n return true;\n }\n }", "_onFileChanged(sender, change) {\n let path = this._model.path;\n let { sessions } = this.manager.services;\n let { oldValue, newValue } = change;\n let value = oldValue && oldValue.path && coreutils_1.PathExt.dirname(oldValue.path) === path\n ? oldValue\n : newValue && newValue.path && coreutils_1.PathExt.dirname(newValue.path) === path\n ? newValue\n : undefined;\n // If either the old value or the new value is in the current path, update.\n if (value) {\n this._scheduleUpdate();\n this._populateSessions(sessions.running());\n this._fileChanged.emit(change);\n return;\n }\n }", "update_url(new_url_path){\n // If the url has changed\n this.setState({\n url_path: new_url_path\n });\n }", "_onFileChanged(sender, change) {\n var _a, _b, _c;\n if (change.type !== 'rename') {\n return;\n }\n let oldPath = change.oldValue && change.oldValue.path;\n let newPath = change.newValue && change.newValue.path;\n if (newPath && this._path.indexOf(oldPath || '') === 0) {\n let changeModel = change.newValue;\n // When folder name changed, `oldPath` is `foo`, `newPath` is `bar` and `this._path` is `foo/test`,\n // we should update `foo/test` to `bar/test` as well\n if (oldPath !== this._path) {\n newPath = this._path.replace(new RegExp(`^${oldPath}/`), `${newPath}/`);\n oldPath = this._path;\n // Update client file model from folder change\n changeModel = {\n last_modified: (_a = change.newValue) === null || _a === void 0 ? void 0 : _a.created,\n path: newPath\n };\n }\n this._path = newPath;\n void ((_b = this.sessionContext.session) === null || _b === void 0 ? void 0 : _b.setPath(newPath));\n const updateModel = Object.assign(Object.assign({}, this._contentsModel), changeModel);\n const localPath = this._manager.contents.localPath(newPath);\n void ((_c = this.sessionContext.session) === null || _c === void 0 ? void 0 : _c.setName(PathExt.basename(localPath)));\n this._updateContentsModel(updateModel);\n this._ycontext.set('path', this._path);\n }\n }", "function updateActivePath(path){\r\n\t\tg_activePath = path;\r\n\t\tg_objWrapper.find(\".uc-assets-activepath .uc-pathname\").text(\"..\"+path);\r\n\t}", "function setPropertyChanged(params) {\n var path = params.path;\n var value = params.value;\n\n var root = _config;\n var iter = root;\n var pathArray = path.split(\".\");\n\n var i = 0;\n while (iter && i < pathArray.length - 1) {\n var pathItem = pathArray[i];\n iter = iter[pathItem];\n i++;\n }\n\n if (iter && pathArray.length) {\n var lastPathItem = pathArray[pathArray.length - 1];\n\n if (!value) {\n if (pathArray.length < 3) {\n return;\n }\n\n var base = getBase({ path: path });\n if (!base) {\n return;\n }\n\n var basePathArray = pathArray.slice(2);\n var basePath = basePathArray.join(\".\");\n var baseValue = getProperty({\n path: basePath,\n root: base\n });\n iter[lastPathItem] = DistModel.clone(baseValue);\n }\n\n if (!iter[\"@metadata\"]) {\n iter[\"@metadata\"] = {};\n }\n var metadata = iter[\"@metadata\"];\n var childrenProperties = metadata.properties;\n if (!childrenProperties) {\n childrenProperties = {};\n metadata.properties = childrenProperties;\n }\n var childProperties = childrenProperties[lastPathItem];\n if (!childProperties) {\n childProperties = {};\n childrenProperties[lastPathItem] = childProperties;\n }\n childProperties.changed = value;\n }\n }", "get currentPathChanged() {\n return this._currentPathChanged;\n }", "update() {\n this.initGrid();\n\n // Sort route definitions by increasing distance.\n const dist = this.options.distance;\n this.routes.sort((a, b) => dist(a.start, a.goal) - dist(b.start, b.goal));\n\n // Compute a new path for each route.\n for (const [i, route] of this.routes.entries()) {\n route.onChange(route, this.findPath(route));\n }\n }", "function mapUpdate (evt) {\n let type = evt.type || 'updated';\n\n // For non-browserify events, the changed paths are in evt.path\n // For browserify events, evt is the changed paths\n // evt.path & path can either be a single path or an array of paths.\n let paths = _.flatten([ (evt.path || evt) ]);\n\n _.each(paths, (path) => {\n let shortenedPath = path.split('src').reduce((prev, current) => current);\n gutil.log(\n 'File ' +\n chalk.green(shortenedPath) +\n ' was ' +\n chalk.blue(type) +\n '. Rebuilding...'\n );\n });\n}", "componentWillUpdate(newProps, newState) {\n if (this.state.value != newState.value) {\n this.updatePath(newState.value);\n }\n }", "function _updatePath() {\n\t\tdocument.documentElement.canAdvance = inputFile && outputFile;\n\t\tif (inputFile) document.getElementById(\"input-path\").value = inputFile.path;\n\t\tif (outputFile) document.getElementById(\"output-path\").value = outputFile.path;\n\t}", "function updatePaths() {\n clearPaths();\n\n // Determine if payment is ready to find paths.\n if(!Payment.isValid()) {\n $rootScope.$broadcast('payment:invalid');\n return;\n }\n\n // Determine if the amount is enough to fund the destination.\n var finalDestBalance = amount.add(destination.balance);\n if (finalDestBalance.compareTo($rootScope.account.reserve_base) < 0) {\n var minimumAmount = $rootScope.account.reserve_base.subtract(destination.balance);\n\n $rootScope.$broadcast('payment:destination-unfunded', minimumAmount);\n return;\n }\n\n if (!amount.is_native()) {\n // Use any issuer the destination trusts.\n amount.set_issuer(destination.address);\n }\n\n // Subscribe to path updates.\n pathSubscription = StellarNetwork.remote.path_find(\n $rootScope.account.Account,\n destination.address,\n amount\n );\n\n // Broadcast path updates.\n pathSubscription.on('update', function(result) {\n if(this.closed) { return; } // TODO: Move to stellar-lib\n\n var paths = processPaths(result.alternatives || []);\n $rootScope.$apply(broadcastPaths.call(null, paths));\n });\n\n // Handle path errors.\n pathSubscription.on('error', function(result) {\n if(this.closed) { return; } // TODO: Move to stellar-lib\n\n $rootScope.$broadcast('payment:paths-error');\n });\n\n // If there is a native STR path broadcast it immediately.\n var initialPaths = processPaths([]);\n if(_.any(initialPaths)) {\n broadcastPaths(initialPaths);\n } else {\n $rootScope.$broadcast('payment:paths-loading');\n }\n }", "handleChange() {\n this.forceUpdate();\n }", "update(path, newValue) {\n // this.currentData is about to become the \"previous generation\"\n const prevData = this.currentData;\n\n if (path.length === 0) {\n // Replace the data entirely. We must manually force its immutability when we do this.\n this.currentData = Immutable(newValue);\n }\n else {\n // Apply the update to produce the next generation. Because this.currentData has\n // been processed by seamless-immutable, nextData will automatically be immutable as well.\n this.currentData = this.currentData.setIn(path, newValue);\n }\n\n // Notify all change listeners\n for (let changeListener of this.changeListeners) {\n let shouldUpdate = true;\n let shorterPathLength = Math.min(path.length, changeListener.path.length);\n\n // Only update if the change listener path is a sub-path of the update path (or vice versa)\n for(let i = 1; i < shorterPathLength; i++) {\n shouldUpdate = shouldUpdate && (path[i] === changeListener.path[i])\n }\n\n if(shouldUpdate) {\n // Only call change listener if associated path data has changed\n if(getIn(this.currentData, changeListener.path) !== getIn(prevData, changeListener.path)) {\n // Pass nextData first because many listeners will ONLY care about that.\n changeListener(this.currentData, prevData, path);\n }\n }\n }\n }", "handleChange(path, update) {\n const address = {\n street: this.props.value.street,\n street2: this.props.value.street2,\n street3: this.props.value.street3,\n city: this.props.value.city,\n country: this.props.value.country,\n state: this.props.value.state,\n provinceCode: this.props.value.provinceCode,\n zipcode: this.props.value.zipcode,\n postalCode: this.props.value.postalCode\n };\n\n address[path] = update;\n\n this.props.onUserInput(address);\n }", "function _update() {\r\n this.component[this.prop] = this.control[this.prop];\r\n }", "function handleFileUpdate(evt) {\n // evt = {type, path}; type can be \"added\", \"changed\", or \"deleted\"\n // https://github.com/shama/gaze/tree/v0.6.4\n // If it was changed or removed, then send the path to LiveReload\n if (['changed', 'deleted'].indexOf(evt.type) !== -1) {\n return gulpLivereload.changed(evt.path);\n }\n\n // Otherwise, do nothing\n }", "update(oldValue, path, action, key) {\n\t\t// resolve data, bind to element from child class\n\t\tthis.resolver.resolve(this.model, this.delayMethod === true ? true : false);\n\t\tvar newValue = this.resolver.resolved;\n\n\t\tif (this.config) this.config.resolve(this.model);\n\t\tif (this.alterer)\n\t\t{\n\t\t\tthis.alterer.resolve(this.model);\n\t\t\tthis.resolver.resolved = RaziloBindCoreDetector.alterers(this.alterer.resolved, this.resolver.resolved);\n\t\t}\n\n\t\tthis.bind(oldValue, path, action, key);\n\n\t\tif (!newValue) return;\n\n\t\t// garbage collection on observables map which is only thing holding ref to binder (so binder will be released naturally)\n\t\tif (action === 'object-remove') delete this.traverser.observables[path + '.' + key];\n\t\telse if (action === 'array-remove')\tfor (var i = newValue.length -1; i < oldValue; i++) delete this.traverser.observables[path + '.' + i];\n\t}", "notify(){\n /**\n * Informs listeners that file system received new data\n * @event DirService#update\n * @type void\n */\n this.emit( \"update\" );\n }", "onUpdateFolder() {\n this.onUpdateFolder();\n }", "componentDidUpdate () {\n this.props.gUpdateUserFolderView(this.props.folderID);\n }", "onChange(changeListener) {\n changeListener.path = this.path;\n privateDataMap.get(this).addListener(changeListener, this.path);\n }", "updateRoute() {\n this.props.updateRoute(this.props.index,\n this.agency, this.line, this.direction, this.time);\n }", "componentDidUpdate(prevProps, prevState) {\n if (window.location.href !== prevState.location) {\n this.setState({ location: window.location.href })\n this.getPathName()\n }\n }", "bind(oldValue, path) {\n\t\t// catch duplicate fires from ui\n\t\tif (this.node.value === this.resolver.resolved) return;\n\n\t\t// set value\n\t\tthis.type = this.node.getAttribute('type');\n\t\tthis.setValue();\n\n\t\t// should we watch for changes?\n\t\tif (!!this.event || this.resolver.observers.length < 1) return;\n\n\t\t// add event listener to node\n\t\tthis.event = 'change';\n\t\tthis.node.addEventListener(this.event, this.listener.bind(this), false);\n\t}", "setPath(path) {\nthis._path = path;\n}", "applyChanges() {\n this._applyClipChanges();\n\n this._applyPathChanges();\n }", "async onSrcDirUpdate(pathSpec) {\n // Kill the current backend if it is running or starting.\n if (\n this._backendState === BACKEND_STATES.STARTING ||\n this._backendState === BACKEND_STATES.RUNNING\n ) {\n log.warn(\n \"Killing current running backend due to source directory update.\"\n );\n await this.killBackend();\n }\n\n // Do nothing if backend is shutting down.\n if (this._backendState === BACKEND_STATES.SHUTTING_DOWN) {\n setTimeout(() => this.onSrcDirUpdate(pathSpec), 500);\n return;\n }\n\n // Start a new backend.\n if (\n this._backendState === BACKEND_STATES.NOT_STARTED ||\n this._backendState === BACKEND_STATES.DEAD\n ) {\n log.info(\"Starting new backend process...\");\n await this.forkBackend();\n }\n }", "updateDir() {\n let url = decodeURIComponent(this.$location.url());\n console.debug(\"url: \" + url);\n let dir = url.slice(BASE_URL.length, url.length);\n if (dir === '/') {\n dir = '';\n }\n if (dir !== this.dir) {\n this.dir = dir;\n this.updateCrumbs();\n }\n }", "[_changePath] (newPath) {\n // have to de-list before changing paths\n this[_delistFromMeta]()\n const oldPath = this.path\n this.path = newPath\n const namePattern = /(?:^|\\/|\\\\)node_modules[\\\\/](@[^/\\\\]+[\\\\/][^\\\\/]+|[^\\\\/]+)$/\n const nameChange = newPath.match(namePattern)\n if (nameChange && this.name !== nameChange[1])\n this.name = nameChange[1].replace(/\\\\/g, '/')\n\n // if we move a link target, update link realpaths\n if (!this.isLink) {\n this.realpath = newPath\n for (const link of this.linksIn) {\n link[_delistFromMeta]()\n link.realpath = newPath\n link[_refreshLocation]()\n }\n }\n // if we move /x to /y, then a module at /x/a/b becomes /y/a/b\n for (const child of this.fsChildren)\n child[_changePath](resolve(newPath, relative(oldPath, child.path)))\n for (const [name, child] of this.children.entries())\n child[_changePath](resolve(newPath, 'node_modules', name))\n\n this[_refreshLocation]()\n }", "pathFromFilters() {\n console.log('The filters have changed.');\n // console.log(this.pathFromFilters);\n this.redrawFeed();\n }", "_update() {\n const revision = this.model.get('fileRevision');\n const diffRevision = this.model.get('diffRevision');\n\n if (diffRevision) {\n this._values = [diffRevision, revision];\n } else {\n this._values = [0, revision];\n }\n\n if (this._rendered) {\n this._updateHandles();\n }\n }", "async componentDidUpdate() {\n if(!this.state.pathSynchronized) {\n if(Fabric.isFrameClient) {\n if(this.props.frameRouting.path === undefined) { return; }\n\n await Fabric.Initialize();\n\n if(this.props.frameRouting.path !== this.props.router.location.pathname) {\n this.setState({redirectPath: this.props.frameRouting.path});\n } else {\n this.setState({\n contentSpaceLibraryId: Fabric.contentSpaceLibraryId,\n redirectPath: \"\",\n pathSynchronized: true\n });\n\n this.props.StartRouteSynchronization();\n }\n } else {\n await Fabric.Initialize();\n this.setState({\n contentSpaceLibraryId: Fabric.contentSpaceLibraryId,\n pathSynchronized: true\n });\n }\n }\n }", "updated(_changedProperties) { }", "handleChange (event) {\n\t\tvar values = assign({}, this.state.values);\n\t\tvalues[event.path] = event.value;\n\t\tthis.setState({\n\t\t\tvalues: values,\n\t\t});\n\t}", "updated(changedProperties) {\n if (super.updated) {\n super.updated(changedProperties);\n }\n changedProperties.forEach((oldValue, propName) => {\n if (propName == \"link\") {\n this.remoteLinkURL = this[propName];\n }\n /* notify example\n // notify\n if (propName == 'format') {\n this.dispatchEvent(\n new CustomEvent(`${propName}-changed`, {\n detail: {\n value: this[propName],\n }\n })\n );\n }\n */\n /* observer example\n if (propName == 'activeNode') {\n this._activeNodeChanged(this[propName], oldValue);\n }\n */\n /* computed example\n if (['id', 'selected'].includes(propName)) {\n this.__selectedChanged(this.selected, this.id);\n }\n */\n });\n }", "update() {\n\t\tif (this.hasChangedBesidesElement_() && this.shouldUpdate(this.changes_)) {\n\t\t\tthis.patch();\n\t\t\tthis.eventsCollector_.detachUnusedListeners();\n\t\t\tthis.disposeUnusedSubComponents_();\n\t\t}\n\t}", "updated(){\n console.log('Updated');\n }", "update() {\n const state = this.store.getState();\n\n if (this.isPresenting !== state.webvr.isPresenting) {\n this.vrEffect.setFullScreen(state.webvr.isPresenting);\n this.isPresenting = state.webvr.isPresenting;\n }\n\n if (this.isPresenting) {\n this.vrControls.update();\n } else {\n const dt = (state.app.timestamp - this.timestamp) || 0;\n this.timestamp = state.app.timestamp;\n\n this.flyControls.update(dt);\n }\n\n // update all components with their state\n const componentState = this.select(state);\n Object.keys(this.components)\n .forEach(id => this.components[id].update(componentState[id]));\n }", "componentDidUpdate(prevProps) {\n const currentPath = this.props.location.pathname;\n if (prevProps.location.pathname !== currentPath) {\n if (document.activeElement) {\n document.activeElement.blur();\n document.body.focus();\n }\n if (getIsPersonalMode()) {\n if (currentPath.startsWith(Routes.Join) || currentPath === Routes.Host) {\n this.updateRoomInfo();\n }\n }\n }\n }", "_UpdateComponents() {\n this.loadedComponents.forEach((component) => {\n if(component.binding) {\n // Update the component from its bound value if the value has changed\n if(component.binding.object[component.binding.property] != component.oldValue) {\n component.SetValue(component.binding.object[component.binding.property]);\n component.oldValue = component.binding.object[component.binding.property];\n }\n }\n });\n\n setTimeout(() => {\n window.requestAnimationFrame(() => {\n this._UpdateComponents();\n });\n }, this.opts.pollRateMS);\n\n }", "updated(_changedProperties) {\n }", "updated(_changedProperties) {\n }", "updated(_changedProperties) {\n }", "update() {\n if (this.state.addedFiles && this.state.addedFiles.length > 0) {\n this.props.onUpdate({ value: this.state.addedFiles });\n } else {\n this.props.onUpdate({ value: undefined });\n }\n }", "updated(changedProperties) {\n changedProperties.forEach((oldValue, propName) => {\n if (propName == \"trackIcon\") {\n this._trackIconChanged(this[propName], oldValue);\n }\n if ([\"id\", \"selected\"].includes(propName)) {\n this.__selectedChanged(this.selected, this.id);\n }\n });\n }", "function updateSitePaths(arg){\n\n\n var delPath = false,\n update = false,\n builtPaths = '',\n payLoad = null,\n pathLabels=null,\n pathUrls=null,\n protocol=\"https\",\n lastPath = $('#existingPathsSel').children()[1],\n existing = $('#existingPathsSel').children()[0];\n\n if(arg!==true && arg !==false){\n arg=false;\n }\n\n delPath = arg;\n\n if(delPath){\n \n if($(lastPath).is(':selected')){\n alert(\"The first path is reserved and can not be deleted. \\n\" +\n \"To update this path, delete the site and add it back\\n\"+\n \"with a new root path. If trying to delete other paths, \\n\" +\n \"make sure the first path is not selected.\");\n return;\n }\n \n //Make sure the root Existing Paths placeholder is not being added.\n \n if($(existing).is(':selected')){\n $(existing).prop('selected',false);\n }\n\n if(confirm(\"Delete The Selected Test Paths From The System?\")){\n update = true;\n }\n }\n else{\n if(confirm(\"Add\" + urlText.val() + \" as paths to site\" + siteSelect.val() + \" ?\")){\n update = true;\n ecto1.aux.toggleButtonState(updateButton);\n } \n }\n\n if(update){\n\n //Deleting Paths\n if(delPath){\n\n //Build up list of the selected Paths\n var selectedPaths = [];\n $(\"#existingPathsSel :selected\").each(function(){\n selectedPaths.push($(this).val());\n });\n\n //We need to build up our path object\n for(var i=0; i < selectedPaths.length; i++){\n if(i===selectedPaths.length-1){\n builtPaths += '{\"url\": \"' + selectedPaths[i] + '\", \"label\":\"removeLabel\"}'; \n }\n else{\n builtPaths += '{\"url\": \"' + selectedPaths[i] + '\", \"label\":\"removeLabel\"},'; \n }\n }\n builtPaths = '{\"paths\":['+builtPaths+']}';\n\n }\n else{ //Adding Paths\n //Every Path Entry requires a lable, we need to validate this and inform the user if this requirment is not met.\n pathLabels = pathLabel.val().split(\",\");\n pathUrls = urlText.val().split(\",\");\n\n if(pathLabels.length!==pathUrls.length||pathLabels[0].valueOf()===\"\"){\n return alert(\"Every path entry requires a label. Label 1 is associated with Path 1. Please make sure you have at least one path and each path has a label.\");\n }\n else{\n siteCheckbox.trigger('click');\n //We need to build up our path object\n for(var i=0; i < pathLabels.length; i++){\n if(i===pathLabels.length-1){\n builtPaths += '{\"url\": '+pathUrls[i]+ ', \"label\":'+ pathLabels[i] +'}'; \n }\n else{\n builtPaths += '{\"url\": '+pathUrls[i]+ ', \"label\":'+ pathLabels[i] +'},'; \n }\n }\n builtPaths = '{\"paths\":['+builtPaths+']}';\n }\n\n if(!secureCheckbox.is(':checked')){\n protocol=\"http\";\n }\n }\n\n payLoad = {\n 'siteName' : siteSelect.val(),\n 'paths' : builtPaths,\n 'protocol' : protocol,\n 'removePaths': delPath\n };\n\n\n payLoad = JSON.stringify(payLoad);\n\n $.ajax({\n url: \"/wraith/updateSitePaths\",\n type: \"POST\",\n data: payLoad,\n async: true,\n timeout:0,\n contentType: 'application/json; charset=utf-8',\n\n beforeSend:function(){\n scriptOutputCont.html('--- Script Output ---');\n scriptOutputCont.append('<div>------- Updating Site Paths for : ' + siteSelect.val() + ' -------</div></br></br>');\n scriptOutputCont.append(\"<div id='timer'>Starting Timer</div>\").each(function(){\n ecto1.aux.startTimer(); \n });\n\n },\n\n success:function(response){\n response += '</br><div>------- End of Script Output ------</div></br></br>';\n scriptOutputCont.append(response);\n getSitePaths(siteSelect.val());\n if(!delPath){\n urlText.val('');\n pathLabel.val('');\n pathCheckbox.prop('checked',false);\n pathCheckbox.trigger('change');\n pathCheckbox.prop('checked',false);\n }\n },\n error:function(response){\n scriptOutputCont.append(\"Problem retrieving script output : \" + JSON.stringify(response));\n },\n complete: function(){\n ecto1.aux.stopTimer();\n }\n }); \n }\n }", "refresh () {\n const provider = this.fileProviderOf('/')\n // emit folderAdded so that File Explorer reloads the file tree\n provider.event.emit('folderAdded', '/')\n }", "componentDidUpdate(prevProps) {\n if (\n routeHasChanged({\n prevWindowPath: prevProps.windowPath,\n curWindowPath: this.props.windowPath,\n prevRouteParams: prevProps.routeParams,\n curRouteParams: this.props.routeParams,\n })\n ) {\n this.fetchData(this.props)\n }\n }", "rerender() {\n // destroy old pathview/errorview instance\n // set symbol to undefined to avoid \"This component has already been destroyed\" message\n if (this._app) {\n this._app.$destroy();\n this._app = undefined;\n }\n let errors = [];\n if (this.db.database_updating) {\n errors.push(\"Updating...\");\n }\n else if (!this.db.database_complete) {\n errors.push(`Your Map of Content couldn't be created.<br><br> Make sure your Central Note path '${this.settings.get(\"CN_path\")}' is correct. You can change this path in the settings tab.`);\n }\n else if (this.app.workspace.getActiveFile() == null) {\n errors.push(\"No file is open\");\n }\n else if (this.settings.isExludedFile(this.app.workspace.getActiveFile())) {\n errors.push(\"This file has been excluded from the Map of Content.\");\n }\n else {\n this.open_file_path = this.app.workspace.getActiveFile().path;\n if (this.db.getNoteFromPath(this.open_file_path) == undefined) {\n errors.push(\"Updating...\");\n this.db.update(true);\n }\n }\n let paths = [];\n if (errors.length == 0) {\n let all_paths = this.db.findPaths(this.open_file_path);\n if (all_paths.length == 0) ;\n paths = all_paths.map((p) => p.items.slice());\n }\n else {\n this.open_file_path = \"None\";\n paths = [];\n }\n this._app = new View({\n target: this.contentEl,\n props: { view: this, paths: paths, errors: errors },\n });\n }", "[_refreshLocation] () {\n const root = this.root\n const loc = relpath(root.realpath, this.path)\n\n this.location = loc\n\n root.inventory.add(this)\n if (root.meta)\n root.meta.add(this)\n }", "updated(_changedProperties){}", "updated(_changedProperties){}", "onChange(document) {\n if (fspath.basename(document.uri.fsPath) == \"property.json\") {\t\t\n this.refreshProperty.updateFolder(serve.opeParam.rootPath,serve.opeParam.workspacePath,document.uri.fsPath);\n this.refreshProperty.updatePrjInfo(serve.opeParam.rootPath,document.uri.fsPath);\n return;\n }\n if (!this.getHDLDocumentType(document)) {\n return;\n }\n else if (this.getHDLDocumentType(document) == 1 ) {\n this.HDLparam = this.parser.removeCurrentFileParam(document, this.HDLparam);\n this.parser.get_HDLfileparam(document, null, 0, null, this.HDLparam);\n this.parser.get_instModulePath(this.HDLparam);\n this.refresh();\n }\n }", "updated(_changedProperties) {\n }", "onMapUpdated() {\n if (this.controller.isInitialized()) {\n this.refresh().then();\n }\n }", "function onSettingsChange(path, value) {\n printerInterface.setProperty({ path: path, value: value });\n requestUpdate();\n }", "updatePath(){\n \n let move = this.getMinL1(this.snake.pos, this.snake.direction, this.target);\n if(move){\n this.path.push(move);\n }\n \n }", "componentDidUpdate() {\n this.bindRouteLinks();\n }", "updated(changedProperties) {\n super.updated(changedProperties);\n const event = new CustomEvent('updated', {\n bubbles: true,\n cancelable: true\n });\n this.dispatchEvent(event);\n }", "routeUpdate(selectedRoutes) {\n this.setState({\n routes: selectedRoutes\n })\n }", "afterupdate (el) {\n console.log('Component was updated')\n }", "_onSessionChanged(sender, type) {\n if (type !== 'path') {\n return;\n }\n const path = this.sessionContext.session.path;\n if (path !== this._path) {\n this._path = path;\n this._ycontext.set('path', this._path);\n }\n }", "handleUpdates(){\n\t\t//put per update scripts here\n\t\tconsole.log('update');\n\t}", "set RenderPaths(value) {}", "attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'path') {\n this.getImg(this.shadowRoot).src = newValue;\n }\n }", "updated(changedProperties) {\n if (super.updated) {\n super.updated(changedProperties);\n }\n changedProperties.forEach((oldValue, propName) => {\n /* notify example\n // notify\n if (propName == 'format') {\n this.dispatchEvent(\n new CustomEvent(`${propName}-changed`, {\n detail: {\n value: this[propName],\n }\n })\n );\n }\n */\n /* observer example\n if (propName == 'activeNode') {\n this._activeNodeChanged(this[propName], oldValue);\n }\n */\n /* computed example\n if (['id', 'selected'].includes(propName)) {\n this.__selectedChanged(this.selected, this.id);\n }\n */\n });\n }", "componentDidUpdate(prevProps, prevState) {\n let regex = /^\\//\n if(this.props.location.pathname !== prevProps.location.pathname) {\n let newSearchTerm = this.props.location.pathname.replace(regex,\"\")\n this.updatePictures(newSearchTerm);\n }\n}", "componentWillUpdate() {\n this.url = splitUrl(window.location.pathname)[0];\n console.log(\"URL \" + this.url);\n }", "function onSettingsChange(path, value) {\n _printerDialog.setProperty({ path: path, value: value });\n component.forceUpdate();\n }", "componentDidUpdate(prevProps) {\n const {\n match: { params },\n } = this.props;\n if (this.props.location.pathname !== prevProps.location.pathname) {\n this.getData();\n }\n }", "function bindCurrentFolderPath() {\n\tconst load = (event) => {\n\t\tconst folderPath = event.target.getAttribute('data-path');\n\t\tloadDirectory(folderPath)();\n\t};\n\n\t// all folders and their paths\n\tconst paths = document.getElementsByClassName('path');\n\t// attach click event to each folder\n\tfor(let i = 0; i < paths.length; i++) {\n\t\tpaths[i].addEventListener('click', load, false);\n\t}\n}", "updated(changedProperties) {\n }", "function update() {\n // ... no implementation required\n }", "handleUpdate(e) {\r\n\t\te.preventDefault();\r\n\t\t//--- Declare state variable for this component ---//\r\n\t\tconst data = {\r\n id : this.state.id,\r\n language : this.state.language\r\n\t\t}\r\n\t\tif( !this.checkValidation(data) ) {\r\n var referenceToEdit = firebase.database().ref('language').orderByChild('id').equalTo(this.state.id);\r\n referenceToEdit.once('value',function(snapshot){\r\n snapshot.forEach(function(child) {\r\n child.ref.child('language').set(data.language);\r\n });\r\n });\r\n\t\t\tthis.reset();\r\n\t\t\tthis.props.updateState(data, 1);\r\n\t\t\tdocument.getElementById(\"closeEditModal\").click();\r\n\t\t\ttoastr.warn('Language updated successfully!', {position : 'top-right', heading: 'Done'});\r\n }\r\n\t}", "update() {\n // Subclasses should override\n }", "onEntityModelComponentUpdate(userViewId) {\n // we don't want to update components if we were the ones who updated it\n if (userViewId === this.viewId) {\n this.lastTimeComponentsWereUpdated = this.lastTimeComponentsWereSet;\n } else {\n this.updateComponents();\n }\n }", "update(props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents)\n ensureListeners(this);\n let prevProps = this._props;\n this._props = props;\n if (props.plugins) {\n props.plugins.forEach(checkStateComponent);\n this.directPlugins = props.plugins;\n }\n this.updateStateInner(props.state, prevProps);\n }", "updateForPaths(paths) {\n if (!paths) return;\n\n let selected = null;\n let remaining = [];\n for (const projectElement of this.projects) {\n if (projectElement.isChecked()) {\n selected = projectElement.path;\n }\n projectElement.markUnchecked();\n if (projectElement.path in paths) {\n remaining.push(projectElement);\n } else {\n projectElement.destroy();\n }\n }\n\n this.projects = [];\n let i = 0;\n for (const path of paths) {\n if (i < remaining.length && remaining[i].path == path) {\n this.projects.push(remaining[i]);\n i++;\n } else {\n const projectElement = new ProjectItem(path, this._selectionHandler.bind(this));\n this.projects.push(projectElement);\n if (i < remaining.length) {\n this.element.insertBefore(projectElement.element, remaining[i]);\n } else {\n this.element.appendChild(projectElement.element);\n }\n }\n }\n\n for (projectElement of this.projects) {\n if (!selected || projectElement.path == selected) {\n projectElement.markChecked();\n return;\n }\n }\n // If we have removed selected project, just mark the first one as selected.\n if (this.projects.length > 0) {\n this.projects[0].markChecked();\n }\n }", "set path(path) {\n this._path = path;\n this.setAttribute('path', path);\n }", "refresh() {\n this.changefolder(); //changefolder with empty folder - just refresh\n }", "computePath(){\n var driver_path = []\n for (var i=0; i < this.state.stops.length; i++){\n driver_path.push({\n \"name\": this.state.stops[i][\"name\"],\n \"x\": this.state.stops[i][\"x\"],\n \"y\": this.state.stops[i][\"y\"],\n })\n if (this.state.stops[i][\"name\"] === this.state.driver_location[\"activeLegID\"][0]){\n break\n }\n }\n \n // Compute driver's current position\n var leg_progress = parseInt(this.state.driver_location[\"legProgress\"]) / 100\n var delta_x = this.state.stops[i+1][\"x\"] - this.state.stops[i][\"x\"]\n var delta_y = this.state.stops[i+1][\"y\"] - this.state.stops[i][\"y\"]\n var x = delta_x * leg_progress + this.state.stops[i][\"x\"]\n var y = delta_y * leg_progress + this.state.stops[i][\"y\"]\n\n driver_path.push({\n \"name\": \"loc\",\n \"x\": x,\n \"y\": y,\n })\n\n this.setState({\n newDriverLoc : {\n \"x\": x,\n \"y\": y,\n },\n sliderVal: parseInt(this.state.driver_location[\"legProgress\"]),\n driver_loc_activeLegID_new: this.state.driver_location[\"activeLegID\"]\n })\n\n // Update driver's path\n this.setState({driver_path: driver_path})\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 }", "updateComponents () {\n\t\tfor (let component in this.components) {\n\t\t\tthis.components[component].update();\n\t\t}\n\t}", "_updateRouteProgress(){\n let time = this.store.getters.time.getTimePassed(this._lastUpdate);\n this._lastUpdate += time;\n this._updateRouteProgressHelper(this.route.route,time);\n }", "handleFilechange(event, path) {\n console.log('PdfjsViewerView: file', event, path)\n this.reloadPdf()\n }", "componentDidUpdate() {\n this.update();\n }", "componentDidUpdate() {\n this.update();\n }", "componentDidUpdate() {\n this.update();\n }", "function updateRoute() {\n\n}", "attributeChangedCallback(attrName, oldVal, newVal) {\n let isDirty = false;\n if (!this.connected) {\n return;\n }\n if (attrName.toLowerCase() == 'modulename' && newVal && newVal != '') {\n this.moduleName = newVal;\n if (this.moduleName) {\n isDirty = true;\n }\n }\n if (this && attrName.toLowerCase() == 'objectname' && newVal && newVal != '') {\n this.objectname = newVal;\n if (this.objectname) {\n isDirty = true;\n }\n }\n if (this && attrName.toLowerCase() == 'objectwhere' && newVal && newVal != '') {\n this.objectwhere = newVal;\n if (this.objectwhere) {\n isDirty = true;\n }\n }\n if (this.connected === true && (isDirty === true)) {\n this.refresh();\n }\n }", "componentDidUpdate() {\n console.log(\"Component updated\");\n }", "update(_changedProperties) {\n super.update();\n }", "function update() {\n\n //Build the path with the new data\n build();\n\n //Remove the old data from the graph\n removeData(pathGraph);\n removeData(trajectoryGraph);\n\n //Make an array for the new datasets\n let data = [];\n\n //Loop through each waypoint\n for (let point of waypoints) {\n if (point !== undefined) {\n //If the point is not undefined at it to the dataset\n data.push({x: point.x, y: point.y});\n }\n }\n\n //Put the new dataset onto the graph\n addData(pathGraph, \"Waypoints\", data, \"--yellow\");\n\n //Clear the data array for the next dataset\n data = [];\n\n //Loop through each point\n for (let point of points) {\n if (point !== undefined) {\n //If the point is not undefined at it to the dataset\n data.push({x: point.x, y: point.y});\n }\n }\n\n //Put the new dataset onto the graph\n addData(pathGraph, \"Path\", data);\n\n let velocityData = [];\n let curvatureData = [];\n\n for (let point of path) {\n if (point !== undefined) {\n //If the point is not undefined at it to the dataset\n velocityData.push({x: point.startDistance, y: point.velocity});\n curvatureData.push({x: point.startDistance, y: point.curvature});\n }\n }\n\n //Put the new datasets onto the trajectory graph\n addData(trajectoryGraph, \"Velocity\", velocityData, \"--yellow\");\n addData(trajectoryGraph, \"Curvature\", curvatureData, \"--blue\");\n}", "updated(e){}", "componentDidUpdate() {}", "componentDidUpdate() {}" ]
[ "0.67468685", "0.66294944", "0.6516461", "0.6516461", "0.6440059", "0.63836426", "0.6234323", "0.61810935", "0.613412", "0.61297524", "0.6126395", "0.6029177", "0.6004393", "0.5979135", "0.59620965", "0.59508556", "0.5931601", "0.59315395", "0.5927795", "0.59016824", "0.58461833", "0.58275276", "0.5789854", "0.57810926", "0.577", "0.57489324", "0.57378995", "0.57193995", "0.5692243", "0.56806654", "0.56588346", "0.5634867", "0.56250745", "0.5594965", "0.55809593", "0.5563479", "0.5554009", "0.55443764", "0.55366325", "0.5526561", "0.5523944", "0.5516315", "0.551153", "0.55102056", "0.5504334", "0.5491665", "0.5491665", "0.5491665", "0.54757047", "0.5456102", "0.54449844", "0.5423331", "0.54137975", "0.5412021", "0.5411529", "0.5405371", "0.5405371", "0.53726286", "0.5370649", "0.5360594", "0.5359365", "0.53482807", "0.53433406", "0.53398013", "0.5338757", "0.53347385", "0.53324634", "0.53267425", "0.5325", "0.532222", "0.5307058", "0.53034604", "0.53009826", "0.5297247", "0.5292525", "0.529042", "0.52892697", "0.5285045", "0.52789557", "0.52736795", "0.5271262", "0.5270337", "0.5268589", "0.5261904", "0.52606195", "0.52587885", "0.5249678", "0.5232072", "0.5231762", "0.5228788", "0.5227806", "0.5227806", "0.5227806", "0.52262163", "0.5215903", "0.52129906", "0.52119", "0.5208424", "0.5201566", "0.51967984", "0.51967984" ]
0.0
-1
Go through and add modified footers to documents that are edited.
addFooters() { /* Add footers for modified rows */ this.gridApi.forEachNodeAfterFilterAndSort((node) => { if (node.data.hadronDocument.isModified()) { this.addFooter(node, node.data, 'editing'); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupFooter(docname, docver, docstage, docrev, docdate) {\n var footer = doc.getFooter();\n var paragraphs = footer.getParagraphs();\n var doctrack = convertStageToTrack(docstage);\n \n // Build the filename based on provided data\n var docfilename = \"\";\n \n // The passed in docname will be something like \"Playbook Requirements\"\n // We need to make this lower case and remove the spaces\n docname = docname.toLowerCase();\n docname = docname.replace(/\\ /g, '-');\n if (docstage === \"wd\" || docstage === \"csd\" || docstage === \"cnd\") {\n docfilename = \"draft-\" + docname + '-v' + docver + '-' + docstage + docrev;\n }\n else {\n docfilename = docname + '-v' + docver + '-' + docstage + docrev;\n }\n\n // Update the first line of the footer\n e0 = paragraphs[0];\n\n // Update filename name on first line of footer\n e0.replaceText('##docfilename##', docfilename);\n \n // Update the Working Draft ##, but only if this is a WD.\n if (docstage === \"wd\") {\n // Update document revision\n e0.replaceText('##docrev##', docrev);\n }\n else {\n // Remove the Working Draft ## for CSD, CS, CND, CN, but only if it is found\n e0.replaceText('Working Draft ##docrev##', \"\");\n }\n\n // Update the document date\n e0.replaceText('##docdate##', docdate);\n\n // Update the second line of the footer\n e1 = paragraphs[1];\n \n // Update document track type (standards track, non-standards track, standards track draft, etc)\n e1.replaceText('##doctrack##', doctrack);\n}", "async inlineToFootnotes(fieldIDs) {\n\t\tlet fields = this.getFields()\n\t\t\t// Sort for update by reverse order of appearance to correctly update the doc\n\t\t\t.reverse()\n\t\t\t// Do not include fields already in footnotes\n\t\t\t.filter(field => !field.noteIndex && fieldIDs.has(field.id));\n\n\t\t// Insert footnotes (and remove placeholders)\n\t\tfor (let field of fields) {\n\t\t\tlet range = field.getRange();\n\t\t\tthis.addBatchedUpdate('createFootnote', { location: { index: range.endIndex, } });\n\t\t\tthis.addBatchedUpdate('deleteContentRange', { range });\n\t\t}\n\t\tlet response = await this.commitBatchedUpdates();\n\t\tthis._updatesCommited = false;\n\n\t\t// Reinsert placeholders in the inserted footnotes\n\t\tfields.forEach((field, index) => {\n\t\t\tlet range = {\n\t\t\t\tstartIndex: 1,\n\t\t\t\tendIndex: field.text.length+1,\n\t\t\t\t// Every second response is from createFootnote\n\t\t\t\tsegmentId: response.replies[index * 2].createFootnote.footnoteId\n\t\t\t};\n\t\t\tthis.addBatchedUpdate('insertText', {\n\t\t\t\ttext: field.text,\n\t\t\t\tlocation: {\n\t\t\t\t\tindex: 1,\n\t\t\t\t\tsegmentId: range.segmentId\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.addBatchedUpdate('updateTextStyle', {\n\t\t\t\ttextStyle: {\n\t\t\t\t\tlink: {\n\t\t\t\t\t\turl: field.links[0].url\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tfields: 'link',\n\t\t\t\trange\n\t\t\t});\n\t\t\tthis.encodeRange(range, field.code, config.fieldPrefix + field.id);\n\t\t});\n\t\treturn this.commitBatchedUpdates();\n\t}", "updateFooter() {\n // Get new footer row HTML string\n let newFoot = footer.render();\n // Add new footer row to table footer\n this.footer.appendChild(newFoot);\n }", "_updateToc() {\n\t if (this.$toc.length) {\n\t // regenerate complete ToC from first enabled question/group label of each page\n\t this.$toc.empty()[0].append(this.form.toc.getHtmlFragment());\n\t this.$toc.closest('.pages-toc').removeClass('hide');\n\t }\n\t }", "function update(){\n\t\tsubHeader();\n\t\tpagePositions();\n\t}", "function authorFootnotes(document) {\n const authors = document.querySelector(\".ltx_authors\");\n if (!authors) {\n return;\n }\n const notes = authors.querySelectorAll(\".ltx_note\");\n if (!notes.length) {\n return;\n }\n const authorNotesContainer = nodeFromString(\n document,\n '<div class=\"ltx_engrafo_author_notes\"></div>'\n );\n authors.appendChild(authorNotesContainer);\n // In the laTeXML's output several authors can have the same note text\n // and we want to deduplicate them. We'll use a dictionary to keep track of\n // unique note texts.\n const noteTextToMark = {};\n for (let note of notes) {\n const authorNote = nodeFromString(\n document,\n '<div class=\"ltx_note_outer\"></div>'\n );\n const noteContent = note.querySelector(\".ltx_note_content\");\n const noteMark = note.querySelector(\".ltx_note_mark\");\n\n const noteText = noteContent.lastChild.textContent;\n if (!(noteText in noteTextToMark)) {\n noteTextToMark[noteText] = Object.keys(noteTextToMark).length + 1;\n authorNote.appendChild(noteContent);\n authorNotesContainer.appendChild(authorNote);\n }\n\n noteMark.innerHTML = noteTextToMark[noteText];\n // Remove the footnote and replace with just the mark, because it isn't really a footnote any longer\n note.parentNode.replaceChild(noteMark, note);\n }\n}", "async footnotesToInline(fieldIDs) {\n\t\tlet fields = this.getFields().filter(field => fieldIDs.has(field.id));\n\t\tlet footnoteReferences = {};\n\t\tthis._reduceStructuralElements(this.body.content, (elem) => {\n\t\t\tif (elem.footnoteReference) {\n\t\t\t\tfootnoteReferences[elem.footnoteReference.footnoteId] = elem;\n\t\t\t}\n\t\t});\n\t\tfor (let i = fields.length-1; i >= 0; i--) {\n\t\t\tlet field = fields[i];\n\t\t\tlet footnoteId = field.links[0].footnoteId;\n\t\t\tif (!footnoteId) continue;\n\t\t\tlet footnoteText = this._reduceStructuralElements(this.footnotes[footnoteId].content);\n\t\t\t// There's other non-citation content in the footnote, so don't convert\n\t\t\tif (footnoteText.trim().length - field.text.length > 2) continue;\n\t\t\tlet footnoteReference = footnoteReferences[footnoteId];\n\t\t\tthis.addBatchedUpdate('deleteContentRange', { range: {\n\t\t\t\tstartIndex: footnoteReference.startIndex,\n\t\t\t\tendIndex: footnoteReference.endIndex\n\t\t\t}});\n\t\t\tlet newRange = {\n\t\t\t\tstartIndex: footnoteReference.startIndex,\n\t\t\t\tendIndex: footnoteReference.startIndex + field.text.length\n\t\t\t}\n\t\t\tthis.addBatchedUpdate('insertText', { text: field.text, location: { index: newRange.startIndex }});\n\t\t\tthis.addBatchedUpdate('updateTextStyle', {\n\t\t\t\ttextStyle: { link: { url: field.links[0].url } },\n\t\t\t\tfields: '*',\n\t\t\t\trange: newRange\n\t\t\t});\n\t\t\tthis.encodeRange(newRange, field.code, config.fieldPrefix + field.id);\n\t\t}\n\t\treturn this.commitBatchedUpdates();\n\t}", "goToFooter() {\n this.owner.enableHeaderAndFooter = true;\n this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget);\n }", "function addFooter(report) {\n report.getFooter().addClass(\"footer\");\n var versionLine = report.getFooter().addText(\"Banana Accounting - Page \", \"description\");\n report.getFooter().addFieldPageNr();\n}", "function updatePages() {\n $('#borrow-content .curr').html(currPage);\n $('#borrow-content .total').html(allPages);\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 afterFooter() {\n // Get Cartridge Cache\n var cache = dw.system.CacheMgr.getCache('DevToolsCache');\n\n // Write log types to their own cache key ( 128KB max per key )\n cache.put('debug', Debugger.debug);\n cache.put('error', Debugger.error);\n cache.put('fatal', Debugger.fatal);\n cache.put('info', Debugger.info);\n cache.put('log', Debugger.log);\n cache.put('warn', Debugger.warn);\n\n // Render Remote Include to Prevent ISML Bug\n var velocity = require('dw/template/Velocity');\n velocity.render('$velocity.remoteInclude(\\'DevTools-AfterFooter\\')', {\n velocity: velocity\n });\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n\t\t function update(line, text, spans) {\n\t\t updateLine(line, text, spans, estimateHeight);\n\t\t signalLater(line, \"change\", line, change);\n\t\t }\n\t\t function linesFor(start, end) {\n\t\t var result = [];\n\t\t for (var i = start; i < end; ++i)\n\t\t { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n\t\t return result\n\t\t }\n\n\t\t var from = change.from, to = change.to, text = change.text;\n\t\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t\t // Adjust the line structure\n\t\t if (change.full) {\n\t\t doc.insert(0, linesFor(0, text.length));\n\t\t doc.remove(text.length, doc.size - text.length);\n\t\t } else if (isWholeLineUpdate(doc, change)) {\n\t\t // This is a whole-line replace. Treated specially to make\n\t\t // sure line objects move the way they are supposed to.\n\t\t var added = linesFor(0, text.length - 1);\n\t\t update(lastLine, lastLine.text, lastSpans);\n\t\t if (nlines) { doc.remove(from.line, nlines); }\n\t\t if (added.length) { doc.insert(from.line, added); }\n\t\t } else if (firstLine == lastLine) {\n\t\t if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t\t } else {\n\t\t var added$1 = linesFor(1, text.length - 1);\n\t\t added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t doc.insert(from.line + 1, added$1);\n\t\t }\n\t\t } else if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t\t doc.remove(from.line + 1, nlines);\n\t\t } else {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t\t var added$2 = linesFor(1, text.length - 1);\n\t\t if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n\t\t doc.insert(from.line + 1, added$2);\n\t\t }\n\n\t\t signalLater(doc, \"change\", doc, change);\n\t\t }", "function fixFoot() {\n var tfoot = $(settings.table).find(\"tfoot\");\n var tr = tfoot.find(\"tr\");\n var cells = tfoot.find(\"tr > *\");\n\n setBackground(cells);\n cells.css({\n 'position': 'relative'\n });\n }", "function setupFooterAndMapSections(sectionsToUpdate, type) {\n\n for (let i = 0; i < sectionsToUpdate.length; i++) {\n\n // Update Footer and Map (if update was successful)\n switch (sectionsToUpdate[i]) {\n\n case 'countryPOI':\n footer.addFooterSection(type, 'countryPOI');\n mapFunctions.update(`${type}CountryPOI_FG`);\n break;\n case 'localPOI':\n footer.addFooterSection(type, 'localPOI');\n mapFunctions.update(`${type}LocalPOI_FG`);\n break;\n case 'countryWeather':\n footer.addFooterSection(type, 'countryWeather');\n mapFunctions.update(`${type}WeatherFG`);\n break;\n case 'localWeather':\n footer.addFooterSection(type, 'localWeather');\n break;\n case 'covid':\n footer.addFooterSection(type, 'covid');\n mapFunctions.update(`${type}CovidFG`);\n break;\n case 'news':\n footer.addFooterSection(type, 'news');\n break;\n\n }\n\n }\n\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t\t function update(line, text, spans) {\n\t\t updateLine(line, text, spans, estimateHeight);\n\t\t signalLater(line, \"change\", line, change);\n\t\t }\n\t\t function linesFor(start, end) {\n\t\t for (var i = start, result = []; i < end; ++i)\n\t\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t\t return result;\n\t\t }\n\t\t\n\t\t var from = change.from, to = change.to, text = change.text;\n\t\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\t\t\n\t\t // Adjust the line structure\n\t\t if (change.full) {\n\t\t doc.insert(0, linesFor(0, text.length));\n\t\t doc.remove(text.length, doc.size - text.length);\n\t\t } else if (isWholeLineUpdate(doc, change)) {\n\t\t // This is a whole-line replace. Treated specially to make\n\t\t // sure line objects move the way they are supposed to.\n\t\t var added = linesFor(0, text.length - 1);\n\t\t update(lastLine, lastLine.text, lastSpans);\n\t\t if (nlines) doc.remove(from.line, nlines);\n\t\t if (added.length) doc.insert(from.line, added);\n\t\t } else if (firstLine == lastLine) {\n\t\t if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t\t } else {\n\t\t var added = linesFor(1, text.length - 1);\n\t\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t doc.insert(from.line + 1, added);\n\t\t }\n\t\t } else if (text.length == 1) {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t\t doc.remove(from.line + 1, nlines);\n\t\t } else {\n\t\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t\t var added = linesFor(1, text.length - 1);\n\t\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t\t doc.insert(from.line + 1, added);\n\t\t }\n\t\t\n\t\t signalLater(doc, \"change\", doc, change);\n\t\t }", "async reformatComments() {\n if (settings.get('reformatComments')) {\n const pagesToCheckExistence = [];\n $(document.body).addClass('cd-reformattedComments');\n this.items.forEach((comment) => {\n pagesToCheckExistence.push(...comment.replaceSignatureWithHeader());\n comment.addMenu();\n });\n\n // Check existence of user and user talk pages and apply respective changes to elements.\n const pageNamesToLinks = {};\n pagesToCheckExistence.forEach((page) => {\n const pageName = page.pageName;\n if (!pageNamesToLinks[pageName]) {\n pageNamesToLinks[pageName] = [];\n }\n pageNamesToLinks[pageName].push(page.link);\n });\n const pageNames = Object.keys(pageNamesToLinks);\n const pagesExistence = await getPagesExistence(pageNames);\n Object.keys(pagesExistence).forEach((name) => {\n pageNamesToLinks[name].forEach((link) => {\n link.title = pagesExistence[name].normalized;\n if (!pagesExistence[name].exists) {\n link.classList.add('new');\n link.href = mw.util.getUrl(name, {\n action: 'edit',\n redlink: 1,\n });\n }\n });\n });\n }\n }", "function addFooter(report) {\r\n report.getFooter().addClass(\"footer\");\r\n var versionLine = report.getFooter().addText(\"Banana Accounting 8\" + \" - \", \"description\");\r\n report.getFooter().addText(\"Pagina \", \"description\");\r\n report.getFooter().addFieldPageNr();\r\n}", "function updateDecorations(editor) {\n // if there is a new editor (aka new tab), then update activeEditor\n if (editor) { activeEditor = editor }\n // if somehow there is no active editor, then just return\n if (!activeEditor) { return }\n \n // if this called by onDidChangeTextDocument(), \n // then the text string will only be the text that changed\n // (it wont be the text of the entire file)\n const document = activeEditor.document\n const text = document.getText()\n const newLines = []\n \n // if disabled, update the page to show nothing (otherwise the old line endings will stick around)\n if (isDisabled) {\n activeEditor.setDecorations(mainDecoration, newLines)\n // if enabled then continue to render everything\n } else {\n // loop through every line ending match\n while (match = endOfLinePattern.exec(text)) {\n // find which ending this particular match is\n switch (match[0]) {\n case '\\n' : theRenderOption = renderNewline; break\n case '\\r\\n': theRenderOption = renderCrlf ; break\n case '\\r' : theRenderOption = renderReturn ; break\n default : theRenderOption = renderBlank ; break\n }\n let startingPosition = document.positionAt(match.index)\n let lineDecoration = {\n // just use startPos twice since we dont want to decorate any existing text\n range: new vscode.Range(startingPosition, startingPosition),\n renderOptions: theRenderOption\n }\n newLines.push(lineDecoration)\n }\n if (activeEditor.setDecorations) {\n activeEditor.setDecorations(mainDecoration, newLines)\n }\n }\n}", "function updateDecorations(editor) {\n // if there is a new editor (aka new tab), then update activeEditor\n if (editor) { activeEditor = editor }\n // if somehow there is no active editor, then just return\n if (!activeEditor) { return }\n \n // if this called by onDidChangeTextDocument(), \n // then the text string will only be the text that changed\n // (it wont be the text of the entire file)\n const document = activeEditor.document\n const text = document.getText()\n const newLines = []\n \n // if disabled, update the page to show nothing (otherwise the old line endings will stick around)\n if (isDisabled) {\n activeEditor.setDecorations(mainDecoration, newLines)\n // if enabled then continue to render everything\n } else {\n // loop through every line ending match\n while (match = endOfLinePattern.exec(text)) {\n // find which ending this particular match is\n switch (match[0]) {\n case '\\n' : theRenderOption = renderNewline; break\n case '\\r\\n': theRenderOption = renderCrlf ; break\n case '\\r' : theRenderOption = renderReturn ; break\n default : theRenderOption = renderBlank ; break\n }\n let startingPosition = document.positionAt(match.index)\n let lineDecoration = {\n // just use startPos twice since we dont want to decorate any existing text\n range: new vscode.Range(startingPosition, startingPosition),\n renderOptions: theRenderOption\n }\n newLines.push(lineDecoration)\n }\n if (activeEditor.setDecorations) {\n activeEditor.setDecorations(mainDecoration, newLines)\n }\n }\n}", "function setupEditContent() {\n var $wp = $('.write-pages li'); // the list of book pages\n // make sure the index is in bound wrapping at the ends\n if (editIndex < 0) {\n editIndex = $wp.length - 1;\n } else if (editIndex >= $wp.length) {\n editIndex = 0;\n }\n var $page = $($wp.get(editIndex)); // the current page\n var $img = $page.find('img');\n var caption = $page.find('p.thr-caption').html() || '';\n var view = {\n image: {\n url: $img.attr('src'),\n width: $img.attr('data-width'),\n height: $img.attr('data-height')\n },\n caption: caption ? caption : $('.wlClickToEdit').html()\n };\n templates.setImageSizes(view.image); // size the image\n var $content = $(templates.render('bookPage', view)); // render like any book page\n $content.filter('a.thr-home-icon,a.thr-settings-icon').hide(); // remove some unneeded links\n $editDialog.empty().append($('.wEditHelp').html()).append($content); // update dialog body\n var $deleteIcon = $('<img class=\"deleteIcon\" src=\"/theme/images/delete.png\" />');\n $deleteIcon.attr('title', $('.wDeleteThisPage').html());\n $editDialog.append($deleteIcon);\n var $copyIcon = $('<img class=\"copyIcon\" src=\"/theme/images/copy.png\" />');\n $copyIcon.attr('title', $('.wCopyThisPage').html());\n $editDialog.append($copyIcon);\n $editDialog.dialog('option', 'title', ''); // clear the title\n $editDialog.find('p.thr-caption').toggleClass('text-too-long',\n caption.length >= maxCaptionLength);\n }", "addFootnote(footnoteCollectionPath) {\n const editorSession = this.getEditorSession();\n editorSession.transaction(tx => {\n const node = documentHelpers.createNodeFromJson(tx, Footnote.getTemplate());\n documentHelpers.append(tx, footnoteCollectionPath, node.id);\n const p = tx.get(node.content[0]);\n tx.setSelection({\n type: 'property',\n path: p.getPath(),\n startOffset: 0,\n surfaceId: this._getSurfaceId(node, 'content'),\n containerPath: [node.id, 'content'],\n });\n });\n }", "function addFooter() {\r\n const contentsSrc = 'MasterPage/footer_contents.txt';\r\n if (document.getElementById) {\r\n let footer = document.getElementById('footer');\r\n if (footer) {\r\n let pathPrefix = relativePath();\r\n let footerContents = readContents(pathPrefix + contentsSrc);\r\n if (footerContents) { \r\n placeInOuterHtml(footer, footerContents);\r\n }\r\n }\r\n } \r\n}", "function addNotesToPage() {\n // for each data_point in this team's notes_data\n for (let data_point_index in notes_data[selected_team]) {\n // data_point is new notes to add\n let data_point = notes_data[selected_team][data_point_index];\n // adds a new line\n $(\"#notes-\" + selected_team + \"-\" + data_point[1]).prepend('<h4>Stand app:</h4>').append(\"<br><hr><h4>Notes app:</h4>\" + data_point[0]);\n }\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}", "function addFooter(banDoc, report) {\r\n\treport.getFooter().addClass(\"footer\");\r\n\treport.getFooter().addText(\"[Banana Accounting, v. \" + banDoc.info(\"Base\", \"ProgramVersion\") + \", \" + scriptVersion + \"] - Page \", \"footer\");\r\n\treport.getFooter().addFieldPageNr();\r\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight)\n signalLater(line, \"change\", line, change)\n }\n function linesFor(start, end) {\n var result = []\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)) }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length))\n doc.remove(text.length, doc.size - text.length)\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1)\n update(lastLine, lastLine.text, lastSpans)\n if (nlines) { doc.remove(from.line, nlines) }\n if (added.length) { doc.insert(from.line, added) }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)\n } else {\n var added$1 = linesFor(1, text.length - 1)\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n doc.insert(from.line + 1, added$1)\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))\n doc.remove(from.line + 1, nlines)\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)\n var added$2 = linesFor(1, text.length - 1)\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }\n doc.insert(from.line + 1, added$2)\n }\n\n signalLater(doc, \"change\", doc, change)\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight)\n signalLater(line, \"change\", line, change)\n }\n function linesFor(start, end) {\n var result = []\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)) }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length))\n doc.remove(text.length, doc.size - text.length)\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1)\n update(lastLine, lastLine.text, lastSpans)\n if (nlines) { doc.remove(from.line, nlines) }\n if (added.length) { doc.insert(from.line, added) }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)\n } else {\n var added$1 = linesFor(1, text.length - 1)\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n doc.insert(from.line + 1, added$1)\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))\n doc.remove(from.line + 1, nlines)\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)\n var added$2 = linesFor(1, text.length - 1)\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }\n doc.insert(from.line + 1, added$2)\n }\n\n signalLater(doc, \"change\", doc, change)\n}", "extractDocumentHistory() {\n let document_entry = this.extractDocumentEntry();\n let ptr = document_entry.pointer;\n if (ptr === -1) {\n throw Error(\"Could not locate document entry\");\n }\n let xref = {\n id: -1,\n pointer: ptr,\n generation: 0,\n free: false,\n update: true\n };\n this.extractCrossReferenceTables(document_entry, xref);\n // adapt pointer in case there is junk before the header\n let pdf_header_start = util_1.Util.locateSequence(util_1.Util.VERSION, this.data, 0);\n if (pdf_header_start !== 0 && pdf_header_start !== -1) {\n for (let updateSection of this.updates) {\n for (let ref of updateSection.refs) {\n ref.pointer += pdf_header_start;\n }\n }\n }\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateFootnoteReferenceLinks() {\r\n\tGWLog(\"updateFootnoteReferenceLinks\");\r\n\r\n\tfor (var i = 0; i < GW.sidenotes.footnoteRefs.length; i++) {\r\n\t\tlet fnref = GW.sidenotes.footnoteRefs[i];\r\n\t\tif (GW.sidenotes.mediaQueries.viewportWidthBreakpoint.matches == false) {\r\n\t\t\tfnref.href = \"#sn\" + (i + 1);\r\n\t\t} else {\r\n\t\t\tfnref.href = \"#fn\" + (i + 1);\r\n\t\t}\r\n\t}\r\n}", "_refreshFooter() {\n const that = this;\n\n if ((that.viewSections.indexOf('footer') < 0 || that.$.footer.offsetHeight === 0)) {\n return;\n }\n\n function preFormatDateOutput() {\n if (that.selectedDates.length === 0) {\n return '';\n }\n\n if (that.selectedDates.length === 1) {\n return that.selectedDates[0].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' });\n }\n else {\n let sortedDates = that.selectedDates.slice(0).sort((a, b) => a.getTime() - b.getTime());\n\n return sortedDates[0].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' }) + ' - ' +\n sortedDates[sortedDates.length - 1].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' });\n }\n }\n\n if (that.footerTemplate) {\n if (typeof that.footerTemplate === 'function') {\n return;\n }\n\n let layoutTemplate = that._layoutTemplates.filter(template => template.selector === that.$.footer)[0],\n clone = document.importNode(layoutTemplate.template.content, true);\n\n if (layoutTemplate.bindings.length > 0) {\n let bindingHolderElement = clone.childNodes[layoutTemplate.bindings[0].childNodeIndex];\n\n layoutTemplate.selector.childNodes[layoutTemplate.bindings[0].childNodeIndex].innerHTML =\n bindingHolderElement.innerHTML.replace(layoutTemplate.bindings[0].bindingString, preFormatDateOutput());\n }\n\n return;\n }\n\n that.$.selectedDatesRange.innerHTML = preFormatDateOutput();\n }", "function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\r\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\r\n function update(line, text, spans) {\r\n updateLine(line, text, spans, estimateHeight$$1);\r\n signalLater(line, \"change\", line, change);\r\n }\r\n function linesFor(start, end) {\r\n var result = [];\r\n for (var i = start; i < end; ++i)\r\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\r\n return result\r\n }\r\n\r\n var from = change.from, to = change.to, text = change.text;\r\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\r\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\r\n\r\n // Adjust the line structure\r\n if (change.full) {\r\n doc.insert(0, linesFor(0, text.length));\r\n doc.remove(text.length, doc.size - text.length);\r\n } else if (isWholeLineUpdate(doc, change)) {\r\n // This is a whole-line replace. Treated specially to make\r\n // sure line objects move the way they are supposed to.\r\n var added = linesFor(0, text.length - 1);\r\n update(lastLine, lastLine.text, lastSpans);\r\n if (nlines) { doc.remove(from.line, nlines); }\r\n if (added.length) { doc.insert(from.line, added); }\r\n } else if (firstLine == lastLine) {\r\n if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\r\n } else {\r\n var added$1 = linesFor(1, text.length - 1);\r\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n doc.insert(from.line + 1, added$1);\r\n }\r\n } else if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\r\n doc.remove(from.line + 1, nlines);\r\n } else {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\r\n var added$2 = linesFor(1, text.length - 1);\r\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\r\n doc.insert(from.line + 1, added$2);\r\n }\r\n\r\n signalLater(doc, \"change\", doc, change);\r\n}", "function printFooter()\r\n{\r\n\ttry\r\n\t{\r\n\r\n\t\tpdfxml += '</body></pdf>';\r\n\t}\r\n\tcatch(e)\r\n\t{\r\n\t\terrorHandler('printFooter', e);\r\n\t}\r\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\t\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\t\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\t\n\t signalLater(doc, \"change\", doc, change);\n\t }", "async function writeAllChanges() {\n while (delFiles.length > 0) {\n await forceDelete(archive, delFiles.pop())\n }\n\n while (newFiles.length > 0) {\n let nf = newFiles.pop()\n await addWrite(archive, nf.path, nf.data)\n }\n\n let doc = u(document.documentElement).clone()\n let newTitle = doc.find('.tape-title').text()\n let info = await archive.getInfo()\n if (info.title !== newTitle) {\n doc.find('title').text(newTitle + ' on Duxtape')\n archive.configure({title: newTitle})\n }\n\n doc.find('.editor').remove()\n doc.find('.editing').removeClass('editing').\n each((node, i) => node.removeAttribute('contenteditable'))\n await forceWrite(archive, '/index.html', doc.html())\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n for (var i = 0, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n for (var added = [], i = 1; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n for (var i = 1, added = []; i < text.length - 1; ++i)\n added.push(new Line(text[i], spansFor(i), estimateHeight));\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }", "function onChange (chg) {\n prepend('articles', h('article', [\n h('header', [\n h('h4', [chg.doc.title])\n ]),\n h('div', [chg.doc.body]),\n h('hr')\n ]))\n}", "function updateDoc(doc, change, markedSpans, estimateHeight) {\r\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\r\n function update(line, text, spans) {\r\n updateLine(line, text, spans, estimateHeight);\r\n signalLater(line, \"change\", line, change);\r\n }\r\n\r\n var from = change.from, to = change.to, text = change.text;\r\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\r\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\r\n\r\n // Adjust the line structure\r\n if (isWholeLineUpdate(doc, change)) {\r\n // This is a whole-line replace. Treated specially to make\r\n // sure line objects move the way they are supposed to.\r\n for (var i = 0, added = []; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n update(lastLine, lastLine.text, lastSpans);\r\n if (nlines) doc.remove(from.line, nlines);\r\n if (added.length) doc.insert(from.line, added);\r\n } else if (firstLine == lastLine) {\r\n if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\r\n } else {\r\n for (var added = [], i = 1; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n doc.insert(from.line + 1, added);\r\n }\r\n } else if (text.length == 1) {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\r\n doc.remove(from.line + 1, nlines);\r\n } else {\r\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\r\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\r\n for (var i = 1, added = []; i < text.length - 1; ++i)\r\n added.push(new Line(text[i], spansFor(i), estimateHeight));\r\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\r\n doc.insert(from.line + 1, added);\r\n }\r\n\r\n signalLater(doc, \"change\", doc, change);\r\n }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\n\t signalLater(doc, \"change\", doc, change);\n\t }", "function updateDoc(doc, change, markedSpans, estimateHeight) {\n\t function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n\t function update(line, text, spans) {\n\t updateLine(line, text, spans, estimateHeight);\n\t signalLater(line, \"change\", line, change);\n\t }\n\t function linesFor(start, end) {\n\t for (var i = start, result = []; i < end; ++i)\n\t result.push(new Line(text[i], spansFor(i), estimateHeight));\n\t return result;\n\t }\n\n\t var from = change.from, to = change.to, text = change.text;\n\t var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n\t var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n\t // Adjust the line structure\n\t if (change.full) {\n\t doc.insert(0, linesFor(0, text.length));\n\t doc.remove(text.length, doc.size - text.length);\n\t } else if (isWholeLineUpdate(doc, change)) {\n\t // This is a whole-line replace. Treated specially to make\n\t // sure line objects move the way they are supposed to.\n\t var added = linesFor(0, text.length - 1);\n\t update(lastLine, lastLine.text, lastSpans);\n\t if (nlines) doc.remove(from.line, nlines);\n\t if (added.length) doc.insert(from.line, added);\n\t } else if (firstLine == lastLine) {\n\t if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n\t } else {\n\t var added = linesFor(1, text.length - 1);\n\t added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t doc.insert(from.line + 1, added);\n\t }\n\t } else if (text.length == 1) {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n\t doc.remove(from.line + 1, nlines);\n\t } else {\n\t update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n\t update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n\t var added = linesFor(1, text.length - 1);\n\t if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n\t doc.insert(from.line + 1, added);\n\t }\n\n\t signalLater(doc, \"change\", doc, change);\n\t }", "function addFooterTooltips(nFoot)\n\t{\n\t\tvar qTipOptions = MutationViewsUtil.defaultTableTooltipOpts();\n\n\t\tvar qTipOptionsFooter = {};\n\t\tjQuery.extend(true, qTipOptionsFooter, qTipOptions);\n\t\tqTipOptionsFooter.position = {my:'top center', at:'bottom center', viewport: $(window)};\n\n\t\tcbio.util.addTargetedQTip($(nFoot).find(\"th\"), qTipOptionsFooter);\n\t}", "function write_footnote_text($footnote_nodes, $write_context) {\n \n // for _each_ footnote in $write_node\n $footnote_nodes.each(function() {\n var footnote_text_selector = '#footnote_text_' + $(this).text();\n var already_written = ($sandbox.find(footnote_text_selector).length > 0);\n \n // sanity check\n if (!already_written) {\n // prepare footnote_text with default CSS attributes\n var $write_footnote = $footnote_texts.filter(footnote_text_selector).css({\n left: $current_column.css('left'),\n 'z-index': FOOTNOTE_DEFAULT_Z_INDEX\n });\n\n // if there were already footnotes in this column, shift them up accordingly\n $sandbox.find(HZ_FOOTNOTE_TEXT).each(function() {\n if ($(this).css('left') == $write_footnote.css('left')) {\n $(this).css({\n bottom: parseInt($(this).css('bottom')) + FOOTNOTE_TEXT_OUTER_HEIGHT,\n 'z-index': parseInt($(this).css('z-index')) - 1\n });\n }\n });\n\n // write out footnote_text\n $write_footnote.appendTo($sandbox);\n\n // subtract footnote height from column max_height\n $current_column.attr('hz_max_height', $current_column.attr('hz_max_height') - FOOTNOTE_TEXT_OUTER_HEIGHT);\n }\n });\n }", "function changeFooterText(){\n\n }", "function theMain(){\n var allTheP = document.getElementsByTagName(\"p\"); //Handle list za svaki <p>\n var allTheLi = document.getElementsByTagName(\"li\");\n var howMuchP = allTheP.length;\n var howMuchLi = allTheLi.length;\n console.log(\"howMuchP: \" + howMuchP);\n var paragraph = new String(\"\"); //Promenjiva za drzanje <p>\n\n for(aplpha=0; aplpha<howMuchP; aplpha++){ //Prolazak kroz sve <p>\n paragraph = allTheP[aplpha].innerHTML; //Citanje sledeceg <p>\n paragraph = replacement(paragraph); //Funkcija koja svakom <p> nadogradjuje kriticnu rec sa linkom i *\n allTheP[aplpha].innerHTML = paragraph; //Updatovanje <p>\n }\n\n for(aplpha=0; aplpha<howMuchLi; aplpha++){ //Prolazak kroz sve <p>\n paragraph = allTheLi[aplpha].innerHTML; //Citanje sledeceg <p>\n paragraph = replacement(paragraph); //Funkcija koja svakom <p> nadogradjuje kriticnu rec sa linkom i *\n allTheLi[aplpha].innerHTML = paragraph; //Updatovanje <p>\n }\n\n var footnotes = document.getElementById(\"footnotes\"); //Ako vec ima div\n if(footnotes == null){// Ako je prvo pokretanje skripte\n var elementi = document.getElementsByTagName(\"body\"); // Dobija niz elemenata tipa body\n elementi[0].insertAdjacentHTML('beforeend', '<div id=\"footnotes\"></div><!--Icon made by Freepik from www.flaticon.com-->'); // Prvi i jednini body\n footnotes = document.getElementById(\"footnotes\"); //Napisati posle svih ostalih elemenata\n }\n footnotes.innerHTML = notes + \"<a id='toTop' href='#content'>Back to top</a>\";\n}", "function iterateMain(intr_customer) {\n backupDocument.main.doc.push(intr_customer.doc);\n }", "function checkPages(doc) {\n var pageHeight = doc.internal.pageSize.height;\n // Before adding new content\n if (y >= pageHeight) {\n doc.text(60, 800, \"Page:\" + pages);\n doc.addPage();\n pages++;\n y = 0; // Restart height position\n }\n return doc;\n }", "function _generateFooterReport() {\n\t\n\n\tthis.htmlFile.writeln( \"</body>\");\n\tthis.htmlFile.writeln( \"</html>\");\n}", "function leftEditSectionLinks () {\n $('#bodyContent').find('span.editsection').each(function () {\n $(this).appendTo($(this).parent());\n });\n\n mw.util.addCSS('#bodyContent span.editsection { float: none; line-height: 1em; }');\n}", "function update(){\n //remove what's there\n Object.keys(itemEls).forEach(function(uuid){\n itemEls[uuid].forEach(function(node){\n if(node.parentNode) node.parentNode.removeChild(node);\n });\n });\n //add in the new order\n list.forEach(function(item){\n itemEls[item.id].forEach(function(node){\n openMarker.parentNode.insertBefore(node, closeMarker);\n });\n })\n }", "function onToggleFooterSection() {\n setAttributes(toggleSection(attributes, 'foot'));\n }", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "function updateDoc(cm, from, to, newText, selUpdate, origin) {\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans &&\n removeReadOnlyRanges(cm.view.doc, from, to);\n if (split) {\n for (var i = split.length - 1; i >= 1; --i)\n updateDocInner(cm, split[i].from, split[i].to, [\"\"], origin);\n if (split.length)\n return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);\n } else {\n return updateDocInner(cm, from, to, newText, selUpdate, origin);\n }\n }", "function updateBodyFields(newnumberbodies, oldnumberbodies){\n\tvar diff = newnumberbodies - oldnumberbodies;\n\tif (diff > 0) {\n\t\twhile (diff-- > 0) {\n\t\t\tbodies.push( new Body(bodies.length+1) );\n\t\t}\t\n\t} else {\n\t\twhile (diff++ < 0) {\n\t\t\tbodies.pop().destroy();\n\t\t}\n\t}\n}", "function inner_after_save()\n\t{\n\t\tthat.processCodeInScripts();\n\t\tthat.editor.focus();\n\t\tthat.showInFooter(\"saved\");\n\t\tLiteGUI.trigger( that, \"stored\" );\n\t}", "function updatePage() {\n \tcountLinks();\n \tgetDropDowns();\n \tquery();\n }", "install() {\n let el = document.getElementsByTagName(\"footer\")\n if (el) { // there should only be one footer...\n let message = this.message\n el[0].innerHTML = `\n <div class=\"footer_copyright\">&copy; 2015—-${ moment().year() } <a href=\"http://www.oscars-sa.eu/\" title=\"Oscars s.a.\" alt=\"Oscars s.a.\">Oscars s.a.</a></div>\n <div class=\"footer_message\">${ message }</div>\n <div class=\"footer_byline\">designed by <a href=\"https://github.com/devleaks\" title=\"Devleaks' github\" alt=\"Devleaks' github\">devleaks</a></div>\n `\n }\n this.listen(this.update.bind(this))\n }", "function addFooter(report) {\n\tvar date = new Date();\n\tvar d = Banana.Converter.toLocaleDateFormat(date);\n\treport.getFooter().addClass(\"footer\");\n\tvar versionLine = report.getFooter().addText(d + \" - Trial balance - Page \", \"description\");\n\treport.getFooter().addFieldPageNr();\n}", "createFooter(footer) {\n footer.appendChild(footerTemplate.content);\n }", "addHeaderFooter(hf, hfType, id) {\n let hfColl = new Dictionary();\n this.headersFooters.add(hfType, hfColl);\n this.headersFooters.get(hfType).add(id, hf);\n }", "function globalUpdate() {\n document.querySelectorAll(\".note\").forEach((e) => e.remove()); //cleares window\n moveSelected(false);\n\n allNotes.forEach((element) => {\n if (element.titleOfNoteBook == openNotebook && element.delete != true) {\n main.prepend(element.noteElement);\n }\n });\n}", "write() {\n let pageWiseSorted = this.sortPageWise(this.annotations);\n let ptr = this.data.length;\n let new_data = [];\n // Fix case that there is no linebreak after the end of the file\n if (this.data[ptr - 1] === 70) { // 70 = 'F' (from [%%EO]F\n new_data.push(Writer.CR);\n new_data.push(Writer.LF);\n ptr += 2;\n }\n for (let key in pageWiseSorted) {\n let pageAnnots = pageWiseSorted[key];\n // write the array referencing to annotations of a certain page\n // it also removes references of annotations that must be deleted\n let annot_array = this.writeAnnotArray(pageAnnots, this.toDelete);\n this.xrefs.push({\n id: annot_array.ptr.obj,\n pointer: ptr,\n generation: annot_array.ptr.generation,\n free: false,\n update: true\n });\n new_data = new_data.concat(annot_array.data);\n ptr += annot_array.data.length;\n // add adapted page object if it exists -- In the case the page had no annotation yet there exists\n // no such array referring to its annotations. A pointer to such an array must be added to the\n // page object. If this was done the `pageData` paramater is set and contains the adapted page object\n if (annot_array.pageData.length > 0) {\n this.xrefs.push({\n id: annot_array.pageReference.obj,\n pointer: ptr,\n generation: annot_array.pageReference.generation,\n free: false,\n update: true\n });\n new_data = new_data.concat(annot_array.pageData);\n ptr += annot_array.pageData.length;\n }\n // writes the actual annotation object\n for (let annot of pageAnnots) {\n let annot_obj = this.writeAnnotationObject(annot);\n this.xrefs.push({\n id: annot_obj.ptr.obj,\n pointer: ptr,\n generation: annot_obj.ptr.generation,\n free: false,\n update: true\n });\n new_data = new_data.concat(annot_obj.data);\n ptr += annot_obj.data.length;\n }\n }\n // take all annotations that are not deleted yet\n let _toDelete = this.toDelete.filter((t) => !t.is_deleted);\n let pageWiseSortedToDelete = this.sortPageWise(_toDelete);\n // adapt the remaining annotation reference tables\n for (let key in pageWiseSortedToDelete) {\n let del_data = this.updatePageAnnotationReferenceArray(pageWiseSortedToDelete[key]);\n this.xrefs.push({\n id: del_data.ptr.obj,\n pointer: ptr,\n generation: del_data.ptr.generation,\n free: false,\n update: true\n });\n new_data = new_data.concat(del_data.data);\n ptr += del_data.data.length;\n }\n // at this point all references to annotation objects in pages should be removed and we can free\n // the annotation object ids\n for (let toDel of this.toDelete) {\n if (!toDel.object_id)\n continue;\n this.xrefs.push({\n id: toDel.object_id.obj,\n pointer: -1,\n generation: toDel.object_id.generation + 1,\n free: true,\n update: false\n });\n }\n let crtable = this.writeCrossSiteReferenceTable();\n new_data = new_data.concat(crtable);\n let trailer = this.writeTrailer(ptr);\n new_data = new_data.concat(trailer);\n let new_data_array = new Uint8Array(new_data);\n let ret_array = new Uint8Array(this.data.length + new_data_array.length);\n ret_array.set(this.data);\n ret_array.set(new_data, this.data.length);\n return ret_array;\n }", "beforeApplyUpdate() {\n const diffFragmentQueue = RB.PageManager.getPage().diffFragmentQueue;\n const diffCommentsData = this.model.get('diffCommentsData');\n\n for (let i = 0; i < diffCommentsData.length; i++) {\n diffFragmentQueue.saveFragment(diffCommentsData[i][0]);\n }\n }", "function renumberPages(document){\n var pageStart = 1;\n for(var p=0;p < document.sections.length;p++){\n document.sections[p].continueNumbering = false;\n document.sections[p].pageNumberStart = pageStart;\n pageStart = pageStart + destination_doc.sections[p].length;\n }\n}", "function addLinks() {\n\t\tsetLoggedUserName();\n\n\t\tif(loggedUserName == null) return;\n\n\t\t// Search for the div element in which tag are listed\n\t\tvar rightDiv = \n\t\t\t\tgetElementByClass(getElementsByName(document,'div'),'right list');\n\t\t\n\t\t// For each tag item in the div add the edit link and delete link\n\t\tvar itemBundles = getElementByClass(getElementsByName(rightDiv,'ul'),'bundles');\n\t\tvar bundleFold = getElementByClass(getElementsByName(itemBundles,'li'),'bundle fold');\n\t\tvar itemsGroupUL= getElementsByName(bundleFold,'ul')[0];\n\t\tvar itemsGroup = getElementsByName(itemsGroupUL,'li');\n\t\t\n\t\tfor(var index=0; index < itemsGroup.length; ++index) {\n\t\t\tvar item = itemsGroup[index];\n\t\t\tvar itemAnchor = getElementsByName(item,'a')[0];\n\t\t\tvar editLinkElem = createRenameLinkElement(item);\n\t\t\tvar delLinkElem = createDeleteLinkElement(item);\n\t\t\tif(editLinkElem != null) item.insertBefore(editLinkElem,itemAnchor);\n\t\t\tif(delLinkElem != null) item.insertBefore(delLinkElem,itemAnchor);\t\t\t\n\t\t}\n\t}", "function update() {\n $spans.each(updateSpan);\n}", "function update() {\n $spans.each(updateSpan);\n}" ]
[ "0.61070263", "0.5891777", "0.57783645", "0.55601573", "0.5443705", "0.54333746", "0.5428693", "0.5251889", "0.5247858", "0.5243702", "0.51936513", "0.5155064", "0.51381797", "0.5113296", "0.51047283", "0.50937366", "0.50905514", "0.5075639", "0.5064649", "0.5064649", "0.50430954", "0.5040342", "0.5037533", "0.50325567", "0.5020745", "0.5020745", "0.5020745", "0.5020745", "0.5020745", "0.5020745", "0.5020745", "0.5020745", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.5015507", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.50127405", "0.5010612", "0.5008609", "0.5008609", "0.5001479", "0.50012237", "0.50012237", "0.50012237", "0.50012237", "0.49957684", "0.49909043", "0.4983645", "0.49644244", "0.49486247", "0.493712", "0.49193072", "0.49193072", "0.49193072", "0.49155593", "0.49062508", "0.4895239", "0.4895239", "0.48866916", "0.48680717", "0.48526788", "0.48451173", "0.48447883", "0.4839393", "0.48218024", "0.48062056", "0.48010954", "0.4796583", "0.47913617", "0.47913617", "0.47913617", "0.4785068", "0.47847226", "0.4777572", "0.47714576", "0.47684422", "0.47535482", "0.47467518", "0.4733926", "0.47280967", "0.47254315", "0.4724703", "0.4707917", "0.47044152", "0.47044152" ]
0.72144055
0
format: NQXX XXXX XXXX ...
function getNimDepositLink(address) { const safeUrl = NIMIQ_NETWORK === 'main' ? 'https://safe.nimiq.com/' : 'https://safe.nimiq-testnet.com/'; return `${safeUrl}#_request/${address.replace(/ /g, '-')}_`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "asString_n(n) {\nreturn RQ.qStr(this.xyzw, n);\n}", "static qStr(qv, n) {\nvar t, w, x, y, z;\n//----\n[x, y, z, w] = (function() {\nvar j, len, results;\nresults = [];\nfor (j = 0, len = qv.length; j < len; j++) {\nt = qv[j];\nresults.push(this.fStr(t, n));\n}\nreturn results;\n}).call(this);\nreturn `<${x} ${y} ${z}; ${w}>`;\n}", "function createQmarks(num) {\n var arr = [];\n for (var i = 0; i < num; i++) {\n arr.push(\"?\");\n }\n return arr.toString();\n }", "function DQNumberId(n) {\n\t// convert to string\n\tn = \"\" + n;\n\n\t// replace non-word characters with _\n\tn = n.replace(/\\W/g, \"_\");\n\t\n\t// PW: was starting with a word char, but turns out that's not necessary and\n\t// is problematic for backwards-compatibility\n\t// n = \"dq_\" + n;\n\t\n\treturn n;\n}", "function qn(a,b,c,d){wc.call(this);rn();sn();this.Gp={h:gm,gM:mn};this.dd=null!=a?a:qn.States.Mj;this.NJ=b;this.cC=d;this.Ur=Xg(d);this.Wg=this.Wg?this.Wg:[];a=\"/\"!==c[0]?\"/\"+c:c;-1===this.Wg.indexOf(this.Ur+a)&&this.Wg.push(-1===a.indexOf(this.Ur)?this.Ur+a:a);1==this.Wg.length&&(this.Ud=new Vg(this.Wg[0]))}", "function qd_number_format(b,c,d,e){b=(b+\"\").replace(/[^0-9+\\-Ee.]/g,\"\");b=isFinite(+b)?+b:0;c=isFinite(+c)?Math.abs(c):0;e=\"undefined\"===typeof e?\",\":e;d=\"undefined\"===typeof d?\".\":d;var a=\"\",a=function(a,b){var c=Math.pow(10,b);return\"\"+(Math.round(a*c)/c).toFixed(b)},a=(c?a(b,c):\"\"+Math.round(b)).split(\".\");3<a[0].length&&(a[0]=a[0].replace(/\\B(?=(?:\\d{3})+(?!\\d))/g,e));(a[1]||\"\").length<c&&(a[1]=a[1]||\"\",a[1]+=Array(c-a[1].length+1).join(\"0\"));return a.join(d)}", "function qd_number_format(b,c,d,e){b=(b+\"\").replace(/[^0-9+\\-Ee.]/g,\"\");b=isFinite(+b)?+b:0;c=isFinite(+c)?Math.abs(c):0;e=\"undefined\"===typeof e?\",\":e;d=\"undefined\"===typeof d?\".\":d;var a=\"\",a=function(a,b){var c=Math.pow(10,b);return\"\"+(Math.round(a*c)/c).toFixed(b)},a=(c?a(b,c):\"\"+Math.round(b)).split(\".\");3<a[0].length&&(a[0]=a[0].replace(/\\B(?=(?:\\d{3})+(?!\\d))/g,e));(a[1]||\"\").length<c&&(a[1]=a[1]||\"\",a[1]+=Array(c-a[1].length+1).join(\"0\"));return a.join(d)}", "function qd_number_format(b,c,d,e){b=(b+\"\").replace(/[^0-9+\\-Ee.]/g,\"\");b=isFinite(+b)?+b:0;c=isFinite(+c)?Math.abs(c):0;e=\"undefined\"===typeof e?\",\":e;d=\"undefined\"===typeof d?\".\":d;var a=\"\",a=function(a,b){var c=Math.pow(10,b);return\"\"+(Math.round(a*c)/c).toFixed(b)},a=(c?a(b,c):\"\"+Math.round(b)).split(\".\");3<a[0].length&&(a[0]=a[0].replace(/\\B(?=(?:\\d{3})+(?!\\d))/g,e));(a[1]||\"\").length<c&&(a[1]=a[1]||\"\",a[1]+=Array(c-a[1].length+1).join(\"0\"));return a.join(d)}", "function qMarks(num) {\n\t var s = '(';\n\t while (num--) {\n\t s += '?';\n\t if (num) {\n\t s += ',';\n\t }\n\t }\n\t return s + ')';\n\t}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function qMarks(num) {\n var s = '(';\n while (num--) {\n s += '?';\n if (num) {\n s += ',';\n }\n }\n return s + ')';\n}", "function toQYY(num){\n\t var q_names = [\"Q1\", \"Q1\", \"Q1\", \"Q2\", \"Q2\", \"Q2\", \"Q3\", \"Q3\", \"Q3\", \"Q4\", \"Q4\", \"Q4\"];\n\t \n\t\tvar date = new Date(num);\n\t return (q_names[date.getMonth()]+ \"'\" + date.getFullYear().toString().substring(2));\n\t}", "function dnsQname(msg) {\n var i = 12;\n var qname = '';\n while (msg[i] !== '\\x00') {\n qname += msg[i];\n i++;\n }\n return qname + '\\x00';\n}", "function nFormatter(num) {\n if (num >= 1e51) {\n return (num / 1e51).toFixed(2).replace(/\\.0$/, '') + 'SD';\n } \n if (num >= 1e48) {\n return (num / 1e48).toFixed(2).replace(/\\.0$/, '') + 'Q3';\n } \n if (num >= 1e45) {\n return (num / 1e45).toFixed(2).replace(/\\.0$/, '') + 'Q2';\n } \n if (num >= 1e42) {\n return (num / 1e42).toFixed(2).replace(/\\.0$/, '') + 'T';\n } \n if (num >= 1e39) {\n return (num / 1e39).toFixed(2).replace(/\\.0$/, '') + 'D';\n } \n if (num >= 1e36) {\n return (num / 1e36).toFixed(2).replace(/\\.0$/, '') + 'u';\n } \n if (num >= 1e33) {\n return (num / 1e33).toFixed(2).replace(/\\.0$/, '') + 'd';\n } \n if (num >= 1e30) {\n return (num / 1e30).toFixed(2).replace(/\\.0$/, '') + 'n';\n } \n if (num >= 1e27) {\n return (num / 1e27).toFixed(2).replace(/\\.0$/, '') + 'o';\n } \n if (num >= 1e24) {\n return (num / 1e24).toFixed(2).replace(/\\.0$/, '') + 'S';\n } \n if (num >= 1e21) {\n return (num / 1e21).toFixed(2).replace(/\\.0$/, '') + 's';\n } \n if (num >= 1e18) {\n return (num / 1e18).toFixed(2).replace(/\\.0$/, '') + 'Q';\n } \n if (num >= 1e15) {\n return (num / 1e15).toFixed(2).replace(/\\.0$/, '') + 'q';\n } \n if (num >= 1e12) {\n return (num / 1e12).toFixed(2).replace(/\\.0$/, '') + 't';\n } \n if (num >= 1e9) {\n return (num / 1e9).toFixed(2).replace(/\\.0$/, '') + 'b';\n }\n if (num >= 1e6) {\n return (num / 1e6).toFixed(2).replace(/\\.0$/, '') + 'm';\n }\n if (num >= 1e3) {\n return (num / 1e3).toFixed(2).replace(/\\.0$/, '') + 'k';\n }\n\n return num;\n}", "function fmtIso(str, n, d) {\n const [min,max] = [Math.min(0, n, d), Math.max(n, d)];\n let items = [];\n for (let i = min; i <= max; i++) {\n if (i == 0) { items.push(\"1\") }\n else if (i == n) { items.push(\"?\"); }\n else if (i == d) { items.push(str); }\n else { items.push(\"-\"); }\n }\n return items.join(\" : \");\n}", "function formatResult(n, columns) {\n const result = [];\n for (let i = 0; i < n; i++) {\n const arr = Array(n).fill('-');\n arr[columns[i]] = 'q';\n result.push(arr.join(''));\n }\n return result;\n}", "function printQMarks (num) {\n var arr = [];\n for (var i = 0; i < num; i++) {\n arr.push(\"?\");\n }\n return arr.toString();\n}", "writeQLocator(numBytes) {\n this.writeUB4(40); // QLocator length\n this.writeUInt8(40); // repeated length\n this.writeUInt16BE(38); // internal length\n this.writeUInt16BE(constants.TNS_LOB_QLOCATOR_VERSION);\n this.writeUInt8(constants.TNS_LOB_LOC_FLAGS_VALUE_BASED |\n constants.TNS_LOB_LOC_FLAGS_BLOB | constants.TNS_LOB_LOC_FLAGS_ABSTRACT);\n this.writeUInt8(constants.TNS_LOB_LOC_FLAGS_INIT);\n this.writeUInt16BE(0); // additional flags\n this.writeUInt16BE(1); // byt1\n this.writeUInt64BE(numBytes);\n this.writeUInt16BE(0); // unused\n this.writeUInt16BE(0); // csid\n this.writeUInt16BE(0); // unused\n this.writeUInt64BE(0); // unused\n this.writeUInt64BE(0); // unused\n }", "function getQrCode () {\n\n}", "function CreateDQRecord(c, n) {\n\t// Establish the chapter array if necessary\n\tif (dqs[c] == null) {\n\t\t// PW: this used to be a numeric array, but to accommodate\n\t\t// non-numeric question \"numbers\", I've made it an object (associative array)\n\t\tdqs[c] = new Object();\n\t}\n\n\t// Establish the individual question array if necessary\n\tvar nid;\n\t\n\t// Krugman method; now used by others\n\tnid = DQNumberId(n);\n\tif (dqs[c][nid] == null) {\n\t\tdqs[c][nid] = new Object();\n\t\t// Record the untransformed number\n\t\tdqs[c][nid].n = n;\n\t}\n\n\treturn nid;\n}", "function qn(e){return e.text?R(e.from.line+e.text.length-1,p(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}", "function format(msg) \n{\n if (msg.length == 16) return msg;\n \n if (msg.length > 16) {return (msg.substring(0,16));} // return only the first 16 characters if longer.\n \n if (msg.length < 16) {\n return ((msg + \"000000000000000\").substring(0,16));\n }\n}", "function getQType(q) {\n var type = {};\n if (/:$/.test(q)) {\n type.what = 'N';\n if (/\\[\\]:$/.test(q)) {\n type.what = 'A';\n }\n q = q.replace(/(\\[\\])?:$/, '');\n } else {\n type.what = 'E';\n }\n type.q = q;\n return type;\n }", "function Xi(t, e) {\n // Use two different prefix formats:\n // * firestore / persistenceKey / projectID . databaseID / ...\n // * firestore / persistenceKey / projectID / ...\n // projectIDs are DNS-compatible names and cannot contain dots\n // so there's no danger of collisions.\n var n = t.projectId;\n return t.o || (n += \".\" + t.database), \"firestore/\" + e + \"/\" + n + \"/\"\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */;\n}", "toQV(xyzw) {\nreturn RQ.setQV(xyzw, this.xyzw);\n}", "function toFormattedNF()\n{\n\tvar pos;\n\tvar nNum = this.num; // v1.0.1 - number as a number\n\tvar nStr; // v1.0.1 - number as a string\n\n\t// round decimal places\n\tnNum = this.getRounded(nNum);\n\tnStr = this.preserveZeros(Math.abs(nNum)); // this step makes nNum into a string. v1.0.1 Math.abs\n\n\tif (this.isCommas)\n\t{\n\t\tpos = nStr.indexOf('.');\n\t\tif (pos == -1)\n\t\t{\n\t\t\tpos = nStr.length;\n\t\t}\n\t\twhile (pos > 0)\n\t\t{\n\t\t\tpos -= 3;\n\t\t\tif (pos <= 0) break;\n\t\t\tnStr = nStr.substring(0,pos) + ',' + nStr.substring(pos, nStr.length);\n\t\t}\n\t}\n\t\n\tnStr = (nNum < 0) ? '-' + nStr : nStr; // v1.0.1\n\n\tif (this.isCurrency)\n\t{\n\t\t// add dollar sign in front\n\t\tnStr = this.currencyPrefix + nStr;\n\t}\n\n\treturn (nStr);\n}", "_encodeQuad(_ref) {\n let {\n subject,\n predicate,\n object,\n graph\n } = _ref;\n return `<<${this._encodeSubject(subject)} ${this._encodePredicate(predicate)} ${this._encodeObject(object)}${(0, _N3Util.isDefaultGraph)(graph) ? '' : ` ${this._encodeIriOrBlank(graph)}`}>>`;\n }", "function uuformat(format) { // @param String: formatted string with \"?\" placeholder\r\n // @return String: \"formatted string\"\r\n var i = 0, args = arguments;\r\n\r\n return format.replace(uuformat._PLACEHOLDER, function() {\r\n return args[++i];\r\n });\r\n}", "function findFYQ(date) {\n let year = date.substring(0,4)\n let month = date.substring(5,7)\n let quarter = Math.floor(month / 3) + 1\n return `${year} Q${quarter}`\n }", "function q(t) {\n // Return the input string, with an additional NUL byte appended.\n return t + \"\\0\";\n}", "function xf(format) {\n var args = Array.prototype.slice.call(arguments, 1);\n return format.replace(/\\{(\\d+)\\}/g, function(m, i) {\n return args[i];\n });\n}", "function xf(format) {\n var args = Array.prototype.slice.call(arguments, 1);\n return format.replace(/\\{(\\d+)\\}/g, function(m, i) {\n return args[i];\n });\n}", "function makeOutString() {\n var outString = \"\";\n outString += first_name + \"\\t\"\n + surname + \"\\t\"\n + patient_alert + \"\\t\"\n + education_level + \"\\t\"\n + dob + \"\\t\"\n + q1 + \"\\t\"\n + q2 + \"\\t\"\n + q3 + \"\\t\"\n + q5a + \"\\t\"\n + q5b + \"\\t\"\n + q6.toString() + \"\\t\"\n + q7.toString() + \"\\t\"\n + q8a + \"\\t\"\n + q8b + \"\\t\"\n + q9a + \"\\t\"\n + q9b + \"\\t\"\n + q10a + \"\\t\"\n + q10b + \"\\t\"\n + q11a + \"\\t\"\n + q11b + \"\\t\"\n + q11c + \"\\t\"\n + q11d + \"\\t\"\n + now.getFullYear().toString() + now.getMonth().toString() + now.getDate().toString()\n + \"\\n\";\n \n return outString;\n}", "function Format() {}", "function Format() {}", "asString_n(n) {\nreturn E3Vec.vStr(this.xyz, n);\n}", "function showQr() {\n new QRCode(qr,{\n text: `${name.value.toUpperCase()}\nNUMBER PLATE: ${plate.value.toUpperCase()}\nCHASSIS: ${chassis.value.toUpperCase()}\nhttp://www.npf.gov.ng/tinted/permit/index.index.php?abuja=${id.value}`,\n width: 300,\n height: 300,\n })\n }", "function printNs(n) {\n return +`${n}` + +`${n}${n}` + +`${n}${n}${n}`;\n}", "function reformatSSN (SSN)\r\n{ return (reformat (SSN, \"\", 3, \"-\", 2, \"-\", 4))\r\n}", "function reformatSSN (SSN)\r\n{ return (reformat (SSN, \"\", 3, \"-\", 2, \"-\", 4))\r\n}", "function qd(a,b,c){var d={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return a+\" \"+td(d[c],a)}", "function qd(a,b,c){var d={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return a+\" \"+td(d[c],a)}", "function qd(a,b,c){var d={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return a+\" \"+td(d[c],a)}", "function qd(a,b,c){var d={mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"};return a+\" \"+td(d[c],a)}", "function build_line(name, n1, n2, n3, n4, sepa) {\n\n if (!sepa) sepa = ' ';\n if (n2) n2 = numberWithCommas(n2);\n if (n4) n4 = numberWithCommas(n4);\n\n return pad(sepa.repeat(46), name, false) +\n pad(sepa.repeat(3), n1 || '', true) +\n pad(sepa.repeat(10), n2 || '', true) +\n pad(sepa.repeat(9), n3 || '', true) +\n pad(sepa.repeat(11), n4 || '', true);\n}", "function formatString(format) {\n var ars = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n ars[_i - 1] = arguments[_i];\n }\n var s = format;\n for (var i = 0; i < ars.length; i++) {\n s = s.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\"), ars[i]);\n }\n return s;\n }", "function qv() {}", "function makeAsciiPhred(qualities) {\n if (qualities.length === 0) return '';\n if (_underscore2['default'].every(qualities, function (x) {\n return x == 255;\n })) return '*';\n return qualities.map(function (q) {\n return String.fromCharCode(33 + q);\n }).join('');\n}", "function ReportEmptyQr() {\n\n}", "function ReportEmptyQr() {\n\n}", "function generateQueryANDPartition(str) {\n\treturn str + \" \";\n}", "function formatExpression(timeUnit, field, shortTimeLabels, isUTCScale) {\n if (!timeUnit) {\n return undefined;\n }\n var dateComponents = [];\n var expression = '';\n var hasYear = containsTimeUnit(timeUnit, TimeUnit.YEAR);\n if (containsTimeUnit(timeUnit, TimeUnit.QUARTER)) {\n // special expression for quarter as prefix\n expression = \"'Q' + quarter(\" + field + \")\";\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) {\n // By default use short month name\n dateComponents.push(shortTimeLabels !== false ? '%b' : '%B');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.DAY)) {\n dateComponents.push(shortTimeLabels ? '%a' : '%A');\n }\n else if (containsTimeUnit(timeUnit, TimeUnit.DATE)) {\n dateComponents.push('%d' + (hasYear ? ',' : '')); // add comma if there is year\n }\n if (hasYear) {\n dateComponents.push(shortTimeLabels ? '%y' : '%Y');\n }\n var timeComponents = [];\n if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) {\n timeComponents.push('%H');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) {\n timeComponents.push('%M');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) {\n timeComponents.push('%S');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MILLISECONDS)) {\n timeComponents.push('%L');\n }\n var dateTimeComponents = [];\n if (dateComponents.length > 0) {\n dateTimeComponents.push(dateComponents.join(' '));\n }\n if (timeComponents.length > 0) {\n dateTimeComponents.push(timeComponents.join(':'));\n }\n if (dateTimeComponents.length > 0) {\n if (expression) {\n // Add space between quarter and main time format\n expression += \" + ' ' + \";\n }\n if (isUTCScale) {\n expression += \"utcFormat(\" + field + \", '\" + dateTimeComponents.join(' ') + \"')\";\n }\n else {\n expression += \"timeFormat(\" + field + \", '\" + dateTimeComponents.join(' ') + \"')\";\n }\n }\n // If expression is still an empty string, return undefined instead.\n return expression || undefined;\n}", "function index_string(index, elem) {\n\tvar str = \"\";\n\tif (index < 9) {\n\t\tstr = '[0' + (index+1) + ']' + elem.nickname;\n\t} else {\n\t\tstr = '[' + (index+1) + ']' + elem.nickname;\n\t}\n\treturn str;\n}", "format (formatString = '%s%y%j%p%n') {\n let str = formatString\n\n str = str.replace(/%s/g, this.sign)\n str = str.replace(/%c/g, this.currency)\n str = str.replace(/%y/g, this.symbol)\n\n str = str.replace(/%\\+/g, this.signIfPositive)\n str = str.replace(/%-/g, this.signIfNegative)\n\n str = str.replace(/%r/g, this.raw)\n str = str.replace(/%a/g, this.amount)\n\n str = str.replace(/%j/g, this.major)\n str = str.replace(/%n/g, this.minor)\n str = str.replace(/%p/g, this.separator)\n\n return str\n }", "asString4() {\nreturn this.asString_n(4);\n}", "asString4() {\nreturn this.asString_n(4);\n}", "function calculateQ(input) {\n console.log(QUtil)\n if (input.mode == 'float') {\n let floatValue = parseFloat(input.input)\n if (floatValue==NaN)\n throw new Error(`invalid number: ${input.input}`)\n return QUtil.fromFloat(floatValue, input.fractBits, input.wholeBits)\n }\n else if (input.mode == 'hex') {\n if (input.input.length < 1)\n throw new Error(`no input`)\n return QUtil.fromHexString(input.input, input.fractBits, input.wholeBits)\n }\n }", "function obsQP() {\n return opts.strict ? null : wrap('obs-qp', and(\n literal('\\\\'),\n or(literal('\\0'), obsNoWsCtl, lf, cr)\n )());\n }", "function obsQP() {\n return opts.strict ? null : wrap('obs-qp', and(\n literal('\\\\'),\n or(literal('\\0'), obsNoWsCtl, lf, cr)\n )());\n }", "function obsQP() {\n return opts.strict ? null : wrap('obs-qp', and(\n literal('\\\\'),\n or(literal('\\0'), obsNoWsCtl, lf, cr)\n )());\n }", "function obsQP() {\n return opts.strict ? null : wrap('obs-qp', and(\n literal('\\\\'),\n or(literal('\\0'), obsNoWsCtl, lf, cr)\n )());\n }", "function createQuest(num) {\n var arr = [];\n \n for (var i = 0; i < num; i++) {\n arr.push(\"?\");\n }\n return arr.toString();\n}", "function format(n,i,rm,id){var c0,e,ne,len,str;if(rm==null)rm=ROUNDING_MODE;else intCheck(rm,0,8);if(!n.c)return n.toString();c0=n.c[0];ne=n.e;if(i==null){str=coeffToString(n.c);str=id==1||id==2&&(ne<=TO_EXP_NEG||ne>=TO_EXP_POS)?toExponential(str,ne):toFixedPoint(str,ne,\"0\")}else{n=round(new BigNumber(n),i,rm);// n.e may have changed if the value was rounded up.\ne=n.e;str=coeffToString(n.c);len=str.length;// toPrecision returns exponential notation if the number of significant digits\n// specified is less than the number of digits necessary to represent the integer\n// part of the value in fixed-point notation.\n// Exponential notation.\nif(id==1||id==2&&(i<=e||e<=TO_EXP_NEG)){// Append zeros?\nfor(;len<i;str+=\"0\",len++){;}str=toExponential(str,e);// Fixed-point notation.\n}else{i-=ne;str=toFixedPoint(str,e,\"0\");// Append zeros?\nif(e+1>len){if(--i>0)for(str+=\".\";i--;str+=\"0\"){;}}else{i+=e-len;if(i>0){if(e+1==len)str+=\".\";for(;i--;str+=\"0\"){;}}}}}return n.s<0&&c0?\"-\"+str:str}// Handle BigNumber.max and BigNumber.min.", "_makeText(amtstr) {\nvar NX, nmstr, pad;\n//--------\nnmstr = FourCC.fourCCString(this.fourCCName);\nNX = 4 - nmstr.length;\npad = 0 < NX ? \" \".slice(0, NX) : \"\";\nreturn `${nmstr}${pad} ${this.amtstr}`;\n}", "function Zn() {\n return arguments[t[15]].split(n[19]).reverse().join(t[13]);\n }", "function formatNumber(n,d) {\n let x=(''+n).length;\n const p=Math.pow;\n d=p(10,d);\n x-=x%3;\n return Math.round(n*d/p(10,x))/d+\" kMGTPE\"[x/3];\n }", "printQuestionMarks(numberOfValues){\n const questionMarks = [];\n\n for (var i = 0; i < numberOfValues; i++) {\n questionMarks.push(\"?\");\n }\n\n return questionMarks.join(', ');\n }", "function questionsToSQL(num) {\n let arr = [];\n for (let i = 0; i < num; i++) {\n arr.push(\"?\");\n }\n return arr.toString();\n}", "function createQuestionSummary(question)\n {\n if (question.length > 40)\n {\n // truncate the question and add \"...\" to the end.\n question = question.substring(0,40) + \" ...\";\n }\n \n return question;\n }", "function ______TEXT_QUERIES______() {}", "function dpFormat(format){\r\n \treturn format.replace(/[HhMmYySsD]/g, 'd');\r\n }", "function displayQ(queue){\n return util.inspect(queue, {depth:null});\n}", "function formatString(x) {\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }", "function getQueryHeaderText(qID) {\n var headerText = \"Selected questions:\";\n for (var i=0; i<qID.length; i++) {\n headerText += (\" \"+qID[i]);\n if (i != qID.length - 1) headerText += \",\";\n }\n return headerText;\n }", "serialNumber() {\n return `${this.getSNString()}${(this.increament++).toString().padStart(this.padCount, '0')}`;\n }", "function RecordDQAnswer(c, n, answer) {\n\tvar nid = CreateDQRecord(c, n);\t// n may be transformed to deal with non-word chars\n\tdqs[c][nid].answer = answer;\n\treturn nid;\n}", "function _parseNQuads(input) {\n // define partial regexes\n var iri = '(?:<([^:]+:[^>]*)>)';\n var bnode = '(_:(?:[A-Za-z0-9]+))';\n var plain = '\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';\n var datatype = '(?:\\\\^\\\\^' + iri + ')';\n var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';\n var literal = '(?:' + plain + '(?:' + datatype + '|' + language + ')?)';\n var ws = '[ \\\\t]+';\n var wso = '[ \\\\t]*';\n var eoln = /(?:\\r\\n)|(?:\\n)|(?:\\r)/g;\n var empty = new RegExp('^' + wso + '$');\n\n // define quad part regexes\n var subject = '(?:' + iri + '|' + bnode + ')' + ws;\n var property = iri + ws;\n var object = '(?:' + iri + '|' + bnode + '|' + literal + ')' + wso;\n var graphName = '(?:\\\\.|(?:(?:' + iri + '|' + bnode + ')' + wso + '\\\\.))';\n\n // full quad regex\n var quad = new RegExp(\n '^' + wso + subject + property + object + graphName + wso + '$');\n\n // build RDF dataset\n var dataset = {};\n\n // split N-Quad input into lines\n var lines = input.split(eoln);\n var lineNumber = 0;\n for(var li = 0; li < lines.length; ++li) {\n var line = lines[li];\n lineNumber++;\n\n // skip empty lines\n if(empty.test(line)) {\n continue;\n }\n\n // parse quad\n var match = line.match(quad);\n if(match === null) {\n throw new JsonLdError(\n 'Error while parsing N-Quads; invalid quad.',\n 'jsonld.ParseError', {line: lineNumber});\n }\n\n // create RDF triple\n var triple = {};\n\n // get subject\n if(!_isUndefined(match[1])) {\n triple.subject = {type: 'IRI', value: match[1]};\n } else {\n triple.subject = {type: 'blank node', value: match[2]};\n }\n\n // get predicate\n triple.predicate = {type: 'IRI', value: match[3]};\n\n // get object\n if(!_isUndefined(match[4])) {\n triple.object = {type: 'IRI', value: match[4]};\n } else if(!_isUndefined(match[5])) {\n triple.object = {type: 'blank node', value: match[5]};\n } else {\n triple.object = {type: 'literal'};\n if(!_isUndefined(match[7])) {\n triple.object.datatype = match[7];\n } else if(!_isUndefined(match[8])) {\n triple.object.datatype = RDF_LANGSTRING;\n triple.object.language = match[8];\n } else {\n triple.object.datatype = XSD_STRING;\n }\n var unescaped = match[6]\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\\\\\/g, '\\\\');\n triple.object.value = unescaped;\n }\n\n // get graph name ('@default' is used for the default graph)\n var name = '@default';\n if(!_isUndefined(match[9])) {\n name = match[9];\n } else if(!_isUndefined(match[10])) {\n name = match[10];\n }\n\n // initialize graph in dataset\n if(!(name in dataset)) {\n dataset[name] = [triple];\n } else {\n // add triple if unique to its graph\n var unique = true;\n var triples = dataset[name];\n for(var ti = 0; unique && ti < triples.length; ++ti) {\n if(_compareRDFTriples(triples[ti], triple)) {\n unique = false;\n }\n }\n if(unique) {\n triples.push(triple);\n }\n }\n }\n\n return dataset;\n}", "function _parseNQuads(input) {\n // define partial regexes\n var iri = '(?:<([^:]+:[^>]*)>)';\n var bnode = '(_:(?:[A-Za-z0-9]+))';\n var plain = '\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';\n var datatype = '(?:\\\\^\\\\^' + iri + ')';\n var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';\n var literal = '(?:' + plain + '(?:' + datatype + '|' + language + ')?)';\n var ws = '[ \\\\t]+';\n var wso = '[ \\\\t]*';\n var eoln = /(?:\\r\\n)|(?:\\n)|(?:\\r)/g;\n var empty = new RegExp('^' + wso + '$');\n\n // define quad part regexes\n var subject = '(?:' + iri + '|' + bnode + ')' + ws;\n var property = iri + ws;\n var object = '(?:' + iri + '|' + bnode + '|' + literal + ')' + wso;\n var graphName = '(?:\\\\.|(?:(?:' + iri + '|' + bnode + ')' + wso + '\\\\.))';\n\n // full quad regex\n var quad = new RegExp(\n '^' + wso + subject + property + object + graphName + wso + '$');\n\n // build RDF dataset\n var dataset = {};\n\n // split N-Quad input into lines\n var lines = input.split(eoln);\n var lineNumber = 0;\n for(var li = 0; li < lines.length; ++li) {\n var line = lines[li];\n lineNumber++;\n\n // skip empty lines\n if(empty.test(line)) {\n continue;\n }\n\n // parse quad\n var match = line.match(quad);\n if(match === null) {\n throw new JsonLdError(\n 'Error while parsing N-Quads; invalid quad.',\n 'jsonld.ParseError', {line: lineNumber});\n }\n\n // create RDF triple\n var triple = {};\n\n // get subject\n if(!_isUndefined(match[1])) {\n triple.subject = {type: 'IRI', value: match[1]};\n } else {\n triple.subject = {type: 'blank node', value: match[2]};\n }\n\n // get predicate\n triple.predicate = {type: 'IRI', value: match[3]};\n\n // get object\n if(!_isUndefined(match[4])) {\n triple.object = {type: 'IRI', value: match[4]};\n } else if(!_isUndefined(match[5])) {\n triple.object = {type: 'blank node', value: match[5]};\n } else {\n triple.object = {type: 'literal'};\n if(!_isUndefined(match[7])) {\n triple.object.datatype = match[7];\n } else if(!_isUndefined(match[8])) {\n triple.object.datatype = RDF_LANGSTRING;\n triple.object.language = match[8];\n } else {\n triple.object.datatype = XSD_STRING;\n }\n var unescaped = match[6]\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\\\\\/g, '\\\\');\n triple.object.value = unescaped;\n }\n\n // get graph name ('@default' is used for the default graph)\n var name = '@default';\n if(!_isUndefined(match[9])) {\n name = match[9];\n } else if(!_isUndefined(match[10])) {\n name = match[10];\n }\n\n // initialize graph in dataset\n if(!(name in dataset)) {\n dataset[name] = [triple];\n } else {\n // add triple if unique to its graph\n var unique = true;\n var triples = dataset[name];\n for(var ti = 0; unique && ti < triples.length; ++ti) {\n if(_compareRDFTriples(triples[ti], triple)) {\n unique = false;\n }\n }\n if(unique) {\n triples.push(triple);\n }\n }\n }\n\n return dataset;\n}", "function make_biquad_q(q_db) {\n if (!browser_biquad_filter_uses_audio_cookbook_formula)\n return q_db;\n\n var q_lin = dBToLinear(q_db);\n var q_new = 1 / Math.sqrt((4 - Math.sqrt(16 - 16 / (q_lin * q_lin))) / 2);\n q_new = linearToDb(q_new);\n return q_new;\n}", "function _parseNQuads(input) {\n // define partial regexes\n var iri = '(?:<([^:]+:[^>]*)>)';\n var bnode = '(_:(?:[A-Za-z0-9]+))';\n var plain = '\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';\n var datatype = '(?:\\\\^\\\\^' + iri + ')';\n var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';\n var literal = '(?:' + plain + '(?:' + datatype + '|' + language + ')?)';\n var comment = '(?:#.*)?';\n var ws = '[ \\\\t]+';\n var wso = '[ \\\\t]*';\n var eoln = /(?:\\r\\n)|(?:\\n)|(?:\\r)/g;\n var empty = new RegExp('^' + wso + comment + '$');\n\n // define quad part regexes\n var subject = '(?:' + iri + '|' + bnode + ')' + ws;\n var property = iri + ws;\n var object = '(?:' + iri + '|' + bnode + '|' + literal + ')' + wso;\n var graphName = '(?:\\\\.|(?:(?:' + iri + '|' + bnode + ')' + wso + '\\\\.))';\n\n // full quad regex\n var quad = new RegExp(\n '^' + wso + subject + property + object + graphName + wso + comment + '$');\n\n // build RDF dataset\n var dataset = {};\n\n // split N-Quad input into lines\n var lines = input.split(eoln);\n var lineNumber = 0;\n for(var li = 0; li < lines.length; ++li) {\n var line = lines[li];\n lineNumber++;\n\n // skip empty lines\n if(empty.test(line)) {\n continue;\n }\n\n // parse quad\n var match = line.match(quad);\n if(match === null) {\n throw new JsonLdError(\n 'Error while parsing N-Quads; invalid quad.',\n 'jsonld.ParseError', {line: lineNumber});\n }\n\n // create RDF triple\n var triple = {};\n\n // get subject\n if(!_isUndefined(match[1])) {\n triple.subject = {type: 'IRI', value: match[1]};\n } else {\n triple.subject = {type: 'blank node', value: match[2]};\n }\n\n // get predicate\n triple.predicate = {type: 'IRI', value: match[3]};\n\n // get object\n if(!_isUndefined(match[4])) {\n triple.object = {type: 'IRI', value: match[4]};\n } else if(!_isUndefined(match[5])) {\n triple.object = {type: 'blank node', value: match[5]};\n } else {\n triple.object = {type: 'literal'};\n if(!_isUndefined(match[7])) {\n triple.object.datatype = match[7];\n } else if(!_isUndefined(match[8])) {\n triple.object.datatype = RDF_LANGSTRING;\n triple.object.language = match[8];\n } else {\n triple.object.datatype = XSD_STRING;\n }\n var unescaped = match[6]\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\\\\\/g, '\\\\');\n triple.object.value = unescaped;\n }\n\n // get graph name ('@default' is used for the default graph)\n var name = '@default';\n if(!_isUndefined(match[9])) {\n name = match[9];\n } else if(!_isUndefined(match[10])) {\n name = match[10];\n }\n\n // initialize graph in dataset\n if(!(name in dataset)) {\n dataset[name] = [triple];\n } else {\n // add triple if unique to its graph\n var unique = true;\n var triples = dataset[name];\n for(var ti = 0; unique && ti < triples.length; ++ti) {\n if(_compareRDFTriples(triples[ti], triple)) {\n unique = false;\n }\n }\n if(unique) {\n triples.push(triple);\n }\n }\n }\n\n return dataset;\n}", "function _parseNQuads(input) {\n // define partial regexes\n var iri = '(?:<([^:]+:[^>]*)>)';\n var bnode = '(_:(?:[A-Za-z0-9]+))';\n var plain = '\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';\n var datatype = '(?:\\\\^\\\\^' + iri + ')';\n var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';\n var literal = '(?:' + plain + '(?:' + datatype + '|' + language + ')?)';\n var comment = '(?:#.*)?';\n var ws = '[ \\\\t]+';\n var wso = '[ \\\\t]*';\n var eoln = /(?:\\r\\n)|(?:\\n)|(?:\\r)/g;\n var empty = new RegExp('^' + wso + comment + '$');\n\n // define quad part regexes\n var subject = '(?:' + iri + '|' + bnode + ')' + ws;\n var property = iri + ws;\n var object = '(?:' + iri + '|' + bnode + '|' + literal + ')' + wso;\n var graphName = '(?:\\\\.|(?:(?:' + iri + '|' + bnode + ')' + wso + '\\\\.))';\n\n // full quad regex\n var quad = new RegExp(\n '^' + wso + subject + property + object + graphName + wso + comment + '$');\n\n // build RDF dataset\n var dataset = {};\n\n // split N-Quad input into lines\n var lines = input.split(eoln);\n var lineNumber = 0;\n for(var li = 0; li < lines.length; ++li) {\n var line = lines[li];\n lineNumber++;\n\n // skip empty lines\n if(empty.test(line)) {\n continue;\n }\n\n // parse quad\n var match = line.match(quad);\n if(match === null) {\n throw new JsonLdError(\n 'Error while parsing N-Quads; invalid quad.',\n 'jsonld.ParseError', {line: lineNumber});\n }\n\n // create RDF triple\n var triple = {};\n\n // get subject\n if(!_isUndefined(match[1])) {\n triple.subject = {type: 'IRI', value: match[1]};\n } else {\n triple.subject = {type: 'blank node', value: match[2]};\n }\n\n // get predicate\n triple.predicate = {type: 'IRI', value: match[3]};\n\n // get object\n if(!_isUndefined(match[4])) {\n triple.object = {type: 'IRI', value: match[4]};\n } else if(!_isUndefined(match[5])) {\n triple.object = {type: 'blank node', value: match[5]};\n } else {\n triple.object = {type: 'literal'};\n if(!_isUndefined(match[7])) {\n triple.object.datatype = match[7];\n } else if(!_isUndefined(match[8])) {\n triple.object.datatype = RDF_LANGSTRING;\n triple.object.language = match[8];\n } else {\n triple.object.datatype = XSD_STRING;\n }\n var unescaped = match[6]\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\\\\\/g, '\\\\');\n triple.object.value = unescaped;\n }\n\n // get graph name ('@default' is used for the default graph)\n var name = '@default';\n if(!_isUndefined(match[9])) {\n name = match[9];\n } else if(!_isUndefined(match[10])) {\n name = match[10];\n }\n\n // initialize graph in dataset\n if(!(name in dataset)) {\n dataset[name] = [triple];\n } else {\n // add triple if unique to its graph\n var unique = true;\n var triples = dataset[name];\n for(var ti = 0; unique && ti < triples.length; ++ti) {\n if(_compareRDFTriples(triples[ti], triple)) {\n unique = false;\n }\n }\n if(unique) {\n triples.push(triple);\n }\n }\n }\n\n return dataset;\n}", "function _parseNQuads(input) {\n // define partial regexes\n var iri = '(?:<([^:]+:[^>]*)>)';\n var bnode = '(_:(?:[A-Za-z0-9]+))';\n var plain = '\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\"';\n var datatype = '(?:\\\\^\\\\^' + iri + ')';\n var language = '(?:@([a-z]+(?:-[a-z0-9]+)*))';\n var literal = '(?:' + plain + '(?:' + datatype + '|' + language + ')?)';\n var comment = '(?:#.*)?';\n var ws = '[ \\\\t]+';\n var wso = '[ \\\\t]*';\n var eoln = /(?:\\r\\n)|(?:\\n)|(?:\\r)/g;\n var empty = new RegExp('^' + wso + comment + '$');\n\n // define quad part regexes\n var subject = '(?:' + iri + '|' + bnode + ')' + ws;\n var property = iri + ws;\n var object = '(?:' + iri + '|' + bnode + '|' + literal + ')' + wso;\n var graphName = '(?:\\\\.|(?:(?:' + iri + '|' + bnode + ')' + wso + '\\\\.))';\n\n // full quad regex\n var quad = new RegExp(\n '^' + wso + subject + property + object + graphName + wso + comment + '$');\n\n // build RDF dataset\n var dataset = {};\n\n // split N-Quad input into lines\n var lines = input.split(eoln);\n var lineNumber = 0;\n for(var li = 0; li < lines.length; ++li) {\n var line = lines[li];\n lineNumber++;\n\n // skip empty lines\n if(empty.test(line)) {\n continue;\n }\n\n // parse quad\n var match = line.match(quad);\n if(match === null) {\n throw new JsonLdError(\n 'Error while parsing N-Quads; invalid quad.',\n 'jsonld.ParseError', {line: lineNumber});\n }\n\n // create RDF triple\n var triple = {};\n\n // get subject\n if(!_isUndefined(match[1])) {\n triple.subject = {type: 'IRI', value: match[1]};\n } else {\n triple.subject = {type: 'blank node', value: match[2]};\n }\n\n // get predicate\n triple.predicate = {type: 'IRI', value: match[3]};\n\n // get object\n if(!_isUndefined(match[4])) {\n triple.object = {type: 'IRI', value: match[4]};\n } else if(!_isUndefined(match[5])) {\n triple.object = {type: 'blank node', value: match[5]};\n } else {\n triple.object = {type: 'literal'};\n if(!_isUndefined(match[7])) {\n triple.object.datatype = match[7];\n } else if(!_isUndefined(match[8])) {\n triple.object.datatype = RDF_LANGSTRING;\n triple.object.language = match[8];\n } else {\n triple.object.datatype = XSD_STRING;\n }\n var unescaped = match[6]\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\\\\\/g, '\\\\');\n triple.object.value = unescaped;\n }\n\n // get graph name ('@default' is used for the default graph)\n var name = '@default';\n if(!_isUndefined(match[9])) {\n name = match[9];\n } else if(!_isUndefined(match[10])) {\n name = match[10];\n }\n\n // initialize graph in dataset\n if(!(name in dataset)) {\n dataset[name] = [triple];\n } else {\n // add triple if unique to its graph\n var unique = true;\n var triples = dataset[name];\n for(var ti = 0; unique && ti < triples.length; ++ti) {\n if(_compareRDFTriples(triples[ti], triple)) {\n unique = false;\n }\n }\n if(unique) {\n triples.push(triple);\n }\n }\n }\n\n return dataset;\n}", "function formatExpression(timeUnit, field, shortTimeLabels, isUTCScale) {\n if (!timeUnit) {\n return undefined;\n }\n var dateComponents = [];\n var expression = '';\n var hasYear = containsTimeUnit(timeUnit, TimeUnit.YEAR);\n if (containsTimeUnit(timeUnit, TimeUnit.QUARTER)) {\n // special expression for quarter as prefix\n expression = \"'Q' + quarter(\" + field + \")\";\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MONTH)) {\n // By default use short month name\n dateComponents.push(shortTimeLabels !== false ? '%b' : '%B');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.DAY)) {\n dateComponents.push(shortTimeLabels ? '%a' : '%A');\n }\n else if (containsTimeUnit(timeUnit, TimeUnit.DATE)) {\n dateComponents.push('%d' + (hasYear ? ',' : '')); // add comma if there is year\n }\n if (hasYear) {\n dateComponents.push(shortTimeLabels ? '%y' : '%Y');\n }\n var timeComponents = [];\n if (containsTimeUnit(timeUnit, TimeUnit.HOURS)) {\n timeComponents.push('%H');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MINUTES)) {\n timeComponents.push('%M');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.SECONDS)) {\n timeComponents.push('%S');\n }\n if (containsTimeUnit(timeUnit, TimeUnit.MILLISECONDS)) {\n timeComponents.push('%L');\n }\n var dateTimeComponents = [];\n if (dateComponents.length > 0) {\n dateTimeComponents.push(dateComponents.join(' '));\n }\n if (timeComponents.length > 0) {\n dateTimeComponents.push(timeComponents.join(':'));\n }\n if (dateTimeComponents.length > 0) {\n if (expression) {\n // Add space between quarter and main time format\n expression += \" + ' ' + \";\n }\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n if (isUTCScale) {\n expression += \"utcFormat(\" + field + \", '\" + dateTimeComponents.join(' ') + \"')\";\n }\n else {\n expression += \"timeFormat(\" + field + \", '\" + dateTimeComponents.join(' ') + \"')\";\n }\n }\n // If expression is still an empty string, return undefined instead.\n return expression || undefined;\n }", "quadToString(subject, predicate, object, graph) {\n return `${this._encodeSubject(subject)} ${this._encodeIriOrBlank(predicate)} ${this._encodeObject(object)}${graph && graph.value ? ` ${this._encodeIriOrBlank(graph)} .\\n` : ' .\\n'}`;\n }", "function fixQuery(q)\n{\n if (db_connect.substring(0,5) == \"mysql\") {\n q = q.replace(/\\$\\d+/g,\"?\");\n }\n\n return q;\n}", "static vStr(xyz, n) {\nvar t, xs, ys, zs;\n//----\n[xs, ys, zs] = (function() {\nvar i, len1, results;\nresults = [];\nfor (i = 0, len1 = xyz.length; i < len1; i++) {\nt = xyz[i];\nresults.push(this.fStr(t, n));\n}\nreturn results;\n}).call(this);\nreturn `<${xs} ${ys} ${zs}>`;\n}", "function xi(t, e) {\n // Use two different prefix formats:\n // * firestore / persistenceKey / projectID . databaseID / ...\n // * firestore / persistenceKey / projectID / ...\n // projectIDs are DNS-compatible names and cannot contain dots\n // so there's no danger of collisions.\n var n = t.projectId;\n return t.isDefaultDatabase || (n += \".\" + t.database), \"firestore/\" + e + \"/\" + n + \"/\"\n /**\n * @license\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */;\n}", "function get_dec_name()\n{\n\treturn \"NMEA 0183\";\n}", "function ReportInvoiceQrCodeWithAddress() {\n\n}", "function parseQry(qry){\n // encode query for transport to salesforce\n return(qry.replace(/ /g, '+').replace(/=/g,'%3D'));\n}", "function _toNQuads(dataset) {\n var quads = [];\n for(var graphName in dataset) {\n var triples = dataset[graphName];\n for(var ti = 0; ti < triples.length; ++ti) {\n var triple = triples[ti];\n if(graphName === '@default') {\n graphName = null;\n }\n quads.push(_toNQuad(triple, graphName));\n }\n }\n return quads.sort().join('');\n}", "function _toNQuads(dataset) {\n var quads = [];\n for(var graphName in dataset) {\n var triples = dataset[graphName];\n for(var ti = 0; ti < triples.length; ++ti) {\n var triple = triples[ti];\n if(graphName === '@default') {\n graphName = null;\n }\n quads.push(_toNQuad(triple, graphName));\n }\n }\n return quads.sort().join('');\n}", "function _toNQuads(dataset) {\n var quads = [];\n for(var graphName in dataset) {\n var triples = dataset[graphName];\n for(var ti = 0; ti < triples.length; ++ti) {\n var triple = triples[ti];\n if(graphName === '@default') {\n graphName = null;\n }\n quads.push(_toNQuad(triple, graphName));\n }\n }\n return quads.sort().join('');\n}" ]
[ "0.66940546", "0.6036612", "0.5939234", "0.57420963", "0.5603289", "0.5554034", "0.5554034", "0.5554034", "0.55520684", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.55107087", "0.5505026", "0.5501467", "0.54506147", "0.5444044", "0.5421463", "0.53945553", "0.5322854", "0.53104454", "0.5262737", "0.5227952", "0.5125061", "0.5108634", "0.5102163", "0.51020956", "0.5084315", "0.50785726", "0.5077361", "0.50515944", "0.50351685", "0.50321335", "0.50321335", "0.50221574", "0.5005041", "0.5005041", "0.50010324", "0.50004417", "0.49953112", "0.4992112", "0.4992112", "0.49512646", "0.49512646", "0.49512646", "0.49512646", "0.49390817", "0.49233204", "0.49193498", "0.4915273", "0.49119848", "0.49119848", "0.48985142", "0.48934594", "0.48754975", "0.4871536", "0.48695493", "0.48695493", "0.48688573", "0.48655456", "0.48655456", "0.48655456", "0.48655456", "0.48588845", "0.485342", "0.48521996", "0.48497418", "0.48458746", "0.48446184", "0.4837038", "0.48189503", "0.4815688", "0.48117074", "0.48106518", "0.48067382", "0.48017496", "0.479397", "0.4792754", "0.4790129", "0.4790129", "0.47850314", "0.4775346", "0.4775346", "0.4775346", "0.4761892", "0.47590834", "0.47562936", "0.4755256", "0.47532997", "0.4752618", "0.47470614", "0.47419488", "0.4740901", "0.4740901", "0.4740901" ]
0.0
-1
when a message comes into NimiqTipbot inbox it should be handled depending on the topic
async handleInboxMessage(message, $) { const { subject, authorName, body } = message; // console.log('handleInboxMessage', message); const { replyMessage, replySubject, sourceAuthor, sourceAddress, destinationAuthor, destinationAddress, sourceBalance, nimAmount, privateKey } = subject === REDDIT.TOPICS.DEPOSIT ? await this.getReplyMessageForDeposit(authorName, $) : subject === REDDIT.TOPICS.WITHDRAW ? await this.getReplyMessageForWithdraw(authorName, body, $) : subject === REDDIT.TOPICS.BALANCE ? await this.getReplyMessageForBalance(authorName, $) : {}; if (replyMessage && replySubject) { await this.postMessage(authorName, replySubject, replyMessage); } if (subject === REDDIT.TOPICS.WITHDRAW && typeof privateKey !== 'undefined' && typeof destinationAddress !== 'undefined' && typeof nimAmount !== 'undefined') { // log the withdrawal, it will be picked up later by a separate tip polling process console.log(`Recording reddit withdrawal from ${sourceAuthor} for the amount ${nimAmount} to ${destinationAddress}`); await dynamo.putTransaction(message.id, { sourceAuthor, sourceAddress, sourceBalance, destinationAuthor, destinationAddress, privateKey, nimAmount, replyMetadata: { // when the transaction later gets sent, this info is used to send the reply message back to user reddit: { authorName, subject: replySubject } }, heightRecorded: $.getHeight($) }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMessageArrived(message) {\n var msg = message.payloadString;\n var topic = message.destinationName;\n console.log(\"onMessageArrived(\" + topic + \"):\"+msg);\n\n // response according to topic\n var topicHie = topic.split(\"/\");\n var topicType = topicHie[topicHie.length-1];\n if ( topicType == \"newChat\" ) {\n // chat message\n // append message to chat textarea\n if ( $(\"#findFriendsBtn\").hasClass(\"active\")) {\n var chatwith = topicHie[topicHie.length-2];\n // only update chat text area if the current chat user is the sender\n if ( $(\"#chat_\" + chatwith).hasClass(\"double\") ) {\n $('#chatarea').append('<p class=\"mensagem2 toggle\">'+msg+'</p>');\n scrollTextareaToEnd();\n }\n }\n\n $(\"#findFriendsBtn\").addClass('notify');\n } else if ( topicType == \"addItinerary\" ) {\n // new itinerary\n $(\"#myTripsBtn\").addClass('notify');\n } else if ( topicType == \"updateItinerary\" ) {\n // new itinerary feed/comment\n $(\"#myTripsBtn\").addClass('notify');\n } else if ( topicType == \"addFriend\" ) {\n // is added friend\n $(\"#findFriendsBtn\").addClass('notify');\n }\n\n\n }", "function onMessageArrived(message) {\n\n var topic = message.destinationName;\n \n var messageObj = {\n 'topic': message.destinationName,\n 'retained': message.retained,\n 'qos': message.qos,\n 'payload': message.payloadString,\n 'timestamp': moment().format('YYYY-MM-DD, hh:mm:ss')\n };\n \n // check if need to show Notification on UI\n if ($scope.isNotificationEnabled) {\n Notification.info({ title: \"Topic: \" + messageObj.topic + \", Qos: \" + messageObj.qos, message: messageObj.payload });\n }\n \n //**below coding blocks are used to process incomeing MQTT message:\n // this demonstration, there are two types of message need to be taking of:\n // 1.user \"presence\" messages (online/offline/status)\n // 2.user self-owned \"chat\" which submitted by other user\n \n // use regular expression to detect \"presence\" message\n var regex = \"demo/whoisonline/(.+)/presence\";\n var found = topic.match(regex);\n if (found) { // this is \"Presence\" message\n\n var user = found[1]; //get the \"userid\" from regular expression matching \n \n if (user == $scope.mqtt_whoisonline.username) {\n if (!messageObj.payload || messageObj.payload.length === 0) {\n //self offline presence messsage\n //-> should not reach code here, since we are offline\n \n }\n else {\n //update self page user status\n var presence = JSON.parse(messageObj.payload);\n $scope.mqtt_whoisonline.userstatus = presence.status;\n }\n } else {\n if (!messageObj.payload || messageObj.payload.length === 0) {\n //user offline\n var user = found[1];\n delete $scope.mqtt_online_users[user];\n }\n else {\n //user online\n var presence = JSON.parse(messageObj.payload);\n var user = found[1];\n if ($scope.mqtt_online_users[user])\n $scope.mqtt_online_users[user].presence = presence;\n else\n $scope.mqtt_online_users[user] = { presence: presence, lastmsg: null }\n }\n }\n }\n \n // verify if message's topic name is the the as self \"chat\" topic name\n var message_topic = \"demo/whoisonline/\" + $scope.mqtt_whoisonline.username + \"/chat\"; \n if (message_topic == topic) {\n var user_messaging = JSON.parse(messageObj.payload);\n Notification.info({ title: \"Message from :\" + user_messaging.user_from, message: user_messaging.message }); \n $scope.mqtt_online_users[user_messaging.user_from].lastmsg = user_messaging;\n }\n \n //*****verify if message's topic is related to \"unread inbox\" or \"unread notification\" counter\n regex = \"demo/whoisonline/\" + $scope.mqtt_whoisonline.username + \"/(.+)/unread\";\n var unread_found = topic.match(regex);\n if (unread_found) {\n //check what type of unread counter\n var unread_type = unread_found[1];\n\n if (unread_type === \"inbox\") {\n $scope.mqtt_whoisonline.unread_inbox = Number(messageObj.payload);\n if ($scope.mqtt_whoisonline.unread_inbox > 0)\n $('#notifyAudio')[0].play(); //play Notification Sound\n }\n else if (unread_type === \"notification\") {\n $scope.mqtt_whoisonline.unread_notification = Number(messageObj.payload);\n if ($scope.mqtt_whoisonline.unread_notification > 0)\n $('#notifyAudio')[0].play(); //play Notification Sound\n }\n }\n $scope.$apply();\n }", "_onMessage (msg) {\n const { data, from, topicIDs } = msg\n let key\n try {\n key = topicToKey(topicIDs[0])\n } catch (err) {\n log.error(err)\n return\n }\n\n log(`message received for ${key} topic`)\n\n // Stop if the message is from the peer (it already stored it while publishing to pubsub)\n if (from === this._peerId.toB58String()) {\n log(`message discarded as it is from the same peer`)\n return\n }\n\n if (this._handleSubscriptionKeyFn) {\n this._handleSubscriptionKeyFn(key, (err, res) => {\n if (err) {\n log.error('message discarded by the subscriptionKeyFn')\n return\n }\n\n this._storeIfSubscriptionIsBetter(res, data)\n })\n } else {\n this._storeIfSubscriptionIsBetter(key, data)\n }\n }", "function filtraMensaje(topic, message){\n\tvar messagestr = message.toString();\n\tconsole.log(messagestr);\n\tswitch (topic) {\n\t case 'desimat/estado':\n\t manejoTopicoItem1(messagestr, topic);\n\t break;\n\t case 'postplc002':\n\t manejoTopicoItem2(messagestr, topic);\n\t break;\n\t default:\n\t console.log('No hay ningún procesamiento para el tópico %s', topic); \n\t}\n}", "onMessage(event) {\n const message = JSON.parse(event.data);\n const topicId = message[TOPIC_KEY];\n const topicCallback = this.topics[topicId];\n\n if (topicId && topicCallback) {\n topicCallback(message.payload);\n } else if (topicId) {\n // eslint-disable-next-line no-console\n console.error(`Could not find topic ${topicId}. Dropping message.`, event);\n } else {\n // consider this some sort of broadcast from the server\n // eslint-disable-next-line no-console\n console.log('Unknown message from server', message, event);\n }\n }", "function onMessageArrived(message) {\n\t\t \n\t\tvar topic = message.destinationName;\n\t\tvar n = topic.lastIndexOf('/');\n\t\tvar result = topic.substring(n + 1);\n\t\tswitch(result){\n\t\t case \"data\":{\n\t\t\tconsole.log(\"onMessageArrived DATA :\"+message.payloadString);\n\t\t\tvar datamsg = message.payloadString;\n\t\t\tif(temp == '1')\n\t\t\t{\n\t\t\t\twindow.location.href = \"http://localhost/login-system/mqttmsg.php?javasmsg=\"+message.payloadString;\n\t\t\t}\n\t\t\tclient.send(message2);\n\t\t }\n\t\t break;\n\t\t case \"temp\":{\n\t\t\tconsole.log(\"onMessageArrived TEMP :\"+message.payloadString);\n\t\t\ttemp = message.payloadString;\n\t\t }\n\t\t break;\n\t\t default:{\n\t\t\talert(\"wrong topic\");\n\t\t }\n\t\t};\n\t\t \n\t /*console.log(\"onMessageArrived:\"+message.payloadString);\t\t\n\t\tvar datamsg = message.payloadString;\n\t\tif(temp=='1')\n\t\t{\n\t\t\twindow.location.href = \"http://localhost/login-system/mqttmsg.php?javasmsg=\"+message.payloadString;\n\t\t}*/\n\t\t\n\t\t//client.send(message2);\n\t }", "processMqttMessage(topic, message) {\n const path = topic.split('/');\n if (path.pop() === 'cmd') {\n const keyValuePairs = message.split('|') || [''];\n const command = getUltralightCommand(keyValuePairs[0]);\n const deviceId = path.pop();\n const result = keyValuePairs[0] + '| ' + command;\n\n if (!IoTDevices.notFound(deviceId)) {\n IoTDevices.actuateDevice(deviceId, command);\n const topic = '/' + DEVICE_API_KEY + '/' + deviceId + '/cmdexe';\n MQTT_CLIENT.publish(topic, result + OK);\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 }", "function onMessageArrived(message) {\n let receivedMessage = JSON.parse(message.payloadString.toString());\n if(receivedMessage[webPageUrl+'-clientid' ]!=creds.clientID){\n annotateReceivedMessage(receivedMessage); \n }\n $.notify('MQTT: Received:' + message.payloadString, \"info\");\n }", "onMessageArrived(topic,message) {\n\t\tlet that = this;\n\t\tlet parts = topic ? topic.split(\"/\") : [];\n if (topic === \"hermod/default/tts/say\") {\n\t\t\tconsole.log('DUMPME')\n\t\t\tconsole.log(this.eventCallbackFunctions);\n\t\t} \n\t\tlet payload = null\n\t\tif (parts.length > 0 && parts[0] === \"hermod\") {\n // Audio Messages pass through message body direct\n if (parts.length > 3 && (parts[2]===\"speaker\"&& parts[3]===\"play\" )) {\n\t\t\t\tpayload = message;\n\t\t\t\tconsole.log('speaker play')\n } else if (parts.length > 3 && (parts[2]===\"microphone\" && parts[3]===\"audio\")) {\n\t\t\t\tpayload = message;\n\t\t\t} else {\n\t\t\t\t// only log non audio\n\t\t\t\t//console.log(['message '+topic,message.toString()]);\n\t\t\t\ttry {\n payload = JSON.parse(message.toString()); \n } catch (e) {\n\t\t\t\t console.log(['JSON PARSE ERROR',message.toString()]);\n\t\t\t\t payload = {}\n }\n console.log(['message payload '+topic,payload]);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tlet siteId = parts[1];\n\t\t\tlet callbacks = this.subscriptions[topic];\n\t\t\tif (callbacks) {\n\t\t\t\tfor (var subscriptionId in callbacks) {\n\t\t\t\t\tlet value = callbacks[subscriptionId]\n\t\t\t\t\tvalue.callBack.bind(that)(topic,siteId,payload);\n\t\t\t\t\tif (value.oneOff) {\n\t\t\t\t\t\tthis.removeCallbackById(subscriptionId)\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\t\n\t\n }\n }", "processCommand(message, topic) {\n switch (topic.split(\"/\").slice(-2).join(\"/\")) {\n case 'snooze/command':\n this.setSnoozeState(message)\n break;\n case 'snooze_minutes/command':\n this.setSnoozeMinutes(message)\n break; \n case 'volume/command':\n this.setVolumeLevel(message)\n break;\n case 'play_ding_sound/command':\n this.playSound(message, 'ding')\n break;\n case 'play_motion_sound/command':\n this.playSound(message, 'motion')\n break;\n default:\n this.debug(`Received message to unknown command topic: ${componentCommand}`)\n }\n }", "processTopicMessage (topic, message) {\n\t\tconsole.debug('Processing topic ' + topic + ' message', message)\n\n\t\tif (this.topicProcessors[topic]) {\n\t\t\tthis.topicProcessors[topic](message, topic)\n\t\t\treturn\n\t\t}\n\n\t\tconsole.warn('No processor registered for topic ' + topic + ', dropping message')\n\t}", "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 onMessage(message) {\t\n\tvar topic = message.destinationName;\n\n\t// find any matching subscriptions in our map\n\tvar matchingSubs = findMatchingSubs(topic);\n\n\t// did we find any?\n\tif (matchingSubs.length === 0) {\n\t\tconsole.log(\"don't seem to have matching sub...\");\n\t\treturn;\n\t}\t\t\n\n\t// for each matching sub we have, add the message to the\n\t// appropriate text area.\n\tfor (var i=0; i<matchingSubs.length; i++) {\n\t\t// grab the entry from the map\n\t\tvar entry = subscriptions[matchingSubs[i]];\n\t\tvar textArea = entry.text;\n\t\t// grab the current text (i.e all the messages displayed so far)\n\t\tvar current = textArea.value;\t\t\n\n\t\t// if we are already displaying 500 messages, reset...\n\t\tif (entry.msgCount === 500) {\n\t\t\tcurrent = \"\";\n\t\t\tentry.msgCount = 0;\n\t\t}\n\n\t\t// stick the most recent message at the top.\n\t\t// append a newline, so that each message is on\n\t\t// its own line.\n\t\tvar newText = message.payloadString + \"\\n\";\n\t\t// then append the existing messages\n\t\tnewText += current;\n\t\ttextArea.value = newText;\n\t\t// note how many messages we are now displaying\n\t\tentry.msgCount++;\n\t}\t\n}", "SOCKET_ONMESSAGE (state, message) {\n console.log('Message: ', message)\n if (state.activeChannel.chat_id === message.channel.is_private?message.channel.name:message.channel.chat_id) {\n state.messages.results.push(message)\n } else {\n console.log('another one')\n }\n }", "function handleMessage(message)\n{\n var topic = message.topic;\n \n if(topic == window.thTopic.assetAdded || topic == window.thTopic.assetUpdated)\n {\n rcUpdateAssetsSideList();\n rcUpdateAssetsList();\n rcUpdateAssetCommandControl();\n }\n else if (topic == window.thTopic.assetActivationStatusUpdated)\n {\n rcUpdateAssetsList();\n }\n else if(topic == window.thTopic.assetRemoved)\n {\n rcUpdateAssetsSideList();\n rcUpdateAssetsList();\n rcUpdateAssetCommandControl();\n rcUpdateObservations();\n }\n else if(topic == window.thTopic.assetLocationUpdated)\n {\n rcUpdateAssetsLocation();\n }\n else if(topic == window.thTopic.assetTypesUpdated)\n {\n rcUpdateAssetTypes();\n }\n else if(topic == window.thTopic.assetSensorIdsUpdated)\n {\n rcUpdateAssetSensorIds();\n }\n else if(topic == window.thTopic.assetCommandSynced)\n {\n rcUpdateAssetCommandControl();\n }\n else if(topic == window.thTopic.obsStoreUpdated)\n {\n rcUpdateObservations();\n }\n else if(topic == window.thTopic.configModelUpdated || topic == window.thTopic.metaModelUpdated)\n {\n rcUpdateConfigDialog();\n }\n else if (topic == window.thTopic.assetGetCommandResponseReceived)\n {\n rcUpdateGetCommandWithResponse();\n }\n}", "function topicChanged( topic, room, user ) {\n}", "function BOT_expressTopic(tid,possessive) {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tvar c = BOT_get(tid,\"_class\",\"VAL\");\r\n\tif(c == \"user\" && possessive == \"POS\") return(\"yours\");\r\n\telse if(tid == thebottopicid && possessive == \"POS\") return(\"mine\"); \r\n\telse if(tid == thebottopicid) return(\"me\"); \r\n\telse if (c == \"user\") return(\"you\");\r\n\telse return BOT_topicToName(tid);\r\n}", "onMqttMessage(topic, payload) {\r\n const o = JSON.parse(payload.toString());\r\n console.log(`Received message on topic:${topic}`);\r\n // console.log(`Received message on topic:${topic}, payload:`, o);\r\n }", "function mqtt_messsageReceived(topic, message) {\n\n if (topic.toString() == dbTopic.toString()) {\n console.log(\"Message is \" + message + \" and going to store in database!\");\n var msg = message.toString();\n const strarray = msg.split(';');\n var inDate = strarray[0];\n var inStartTime = strarray[1];\n var inStopTime = strarray[2];\n var inMoist = strarray[3];\n console.log(\"StopTime\" + inStopTime.toString());\n insertIrrigationData(inDate, inStartTime, inStopTime, inMoist);\n return;\n }\n\n if (topic.toString() == plantNameTopic.toString()) {\n currentPlant = message.toString();\n irrigationsPath += currentPlant;\n console.log('currentplant:' + currentPlant);\n return;\n }\n\n if (topic.toString() == brokerUrlTopic.toString()) {\n currentBrokerUrl = message.toString();\n irrigationsPath += currentBrokerUrl + \"/irrigations/\";\n console.log('currentbrokerUrl:' + currentBrokerUrl);\n return;\n }\n}", "function onMessageArrived(message) {\n\n if (message.destinationName == temp_topic) {\n\tg_t.refresh(message.payloadString);\n } \n if (message.destinationName == humidity_topic) {\n\tg_h.refresh(message.payloadString);\n } \n\n if (message.destinationName == light_topic) {\n\tif (message.payloadString == \"on\") {\n\t $scope.light = true;\n\t} else {\n\t $scope.light = false;\n\t} \n\tconsole.log(message.payloadString);\n }\n\n $scope.$apply();\n}", "processTopic() {\n let input = this.topic\n resetError(input)\n if (isEmpty(input)) {\n this.valid = false\n } else\n input.success = true\n }", "handlePublishMessage(topic, message) {\n let subscriptions = this.subscription.getSubscriptions(\n (subs) => subs.topic === topic)\n // now let send to all subscribers in the topic with exactly message from publisher\n subscriptions.forEach((subscription) => {\n const clientId = subscription.clientId\n this.send(clientId, {\n action: 'publish',\n payload: {\n topic: topic,\n message: message,\n },\n })\n })\n }", "function receivedMessage(event) {\n if (!event.message.is_echo) {\n var message = event.message;\n var senderId = event.sender.id;\n\n console.log(\"Received message from senderId: \" + senderId);\n console.log(\"Message is: \" + JSON.stringify(message));\n\n // You may get a text or attachment but not both\n if (message.text) {\n var formattedMsg = message.text.toLowerCase().trim();\n\n // If we receive a text message, check to see if it matches any special\n // keywords and send back the corresponding movie detail.\n // Otherwise, search for new movie.\n switch (formattedMsg) {\n case \"hla!\":\n case \"hola!\":\n case \"hi!\":\n case \"hi\":\n case \"hello\":\n case \"hola\":\n sendMessageText(senderId, \"Hola! Gracias por saludarnos\");\n break;\n\n default:\n sendMessageText(senderId, \"Hola! Ahora estamos algo ocupados! Cuéntanos tu duda o consulta. A penas podamos, te responderemos! Que tengas un estupendo día!\");\n }\n } else if (message.attachments) {\n sendMessage(senderId, {text: \"Sorry. No entiendo lo que quieres decir :(\"});\n }\n }\n}", "async function onMessageHandler (target, context, msg, self) {\n // if (stream_id != context.room_id){\n // stream_id = context.room_id\n // }\n if (msg[0] !== '!') { // we are ignoring any attempts to send chatbot commands\n let words = msg.split(' ');\n for (let word of words) {\n if (currsec[word]) {currsec[word]++;}\n else {currsec[word] = 1;}\n }\n }\n} // end onMessageHandler", "function processBOTMsg(msgObj) {\n /*\n msgObj format:{\n type: \"BOT\",\n from: \"\" // email of sender,\n to: \"\", // email of receiver..\n msg: \"\"\n }\n */\n\n addMsgFromUser(msgObj, false, false);\n}", "handleTopic(topic, msg) {\n\t\tthis.logger.debug(\"[\" + this.name + \"] wheel position sensor handleTopic: topic = \" + topic + \", msg = \" + msg)\n\t\tif (topic === this.subTopic) {\n\t\t\tvar wheel_position = parseInt(msg)\n\t\t\tvar valid = true\n\t\t\tif (this.simulator) valid = this.simulator.valid(wheel_position)\n\t\t\tif (isNaN(wheel_position) || !valid || wheel_position > this.max_position || wheel_position < this.min_position) {\n\t\t\t\tthis.logger.error(\"Invalid wheel position received: \" + msg)\n\t\t\t} else {\n\t\t\t\tthis.position = wheel_position\n\t\t\t\tif (this.simulator) this.simulator.value = wheel_position\n\t\t\t\tthis.logger.info(\"Setting wheel position: \" + wheel_position)\n\t\t\t}\n\t\t}\n\t}", "function onMessageArrived(message) {\n console.log(message.destinationName\t+ \" : \"+message.payloadString);\n if(message.destinationName == house.topics.weather){ update_bed_with_msg(\"weather\",JSON.parse(message.payloadString)); }\n else if(message.destinationName == house.topics.heater){ update_bed_with_msg(\"heater\",message.payloadString); }\n else if(message.destinationName == house.topics.heater_status){ update_bed_with_msg(\"status\",message.payloadString); }\n else if(message.destinationName == house.topics.timer){ update_bed_with_msg(\"timer\",message.payloadString); }\n else if(message.destinationName == house.topics.level){ update_bed_with_msg(\"level\",message.payloadString); }\n else if(message.destinationName == house.topics.relay_status){ update_bed_with_msg(\"relay\",message.payloadString); }\n else if(message.destinationName == house.topics.relay_power){ update_bed_with_msg(\"power\",message.payloadString); }\n}", "function onMessageArrived(message) {\n\t\tvar data = JSON.parse(message.payloadString);\n\n\t\tif (data.hasOwnProperty('status')) {\n\t\t\tvar topics = message.destinationName.split('/')[1];\n\n\t\t\t$('.field-username').each(function () {\n\t\t\t\tvar name = $(this).find('a').text();\n\n\t\t\t\tif (name === topics) {\n\t\t\t\t\tif (data['status'] === 'online') {\n\t\t\t\t\t\t$(this).parent().find('.field-is_online > img').attr('src', '/static/admin/img/icon-yes.svg');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$(this).parent().find('.field-is_online > img').attr('src', '/static/admin/img/icon-no.svg');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "function onMessageArrived(message) {\n toastr.info(`Message Arrived: ${message.destinationName}: ${message.payloadString}`)\n\n // setReading = {\n // \"topic_1\": function(msg) { ... },\n // \"topic_2\": function(msg) { ... }\n // }\n\n let topic = message.destinationName\n\n // Sensor Data\n if (setReading[topic] != null) {\n setReading[topic](message.payloadString)\n }\n\n // Online/Offline\n if (setStatus[topic] != null) {\n setStatus[topic](message.payloadString)\n }\n }", "onMessage(message) {\n if ( message.user === this.rtm.activeUserId ) {\n return;\n }\n\n if (message && message.text) {\n if ( -1 !== message.text.indexOf( '<@' + this.rtm.activeUserId + '>' ) ) {\n if ( -1 !== message.text.indexOf( 'rate me' ) ) {\n this.rateUser( message.channel, message.user );\n return;\n }\n\n if ( -1 !== message.text.indexOf( 'reset' ) ) {\n this.ratings.reset();\n this.rtm.sendMessage( 'I have reset all ratings.', message.channel );\n return;\n }\n }\n }\n //this.rtm.sendMessage('Hey there!', message.channel);\n\n // console.log('Received message.');\n // console.log(message);\n }", "function onMessageArrived(message) {\n try{\n let topic = message.destinationName;\n const data = JSON.parse(message.payloadString);\n addData(charts[topic], lists[topic], data.Id, { x: Date.now(), y: data.Value });\n }catch(e){\n // nothing\n }\n console.log(\"onMessageArrived:\"+message.payloadString);\n}", "handleESPINOMessage(message) {\n console.log('Mensaje desde ESPino: ' + message);\n\n if (message === \"MS Detection\" || message === \"PIR Detection\") {\n email.sendMail(message);\n }\n serverClient.publish('web/messages', message);\n serverClient.publish('bot/messages', message);\n }", "function mqtt_messsageReceived(topic, message, packet) {\n\tconsole.log(\"\\n topic: \"+topic);\n\tconsole.log(\"\\n message: \"+message);\n\t\n\t//console.log(\"packet: \"+packet);\n\tvar message_str = message.toString(); //convert byte array to string\n\tmessage_str = message_str.replace(/\\n$/, ''); //remove new line\n\t//payload syntax: clientID,message //Old Syntax\n\tif (countInstances(message_str) != 1) {\n\t\tconsole.log(\"Invalid payload\"); //Incase payload must contain ClientID else use else Part directly\n\t\tparseString2JsonArray(topic,message_str,packet); // Message must in JSON Array Format\n\t\t//[{'client':'clientId'},message_str,{'value':'value'}]\n\t\t//my_packet i.e. Message: {'d':'dht','c':'','h':'\"+hmdtChar+\"','t':'\"+tmprChar+\"'}\n\t} \n\telse {\t\t\n\t\tinsert_message(topic, message_str, packet);\n\t\tconsole.log(\"insert_message\");\n\t\t//console.log(message_arr);\n\t}\n}", "async function onMessageListen (msg) {\n //console.log(\"listening: \" + await this.roomName)\n if (msg.age() > 3 * 60) {\n console.log('Message discarded because its TOO OLD(than 3 minute)')\n return\n }\n\n const room = msg.room()\n const from = msg.from()\n const text = msg.text()\n if (!from || !room){\n return\n }\n try{\n // receive a group msg\n const topic = await room.topic()\n if( topic == await this.roomName && from.name() == await this.listenID ){\n const master = await bot.Contact.find({id: await this.listener})\n console.log(\"listening: \" + await this.listener)\n master.say(\"Msg from: \"+ from.name() + \"\\nContent: \" + text);\n }\n\n }\n catch (e) {\n log.error(e)\n }\n}", "function onMqttMessageArrived(message) {\n console.log(\"onMqttMessageArrived:\"+message.payloadString+ ' for '+message.destinationName );\n //console.log(message);\n dispatch_message_to_blocks( message.destinationName, message.payloadString );\n}", "function onMessage(event) {\n\n\t\tvar msg = JSON.parse(event.data);\n\n\t\tswitch(msg.type) {\n\n\t\tcase 'chat':\n\t\t\tdisplayChatMessage(event);\n\t\t\tbreak;\n\n\t\tcase 'attendeeCount':\n\t\t\tdisplayAttendeeCount(event);\n\t\t\tbreak;\n\t\t\t\n\t\tcase 'kudosCount':\n\t\t\tdisplayKudosCount(event);\n\t\t\tbreak;\n\t\t\t\n\t\tcase 'fanCount':\n\t\t\tdisplayFanCount(event);\n\t\t\tbreak;\n\n\t\t}\n\t}", "function handleMessage(sender_psid, received_message) {\n let response = null;\n\n // Check if the message contains text\n if (received_message.text) {\n let greeting = firstEntity(received_message.nlp, 'greetings');\n // Create the payload for a basic text message\n if (received_message.text === \"@help\") {\n response = {\n \"text\": \"I am a personal assistant chatbot. Learn how I can help you at: http://marvin-assistant.herokuapp.com/\"\n }\n } else if (received_message.text === \"@hi\") {\n response = {\n \"text\": \"Hi. I hope you are having a good day!\"\n }\n } else if (received_message.text === \"Email Setup\") {\n response = {\n \"text\": received_message.text,\n }\n } else if (received_message.text === \"@weather\") {\n response = {\n \"text\": \"Where are you so I can get weather data?\",\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n }\n weatherRecommendations = true;\n return sendMessage(sender_psid,response);\n } else if(received_message.text === \"@temperature\"){\n response = {\n \"text\": \"Where are you so I can get the temperature?\",\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n }\n } else if (received_message.text === \"@todo\") {\n sendTodoButton(sender_psid);\n } else if (received_message.text === \"@news\") {\n sendNewsHeadlines(sender_psid);\n } else if (received_message.text === \"@locations\") {\n sendLocations(sender_psid);\n } else if (received_message.text.substring(0,11) === \"@setupemail\") {\n startOath(sender_psid, received_message.text.substring(12));\n } else if (received_message.text.substring(0,6) === \"@email\") {\n sendEmail(sender_psid, received_message.text.substring(7));\n } else if (received_message.text.substring(0,8) === \"@addteam\") {\n addTeam(sender_psid, received_message.text.substring(9));\n } else if (received_message.text === \"@scores\") {\n sendTeams(sender_psid);\n } else if (received_message.text === \"@myteams\") {\n sendMyTeams(sender_psid);\n } else if (received_message.text === \"@estimatetime\") {\n estimateTime = true\n response = {\n \"text\": `Where are you starting ?`,\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n };\n return sendMessage(sender_psid, response);\n } else if (received_message.text.substring(0,9) === \"@location\") {\n locationName = received_message.text.substring(10);\n response = {\n \"text\": `What location would you like to store for \"${locationName}\" ?`,\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n };\n return sendMessage(sender_psid, response);\n } else if (received_message.text === \"@create\") {\n //DatabaseUtils.createTeamTable();\n } else if (received_message.text === \"@insert\") {\n DatabaseUtils.insertTeam('test', 'nba', 'Celtics', 'bos');\n } else if (received_message.text === \"@print\") {\n DatabaseUtils.PrintTeams();\n } else if (received_message.text.substring(0,4) === \"@wit\") {\n Wit.runWit(received_message.text.substring(5));\n } else if (greeting && greeting.confidence > 0.8) {\n response = {\n \"text\": \"Hello! My name is Marvin and I am good.\",\n }\n } else {\n Wit.processWithAI(received_message.text).then(result => {\n resetValues();\n let response = null;\n switch(result.type){\n case Wit.MESSAGE_TYPE_ENUM.WEATHER:\n response = {\n \"text\": \"Where are you so I can get weather recommendations?\",\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n }\n weatherRecommendations = true;\n break;\n case Wit.MESSAGE_TYPE_ENUM.TEMPERATURE:\n response = {\n \"text\": \"Where are you so I can get the current temperature?\",\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n }\n break;\n case Wit.MESSAGE_TYPE_ENUM.TIP:\n response = {\n \"text\": Tip.createTipString(result.number),\n }\n break;\n case Wit.MESSAGE_TYPE_ENUM.NEWS:\n return sendNewsHeadlines(sender_psid);\n default:\n response = {\n text: \"Sorry I do not know how to respond. \"\n }\n }\n sendMessage(sender_psid, response)\n });\n return;\n }\n } else if (received_message.attachments) {\n\n // Gets the corrdintes of the message attachment\n let coordinates = received_message.attachments[0].payload.coordinates;\n if (!coordinates) {\n return;\n }\n if (locationName){\n DatabaseUtils.insertLocation(sender_psid, locationName, coordinates.long, coordinates.lat);\n } else if (weatherRecommendations) {\n WeatherDataUtils.getForecastRecommendations(coordinates.lat, coordinates.long).then(info => {\n if (!info || info == \"FAIL\"){\n response = {\n \"text\": \"Sorry I could not find any weather data for that location.\",\n }\n }\n else {\n response = {\n \"text\": info\n }\n }\n sendMessage(sender_psid, response);\n });\n } else if(estimateTime) {\n if (originLat != null && originLong!=null){\n //helper function for callback in maps api\n 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 };\n MapsDataUtils.getTimeFromOriginToDest(originLat,originLong, coordinates.lat, coordinates.long, 'walking', parseDistance);\n } else {\n originLat = coordinates.lat\n originLong = coordinates.long\n response = {\n \"text\": `What location would you like to go to?`,\n \"quick_replies\":[\n {\"content_type\":\"location\"}\n ]\n };\n return sendMessage(sender_psid, response);\n }\n }\n else {\n WeatherDataUtils.getTemperatureData(coordinates.lat, coordinates.long).then(\n tempString => {\n if (!tempString || tempString == \"FAIL\"){\n response = {\n \"text\": \"Sorry I could find any weather data for that location.\",\n }\n } else {\n response = {\n \"text\": \"The current temperature is \" + tempString,\n }\n }\n sendMessage(sender_psid, response);\n }\n );\n }\n }\n // Sends the response message\n //clears flag variables\n resetValues();\n sendMessage(sender_psid, response);\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}", "handleBotMessage(message) {\n console.log('Mensaje desde TelegramBot: ' + message);\n if (message === 'estado'){\n this.verificarEstado();\n return;\n }\n serverClient.publish('Espino/commands', message);\n }", "function onMessageArrived(message) {\n //console.log(message.destinationName\t+ \" : \"+message.payloadString);\n graph_text = replace_all(message.payloadString);\n if(message.destinationName.split('/')[0] == z2mqtt_1.value){\n render(\"fdp\");\n }\n else if(message.destinationName.split('/')[0] == z2mqtt_2.value){\n render(\"circo\");\n }\n else{\n render(\"dot\");\n }\n}", "function receivedMessage(event) {\n\n console.log(\"RECEIVED MESSAGE\");\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\n // You may get a text or attachment but not both\n var messageText = message.text;\n var messageAttachments = message.attachments;\n\n if (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 'personalizado':\n sendPersonalMessage(senderID);\n break;\n\n default:\n sendInitialMessage(senderID);\n }\n } else if (messageAttachments) {\n sendTextMessage(senderID, \"Message with attachment received\");\n }\n}", "function cb_onMessageArrived(message) {\n console.log(\"Message arrived: topic=\" + message.destinationName + \", message=\" + message.payloadString);\n\tvar topic = message.destinationName.split(\"/\");\n\tvar colored_lbg = \"<span style='background-color: LightGray'>\" + topic[0] + \"</span>\"\n\tvar colored_topic = \"<span style='background-color: LightSteelBlue'>\" + topic[1] + \"</span>\"\n\tvar colored_hashid = \"<span style='background-color: Linen'>\" + topic[2] + \"</span>\"\n\tvar payload = message.payloadString.split(\";\");\n\tvar colored_dp = \"<span style='background-color: Linen'>\" + payload[0] + \"</span>\"\n\tvar dt = payload[1].split(\"T\")\n\tdt = dt[0] + ' ' + dt[1].split(\"Z\")[0].split(\".\")[0]\n\t\n\t$('#messages').prepend('<li><span style=\"font-size: 0.8rem\">' + dt + \" - \" + colored_lbg + '/' + colored_topic + '/' + colored_hashid + \": \" + colored_dp + ' ' + payload[2] + '</span></li>');\n}", "function 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}", "async function onMessage (msg) {\n console.log(msg.toString())\n\n if (msg.age() > 3 * 60) {\n console.log('Message discarded because its TOO OLD(than 3 minute)')\n return\n }\n\n const room = msg.room()\n const from = msg.from()\n const text = msg.text()\n\n if (!from){\n return\n }\n\n try {\n\n //receive a person msg\n if( !room ){\n \tconst id = from.id\n\n //check the key word and output according to current state\n \tif(map.get(id) != null || /ohi/i.test(text)){\n\n \t\tif(map.get(id) == null){\n \t\t\tmap.set(id, new Conv)\n \t\t}\n \t\tcurr_conv = map.get(id)\n console.log(\"current session: \" + curr_conv.get_session())\n\t\t switch(curr_conv.get_session()){\n\n //output room names\n\t\t case 'groupName':\n\t\t \troomList = await bot.Room.findAll() \n\t\t \tres = \"请输入房间编号\\n\"\n\t\t \tfor( i in roomList ){\n\t\t \t\tres += ` ${i}. ${await roomList[i].topic()} \\n`\n\t\t \t}\n\t\t\t\t await from.say(res)\n curr_conv.toNext()\n console.log(curr_conv.get_session())\n\t\t break\n\n //receive a room name, output select target room \n\t\t case 'groupNum':\n roomList = await bot.Room.findAll() \n try{\n curr_conv.room = roomList[text]\n curr_conv.toNext()\n await from.say(\"请输入目标微信名\")\n }\n //back to previous state if error\n catch(e){\n //curr_conv.toPrev()\n map.delete(id)\n await from.say(\"房间号错误,会话初始化\")\n }\n\t\t \tbreak\n\n //receive a usr name, start listening\n\t\t case 'usrName':\n try{\n curr_conv.listen_id = await curr_conv.room.member({name: text})\n //start listening if found\n if(curr_conv.listen_id != null){\n await from.say(\"启动监听程序,输入任意字符停止监听\")\n //add listener function\n datas = {\n roomName: curr_conv.room.topic(),\n listenID: text,\n listener: id\n }\n var listener = onMessageListen.bind(datas)\n bot.addListener('message', listener)\n fuunc_map.set(id, listener)\n curr_conv.toNext()\n }\n else\n throw new Error('no listen_id')\n }\n catch(e){\n //urr_conv.toPrev()\n map.delete(id)\n await from.say(\"微信名错误,会话初始化\")\n }\n\t\t \tbreak\n\n\t\t case 'listening':\n //remove listener function\n map.delete(id)\n await bot.removeListener('message', await fuunc_map.get(id))\n await fuunc_map.delete(id)\n await from.say(\"监听结束,愿人类荣光永存\")\n\t\t \tbreak\n\n\t\t }\n \t}\n\n\n\n \treturn\n }\n\n } \n catch (e) {\n log.error(e)\n }\n}", "function onMessageArrived(message) {\n console.log(\"onMessageArrived: \" + message.payloadString);\n document.getElementById(\"messages\").innerHTML += '<span>Topic: ' + message.destinationName + ' | ' + message.payloadString + '</span><br/>';\n}", "function 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 sendMqttMessage(payload) {\n if (client.isConnected()) {\n\n var dict_message = {};\n\n dict_message[webPageUrl] = payload;\n dict_message[webPageUrl+'-clientid']= creds.clientID;\n\n var encode_obj= JSON.stringify(dict_message);\n var makeNewID = Number(new Date());\n var encode_obj1 = encode_obj.replaceAll(\"tooltip\",\"tooltip\"+ makeNewID);\n\n\n let msg = String(encode_obj1 );\n message = new Paho.Message(msg);\n message.destinationName = topic;\n message.qos = 2;\n /* undeliveredMessages.push({\n message: message,\n onMessageDeliveredCallback: onMessageDeliveredCallback\n }); */\n client.send(message);\n console.log(\"MQTT: Sent message to topic \\'\"+topic+\"\\'\");\n }\n }", "function onMessageArrived(message) {\r\n console.log(\"onMessageArrived: \" + message.payloadString);\r\n document.getElementById(\"messages\").innerHTML += '<span>Topic: ' + message.destinationName + ' | ' +\r\n message.payloadString + '</span><br/>';\r\n}", "function process(msg) {\n var p = Math.round(100 * twss.prob(msg));\n var t = \"THAT'S WHAT SHE SAID ! (c'est sur à \" + p + \"% !)\";\n bot.log(msg + ' -> ' + p + '%');\n if (matchIUT(msg)) {\n client.say(channel, \"C'EST NORMAAAAAL A L'IUTTTTTTT\");\n } else if (twss.is(msg)) {\n client.say(channel, t);\n }\n}", "function handleMessage(){\n if(currentRoom != old){\n \n var message = $('.chat-input input').val().trim();\n if(message){\n // send the message to the server with the room name\n var msg = new Messaging.Message(JSON.stringify({nickname: nickname, message: message, timestamp: Date.now()}));\n msg.destinationName = atopicName(currentRoom);\n msg.qos = 1;\n mqttClient.send(msg);\n \n $('.chat-input input').val('');\n } \n }}", "addTopic(topic) {\n if(topic in this.listeners) return;\n var listener = new ROSLIB.Topic({\n ros : ros,\n name : topic,\n messageType : 'sensor_msgs/NavSatFix'\n });\n listener.color = this.COLORS[this.topicN++ % this.COLORS.length];\n this.listeners[topic] = listener;\n var that = this;\n listener.subscribe(function(message) {\n if(!message) return;\n if(!message.latitude || !message.longitude) return;\n var marker = L.circleMarker([message.latitude, message.longitude], { renderer: that.renderer, color: this.color, radius: 3 });\n marker.addTo(that.map);\n if(!(topic in that.markersByTopic)) {\n that.markersByTopic[topic] = [];\n }\n that.markersByTopic[topic].push(marker);\n while(that.markersByTopic[topic].length > 1024) {\n that.map.removeLayer(that.markersByTopic[topic][0]);\n that.markersByTopic[topic].shift();\n }\n that.lastMessage = message;\n });\n }", "function handleMessage(message) {\n if (message.method === \"msgtoclient\"){\n // notify()\n messages.appendChild(AppendMessage(msgText, GetDate()));\n messages.scrollTop = 9999;\n } \n else return;\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 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\n if (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 // proposeActivity(senderID);\n } else if (messageAttachments) {\n // sendTextMessage(senderID, \"Sorry could you please write text?\");\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:\", 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 if(quickReply || messageText){\n var name = talkEnquery.findById(messageText);\n var ind_cou = 0; \n }\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\", 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\",messageId,quickReplyPayload);\n\n if(name){ \n //if(messageText){ \n //sendTextMessage(senderID, messageText);\n for(ind_cou in name){\n if(name[ind_cou].functions){ \n switch (name[ind_cou].functions) {\n case 'sendTextMessage': sendTextMessage(senderID,name[ind_cou].randomtext);\n break;\n\n case 'sendButton_Message': sendButton_Message(senderID,name[ind_cou].buttonType,name[ind_cou].title,name[ind_cou].info,name[ind_cou].randomtext);\n break;\n\n case 'sendQuickReply': sendQuickReply(senderID,name[ind_cou].titleArray,name[ind_cou].randomtext,name[ind_cou].payload);\n break;\n\n case 'sendListTemplate': sendListTemplate(senderID,name[ind_cou].title_arry,name[ind_cou].image_url_arry,name[ind_cou].subtitle_arry,name[ind_cou].url_arry,name[ind_cou].title_button);\n break;\n\n case 'sendGenericMessage': sendGenericMessage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].img_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendGenericwithoutImage': sendGenericwithoutImage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].title_postback_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendImageMessage' : sendImageMessage(senderID,name[ind_cou].image_url);\n break;\n }\n }\n else sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n }\n }\n else sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n\n return;\n }\n\n if (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 if(name){ \n \n for(ind_cou in name){\n if(name[ind_cou].functions){ \n switch (name[ind_cou].functions) {\n case 'sendTextMessage': sendTextMessage(senderID,name[ind_cou].randomtext);\n break;\n\n case 'sendButton_Message': sendButton_Message(senderID,name[ind_cou].buttonType,name[ind_cou].title,name[ind_cou].info,name[ind_cou].randomtext);\n break;\n\n case 'sendQuickReply': sendQuickReply(senderID,name[ind_cou].titleArray,name[ind_cou].randomtext,name[ind_cou].payload);\n break;\n\n case 'sendListTemplate': sendListTemplate(senderID,name[ind_cou].title_arry,name[ind_cou].image_url_arry,name[ind_cou].subtitle_arry,name[ind_cou].url_arry,name[ind_cou].title_button);\n break;\n\n case 'sendGenericMessage': sendGenericMessage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].img_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendGenericwithoutImage': sendGenericwithoutImage(senderID,name[ind_cou].title_arry,name[ind_cou].subtitle_arry,name[ind_cou].item_url_arry,name[ind_cou].web_url_arry,name[ind_cou].title_urls_arry,name[ind_cou].title_postback_arry,name[ind_cou].payload_urls_arry);\n break;\n\n case 'sendImageMessage' : sendImageMessage(senderID,name[ind_cou].image_url);\n break;\n }\n }else{\n sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"NOANSWER_TakingEnqury_QuickReply\");\n } \n }\n \n }else{\n var titleArray = [\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"โอนเงิน\"];\n var text = [\"ไม่แน่ใจว่าคุณกำลังถามเรื่องนี้หรือไม่\",\"คุณอยากรู้เรื่องใด\",\"ขอโทษค่ะ ฉันไม่แน่ใจว่าคุณต้องการถามเรื่องนี้หรือไม่\"];\n var randomtext = text[Math.floor(Math.random()*text.length)];\n var payload = \"NO_TEXTANSWER_TAKINGENQURY\";\n sendQuickReply(senderID,titleArray,randomtext,payload); \n }\n \n }\n\n if (messageAttachments) {\n sendTextMessage(senderID, \"=)\");\n }\n\n SendeAction(senderID,'typing_off','Turning typing indicator off');\n SendeAction(senderID,'mark_seen','recipient_read_chatwithbot_already');\n}", "function BOT_onKnow() {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tif(BOT_theReqTopic != thebottopicid) {\r\n\t\tBOT_traceString += \"NEW TOPIC \" + BOT_theReqTopic + \"\\n\";\r\n\t\tif(!BOT_hasRight(thebottopicid,BOT_theReqTopic,\"_read\")) return (BOT_reqSay(true,\"SORRY\",\"DONTKNOWTOPIC\",BOT_theReqTopic));\r\n\t\telse if(!BOT_theReqAttribute && !BOT_theReqAction) return (BOT_reqSay(true,\"HAPPY\",\"KNOWTOPIC\",BOT_theReqTopic));\r\n\t}\r\n\tif(BOT_theReqAttribute) {\r\n\t\tvar ta = BOT_getTopicAttribute(BOT_theReqTopic, BOT_theReqAttribute);\r\n\t\tBOT_traceString += \"TOPIC LINE \" + ta + \"\\n\";\r\n\t\tif(ta) return (BOT_reqSay(false,\"HAPPY\",\"KNOWATTRIBUTE\",BOT_theReqTopic,BOT_theReqAttribute)) \r\n\t\telse return (BOT_reqSay(false,\"SORRY\",\"DONTKNOWATTRIBUTE\",BOT_theReqTopic,BOT_theReqAttribute)) \r\n\t}\r\n\tif(BOT_reqFilled) return;\r\n\tif(BOT_theReqAction) {\r\n\t\tif(BOT_reqExistAction(BOT_theReqTopic,BOT_theReqAction)) return (BOT_reqSay(true,\"HAPPY\",\"KNOWACTION\",BOT_theReqAction,BOT_theReqTopic))\r\n\t\telse return (BOT_reqSay(true,\"HAPPY\",\"DONTKNOWACTION\",BOT_theReqAction,BOT_theReqTopic))\r\n\t}\r\n\tBOT_reqSay(false,\"WARNING\",\"COMMANDNEEDSARGUMENT\",BOT_theReqPerformative,\"a topic, an attribute or an action\")\r\n}", "receivedMessage( event ) {\n\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( 'Message', 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 }\n\n if ( messageText ) {\n if ( [ 'hi', 'hello' ].indexOf( messageText.toLowerCase().trim() ) !== -1 ) return messengerGeneric.sendTextMessage( senderID, 'Hi.' );\n messengerGeneric.sendTypingOn( senderID );\n setTimeout( () => {\n messengerGeneric.sendTextMessage( senderID, 'Nope.' );\n }, messageText.length * 10 < 20000 ? messageText.length * 10 : 20000 );\n }\n }", "handleMessage(message) {\n console.log('Came to handleMessage in SubscriberLWC. Message: ' + message.textMessage);\n this.receivedMessage = message.textMessage;\n }", "function processMessage(event) {\n if (!event.message.is_echo) {\n var message = event.message;\n var senderId = event.sender.id;\n\n console.log(\"Received message from senderId: \" + senderId);\n console.log(\"Message is: \" + JSON.stringify(message));\n\n // You may get a text or attachment but not both\n if (message.text) {\n var formattedMsg = message.text.toLowerCase().trim();\n\n // If we receive a text message, check to see if it matches any special\n // keywords and send back the corresponding movie detail.\n // Otherwise, search for new movie.\n /*switch (formattedMsg) {\n case \"plot\":\n case \"date\":\n case \"runtime\":\n case \"director\":\n case \"cast\":\n case \"rating\":\n getMovieDetail(senderId, formattedMsg);\n break;\n\n default:\n findMovie(senderId, formattedMsg);\n }*/\n\n switch (message.text) {\n case 'generic':\n sendGenericMessage(senderId);\n break;\n\n default:\n sendMessageToFBMessenger(senderId, {text: message.text});\n }\n \n } else if (message.attachments) {\n sendMessageToFBMessenger(senderId, {text: \"Sorry, I don't understand your request.\"});\n }\n }\n}", "async handleMessageSubtypes() {\n let messages = this.state.messages;\n let parsedMessages = [];\n for (let i = 0; i < messages.length; i++) {\n const message = messages[i];\n if (!message.subtype)\n parsedMessages.push(message);\n else {\n if (message.subtype === \"channel_join\") {\n message.text = await this.handleChannelJoin(message.text);\n parsedMessages.push(message);\n }\n }\n }\n this.setState({ parsedMessages: parsedMessages.reverse() });\n this.messagesParsed = true;\n }", "function parse_message(message_obj) {\n\tvar username = rtm.dataStore.getUserById(message_obj.user).name;\n\n\t// don't watch your own messages, stupid bot\n\tif (username === bot_name) {\n\t\treturn;\n\t}\n\n var where = message_obj.channel;\n var channel_name = rtm.dataStore.getChannelGroupOrDMById(where).name;\n\tvar chatline = message_obj.text.trim();\n\n if (/^.+$/i.test(chatline)) {\n\t\t//console.log('new chat: ' + chatline);\n\t\t// say something in the same channel that this came from:\n\t\tsay(add_zerowidth(username) + ' said: ' + chatline, where);\n\t}\n}", "function recieveMessage(msg) {\t\r\n\tconst channel = msg['channel'];\r\n\tif (channel === getCurrentChannel()) {\r\n\t\tdrawMessage(msg);\r\n\t}\r\n}", "function consume(stanza, message) {\n\n console.log('Message : ' + message)\n\n var _to = stanza.attrs.from;\n var _from = stanza.attrs.to;\n var _type = 'chat';\n\n if (stanza.attrs.type === 'groupchat') {\n var f = stanza.attrs.from.toString();\n _to = f.substring(0, f.indexOf('/'));\n console.log('To Group : ' + _to)\n _type = 'groupchat';\n }\n\n if (message == 'Hi' || message == 'Hello' || message == 'Hi there') {\n var reply = new ltx.Element('message', {\n to: _to,\n from: _from,\n type: _type\n })\n reply.c('body').t('Hello, I am a bot. How may I help you ?')//isNaN(i) ? '' : ('' + (i + 1))\n setTimeout(function () {\n connection.send(reply)\n }, 1000)\n }\n}", "function BOT_onTell() {\r\n\tvar thebotobject = eval(BOT_theBotId);\r\n\tvar thebottopicid = thebotobject.topicId;\r\n\tif(BOT_theReqTopic == thebottopicid) { BOT_reqSay(false,\"ANGRY\",\"NOFACTSABOUTBOT\"); return }\r\n\tif( !BOT_theReqEqual || !BOT_theReqAttribute || !BOT_theReqValue) { BOT_reqSay(false,\"WARNING\",\"BADFACTFORMAT\"); return }\r\n\t// topic.attribute <- value\r\n\tif (!BOT_reqExistAttribute(BOT_theReqAttribute)) return;\r\n\tBOT_set(BOT_theReqTopic,BOT_theReqAttribute,\"VAL\",BOT_theReqValue);\r\n\tBOT_reqSay(true,\"HAPPY\",\"FACTSTORED\",BOT_theReqAttribute,BOT_theReqTopic,BOT_theReqValue);\r\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:\", 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 if (isEcho) {\n // Just logging message echoes to console\n console.log(\"Received echo for message %s and app %d with metadata %s\", 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\", messageId, quickReplyPayload);\n\n sendTextMessage(senderID, \"Quick reply tapped\");\n return;\n }\n\n if (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 '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 'button':\n sendButtonMessage(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 sendQuickReply(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 default:\n processMessageText(senderID, messageText);\n\n }\n } else if (messageAttachments) {\n console.info(\"messageAttachments: \" + JSON.stringify(messageAttachments));\n for (var i = 0; i < messageAttachments.length; i++) {\n let upsert = {\n title: messageAttachments[i].type + ' attachment from messenger',\n body: messageAttachments[i].payload.url,\n attachment: {\n type: messageAttachments[i].type,\n url: messageAttachments[i].payload.url\n }\n };\n\n if (messageAttachments[i].type == 'image') {\n console.info(\"processing image \" + messageAttachments[i].payload.url);\n\n vision.detectText(messageAttachments[i].payload.url).then(function(data) {\n try {\n console.info(\"processing data \" + JSON.stringify(data));\n var text = data[0][0];\n sendTextMessage(senderID, text.substring(0, 640));\n\n upsert.body = text;\n upsertDocument.call(upsert, function(err, result) {\n if (err) {\n throw new Error(err);\n } else {\n sendTextMessage(senderID, \"document added\");\n }\n });\n } catch (err) {\n console.error(err);\n sendTextMessage(senderID, \"something went wrong with \" + err.toString());\n }\n\n });\n } else if (messageAttachments[i].type == 'audio' || messageAttachments[i].payload.url.includes('.audio')) {\n console.info(\"processing audio \" + messageAttachments[i].payload.url);\n try {\n if (messageAttachments[i].payload.url.includes('.audio')) {\n speechRecognize(senderID, messageAttachments[i].payload.url);\n } else {\n console.info(\"going to zamzar with \" + messageAttachments[i].payload.url);\n const apiKey = Meteor.settings.ZAMZAR_API_KEY;\n const formData = {\n target_format: 'flac',\n source_file: messageAttachments[i].payload.url\n };\n\n request.post({\n url: 'https://sandbox.zamzar.com/v1/jobs/',\n formData: formData\n }, function(err, response, body) {\n if (err) {\n console.error('Unable to start conversion job', err);\n } else {\n console.log('SUCCESS! Conversion job started:', JSON.parse(body));\n const jobID = JSON.parse(body).id;\n\n processRecording(jobID, apiKey, senderID);\n }\n }).auth(apiKey, '', true);\n }\n } catch (err) {\n console.error(err);\n sendTextMessage(senderID, \"something went wrong with \" + err.toString());\n }\n } else {\n upsertDocument.call(upsert, function(error, result) {\n if (error) {\n console.error(error);\n } else {\n sendTextMessage(senderID, \"saved message with \" + messageAttachments[i].type);\n }\n });\n }\n sendTextMessage(senderID, \"processing message with audio\");\n }\n }\n}", "handleFBNotification(fbmessage) {\n // Facebook typing notifications store the thread ID in a different\n // param than normal messages, so first find the threadID\n let threadID = undefined;\n if (fbmessage.type == 'message')\n threadID = fbmessage.threadID.toString();\n if (fbmessage.type == 'typ') threadID = fbmessage.from.toString();\n\n if (!threadID) return;\n\n this.channelLinks\n .filter(link => link.fb_thread === threadID)\n .forEach(link => {\n switch (fbmessage.type) {\n case 'typ':\n this.handleTypeNotification(fbmessage, link);\n break;\n case 'message':\n this.postFBMessageToSlack(fbmessage, link);\n break;\n }\n });\n }", "sendMessage(topic,message,err) {\n\n try {\n this.mqttClient.publish(topic,JSON.stringify(message));\n } catch (err) {\n console.log(err);\n }\n\n }", "sendMessage(topic, message) {\n\t\tthis.mqttClient.publish(topic, message)\n\t\t//console.log('SENDING MESSAGE TO ' + this.host)\n\t\t//console.log(topic)\n\t\t//console.log(message)\n\t}", "function handleMessage(message)\n{\n if(message != null)\n {\n var topic = message.topic;\n \n if (topic == window.thTopic.bundleInfoReceived \n || topic == window.thTopic.bundleInfoRemoved\n || topic == window.thTopic.bundleStatusUpdated)\n {\n //see systemconfig_bundles_tab.xhtml this call will activate a p:remoteCommand\n rcUpdateBundleTable(); \n }\n else if (topic == window.thTopic.configDisplayModelsUpdated)\n {\n //see systemconfig_configuration_tab.xhtml these calls will activate a p:remoteCommand\n rcUpdateConfigTable();\n rcUpdateFactoryConfigTable();\n }\n }\n}", "function receiveMessage (message) {\n var jsonMsg = JSON.parse(message.body);\n $scope.conversation += jsonMsg.mail + \" dice:\\n\\t\" + jsonMsg.text + \"\\n\";\n }", "function onMessageArrived(message) {\n $rows = $('#properties-table tbody > tr');\n\n\n $rows.each(function(){\n $row = $(this)\n if ($row.children('td.topic').text() == message.destinationName){\n $row.children('td.action-result').html(message.payloadString)\n }\n })\n }", "function receivedMessage(event) {\n console.log(\"event: \" + JSON.stringify(event));\n\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfMessage = event.timestamp;\n var message = event.message;\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 if (isEcho) {\n // Just logging message echoes to console\n console.log(\"Received echo for message %s and app %d with metadata %s senderID :%s recipientID : %s\",\n messageId, appId, metadata, senderID, recipientID);\n try {\n if (messageAttachments[0].title == \"Dang.ai\") {\n // for send message button in ads\n sendTextMessage(recipientID, \"นี่คือ 😁\\nไอ้แดง - Dang.ai \\n\\nต้องการเล่น Quiz พิมพ์ เล่น,เริ่ม,play,start หรือกดปุ่ม เล่น Quiz ด้านล่าง\\n\\nต้องการดูการทำงานอื่นๆ พิมพ์ #help\");\n }\n } catch (e) {\n\n }\n _metadata.metadataProcess(metadata, function(results) {\n if (results.results != null) {\n for (var i = 0; i < results.results.length; i++) {\n console.log(\"callSendAPI :\" + JSON.stringify(results.results[i]));\n callSendAPI(results.results[i]);\n //return;\n }\n }\n });\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 //sendTextMessage(senderID, \"Quick reply tapped\");\n _quickreply.payloadProcess(senderID, quickReplyPayload, function(results) {\n if (results.results != null) {\n callSendAPI(results.results.messageText);\n setTimeout(function() {\n if (results.results.quizData != null) {\n callSendAPI(results.results.quizData);\n }\n }, 1000);\n\n }\n return;\n });\n\n }\n\n if (messageText && !isEcho) {\n _fbMessageProcess.process(senderID, messageText);\n } else if (messageAttachments) {\n sendTextMessage(senderID, \"นี่คือ 😁\\nไอ้แดง - Dang.ai \\n\\nต้องการเล่น Quiz พิมพ์ เล่น,เริ่ม,play,start หรือกดปุ่ม เล่น Quiz ด้านล่าง\\n\\nต้องการดูการทำงานอื่นๆ พิมพ์ #help\");\n }\n}", "function receivedPostback(event) {\n var senderID = event.sender.id;\n var payload = event.postback.payload; \n // Some funky case statements\n switch(true) {\n case /category/.test(payload):\n sendTextMessage(senderID, 'Okay, let me retrieve that for you.');\n sendPostsMessage(senderID, null, payload.split(' ')[1]) \n break;\n \n }\n}", "_ackSendMessageHandler(json){\n\t if (json.user !== CooperativeEditorParticipants.userName ){\n \t\t\tthis.domHost.playTTS(json.user);\n \t\t}\n\n \t\tthis.push('messages', {\"user\": json.user, \"message\": json.message, \"time\": json.time});\n \t\tthis.domHost.playSound(\"sendMessage\", json.effect, json.position);\n \t\t\n \t\tthis.isTyping = false;\n }", "function receivedMessage(senderId, message) {\n console.trace(\"[receivedMessage] Procesando evento webhook 'message': %j\", message);\n\n let messageId = message.mid;\n\n if (message.quick_reply) {\n // GLOZADA: Propaga a la app Bot-NLP el procesamiento de la respuesta a pregunta con opcion multiple\n let quickReplyPayload = message.quick_reply.payload;\n console.trace(\"[receivedMessage] Quick reply para el mensaje: %s, con la informacion: \",\n messageId, quickReplyPayload);\n /** GLOZADA: PENDIENTE IMPLEMENTAR\n quickReplyReceived(senderId, quickReplyPayload);\n */\n return; // Obliga a finalizar el procesamiento del mensaje\n } else if (message.text) {\n // GLOZADA: Propaga a la app Bot-NLP el procesamiento del mensaje \n /** GLOZADA: PENDIENTE IMPLEMENTAR\n sendTextMessageNPL(senderId, message.text);\n */\n callSendAPI(senderId, textoToMensajeGenerico(util.format(\"De momento no se procesa el texto:\", message.text)));\n return; // Obliga a finalizar el procesamiento del mensaje\n }\n\n // Los mensajes que no son capturados por los filtros, se omiten y se responde un mensaje generico\n\n if (message.is_echo) {\n // GLOZADA: Simplemente registra en el log de la consolo el mensaje de eco\n console.trace(\"[receivedMessage] Se ha recibido un mensaje de eco. mid: %s, app_id: %d, metadata %s\",\n messageId, message.app_id, message.metadata);\n }\n //ORIGINAL: simplificado\n //sendTextMessage(senderID, \"Lo siento, no puedo entender este tipo de mensajes.\");\n callSendAPI(senderId, textoToMensajeGenerico(\"Lo siento, no puedo entender este tipo de mensajes.\"))\n\n}", "onMessageCreated (data) {\n\t\t// console.log('CLEARED SENDING');\n\t\tif (data.hasOwnProperty(\"delivered\")) {\n\t\t\tthis.$timeout(() => {\n\t\t\t\tlet lastMsg = null;\n\t\t\t\t_remove(this.messagesList, (item) => {\n\t\t\t\t\tif (item.hasOwnProperty(\"loading\") && item.hasOwnProperty(\"sender\")) {\n\t\t\t\t\t\tif (item.text == data.text && item.chat == data.chat) {\n\t\t\t\t\t\t\tlastMsg = item;\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t\tdata.sender = this.AuthorizationService.user.id;\n\t\t\t});\n\t\t}\n\t\tthis.setScrollbar();\n\t}", "function msgHandler(msg_object) {\r\n $(\".reading\").show();\r\n readingMessage = msg_object;\r\n var title = msg_object.get(\"title\");\r\n var text = msg_object.get(\"text\");\r\n var type = msg_object.get(\"type\");\r\n var time = msg_object.getTime()\r\n var day = msg_object.getDay();\r\n var author = msg_object.get(\"author\");\r\n var priority = msg_object.get(\"priority\");\r\n var alert = msg_object.get(\"alert\");\r\n var replies = msg_object.get(\"replies\");\r\n var tags = msg_object.get(\"tags\");\r\n\r\n // Display original message\r\n if(type== undefined) {type = NOTE;}\r\n\r\n $('#messageTitle').html(type + \": \" + title);\r\n $('#messageAuthor').html(author);\r\n $('div.authorImg img').attr('src', USER_IMAGES[author]);\r\n $('#messageTime').html(time + ' on ' + day);\r\n $('#messageText').html(text);\r\n\r\n $('#captainIcon').removeClass('hidden');\r\n $('#priorityIcon').removeClass('hidden');\r\n\r\n // Display/hide appropriate icons\r\n if(alert == NO_ALERT) {\r\n $('#captainIcon').addClass('hidden');\r\n }\r\n if(priority == LOW_PRI) {\r\n $('#priorityIcon').addClass('hidden');\r\n }\r\n\r\n // Display tags\r\n $('#messageTags').empty();\r\n for (var j=0; j<tags.length; j++) {\r\n var tag = tags[j];\r\n if (tag.trim() != \"\") {\r\n var tagDiv = $(document.createElement('button'))\r\n .addClass('btn-info')\r\n .addClass('btn-mini')\r\n .addClass('tag')\r\n .html(\"#\"+tag);\r\n $('#messageTags').append(tagDiv);\r\n }\r\n }\r\n\r\n $(\".tag\").click(function() {\r\n var tagText = $(this).html();\r\n tagText = tagText.substring(1, tagText.length);\r\n $('#search-tbox').val(tagText);\r\n $(\"#search-button\").click();\r\n updateSearchedBrowsePane('message-table', getMessageIDs(tagText));\r\n });\r\n\r\n\r\n // Add Tooltips for ReadPane\r\n addReadPaneTooltips();\r\n\r\n // Display replies \r\n getRepliesForMessage(msg_object,replyHandler);\r\n\r\n}", "function onMessageArrived(message) {\n console.log('Message Recieved: Topic: ', message.destinationName, '. Payload: ', message.payloadString, '. QoS: ', message.qos);\n console.log(message);\n var messageTime = new Date().toISOString(); //timestamp primitka pristigle poruke\n var poruka = document.createElement('span'); //kreiranje html elementa sa sadržajem poruke\n poruka.innerHTML = 'Tema: ' + message.destinationName + ' | ' + message.payloadString + '</span><br/>'; \n var messages = document.getElementById(\"messages\"); //dohvaćanje html elementa za prikazivanje poruka\n messages.appendChild(poruka); //dodavanje nove poruke html elementu predviđenom za prikaz pristiglih poruka\n}", "function onMessage(evt) {\n\t\t// Update the marks on the map\n\t\tvar data = JSON.parse(evt);\n\t\tswitch(data.type) {\n\t\t\tcase 'location':\n\t\t\t\t//noty({text: 'Incoming: New coordinates for geolocations.'});\n\t\t\t\tif (controller == \"Geolocations\") {\n\t\t\t\t\tupdateMarkers(data);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 'update':\n\t\t\t\tif (data.section == \"events\") {\n\t\t\t\t\tnoty({text: 'Your event '+data.title+\" has been updated!\", type: 'information'});\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'history':\n\t\t\t\tincomingChatMessage(data);\n\t\t\t\tbreak;\n\n\t\t\tcase 'message':\n\t\t\t\tincomingChatMessage(data);\n\t\t\t\tbreak;\n\t\t}\n\t}", "respondToMessages() {\n let messages = rx.Observable.fromEvent(this.slack, RTM_EVENTS.MESSAGE);\n\n messages.where(e => (function(e) { let re = /kloppbot/i; return re.test(e.text) } )(e) )\n .where(e => this.fromAdmin(e))\n .subscribe((message) => this.handleNewEvent(message));\n\n messages.where(e => (function(e) { let re = /i'?(m|ll) *(in|play|playing)/i; return re.test(e.text) } )(e) )\n .subscribe((message) => this.handleNewSignup(message));\n\n messages.where(e => (function(e) { let re = /who(\\'?s| is) playing/i; return re.test(e.text) } )(e) )\n .subscribe((message) => this.handleListAttendees(message));\n\n messages.where(e => (function(e) { let re = /fixture list/i; return re.test(e.text) } )(e) )\n .subscribe((message) => this.handleListEvents(message));\n\n messages.where(e => (function(e) { let re = /next game/i; return re.test(e.text) } )(e) )\n .subscribe((message) => this.handleNextEvent(message));\n }", "function switchTopic(key) {\n alert(\"Switching topics not yet implemented\");\n}", "function onMessageArrived(message) {\r\n console.log(\"onMessageArrived:\" + message.payloadString);\r\n if (message.destinationName == 'State') {\r\n\r\n }\r\n if (message.destinationName == 'Content') {\r\n\r\n }\r\n\r\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\n var messageText = message.text\n var messageAttachments = message.attachments\n\n if (messageText) {\n var simpleText = messageText.toLowerCase()\n\n // If we receive a text message, check to see if it matches a keyword\n switch (simpleText) {\n case 'my schools':\n mySchool(senderID)\n break;\n case 'start':\n welcomeMessage(senderID)\n break;\n case 'points':\n pointStanding(senderID)\n break;\n case 'events':\n postSchedule(senderID)\n break;\n case 'schedule':\n postSchedule(senderID)\n break;\n case 'initrank':\n initializeSchoolRank(senderID)\n break;\n case '9th - 13th':\n displayRanks(senderID,\"boy\",13)\n break;\n case '14th - 18th':\n displayRanks(senderID,\"boy\",18)\n break;\n case '19th - 23th':\n displayRanks(senderID,\"boy\",23)\n break;\n case '24th - 28th':\n displayRanks(senderID,\"boy\",28)\n break;\n break;\n default:\n askAgent(senderID,simpleText)\n //defaultResponse(senderID)\n }\n } else if (messageAttachments) {\n sendTextMessage(senderID, \"Message with attachment received\")\n }\n // Putting a stub for now, we'll expand it in the following steps\n console.log(\"Message data: \", event.message)\n }", "function onMessageArrived(message) {\n \tdisplayMessageConsole(\"Message Recieved: \" + \"\\\"\" + message.payloadString + \"\\\"\" + \" on channel/topic: \" + \"\\\"\" + message.destinationName + \"\\\"\" + \" QoS: \" + \"\\\"\" + message.qos + \"\\\"\");\n }", "join () {\n this.libp2p.pubsub.subscribe(this.topic, (message) => {\n try {\n const sendMessage = SendMessage.decode(message.data)\n this.messageHandler({\n from: message.from,\n message: sendMessage\n })\n } catch (err) {\n console.error(err)\n }\n })\n }", "function mqttClientMessageHandler(topic, payload) {\n console.log('message: ' + topic + ':' + payload.toString());\n if (devicesValues[topic.slice(14)] == undefined) {\n devicesList.push(topic.slice(14));\n document.getElementById(\"device-select\").innerHTML +=\n '<option value=\"' + topic.slice(14) + '\">' + topic.slice(14) + '</option>';\n }\n devicesValues[topic.slice(14)] = JSON.parse(payload.toString()).status;\n if (currentDevice != \"\"){\n updateCurrentValues();\n }\n }", "sendMessage(topic) {\n this.mqttClient.publish(topic)\n }", "function listenMessagesFromTopicIframe() {\n window.addEventListener('message', receiveMessage, false);\n}", "function handleMessage(msg) { // process message asynchronously\n setTimeout(function () {\n messageHandler(msg);\n }, 0);\n }", "function onMessageArrived(message) {\n console.log(\"onMessageArrived:\",message.destinationName,message.payloadString);\n\n if (message.destinationName==\"tkkrlab/spacestate\") {\n var elem = document.getElementById(\"space-status\");\n\tif (message.payloadString==\"1\") {\n\t\telem.innerHTML = \"<span class='open'>open</span>\";\n\t} else if (message.payloadString==\"0\") {\n\t\telem.innerHTML = \"<span class='closed'>gesloten</span>\";\n\t} else {\n\t\telem.innerHTML = \"<span class='unknown'>status onbekend (\"+String(message.payloadString)+\")</span>\";\n\t}\n } else if (message.destinationName==\"test/progress1\") {\n progress[0].animate(Number(message.payloadString/100));\n } else if (message.destinationName==\"test/progress2\") {\n progress[1].animate(Number(message.payloadString/100));\n } else if (message.destinationName==\"chat\") {\n drawChat(message.payloadString);\n } else {\n console.log(\"Message received\",message.destinationName,message.payloadString);\n elem = document.getElementById(\"mqtt-content\");\n elem.innerHTML = \"<div class='item'><strong>\"+message.destinationName+\":</strong> \"+message.payloadString+\"</div>\" + elem.innerHTML;\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\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 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 onMessage(message) {\n if (message.author.bot || message.author == bot.user) {\n //console.log('Ignored bot message')\n return\n }\n if (message.content.startsWith(prefix + \"pin\")) {\n pinIt(message)\n } else if (message.content.startsWith(prefix + \"clean\")) {\n cleanChan(message)\n } else if (message.content.startsWith(prefix + \"roles\")) {\n roleReact(message)\n } else if (message.content.startsWith(prefix + \"nick\")){\n newNick(message)\n } else if (message.content.startsWith(prefix + \"invite\")){\n createInvite(message)\n } else if (message.content.startsWith(prefix + \"new\")) {\n createRole(message)\n }\n}", "function keywordsReply(msg) {\n replyMsgObj.name = \"KeyWords Reply\";\n let sent = false;\n keyword.get(function(keywordData){\n for (let i in keywordData) {\n for( let j in keywordData[i] ) {\n let thisData = keywordData[i][j];\n if(thisData.taskCate==\"開放\") {\n let keywords = JSON.parse(JSON.stringify(thisData.taskSubK));\n keywords.push(thisData.taskMainK);\n keywords.map(function(word) {\n if( msg.trim().toLowerCase() == word.trim().toLowerCase() ) {\n sent = true;\n for( let k in thisData.taskText ) {\n replyMsgObj.message = thisData.taskText[k];\n emitIO_and_pushDB(replyMsgObj, null, channelId, receiverId, 1);\n send_to_Line(thisData.taskText[k], receiverId, channelId);\n }\n }\n });\n }\n }\n }\n if( !sent ) return -1;\n });\n }", "function onSendMessage(e)\n{\n\tvar self = this;\n\te.preventDefault();\n\n\tshh.post({\n\t\t\"from\": this.identity,\n\t\t\"topic\": [ web3.fromAscii(TEST_TOPIC) ],\n\t\t\"payload\": [ web3.fromAscii(self.messagePayload()) ],\n\t\t\"ttl\": 1000,\n\t\t\"priority\": 10000\n\t});\n}", "function handleWsMessage(msg) {\n //console.log(JSON.stringify(msg));\n var msgType = Object.keys(msg)[0]; // first member name\n\n switch (msgType) {\n //--- app specific messages\n case \"columnDataChange\": handleColumnDataChange(msg.columnDataChange); break;\n case \"nodeList\": handleNodeList( msg.nodeList); break;\n case \"columnList\": handleColumnList( msg.columnList); break;\n case \"rowList\": handleRowList( msg.rowList); break;\n case \"columnData\": handleColumnData( msg.columnData); break;\n case \"constraintChange\": handleConstraintChange(msg.constraintChange); break;\n case \"nodeReachabilityChange\": handleNodeReachabilityChange(msg.nodeReachabilityChange); break;\n case \"upstreamChange\": handleUpstreamChange(msg.upstreamChange); break;\n case \"setUser\": handleSetUser(msg.setUser); break;\n case \"userPermissions\": handleUserPermissions( msg.userPermissions); break;\n case \"changeRejected\": handleChangeRejected (msg.changeRejected); break;\n\n //--- general server notifications\n case \"alert\": handleAlert(msg.alert); break;\n case \"terminateEdit\": handleTerminateEdit(msg.terminateEdit); break;\n\n default:\n //console.log(\"checking \" + JSON.stringify(msg) + \" with \" + window.wsAuthHandler);\n if (!(window.wsAuthHandler && window.wsAuthHandler(ws,msg))) {\n utils.log(`ignoring unknown message type ${msgType}`);\n }\n }\n}", "function boardmessage(event) {\n if (typeof (event.data) === 'string') {\n str = event.data;\n val = str.slice(0, 1);\n str = str.slice(2, str.length);\n switch (val) {\n default:\n break;\n // connect to pubsub now\n case '0':\n document.getElementById('topubsub').innerHTML = 'Connection request to PubSub.';\n serverurl = str;// not used\n on_server = 1;\n connectserver();\n connecttwitchchat();\n twitch_timeout = 4000;\n break;\n // transmitting LioranBoard message to pubsub\n case '1':\n pubsubserver.send(str);\n break;\n // send api request\n case '2':\n apiconnect(str);\n break;\n // JSON string from LioranBoard\n case '3':\n LBExtensionReceived(str);\n if (LBDebugPost) LBDebugPost('receiver', event.data);\n break;\n // reload transmitter\n case '4':\n window.location.reload();\n break;\n // send stuff to twitch chat\n case '5':\n TwitchChatConnect.send(str);\n if (LBDebugPost) LBDebugPost('chatSent', str);\n break;\n }\n } else {\n console.log('Message received from LioranBoard is not a string.');\n }\n}", "function handleMessage(data,client){\n\t\t//var jsondata = '{\"sample\": \"data\", \"is\": \"great\", \"data\": [1, 2, 3, 4]}';\n\t\t//var obj = JSON.parse(jsondata);\n\t\t//console.log(obj.sample);\t\n\t\tvar obj;\n\t\tif(typeof data !== 'object'){\n\t\t\tconsole.log(\"error with an object\");\n\t\t\tobj = JSON.parse(data);\n\t\t}else{\n\t\t\tobj = data;\n\t\t}\n\n\t\tvar eventType = messageConfig[obj.id];\n\t\t\n\t\t//Check if this getting data by collection or other call\n\t\tif(data.hasOwnProperty(\"collection\")){\n\t\t\t\teventType(client, obj.collection);\n\t\t}else{\n\t\t\teventType(client);\n\t\t}\t\t\n\t}", "function onMessageArrived(message) {\r\n Men2Recv=message.payloadString;\r\n console.log(Men2Recv);\r\n accion(Men2Recv);\r\n}", "function change_topic() {\n\tif (numAnswered < chosenTopics.length - 1) {\n\t\t//update progress bar\n\t\tnumAnswered++; //global\n\t\tset_progress();\n\t\t//reset input in text area\n\t\tdocument.getElementById(\"answer-input\").value=\"\";\n\t\t//change topic in header\n\t\tdocument.getElementById(\"topic-text\").innerHTML = chosenTopics[numAnswered].topicText;\n\t\tif (numAnswered === chosenTopics.length - 1){\n\t\t\tdocument.getElementById(\"send-button\").innerHTML = \"Finish\";\n\t\t}\n\t}\n\telse {\n\t\tprepare_modal();\n\t}\n}" ]
[ "0.70958245", "0.70470303", "0.6819762", "0.6777956", "0.67053133", "0.65790987", "0.655018", "0.64549387", "0.639533", "0.6356727", "0.6309846", "0.6304678", "0.6277479", "0.6267934", "0.62505186", "0.6247735", "0.6242691", "0.62367207", "0.62294394", "0.61922187", "0.6187285", "0.61795545", "0.61720777", "0.6118974", "0.61149335", "0.6074435", "0.6043273", "0.60356414", "0.6016592", "0.6011474", "0.6009063", "0.6007624", "0.59875566", "0.5974436", "0.59735733", "0.5972019", "0.59552467", "0.5952789", "0.5939405", "0.5908372", "0.59059036", "0.5903285", "0.5902021", "0.58995056", "0.58993304", "0.5897744", "0.5896039", "0.58958125", "0.58808464", "0.58729583", "0.5871269", "0.58698833", "0.58330625", "0.5821702", "0.5820911", "0.58165807", "0.58160466", "0.58044475", "0.5781727", "0.57710665", "0.57642514", "0.57588774", "0.57563883", "0.5755212", "0.5751718", "0.5751476", "0.5751091", "0.57456696", "0.5728815", "0.5718873", "0.5718386", "0.57158524", "0.57088524", "0.5690355", "0.5688186", "0.5681883", "0.56808406", "0.5680662", "0.56784487", "0.56777525", "0.56718063", "0.56667787", "0.5666198", "0.56638134", "0.5661586", "0.5652453", "0.56498724", "0.56441694", "0.56361026", "0.5635771", "0.5631679", "0.5629178", "0.56282187", "0.5625124", "0.56238705", "0.56099373", "0.5601443", "0.5594439", "0.5593698", "0.5588591" ]
0.57930505
58
serviceAuth = 'Basic ' + Base64.encode(serviceUser + ':' + servicePassword); serviceAuth = 'Basic ' + serviceUser + ':' + servicePassword;
function make_base_auth(user, password) { var tok = user + ':' + password; var hash = btoa(tok); return 'Basic ' + hash; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildBasicAuth(username, password) {\n\tvar tok = username + ':' + password;\n\tvar hash = btoa(tok);\n\treturn \"Basic \" + hash;\n}", "createBasicAuthToken(username, password) {\n return 'Basic ' + window.btoa(username + \":\" + password)\n }", "function createBasicAuth(username, password) {\n return \"Basic \" + new Buffer(username + \":\" + password).toString(\"base64\");\n}", "function make_base_auth(user, password) {\r\n var tok = user + ':' + password;\r\n var hash = Base64.encode(tok);\r\n return \"Basic \" + hash;\r\n}", "function setBasicAuth(username, password) {\n var credentials = Utilities.base64Encode(username + \":\" + password);\n header_[AUTHORIZATION] = \"Basic \" + credentials;\n return credentials;\n }", "function buildHeader(username, password) {\n return 'basic ' + base64.encode(username + ':' + password);\n}", "executeBasicAuthenticationService(username, password) {\n let basicAuthHeader = this.createBasicAuthToken(username, password);\n return axios.get(`${API_URL}/basicauth`, {\n headers: { authorization: basicAuthHeader},\n });\n }", "function getOBAuth () {\r\n // debugger\r\n\r\n var clientID = 'yourUsername'\r\n var clientSecret = 'yourPassword'\r\n\r\n // Encoding as per Centro API Specification.\r\n var combinedCredential = clientID + ':' + clientSecret\r\n // var base64Credential = window.btoa(combinedCredential);\r\n var base64Credential = Buffer.from(combinedCredential).toString('base64')\r\n var readyCredential = 'Basic ' + base64Credential\r\n\r\n return readyCredential\n}", "function hashAuthhttp() {\n\tvar username = process.env.API_USER;\n\tvar password = process.env.API_PASS;\n\tvar auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');\n\treturn auth;\n}", "function make_base_auth(user, pass) {\n\t var tok = user + ':' + pass;\n\t var hash = btoa(tok);\n\t return \"Basic \" + hash;\n}", "generateCredentials () {\n // Generate the Basic Authentication header for a private instance of SLPDB.\n const username = 'BITBOX'\n const password = SLPDB_PASS\n const combined = `${username}:${password}`\n var base64Credential = Buffer.from(combined).toString('base64')\n var readyCredential = `Basic ${base64Credential}`\n\n const options = {\n headers: {\n authorization: readyCredential\n },\n timeout: 15000\n }\n\n return options\n }", "generateCredentialsGP () {\n // Generate the Basic Authentication header for a private instance of SLPDB.\n const username = 'BITBOX'\n const password = SLPDB_PASS_GP\n const combined = `${username}:${password}`\n // console.log(`combined: ${combined}`)\n var base64Credential = Buffer.from(combined).toString('base64')\n var readyCredential = `Basic ${base64Credential}`\n\n const options = {\n headers: {\n authorization: readyCredential\n },\n timeout: 15000\n }\n\n return options\n }", "function getBasicAuthenticationValue() {\r\n\t\r\n\tvar authString:String = sessionScope.get(\"connectionsUsername\") + \":\" + sessionScope.get(\"connectionsPassword\");\r\n\t//dBar.debug(\"auth string: \" + authString);\r\n\t\r\n\tvar authEncBytes = javax.xml.bind.DatatypeConverter.printBase64Binary(authString.getBytes());\r\n\t//dBar.debug(\"Base64 encoded auth string: \" + authEncBytes);\r\n\t\r\n\treturn \"Basic \" + authEncBytes;\r\n}", "function httpProveedores($httpProvider, $base64){\n var auth = $base64.encode(\"user:123456\");\n $httpProvider.defaults.headers.common = {};\n $httpProvider.defaults.headers.common['Authorization'] = 'Basic' + auth;\n $httpProvider.defaults.headers.post = {};\n $httpProvider.defaults.headers.put = {};\n $httpProvider.defaults.headers.patch = {}\n}", "function authHeaderVal(username, password) {\r\n\t\t var authString = username + ':' + password;\r\n\t\t var buffer = new Buffer(authString.toString(), 'binary');\r\n\t\t return 'Basic ' + buffer.toString('base64');\r\n\t\t}", "executeBasicAuthenticationService(userName, password) {\n console.log(\"inside the auth\")\n return axios.get(`${API_URL}/basicauth`,{ headers: { authorization: this.createBasicAuthToken(userName, password) } }).catch(\"invalid credentials\")\n \n }", "generateCredentialsWL () {\n // Generate the Basic Authentication header for a private instance of SLPDB.\n const username = 'BITBOX'\n const password = SLPDB_PASS_WL\n const combined = `${username}:${password}`\n // console.log(`combined: ${combined}`)\n var base64Credential = Buffer.from(combined).toString('base64')\n var readyCredential = `Basic ${base64Credential}`\n\n const options = {\n headers: {\n authorization: readyCredential\n },\n timeout: 15000\n }\n\n return options\n }", "function toAuth(email, password){\n // Concatenate email and password together\n let credentials = email + \":\" + password;\n\n // Convert to basic string\n return \"Basic \" + Buffer.from(credentials).toString('base64');\n}", "function getCredentials() {\n let concatenatedString = twittersecret.Key + \":\" + twittersecret.Secret;\n let base64encodedString =\n Buffer.from(concatenatedString).toString(\"base64\");\n return `Basic ${base64encodedString}`;\n}", "function getAuth(name, pwd) {\n var bytes = Crypto.charenc.Binary.stringToBytes(name+':'+pwd);\n var base64 = Crypto.util.bytesToBase64(bytes);\n return \"Basic \" + base64;\n}", "function getAuthHeader() {\n\tvar key = process.env.API_KEY,\n\tpass = process.env.API_PASS\n\t// Base 64 encode as required by MySportsFeed\n\tencrypted_creds = Buffer.from(key + ':' + pass).toString('base64');\n\n\treturn {'Authorization': 'Basic ' + encrypted_creds};\n}", "prepareRequest(options) {\n options.headers['Authorization'] =\n 'Basic ' + Buffer.from('PAT:' + this.token).toString('base64');\n }", "function authHeaderVal(username, password) {\n // Generate a value based on UN and PW to send with the header for authentication.\n var authString = username + ':' + password;\n var buffer = new Buffer(authString.toString(), 'binary');\n return 'Basic ' + buffer.toString('base64');\n}", "_getAuthHeaders() {\n if (!this.settings.authPrincipal && !this.settings.authCredentials) {\n throw new Error('Please set authPrincipal and authCredentials');\n }\n var combo = this.settings.authPrincipal + ':' + this.settings.authCredentials;\n var authHeader = 'Basic ' + btoa(unescape(encodeURIComponent(combo)));\n return authHeader;\n }", "async getTokenAuth(service) {\n\t\tconst date = new Date();\n\t\n\t\t// Tokent request authorization XML\n\t\tconst tra = (`<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\t\t<loginTicketRequest version=\"1.0\">\n\t\t\t<header>\n\t\t\t\t<uniqueId>${Math.floor(date.getTime() / 1000)}</uniqueId>\n\t\t\t\t<generationTime>${new Date(date.getTime() - 600000).toISOString()}</generationTime>\n\t\t\t\t<expirationTime>${new Date(date.getTime() + 600000).toISOString()}</expirationTime>\n\t\t\t</header>\n\t\t\t<service>${service}</service>\n\t\t</loginTicketRequest>`).trim();\n\n\t\t// Get cert from parameters\n\t\tconst certPromise = this.afip.CERT\n\t\t\t\n\t\t// Get key from parameters\n\t\tconst keyPromise = this.afip.PRIVATEKEY\n\n\t\t// Wait for cert and key content\n\t\tconst [cert, key] = await Promise.all([certPromise, keyPromise]);\n\n\t\t// Sign Tokent request authorization XML\n\t\tconst p7 = forge.pkcs7.createSignedData();\n\t\tp7.content = forge.util.createBuffer(tra, \"utf8\");\n\t\tp7.addCertificate(cert);\n\t\tp7.addSigner({\n\t\t\tauthenticatedAttributes: [{\n\t\t\t\ttype: forge.pki.oids.contentType,\n\t\t\t\tvalue: forge.pki.oids.data,\n\t\t\t}, \n\t\t\t{\n\t\t\t\ttype: forge.pki.oids.messageDigest\n\t\t\t}, \n\t\t\t{\n\t\t\t\ttype: forge.pki.oids.signingTime, \n\t\t\t\tvalue: new Date()\n\t\t\t}],\n\t\t\tcertificate: cert,\n\t\t\tdigestAlgorithm: forge.pki.oids.sha256,\n\t\t\tkey: key,\n\t\t});\n\t\tp7.sign();\n\t\tconst bytes = forge.asn1.toDer(p7.toAsn1()).getBytes();\n\t\tconst signedTRA = Buffer.from(bytes, \"binary\").toString(\"base64\");\n\n\t\t// SOAP Client options\n\t\tconst soapClientOptions = { disableCache:true, endpoint: this.afip.WSAA_URL };\n\n\t\t// Create SOAP client\n\t\tconst soapClient = await soap.createClientAsync(this.afip.WSAA_WSDL, soapClientOptions);\n\n\t\t// Arguments for soap client request \n\t\tconst loginArguments = { in0: signedTRA };\n\t\t\n\t\t// Call loginCms SOAP method\n\t\tconst [ loginCmsResult ] = await soapClient.loginCmsAsync(loginArguments)\n\n\t\t// Parse loginCmsReturn to JSON \n\t\tconst res = await xmlParser.parseStringPromise(loginCmsResult.loginCmsReturn); \n\n\t\treturn JSON.stringify(res.loginticketresponse)\n\t}", "function authentication (type) {\n \n return type === 'Basic'\n ? 'Basic ' + btoa(appKey + ':' + appSecret)\n : 'Kinvey ' + sessionStorage.getItem('authtoken');\n}", "function BasicAuth (apiKey, password) {\n var token = apiKey + ':' + password;\n this._token = {\n method: 'basic',\n token: token\n }\n}", "login_basic_auth(username, password, checkAuthCallback) {\n const loginPath = API_ROOT_URL + \"/auth\";\n const loginAndPassInBase64 = btoa(username + \":\" + password);\n const basicLoginAndPassInBase64 = \"Basic \" + loginAndPassInBase64;\n\n fetch(loginPath, {\n method: \"GET\",\n headers: {\n Authorization: basicLoginAndPassInBase64\n }\n })\n .then(response => {\n if (response.status === 200) {\n localStorage.setItem(authenticated, true);\n localStorage.setItem(BASIC_AUTH_CREDS, basicLoginAndPassInBase64);\n }\n\n checkAuthCallback();\n })\n .catch(e => console.error(e));\n }", "function authenticateBasic(credentials){\n let unBufferedCredentials = unBuffer(credentials);\n //unBufferedCredentials = {username,password}\n return User.authBasic(unBufferedCredentials)\n .then( response => {\n if(response.status){\n const user = response.payload;\n request.user = { id: user._id, username: user.username };\n request.token = user.generateToken();\n next();\n } else authError(response.payload);\n })\n .catch( error => authError(error));\n }", "function setAuthorization(){\n let username = '';\n let password = '';\n let authorization = Utilities.base64Encode(username + ':' + password);\n let userProperties = PropertiesService.getUserProperties();\n userProperties.setProperty('CAPWATCH_AUTHORIZATION', authorization);\n}", "function make_basic_auth_header(api_key) {\n // Heroku Basic Auth header comprises an empty username field and the API key\n var str = \":\" + api_key;\n var val = new Buffer(str).toString('base64');\n var header = {\"Authorization\":\"Basic \" + val};\n\n return header;\n}", "encodeLine(username, password) {\n username = username.substring(0, 255);\n password = password.substring(0, 255);\n return btoa(\"\\u0000\" + username + \"\\u0000\" + password); // base64 encode\n }", "function makeAuthorizationString (sBaseURL, sURLParameters, sUserSecret, oParameters) {\n\tvar oAPIData = {\n\t\tstatus: \"Hello World\"\n\t};\n\tvar sMethod = \"POST\",\n\t\t// sOrigin = oHeader.clientprotocol + \"://\" + oHeader[\"~server_name\"],\n\t\t// sBaseURL = sOrigin + \"/twitter/1.1/statuses/update.json\",\n// \t\tsBaseURL = dest.baseUrl,\n// \t\tsURLParameters = \"?include_entities=true\",\n\t\tsURL = sBaseURL + sURLParameters,\n\t\tsStatus = \"Hello world\",\n\t\tsIncludeEntities = \"true\",\n\t\tsConsumerKey = \"mjpp4cUeysMM0ruMjjPCjJMZc\",\n\t\tsNonce = randomString(32),\n\t\tsSignatureMethod = \"HMAC-SHA1\",\n\t\tsTimestamp = Math.floor(Date.now() / 1000) + \"\",\n\t\tsToken = \"\",\n\t\tsOAuthVersion = \"1.0\",\n\t\tsConsumerSecret = \"BZNucwCwizaARqNEZ1evQfgERP3tuBfqXGVI1nLz8CkaneMKmg\",\n\t\tsOAuthTokenSecret = sUserSecret || \"\";\n\t\t\n\tvar oOAuthKeys = {\n\t\tstatus: sStatus,\n\t\tinclude_entities: sIncludeEntities,\n\t\toauth_consumer_key: sConsumerKey,\n\t\toauth_nonce: sNonce,\n\t\toauth_signature_method: sSignatureMethod,\n\t\toauth_timestamp: sTimestamp,\n\t\toauth_token: sToken,\n\t\toauth_version: sOAuthVersion\n\t};\n\tvar aOAuthKeys = [];\n\tfor (var i in oOAuthKeys) {\n\t\taOAuthKeys.push(to_rfc3986(i) + \"=\" + to_rfc3986(oOAuthKeys[i]));\n\t}\n\taOAuthKeys.sort(function (a, b) {return a > b;});\n\tvar sOAuthKeys = aOAuthKeys.join(\"&\");\n\tvar sOAuthSignatureBaseString =\n\t\tsMethod + \"&\" +\n\t\tto_rfc3986(sBaseURL) + \"&\" +\n\t\tto_rfc3986(sOAuthKeys);\n\tvar sSigningKey = btoa(sConsumerSecret) + \"&\" + btoa(sOAuthTokenSecret);\n\treturn $.security.crypto.sha1(sOAuthSignatureBaseString, sSigningKey);\n}", "function BaseChannelAuth () {}", "function YCellular_set_apnAuth(username,password)\n {\n return this.set_apnSecret(\"\"+username+\",\"+password);\n }", "function makeAuth(type) {\n return type === 'basic'\n ? 'Basic ' + btoa(appKey + ':' + appSecret)\n : 'Kinvey ' + localStorage.getItem('authtoken');\n }", "function sendAuthData(uri, httpmethod, token, data, callback) {\r\n var requestbody = \"\";\r\n if (data) {\r\n requestbody = JSON.stringify(data);\r\n }\r\n request({\r\n url: uri,\r\n method: httpmethod,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n \"Authorization\": \"Bearer \" + token\r\n },\r\n body: requestbody\r\n }, function (error, response, body) {\r\n if (callback) {\r\n callback(error || response.statusCode, body);\r\n } else {\r\n if (error) {\r\n console.log(error);\r\n } else {\r\n console.log(response.statusCode, body);\r\n }\r\n }\r\n });\r\n}", "function AccountService($http) {\n this.Autenticate = function (user, password) {\n return $http.get(\"http://localhost:50837/\" + \"api/Account/Autenticate?user=\" + user + \"&password=\" + password).then(function (response) {\n return response\n }, function (response) {\n return alert(\"Erro: \" + response.status);\n });\n }\n}", "function AuthService(http) {\n this.http = http;\n }", "function AuthService(http) {\n this.http = http;\n }", "constructor (authToken) {\n super(restBaseURL, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'userName':'root',\n 'password':'Public123',\n 'primeIP':'10.105.41.226',\n 'macAddress':'fa:ab:ee:ee:cc:ff',\n 'xcoordinate':123,\n 'ycoordinate':123\n },\n });\n }", "function digestAuthRequest(method, url, username, password) {\n\n\tvar self = this;\n\n\tthis.nonce = null; // server issued nonce\n\tthis.realm = null; // server issued realm\n\tthis.qop = null; // \"quality of protection\" - '' or 'auth' or 'auth-int'\n\tthis.response = null; // hashed response to server challenge\n\tthis.nc = 1; // nonce count - increments with each request used with the same nonce\n\tthis.cnonce = null; // client nonce\n\n\t// requests\n\tthis.firstRequest;\n\tthis.request;\n\n\t// settings\n\tthis.timeout = 6000;\n\n\t// determine if a post, so that request will send data \n\tthis.post = false;\n\tif (method.toLowerCase() == 'post' || method.toLowerCase() == 'put') this.post = true;\n\n\t// start here\n\t// successFn - will be passed JSON data\n\t// errorFn - will be passed error status code\n\t// data - optional, for POSTS\n\tthis.request = function(successFn, errorFn, data) {\n\t\t// posts data as JSON if there is any\n\t\tif (data !== null) self.data = JSON.stringify(data);\n\t\tself.successFn = successFn;\n\t\tself.errorFn = errorFn;\n\n\t\tif (self.nonce == null) {\n\t\t\tself.unauthenticatedRequest(self.data);\n\t\t} else {\n\t\t\tself.authenticatedRequest();\n\t\t}\t\t\n\t}\n\tthis.unauthenticatedRequest = function(data) {\t\t\n\t\tself.firstRequest = new XMLHttpRequest();\n\t\tself.firstRequest.open(method, url, true);\n\t\tself.firstRequest.timeout = self.timeout;\n\t\t// if we are posting, add appropriate headers\n\t\tif (self.post) {\n\t\t\tself.firstRequest.setRequestHeader('Content-type', 'application/json');\n\t\t\tself.firstRequest.setRequestHeader('Content-length', self.data.length);\n\t\t\tself.firstRequest.setRequestHeader('Connection', 'close');\n\t\t}\n\t\tself.firstRequest.onreadystatechange = function() {\n\n\t\t\t// 2: received headers, 3: loading, 4: done\n\t\t\tif (self.firstRequest.readyState == 2) { \n\n\t\t\t\tvar responseHeaders = self.firstRequest.getAllResponseHeaders();\n\t\t\t\tresponseHeaders = responseHeaders.split('\\n');\n\t\t\t\t// get authenticate header\n\t\t\t\tvar digestHeaders;\n\t\t\t\tfor(var i = 0; i < responseHeaders.length; i++) {\n\t\t\t\t\tif (responseHeaders[i].match(/www-authenticate/i) != null) {\n\t\t\t\t\t\tdigestHeaders = responseHeaders[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (digestHeaders != null) {\n\t\t\t\t\t// parse auth header and get digest auth keys\n\t\t\t\t\tdigestHeaders = digestHeaders.split(':')[1];\n\t\t\t\t\tdigestHeaders = digestHeaders.split(',');\n\t\t\t\t\tfor(var i = 0; i < digestHeaders.length; i++) {\n\t\t\t\t\t\tvar keyVal = digestHeaders[i].split('=');\n\t\t\t\t\t\tvar key = keyVal[0];\n\t\t\t\t\t\tvar val = keyVal[1].replace(/\\\"/g, '').trim();\n\t\t\t\t\t\t// find realm\n\t\t\t\t\t\tif (key.match(/realm/i) != null) {\n\t\t\t\t\t\t\tself.realm = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// find nonce\n\t\t\t\t\t\tif (key.match(/nonce/i) != null) {\n\t\t\t\t\t\t\tself.nonce = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// find QOP\n\t\t\t\t\t\tif (key.match(/qop/i) != null) {\n\t\t\t\t\t\t\tself.qop = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// client generated keys\n\t\t\t\t\tself.cnonce = self.generateCnonce();\n\t\t\t\t\tself.nc++;\n\t\t\t\t\t// now we can make an authenticated request\n\t\t\t\t\t\n\t\t\t\t\tself.authenticatedRequest();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (self.firstRequest.readyState == 4) {\n\t\t\t\tif (self.firstRequest.status == 200) {\n\t\t\t\t\tif (self.firstRequest.responseText !== 'undefined') {\n\t\t\t\t\t\tif (self.firstRequest.responseText.length > 0) {\n\t\t\t\t\t\t\tself.successFn(JSON.parse(self.firstRequest.responseText));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.successFn();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// send\n\t\tif (self.post) {\n\t\t\t// in case digest auth not required\n\t\t\tself.firstRequest.send(self.data);\n\t\t} else {\n\t\t\tself.firstRequest.send();\n\t\t}\n\t\tconsole.log('[digestAuthRequest] Unauthenticated request to '+url);\n\t}\n\tthis.authenticatedRequest = function() {\n\n\t\tself.response = self.formulateResponse();\n\n\t\tself.request = new XMLHttpRequest();\n\t\tself.request.open(method, url, true);\n\t\tself.request.timeout = self.timeout;\n\t\tvar digestAuthHeader =\n\t\t\t'X-Digest username=\"'+username+'\", '+\n\t\t\t'realm=\"'+self.realm+'\", '+\n\t\t\t'nonce=\"'+self.nonce+'\", '+\n\t\t\t'uri=\"'+url+'\", '+\n\t\t\t'response=\"'+self.response+'\", '+\n\t\t\t'qop='+self.qop+', '+\n\t\t\t'nc='+('00000000' + self.nc).slice(-8)+', '+\n\t\t\t'cnonce=\"'+self.cnonce+'\"';\n\t\tself.request.setRequestHeader('Authorization', digestAuthHeader);\n\t\t// if we are posting, add appropriate headers\n\t\tif (self.post) {\n\t\t\tself.request.setRequestHeader('Content-type', 'application/json');\n\t\t\tself.request.setRequestHeader('Content-length', data.length);\n\t\t\tself.request.setRequestHeader('Connection', 'close');\n\t\t}\n\t\tself.request.onload = function() {\n\t\t\t\n\t\t\t// success\n \t\t\tif (self.request.status >= 200 && self.request.status < 400) {\n \t\t\t\t// increment nonce count\n\t\t\t\tself.nc++;\n\t\t\t\t// return JSON\n\t\t\t\tif (self.request.responseText !== 'undefined') {\t\t\t\t\t\n\t\t\t\t\tif (self.request.responseText.length > 0) {\n\t\t\t\t\t\tself.successFn(JSON.parse(self.request.responseText));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tself.successFn();\n\t\t\t\t}\n\t\t\t}\n\t\t\t// failure\n\t\t\telse {\n\t\t\t\tself.nonce = null;\n\t\t\t\tself.errorFn(self.request.status);\n\t\t\t}\n\t\t}\n\t\tself.request.onerror = function() { \n\t\t\tconsole.log('request error');\n\t\t\tself.nonce = null;\n\t\t\tself.errorFn(self.request.status);\n\t\t};\n\t\t// send\n\t\tif (self.post) {\n\t\t\tself.request.send(self.data);\n\t\t} else {\n\t\t\tself.request.send();\n\t\t}\n\t\tconsole.log('[digestAuthRequest] Authenticated request to '+url);\n\t}\n\t// hash response based on server challenge\n\tthis.formulateResponse = function() {\n\t\tvar HA1 = CryptoJS.MD5(username+':'+self.realm+':'+password).toString();\n\t\tvar HA2 = CryptoJS.MD5(method+':'+url).toString();\n\t\tvar response = CryptoJS.MD5(HA1+':'+\n\t\t\tself.nonce+':'+\n\t\t\t('00000000' + self.nc).slice(-8)+':'+\n\t\t\tself.cnonce+':'+\n\t\t\tself.qop+':'+\n\t\t\tHA2).toString();\n\t\treturn response;\n\t}\n\t// generate 16 char client nonce\n\tthis.generateCnonce = function() {\n\t\tvar characters = 'abcdef0123456789';\n\t\tvar token = '';\n\t\tfor (var i = 0; i < 16; i++) {\n\t\t\tvar randNum = Math.round(Math.random() * characters.length);\n\t\t\ttoken += characters.substr(randNum, 1);\n\t\t}\n\t\treturn token;\n\t}\n\tthis.abort = function() {\n\t\tif (self.firstRequest != null) {\n\t\t\tif (self.firstRequest.readyState != 4) self.firstRequest.abort();\n\t\t}\n\t\tif (self.request != null) {\n\t\t\tif (self.request.readyState != 4) self.request.abort();\n\t\t}\n\t}\n}", "function http_request(username, password) {\n\t\n\tvar httpClient = Ti.Network.createHTTPClient({\n\t onload: function(e) {\n\t Ti.API.info(\"Received text on load: \" + this.responseText);\n\t \n\t if (this.responseText.indexOf(\"Server Login\") > -1){\n\t \tTi.App.login=false;\n\t \talert(\"Please enter valid credentials\");\n\t \treturn false;\n\t }else{\n\t\t Ti.App.login = true;\n\t\t alert(\"login worked!\");\n\t\t return true;\n\t\t\t\t\n\t\t }\n\t },\n\t onerror: function(e) {\n\t Ti.API.error(\"Error is: \" + e.error);\n\t },\n\t timeout : 5000,\n\t});\n\t\n\tauthstr = 'Basic ' + Titanium.Utils.base64encode(username + ':' + password);\n\t\n\thttpClient.open(\"POST\",\"http://coelm2/TNdevelopment/mobile/EricaTest.nsf/HelloWorld.xsp\");\n\thttpClient.setRequestHeader(\"Authorization\", authstr);\n\thttpClient.setRequestHeader(\"Content-Type\", \"text/html; charset=utf-8\");\n\thttpClient.send();\t\n\n}", "performPRTGAPILogin() {\n var username = this.username;\n var passhash = this.passhash;\n var options = {\n method: 'GET',\n url: this.url + \"/getstatus.htm?id=0&username=\" + username + \"&passhash=\" + passhash\n };\n return this.backendSrv.datasourceRequest(options).then(response => {\n this.passhash = response;\n return response;\n });\n }", "get isBasicAuthentication(): boolean {\n const UNAUTHORIZED_RESPONSE_CODE = 401;\n return (\n this.isUnauthorized &&\n this.status === UNAUTHORIZED_RESPONSE_CODE &&\n this.response.error === \"No responseText\"\n );\n }", "function authservice_ajax_call(method, urlpath, params, withAuthorizedHeader, successCallback/*(response)*/, errorCallback/*(statusCode, statusText, responseJSON)*/) {\n\n // var url = ENDPOINT + urlpath;\n var url = ENDPOINT + urlpath;\n console.log('authservice_ajax_call(method, ' + urlpath + ')')\n console.log(url)\n console.log(params);\n console.log(\"vvvvvv calling vvvvvv\");\n // if (errorCallback) {\n // console.log('------- have an errorCallback')\n // } else {\n // console.log('------- no errorCallback - will use default')\n // }\n\n // See if this is an Angular AJAX call\n if (_$http) {\n // Call the API to get the product details\n // ZZZZ This should use JSONP, as some browsers do not support CORS.\n // ZZZZ Unfortunately JSONP does not support headers, so we need\n // ZZZZ to pass details either in the url or the data. i.e. the\n // ZZZZ server requires changes.\n\n\n /*\n * We'll use Angular's $http to call the authservice API.\n *\n * See https://docs.angularjs.org/api/ng/service/$http\n */\nconsole.log('*** Using Angular AJAX call');\n var req = {\n method: method,\n url: url,\n data: params\n };\n\n if (withAuthorizedHeader) {\n req.headers = {\n 'Authorization' : 'Bearer XYZ'\n };\n }\n\n _$http(req).then(function(response) { // success handler\n\n // Successful AJAX call.\n var data = response.data; // {string|Object} – The response body transformed with the transform functions.\n console.log('success:', data)\n return successCallback(data);\n\n }, function(response) { // error handler\n\n // Error during API call.\n var statusCode = response.status; // {number} – HTTP status code of the response.\n var statusText = response.statusText; // {string} – HTTP status text of the response.\n // var error = response.data; // Maybe an error object was returned.\n var responseJSON = response.data; // Maybe an error object was returned.\n if (errorCallback) {\n return errorCallback(statusCode, statusText, responseJSON);\n }\n\n // We have no error callback, so we'll report the error here and return null data.\n alert('An error occurred contacting Authservice.\\nSee the Javascript console for details.')\n console.log('statusCode:', response)\n console.log('statusText:', statusText)\n console.log('error:', error)\n return successCallback(null);\n });\n\n\n } else { // Use jQuery AJAX.\n\n // We don't have Angular's $http, so use jQuery AJAX.\n // See http://api.jquery.com/jquery.ajax/\nconsole.log('*** jQuery AJAX call (before)');\n var headers = { };\n if (withAuthorizedHeader) {\n headers.Authorization = 'Bearer XYZ';\n }\n\n var json = JSON.stringify(params)\n _jQuery.ajax({\n url: url,\n type: method, // Using CORS\n crossDomain: true,\n async: true,\n data: json,\n dataType: \"json\",\n headers: headers,\n contentType: 'application/json',\n success: function(response) {\n console.log('*** jQuery AJAX call (success)', response);\n\n // Successful AJAX call.\n return successCallback(response);\n },\n error: function(jqxhr, textStatus, errorThrown) {\n console.log('*** jQuery AJAX call (error)', jqxhr, textStatus, errorThrown);\n\n // Error during AJAX call.\n var statusCode = jqxhr.status; // {number} – HTTP status code of the response.\n var statusText = jqxhr.statusText; // {string} null, \"timeout\", \"error\", \"abort\", or \"parsererror\"\n var responseJSON = jqxhr.responseJSON;\n // var error = errorThrown; // {string} \"When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status.\"\n if (errorCallback) {\n return errorCallback(statusCode, statusText, responseJSON);\n }\n\n // We have no error callback, so we'll report the error here and return null data.\n alert('An error occurred contacting Authservice.\\nSee the Javascript console for details.')\n console.log('statusCode:', statusCode)\n console.log('statusText:', statusText)\n console.log('responseJSON:', responseJSON)\n // return successCallback(null);\n }\n });\n }\n }", "executeJwtAuthenticationService(username, password) {\n return axios.post(`${API_URL}/authenticate`, {\n username,\n password\n });\n }", "base64EncodedAuthInfo () {\n\t\treturn {\n\t\t\tclientID: this.authInfo.clientID,\n\t\t\tserverToken: this.authInfo.serverToken,\n\t\t\tclientToken: this.authInfo.clientToken,\n\t\t\tencKey: this.authInfo.encKey.toString('base64'),\n\t\t\tmacKey: this.authInfo.macKey.toString('base64')\n\t\t}\n\t}", "function curlCommandAssembler(strings, username, password) {\n return strings[0] + username + strings[1] + password + strings[2];\n}", "function addCredential() {\n if(window.icPatch) {\n post(window.icPatchUrl, {credential: JSON.stringify(window.icPatch)});\n }\n}", "function setCreds(evt) {\n const addressField = document.getElementById(\"address\");\n address = addressField.value;\n\n const userField = document.getElementById(\"username\");\n username = userField.value;\n\n requestUrl = 'http://' + address + '/api/' + username + '/';\n responseDiv.innerHTML = 'address: ' + address\n + '<br>username: ' + username;\n}", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }", "function addClientAuthorizationHeader(httpConfig) {\n httpConfig.headers = angular.extend(httpConfig.headers || {},{\n 'Authorization': 'Basic ' + base64.encode((config.meanSso.clientId || '') + ':' + (config.meanSso.clientSecret || ''))\n });\n return httpConfig;\n }", "executeJwtAuthenticationService(username, password){\n console.log(\"executeJwtAuthenticationService entered\")\n return axios.post(`${API_URL}/authenticate`,\n {\n username,\n password\n })\n\n }", "function getAuthToken( userType, result )\n{\n let dataJSON = {};\n if(userType == 'basic')\n {\n dataJSON = { \"username\": \"basic-thomas\",\n \"password\": \"sR-_pcoow-27-6PAwCD8\" };\n }\n else\n {\n dataJSON = { \"username\": \"premium-jim\",\n \"password\": \"GBLtTyq3E_UNjFnpo9m6\" };\n }\n\n let dataString = JSON.stringify(dataJSON);\n // prepare the header\n var postheaders = {\n 'Content-Type' : 'application/json',\n 'Content-Length' : Buffer.byteLength(dataString, 'utf8')\n };\n\n// the post options\nvar optionspost = {\n host : auth_server_url,\n port : auth_server_port,\n path : '/auth',\n method : 'POST',\n headers : postheaders\n};\n\nvar reqPost = http.request(optionspost, function(res) {\n res.on('data', function(d) {\n // console.log('POST result:\\n' + d);\n let tok = JSON.parse(d);\n result({status:'success', data:tok});\n });\n});\n\n// write the json data\nreqPost.write(dataString);\nreqPost.end();\nreqPost.on('error', function(e) {\n // console.log(e);\n result(null, {status:'failed', msg: e})\n});\n}", "function oauthService() {\n\n this.$get = function ($http, currentUserService, sessionService, formEncodeService, appConfig) {\n\n var url = appConfig.apiServiceBaseUri + \"token\";\n\n var processToken = function (username) {\n return function (response) {\n currentUserService.profile.username = username;\n currentUserService.profile.token = response.data.access_token;\n currentUserService.save();\n sessionService.login(username);\n return username;\n }\n };\n\n var login = function (username, password) {\n\n var configuration = {\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n }\n };\n\n var data = formEncodeService({\n username: username,\n password: password,\n //opCode: config.connectionBase.db,\n //applicationName: config.applicationName,\n //useWebConfig: !config.connectionBase.db,\n grant_type: \"password\"\n });\n\n return $http.post(url, data, configuration).then(processToken(username));\n\n };\n\n var logout = function () {\n currentUserService.profile.username = \"\";\n currentUserService.profile.token = \"\";\n currentUserService.remove();\n sessionService.logout();\n };\n\n return {\n login: login,\n logout: logout\n };\n }\n }", "function makeAuth(auth)\n {\n if(auth === 'basic')\n {\n //Ako e 'basic' vsuhtame obekta jelan ot kinvey\n return `Basic ${btoa(APP_KEY + ':' + APP_SECRET)}`;\n } \n else\n {\n //ako NE e 'basic' vrustha 'Basic' + authoken-a ot locationStorage ili ot sessionStorage\n return `Kinvey ${localStorage.getItem('authtoken')}`;\n }\n }", "function useCredentials(token) {\n //username = token.split('.')[0];\n isAuthenticated = true;\n authToken = token;\n\n // Set the token as header for your requests!\n\n // $http.defaults.headers.common['Authorization'] = 'Bearer '+token;\n }", "function makeConnectCall(connecturl, olapServerName, userName, password) {\n // Make a POST request with form data.\n // alert('makeconnectcall');\n try {\n\n\n Logger.log('makeConnectCall...');\n Logger.log(\"connecturl\" + connecturl);\n Logger.log(\"olapServerName\" + olapServerName);\n Logger.log(\"userName\" + userName);\n Logger.log(\"password\" + password);\n\n // Make a POST request with a JSON payload.\n var str = 'Bob Smith';\n\n var data = {\n \"userName\": userName,\n \"password\": password,\n \"olapServerName\": olapServerName,\n \"url\": connecturl\n };\n var options = {\n 'method': 'post',\n 'contentType': 'application/json',\n 'payload': JSON.stringify(data)\n };\n //var response = UrlFetchApp.fetch(SERVICE_BASE_URL+'login', options);\n var response = UrlFetchApp.fetch(SERVICE_BASE_URL+'login', options);\n // Logger.log(response.getContentText());\n Logger.log(response);\n\n documentProperties.setProperties(data);\n documentProperties.setProperty('isLoggedIn', 'TRUE');\n \n Logger.log('done with call..');\n \n return response.getContentText();\n } catch (error) {\n showErrorDialog(error);\n throw error;\n }\n}", "function send_access_token_request(authentication_cache, user_input, res){\n\tlet base64data = Buffer.from(`${credentials.client_id}:${credentials.client_secret}`).toString('base64');\n\tlet authorization = `Basic ${base64data}`;\n\t\n\tlet post_data = querystring.stringify({//convert js obj to query string format: grant_type=client_credentials&foo=abcn\n\t\t'grant_type':'client_credentials'\n\t});\n\tlet options = {\n\t\tmethod:'POST',\n\t\theaders:{\n\t\t\t'Content-Type':'application/x-www-form-urlencoded',\n\t\t\t'Authorization':authorization,\n\t\t\t'Content-Length':Buffer.byteLength(post_data)//find length of post_data\n\t\t}\n\t};\n\tconst token_endpoint = 'https://api.petfinder.com/v2/oauth2/token';\n\tlet auth_sent_time = new Date(); //create a new Date object which represents the current date and time as of the time of instantiation.\n\tlet authentication_req = https.request(token_endpoint, options, function (authentication_res){\n\t\treceived_authentication(authentication_cache, authentication_res, user_input, auth_sent_time, res);\n\t});\n\t\n\tauthentication_req.on('error', function(e){\n\t\tconsole.error(e);\n\t});\n\tconsole.log(\"Requesting Token\");\n\tauthentication_req.end(post_data);//because this is a POST request, querystring is placed into the body of the request\n}", "function apiURL(service) { //Función para formar la ruta completa a la API \n return BaseApiUrl + service;\n}", "function send_request(method, path, body, q_string, on_success, on_error) {\n\t// Signing request\n\tvar text = method + '::' + path + '::' + body\n\tvar hash = CryptoJS.HmacSHA1(text, secret);\n\tvar hashInBase64 = CryptoJS.enc.Base64.stringify(hash);\n\n\t// Sending request\n\tvar url = 'https://'+domain+path;\n\tif ( q_string ) {\n\t\turl += '?'+q_string; \n\t} \n\tvar xhr = new XMLHttpRequest();\n\txhr.open(method, url, true);\n\txhr.onload = function(res) { on_success(xhr.response); };\n\txhr.onerror = on_error;\n\txhr.withCredentials = false;\n\txhr.responseType = 'json';\n\txhr.setRequestHeader('Content-Type','application/json');\n\txhr.setRequestHeader('X-Gcmp-Application','reporting-1');\n\txhr.setRequestHeader('X-Gcmp-Acting',acting);\n\txhr.setRequestHeader('Authorization','GCMP '+key+':'+hashInBase64);\n\txhr.send(body);\n}", "constructor() {\n // this.service will bind the service to the class\n this.service = axios.create({\n baseURL: process.env.REACT_APP_BASE_URL,\n withCredentials: true\n })\n }", "AUTH(restLine) {\n var scheme = restLine.split(\" \")[0];\n if (scheme == \"GSSAPI\") {\n this._multiline = true;\n this._needGSSAPI = true;\n return \"+\";\n }\n return POP3_RFC5034_handler.prototype.AUTH.call(this, restLine); // call parent\n }", "api(path, method = 'GET', body = null, requiresAuth = false, credentials = null) { // parameters initialized with default values in case no values or undefined gets passed\n const url = config.apiBaseUrl + path; // configures request path using the base URL defined in config.js\n\n const options = { // sends a request with the HTTP method as well as the request headers and a stringified body\n method,\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n },\n };\n\n if (body !== null) {\n options.body = JSON.stringify(body);\n }\n\n if (requiresAuth) { // check if authorization is required\n const encodedCredentials = btoa(`${credentials.emailAddress}:${credentials.password}`); // encode the user credentials with btoa() method which creates a base-64 encoded ASCII string from a \"string\" of data\n options.headers['Authorization'] = `Basic ${encodedCredentials}`; // set the HTTP Authorization request header to the Basic Authentication type\n }\n return fetch(url, options);\n }", "constructor() {\n this._authService = new AuthService(); \n }", "checkAuth() { }", "function getAuthCode(mainResponse, baseUrl, clientId, clientSecret) {\n\tvar dataString = \"client_id=\" + clientId + \"&client_secret=\" + clientSecret + \"&grant_type=client_credentials\";\n\n var headers = {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n };\n\n\tvar options = {\n \t\thost: baseUrl,\n \t\tport: 443,\n \t\tpath: \"/authentication/v1/authenticate\",\n \t\tmethod: \"POST\",\n \t\theaders: headers\n\t};\n\n\tvar req = https.request(options, function(res) {\n \t\tres.setEncoding(\"utf8\");\n \t\tvar responseString = \"\";\n\n \t\tres.on(\"data\", function (data) {\n \t\tresponseString += data;\n \t\t});\n\n \t\tres.on(\"end\", function() {\n console.log(responseString);\n mainResponse.setHeader('Content-Type', 'application/json');\n mainResponse.setHeader('Access-Control-Allow-Origin', '*');\n mainResponse.send(responseString); // forward our response onto the original call from the browser app\n \t});\n });\n\n req.write(dataString);\n req.end();\n}", "constructor($resource) {\n\n // remote call\n this.remoteImsAPI = $resource('/im', {}, {\n logOnSaas: { method: 'POST', url: '/im/login' }\n });\n\n }", "function getAuthCode(mainResponse, baseUrl, clientId, clientSecret) {\n\tvar dataString = \"client_id=\" + clientId + \"&client_secret=\" + clientSecret + \"&grant_type=client_credentials\";\n\n var headers = {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n };\n\n\tvar options = {\n \t\thost: baseUrl,\n \t\tport: 443,\n \t\tpath: \"/authentication/v1/authenticate\",\n \t\tmethod: \"POST\",\n \t\theaders: headers,\n\n \t\t// only for dev!\n \t\trejectUnauthorized: false,\n requestCert: true,\n agent: false\n\t};\n\n\tvar req = https.request(options, function(res) {\n \t\tres.setEncoding(\"utf8\");\n \t\tvar responseString = \"\";\n\n \t\tres.on(\"data\", function (data) {\n \t\tresponseString += data;\n \t\t});\n\n \t\tres.on(\"end\", function() {\n console.log(responseString);\n mainResponse.setHeader('Content-Type', 'application/json');\n mainResponse.setHeader('Access-Control-Allow-Origin', '*');\n mainResponse.send(responseString); // forward our response onto the original call from the browser app\n \t});\n });\n\n req.write(dataString);\n req.end();\n}", "function getAuthCode(mainResponse, baseUrl, clientId, clientSecret) {\n\tvar dataString = \"client_id=\" + clientId + \"&client_secret=\" + clientSecret + \"&grant_type=client_credentials\";\n\n var headers = {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n };\n\n\tvar options = {\n \t\thost: baseUrl,\n \t\tport: 443,\n \t\tpath: \"/authentication/v1/authenticate\",\n \t\tmethod: \"POST\",\n \t\theaders: headers,\n\n \t\t// only for dev!\n \t\trejectUnauthorized: false,\n requestCert: true,\n agent: false\n\t};\n\n\tvar req = https.request(options, function(res) {\n \t\tres.setEncoding(\"utf8\");\n \t\tvar responseString = \"\";\n\n \t\tres.on(\"data\", function (data) {\n \t\tresponseString += data;\n \t\t});\n\n \t\tres.on(\"end\", function() {\n console.log(responseString);\n mainResponse.setHeader('Content-Type', 'application/json');\n mainResponse.setHeader('Access-Control-Allow-Origin', '*');\n mainResponse.send(responseString); // forward our response onto the original call from the browser app\n \t});\n });\n\n req.write(dataString);\n req.end();\n}", "constructor(config)\n {\n config.authorization = 'Basic ' + Convert.base64Encode(`${config['client_id']}:${config['client_secret']}`);\n config.baseURL = config.baseURL || 'https://api.hubtel.com';\n\n this.config = config;\n this.http = new HttpClient(this.config);\n }", "function _authenticateCredentails (callback) {\n\t_credentials.grant_type = 'password';\n\n\tif (!_access_token) {\n\t\t// OAuth to get an Axosoft access token\n\t\trest.get(_base_url + '/api/oauth2/token', {\n\t\t\tdata: _credentials\n\t\t})\n\t\t.on('complete', function (data, response) {\n\t\t\tif (data.access_token){\n\t\t\t\t_access_token = data.access_token;\n\t\t\t\tcallback(null);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Return an informative error object\n\t\t\t\tcallback({statusCode: response.statusCode, responseRaw: response.rawEncoded});\n\t\t\t}\n\t\t});\n\t}\n\telse {\n\t\tcallback(null);\n\t}\n}", "function authenticate(){\n // prepare URL, header, payload(body), and options\n var urlAUTH = 'https://api.teamgantt.com/v1/authenticate';\n var header = {\n 'TG-Authorization' : 'Bearer ' + PropertiesService.getUserProperties().getProperty('authKey'),\n }\n var body = {\n 'user' : PropertiesService.getUserProperties().getProperty('LOGIN'),\n 'pass' : PropertiesService.getUserProperties().getProperty('PASSWORD')\n }\n var options = {\n 'method' : 'post',\n 'contentType' : 'application/json',\n 'headers' : header,\n 'payload' : JSON.stringify(body)\n };\n // call the API and parse the data\n var response = UrlFetchApp.fetch(urlAUTH, options);\n var json = response.getContentText();\n var data = JSON.parse(json);\n // store api_key and user_token as global var\n if (data != null) {\n api_key = data[\"api_key\"];\n user_token = data[\"user_token\"];\n } else {\n Logger.log(\"Wrong user/pass\");\n }\n}", "authenticate(username, password, cb) {\n const self = this;\n request.post({\n url: this.url + '/api/authorization',\n json: { clientkey: username, passcode: password },\n }, function(err, resp, body) {\n if (resp.statusCode !== 200) {\n return cb(true, resp, body);\n }\n self.token = body.token;\n self.session = request.defaults({ auth: { bearer: self.token }, json: true });\n cb(err, resp, body);\n });\n }", "getAccessJwtAuthenticationService(username, password) {\n return axios.post(`${API_URL}/authenticate`, {\n username,\n password\n \n })\n }", "function Authenticate(data) {\n return data.username==\"santiago\"&&data.password==\"santiago\";\n}", "function authentication(callbackFunction) {\n var callbackAuth = function(response) {\n response.on('error', function(e) {\n writeLogs('error : ' + e);\n });\n var res = '';\n\n response.on('data', function(chunk) {\n res += chunk;\n });\n\n response.on('end', function() {\n try {\n res = JSON.parse(res);\n if (response.statusCode == '200') {\n access_token = res.access_token;\n refresh_token = res.refresh_token;\n scope = res.scope;\n writeLogs(\"Your access_token is: \" + access_token);\n writeLogs(\"Your refresh_token is: \" + refresh_token);\n writeLogs(\"Your scopes are: \" + scope);\n\n callbackFunction();\n } else {\n writeLogs('status code:', response.statusCode, '\\n', res);\n }\n } catch (err) {\n writeLogs(err);\n }\n });\n };\n\n var reqAuth = https.request(optionsAuth, callbackAuth);\n\n reqAuth.on('error', function(e) {\n writeLogs('There is a problem with your request:', e.message);\n });\n\n reqAuth.write(paramsAuth);\n reqAuth.end();\n}", "constructor(password, user, host, port) {\n\t\tthis.host = host || DEFAULT_HOST;\n\t\tthis.port = port || DEFAULT_PORT;\n\t\tthis.soap_url = `http://${this.host}:${this.port}/soap/server_sa/`;\n\t\tthis.username = user || DEFAULT_USER;\n\t\tthis.password = password || DEFAULT_PASSWORD;\n\t\tthis.sessionId = SESSION_ID;\n\t\tthis.logged_in = false;\n\t}", "function auth() {\n var url = 'http://158.38.101.146:8080/login?email=' + document.getElementById('email').value + \"&password=\" + document.getElementById('password').value;\n var client = new HttpClient();\n client.get(url, function (response) {\n document.getElementById(\"authResult\").innerHTML = response;\n });\n}", "function check_credentials(service_name){\n \tvar data = {\n \t\t'service': service_name\n \t};\n \tdata = JSON.stringify(data);\n \t$.ajaxSetup({\n\t\t\tbeforeSend: function(xhr){\n\t\t\t\txhr.setRequestHeader('X-CSRFToken', getCookie('csrftoken'));\n\t\t\t}\n\t\t});\n\t\t$.ajax({\n\t\t\turl: 'credential_check',\n\t\t\tdata: data,\n\t\t\ttype: 'POST',\n\t\t\tsuccess: function(response){\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tstatusCode:{\n\t\t\t\t500: function(){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n }", "_authenticateSingleConnection(sendAuthCommand, connection, credentials, callback) {\n const username = credentials.username;\n const password = credentials.password;\n const payload = new Binary(`\\x00${username}\\x00${password}`);\n const command = {\n saslStart: 1,\n mechanism: 'PLAIN',\n payload: payload,\n autoAuthorize: 1\n };\n\n sendAuthCommand(connection, '$external.$cmd', command, callback);\n }", "function ConsignorService(http) {\n this.http = http;\n }", "function auth() {\n \n var token = getParameterByName('token');\n var auth = getParameterByName('auth');\n if (auth == 'rest') {\n return authWithRest(token);\n } else {\n return authWithSDK(token);\n }\n}", "static get servicePath() {\n return 'securitycenter.googleapis.com';\n }", "constructor(username, password) {\n this.username = username;\n this.password = password;\n }", "function testAuth() {\n instance\n .authenticate(ip, { personalNumber: \"190101014801\" })\n .then((response) => {\n console.log(\"got order reference: \", response.orderRef);\n return instance.collect(response.orderRef, 1000, (status, hintCode) => {\n console.log(\"status, hintcode:\", status, hintCode);\n });\n })\n .then((result) => {\n console.log(\"auth result: \", result);\n })\n .catch((e) => {\n console.log(\"something went wrong\");\n console.error(e);\n });\n}", "function createUserAuthObj (userName, password)\n{\n var userObj = {};\n userObj['username'] = userName;\n userObj['password'] = password;\n return JSON.stringify(userObj);\n}", "constructor() {\r\n\r\n super()\r\n\r\n this._CLASSNAME = this.constructor.name\r\n\r\n try{\r\n this._BASIC_AUTH = __EMPOWER_WEBUI.USER.BASIC_AUTH\r\n }\r\n catch(e){\r\n console.error(this._CLASSNAME,\r\n \"init error (possible future malfunctioning):\",e)\r\n }\r\n this.REQUEST = null\r\n\r\n }", "getServiceInfos(service) {\n return this.OvhHttp.get(\n `${service.path}/${window.encodeURIComponent(\n service.serviceName,\n )}/serviceInfos`,\n {\n rootPath: 'apiv6',\n },\n ).then(\n (serviceInfos) =>\n new BillingService({\n ...service,\n ...serviceInfos,\n }),\n );\n }", "function setCredentials(request) {\n var creds = request.userPass;\n var username = creds.username;\n var password = creds.password;\n\n // Optional\n // Check if the provided username and password are valid through a\n // call to your service. You would have to have a `checkForValidCreds`\n // function defined for this to work.\n var validCreds = checkForValidCreds(username, password);\n if (!validCreds) {\n return {\n errorCode: \"INVALID_CREDENTIALS\"\n };\n }\n var userProperties = PropertiesService.getUserProperties();\n userProperties.setProperty('dscc.username', username);\n userProperties.setProperty('dscc.password', password);\n return {\n errorCode: \"NONE\"\n };\n}", "function get (url, callback) {\n var req = new XMLHttpRequest();\n req.onload = callback; \n req.open('GET', url, true);\n req.responseType = 'json';\n req.setRequestHeader(\n 'Authorization',\n 'Basic ' + btoa(creds.appID + ':' + creds.jsKey)\n );\n req.send(); \n}" ]
[ "0.7088766", "0.7082009", "0.7030507", "0.7011721", "0.68047553", "0.6800512", "0.67953736", "0.66620916", "0.66473603", "0.66141343", "0.64408183", "0.6409638", "0.6395443", "0.63856685", "0.63182425", "0.6290841", "0.622527", "0.6103436", "0.6092256", "0.6029161", "0.60215", "0.5854797", "0.583483", "0.5816131", "0.575449", "0.56970006", "0.5667311", "0.5617028", "0.55759925", "0.554429", "0.5513569", "0.54787517", "0.5420012", "0.5358296", "0.5342919", "0.5291399", "0.5289449", "0.5280224", "0.52645844", "0.52645844", "0.52070975", "0.52027845", "0.5166773", "0.51184887", "0.51149064", "0.5112491", "0.5108805", "0.51085055", "0.50982404", "0.5095678", "0.50716156", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.5070161", "0.50533015", "0.5052934", "0.50315815", "0.5019484", "0.50097936", "0.49966046", "0.49808002", "0.49748075", "0.4962858", "0.49501464", "0.494771", "0.49441287", "0.4933662", "0.4899616", "0.4897345", "0.48883337", "0.48864838", "0.48743248", "0.48743248", "0.48736313", "0.48568386", "0.4852647", "0.48499304", "0.48395327", "0.48330444", "0.4828548", "0.4825192", "0.48176938", "0.48005483", "0.47742864", "0.47707596", "0.47614002", "0.4744636", "0.47429243", "0.47366345", "0.4736487", "0.47332567", "0.47307512", "0.47300974", "0.4721079" ]
0.68925077
4
\\ Get Temperatura e humidade
function getTemperatureHumidity(){ $.ajax({ url: ipURL+'/HouseTempHumid', type: 'GET', cache: false, headers: { "Authorization": serviceAuth }, success:function(data){ temperatura = data.temperature; if(temperatura <= 0 || temperatura >=60){ temperatura = '-'; } $("#TemperatureContainer").text(temperatura+" ºC") }, error:function(data){ $("#TemperatureContainer").text("? ºC") console.log("Erro na leitura de temperatura e humidade") } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get temperature() {\n // convertimos los grados F a C\n this.temperature_F = 5 / 9 * (this.temperature_F - 32)\n return this.temperature_F;\n }", "function getTiempo() {\n\tvar date = new Date();\n\tvar time = date.getHours()+':'+\n\t\t\t date.getMinutes()+':'+\n\t\t\t date.getSeconds()+':'+\n\t\t\t date.getMilliseconds();\n\treturn time;\n}", "function getTemperature() {\n local supplyVoltage = hardware.voltage();\n local voltage = supplyVoltage * Temperature.read() / 65535.0;\n local c = (voltage - 0.5) * 100 ;\n local celsius = format(\"%.01f\", c);\n return(celsius);\n}", "get temperature() {\n return (5 / 9) * (this.fahrenheit - 32);\n }", "async function getTemperaturesIntensity() {\n // get temp upper safe level\n let upperArr = [];\n let upperData = await fetch('https://api.thingspeak.com/channels/866214/fields/5',\n {\n method: 'GET',\n })\n upperData = await upperData.json();\n let upperFeed = upperData.feeds.reverse().filter(e => e.field5 !== null && e.field5 !== undefined)\n let upper\n if (upperFeed.length === 0) upper = 50\n else upper = Number.parseInt(upperFeed[0].field5)\n for (let i = 0; i < 12; i++) upperArr.push(upper)\n // get temp below safe level\n let belowArr = [];\n let belowData = await fetch('https://api.thingspeak.com/channels/866214/fields/6',\n {\n method: 'GET',\n })\n belowData = await belowData.json()\n let belowFeed = belowData.feeds.reverse().filter(e => e.field6 !== null && e.field6 !== undefined)\n let below;\n if (belowFeed.length === 0) below = 10\n else below = Number.parseInt(belowFeed[0].field6)\n for (let i = 0; i < 12; i++) belowArr.push(below)\n const response = await fetch('https://api.thingspeak.com/channels/866214/fields/1',\n {\n method: 'GET',\n })\n let feeds = await response.json()\n let feedArr = feeds.feeds.reverse()\n feedArr = feedArr.filter(e => e.field1 !== null && e.field1 !== undefined).slice(0, 12);\n const minuteArr = feedArr.map(e => new Date(e.created_at).getHours() + 'h '\n + (new Date(e.created_at).getMinutes() < 10 ? ('0' + new Date(e.created_at).getMinutes())\n : new Date(e.created_at).getMinutes()));\n const tempsArr = feedArr.map(e => Number.parseFloat(e.field1));\n const lastDate = new Date(feedArr[0].created_at)\n const dateStr = lastDate.getDate() + \"/\" + (lastDate.getMonth() + 1) + \"/\" + lastDate.getFullYear()\n Highcharts.chart('tempChart', {\n chart: {\n type: 'line'\n },\n title: {\n text: 'My smart garden Temperature'\n },\n subtitle: {\n text: 'Date: ' + dateStr\n },\n xAxis: {\n categories: minuteArr.reverse()\n },\n yAxis: {\n title: {\n text: 'Temperature (°C)'\n }\n },\n plotOptions: {\n line: {\n dataLabels: {\n enabled: true\n },\n enableMouseTracking: false\n }\n },\n series: [{\n name: 'Nhiệt độ',\n color: \"#F08F00\",\n data: tempsArr.reverse()\n }, {\n name: 'Ngưỡng an toàn trên',\n color: \"#E94340\",\n data: upperArr\n },\n {\n name: 'Ngưỡng an toàn dưới',\n color: \"#51AD55\",\n data: belowArr\n }\n ]\n });\n}", "function measuredTemp(arr) {\n return tempFormat(8.66 + arr[2]);\n }", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "tempo() {\n return this.t\n }", "TE(){\n\t\tif(this.method == \"ASD\"){\n\t\t\treturn {Fb:0,Ft:0,Fv:0,Fc:0,Fcp:0,E:0,Emin:0,Z:0}\n\t\t}\n\t\telse{\n\t\t\tswitch(this.duration){\n\t\t\t\tcase ('DL'):\n\t\t\t\t\treturn {Fb:0.8,Ft:0.8,Fv:0.8,Fc:0.8,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('LL'):\n\t\t\t\t\treturn {Fb:0.8,Ft:0.8,Fv:0.8,Fc:0.8,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('SL'):\n\t\t\t\t\treturn {Fb:0.8,Ft:0.8,Fv:0.8,Fc:0.8,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('Const'):\n\t\t\t\t\treturn {Fb:1,Ft:1,Fv:1,Fc:1,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('WL'):\n\t\t\t\t\treturn {Fb:1,Ft:1,Fv:1,Fc:1,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('EL'):\n\t\t\t\t\treturn {Fb:1,Ft:1,Fv:1,Fc:1,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t\tcase ('Impact'):\n\t\t\t\t\treturn {Fb:1.25,Ft:1.25,Fv:1.25,Fc:1.25,Fcp:0,E:0,Emin:0,Z:1}\n\t\t\t\t\tbreak\n\t\t\t}//SWITCH\n\t\t}\n }", "function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano in questo istante a Greenwich.\n njd=jdHO(njd)+0.5; // g. g. a mezzogiorno di Greenwich.\n\nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar anno=jd_data(njd); // anno di riferimento.\n\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno[2],njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\n\n\nreturn valore_et\n\n}", "function getTemperature() {\n try {\n var weatherJson = storage.readJSON('weather.json');\n var weather = weatherJson.weather;\n return \"Temp: \" + Math.round(weather.temp - 273.15);\n } catch (ex) {\n return \"\";\n }\n}", "getTtl() {\n const exp = this.getExp();\n return Number.isNaN(exp) ? NaN : exp - Math.round(new Date().getTime() / 1000);\n }", "function getTemperature(tempUnits){\n $.getJSON(api, function(data){\n if (tempUnits ==\"celsius\"){\n var tempSulfix = \"C\";\n var temp = (data.current.temp_c);\n var feelslike = (data.current.feelslike_c);\n }\n else if (tempUnits == \"farenheit\"){\n var tempSulfix = \"F\";\n var temp = (data.current.temp_f);\n var feelslike = (data.current.feelslike_f);\n }\n document.getElementById(\"pTemp\").innerHTML = temp + \"&deg\" + tempSulfix;\n document.getElementById(\"pFeel\").innerHTML = feelslike + \"&deg\" + tempSulfix;\n });\n }", "temperature() {\n this.setup();\n\n // in order to read multiple bytes the high bit of the sub address must be asserted\n return twos_comp(this.i2c_bus.read_word_data(this.addr, TEMP_OUT_L|0x80), 12);\n }", "function o2ws_get_time() { return o2ws_get_float(); }", "function temperatureConversion(t, hardware) {\n console.assert(hardware);\n if (t==0 || t==4095) {\n return null; \n }\n var tempHWParam = 100000;\n if (hardware == \"hw33\") {\n tempHWParam = 10000;\n }\n // convert to raw volts \n const soilTempConverted1 = ((t/4095)*3.3);\n const soilTempConverted2 = ((soilTempConverted1*tempHWParam)/(3.3 - soilTempConverted1));\n const soilTempConverted3 = (Math.log(10000/soilTempConverted2))/(Math.log(2.71828));\n const soilTempConverted4 = 3380/((3380/298.15) - soilTempConverted3);\n const soilTemp = soilTempConverted4 - 273.15;\n return soilTemp.toFixed(2);\n}", "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "function getTemp(weatherData) {\n var tempKelvin = weatherData;\n // console.log(tempKelvin);\n var degFInt = Math.floor(tempKelvin);\n // console.log(degFInt);\n $temp2.html(degFInt + \"\\u00B0F\");\n}", "function getTemp(){\n execFile('./scripts/humidity', ['temp'], (error, stdout, stderr) => {\n if (error) {\n console.error('stderr', stderr);\n throw error;\n }\n console.log(stdout);\n readData.temp = stdout\n })\n}", "function temperature(params) {\n var temperature = params[0];\n return Math.floor(temperature) + \"°\";\n }", "function read_temps() {\r\n var url = \"/power/1week\";\r\n xmlhttp=new XMLHttpRequest();\r\n xmlhttp.onreadystatechange=function() {\r\n if (xmlhttp.readyState==4) {\r\n proc_get_thermal_resp();\r\n }\r\n }\r\n xmlhttp.open(\"GET\",url,true);\r\n xmlhttp.send();\r\n }", "function Temperatura(numero, unidad){\n //Atributos de la clase\n Medida.call(this,numero,unidad); //Llamada al constructor de la clase padre\n\n }", "function hmTos(heure, minute) {\n\t//je convertis les heures données en minutes\n\tlet htom = heure*60;\n\t//j'additionne ces minutes aux minutes données en param, multiplie le tout par 60 pour avoir le nombre de secondes, puis le retourne\n\treturn (htom + minute)*60;\n}", "function covertTemp(temp) {\n return{\n fahrenheit: temp,\n celsius: ((temp - 32)* (5/9)),\n kelvin: ((temp + 459.67)*(5/9))\n }\n}", "function us_getTempData(name) {\r\n\tif (document.getElementById(\"us_temp_info\").getAttribute(name)) {\r\n\t\tvar value = document.getElementById(\"us_temp_info\").getAttribute(name);\r\n\t\treturn value;\r\n\t} else {\r\n\t\treturn 0;\r\n\t}\t\r\n}", "function eq_tempo_data(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // algoritmo di P.D. SMITH.\n\n njd=jdHO(njd)+0.5; // riporta il g.g. della data al mezzogiorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno,njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function t(e,t,a,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[a][0]:r[a][1]}", "function t(e,t,a,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[a][0]:r[a][1]}", "function t(e,t,a,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[a][0]:r[a][1]}", "function calcularTextoTiempo(fecha){\r\n\t\tahora = new Date();\r\n\r\n\t\t// Calcula la diferencia de horas entre la fecha dada y la actual\r\n\t\t// para saber si se trata de las proximas 72 horas\r\n\t\thoras = ((fecha.getTime() - ahora.getTime()) / 1000 / 60 / 60);\r\n\t\thoras += ahora.getHours() + (ahora.getMinutes() / 60);\r\n\t\tif (horas < 24) tiempo_restante = T('HOY');\r\n\t\telse if (horas < 48) tiempo_restante = T('MANYANA');\r\n\t\telse if (horas < 72) tiempo_restante = T('PAS_MANYANA');\r\n\t\telse tiempo_restante = T('EL') + \" \" + LZ((fecha.getMonth()+1)) + \"/\" + LZ(fecha.getDate());\r\n\r\n\t\treturn tiempo_restante + \" \" + T('A_LAS') + \" \" + LZ(fecha.getHours()) + \":\" + LZ(fecha.getMinutes()) + \":\" + LZ(fecha.getSeconds());\r\n\t}", "async function measureTemperature() {\n try {\n const temperature = await bme680.temperatureSensor.read();\n console.log(`Temperature (degrees C): ${temperature}`);\n } catch(err) {\n console.error(`Failed to measure temperature: ${err}`);\n }\n}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,r,n){var i={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?i[r][0]:i[r][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function t(e,t,n,i){var r={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?r[n][0]:r[n][1]}", "function calcularTextoTiempo(fecha){\n\t\tahora = new Date();\n\n\t\t// Calcula la diferencia de horas entre la fecha dada y la actual\n\t\t// para saber si se trata de las proximas 72 horas\n\t\thoras = ((fecha.getTime() - ahora.getTime()) / 1000 / 60 / 60);\n\t\thoras += ahora.getHours() + (ahora.getMinutes() / 60);\n\t\tif (horas < 24) tiempo_restante = T('HOY');\n\t\telse if (horas < 48) tiempo_restante = T('MANYANA');\n\t\telse if (horas < 72) tiempo_restante = T('PAS_MANYANA');\n\t\telse tiempo_restante = T('EL') + \" \" + LZ(fecha.getDate()) + \"/\" + LZ((fecha.getMonth()+1));\n\n\t\treturn tiempo_restante + \" \" + T('A_LAS') + \" \" + LZ(fecha.getHours()) + \":\" + LZ(fecha.getMinutes());\n\t}", "async function getHumidityIntensity() {\n // get hum upper safe level\n let upperArr = [];\n let upperData = await fetch('https://api.thingspeak.com/channels/866214/fields/7',\n {\n method: 'GET',\n })\n upperData = await upperData.json();\n let upperFeed = upperData.feeds.reverse().filter(e => e.field7 !== null && e.field7 !== undefined)\n let upper\n if (upperFeed.length === 0) upper = 100\n else upper = Number.parseInt(upperFeed[0].field7)\n for (let i = 0; i < 12; i++) upperArr.push(upper)\n // get hum below safe level\n let belowArr = [];\n let belowData = await fetch('https://api.thingspeak.com/channels/866214/fields/8',\n {\n method: 'GET',\n })\n belowData = await belowData.json()\n let belowFeed = belowData.feeds.reverse().filter(e => e.field8 !== null && e.field8 !== undefined)\n let below\n if (belowFeed.length === 0) below = 50\n else below = Number.parseInt(belowFeed[0].field8)\n for (let i = 0; i < 12; i++) belowArr.push(below)\n const response = await fetch('https://api.thingspeak.com/channels/866214/fields/2',\n {\n method: 'GET',\n })\n let feeds = await response.json()\n let feedArr = feeds.feeds.reverse()\n feedArr = feedArr.filter(e => e.field2 !== null && e.field2 !== undefined).slice(0, 12);\n const minuteArr = feedArr.map(e => new Date(e.created_at).getHours() + ':'\n + (new Date(e.created_at).getMinutes() < 10 ? ('0' + new Date(e.created_at).getMinutes())\n : new Date(e.created_at).getMinutes()));\n const humsArr = feedArr.map(e => Number.parseFloat(e.field2))\n const lastDate = new Date(feedArr[0].created_at)\n const dateStr = lastDate.getDate() + \"/\" + (lastDate.getMonth() + 1) + \"/\" + lastDate.getFullYear()\n Highcharts.chart('humChart', {\n chart: {\n type: 'line'\n },\n title: {\n text: 'My smart garden Humidity'\n },\n subtitle: {\n text: 'Date: ' + dateStr\n },\n xAxis: {\n categories: minuteArr.reverse()\n },\n yAxis: {\n title: {\n text: 'Humidity'\n }\n },\n plotOptions: {\n line: {\n dataLabels: {\n enabled: true\n },\n enableMouseTracking: false\n }\n },\n series: [{\n name: 'Độ ẩm',\n color: \"#09B2C7\",\n data: humsArr.reverse()\n }, {\n name: 'Ngưỡng an toàn trên',\n color: \"#E94340\",\n data: upperArr\n },\n {\n name: 'Ngưỡng an toàn dưới',\n color: \"#51AD55\",\n data: belowArr\n }\n ]\n });\n}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,n,i){var a={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?a[n][0]:a[n][1]}", "function t(e,t,r,a){var n={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?n[r][0]:n[r][1]}", "function t(e,t,r,a){var n={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?n[r][0]:n[r][1]}", "function t(e,t,r,a){var n={m:[\"eine Minute\",\"einer Minute\"],h:[\"eine Stunde\",\"einer Stunde\"],d:[\"ein Tag\",\"einem Tag\"],dd:[e+\" Tage\",e+\" Tagen\"],w:[\"eine Woche\",\"einer Woche\"],M:[\"ein Monat\",\"einem Monat\"],MM:[e+\" Monate\",e+\" Monaten\"],y:[\"ein Jahr\",\"einem Jahr\"],yy:[e+\" Jahre\",e+\" Jahren\"]};return t?n[r][0]:n[r][1]}", "function convertTemp(t){\n\n return Math.round(((parseFloat(t)-273.15)*1.8)+32);\n\n}" ]
[ "0.67847294", "0.6759858", "0.65702516", "0.64672446", "0.6334757", "0.62835115", "0.6277494", "0.6275334", "0.6227557", "0.62077695", "0.6153436", "0.61393934", "0.61361945", "0.61347866", "0.60935813", "0.6065664", "0.60532993", "0.60480034", "0.60210997", "0.60024166", "0.59747815", "0.5964887", "0.59573007", "0.59492415", "0.59406906", "0.5915965", "0.5895206", "0.5895206", "0.5895206", "0.5887834", "0.5870095", "0.585276", "0.585276", "0.585276", "0.585276", "0.585276", "0.585276", "0.5850605", "0.5850605", "0.5850605", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.5846693", "0.58419764", "0.5826261", "0.5818386", "0.5818386", "0.5818386", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58080274", "0.58064777", "0.58064777", "0.58064777", "0.5806384" ]
0.6735801
2
\\ Get Status do sistema
function getSystemStatus(isDisplayMachinesDown){ $.ajax({ url: ipURL+'/systemStatus', type: 'GET', cache: false, headers: { "Authorization": serviceAuth }, success:function(data){ isSystemAlive = data.isSystemAllAlive; if(isSystemAlive == true){ $("#SystemNOKIcon").hide() $("#SystemOKIcon").show() }else{ $("#SystemOKIcon").hide() $("#SystemNOKIcon").show() $("#systemsDownNumber").text(data.systemsDown) machinesDownText = ""; machinesUpText = ""; if(isDisplayMachinesDown == true){ for (i = 0; i < data.Machines.length; i++) { if(data.Machines[i].Machine.isAlive == false){ machinesDownText += data.Machines[i].Machine.IP+ "\n"; }else{ machinesUpText += data.Machines[i].Machine.IP+ "\n"; } } if(machinesDownText != ""){ machinesDownText = "Máquinas em baixo:\n"+machinesDownText; } if(machinesUpText != ""){ machinesUpText = "Máquinas OK:\n"+machinesUpText; } alert(machinesDownText+"\n"+machinesUpText) } } }, error:function(data){ $("#SystemOKIcon").hide() $("#SystemNOKIcon").show() console.log("Erro na leitura de status de sistema") } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatus() {\n\tapi({ data: \"cmd=getstatus\" },syncStatus);\n}", "function get_system_status() {\n page = 'operator';\n var dataObj = {\n \"content\" : [ {\n \"session_id\" : get_cookie()\n } ]\n };\n call_server('get_system_status', dataObj);\n}", "function getStatusServer() {\r\n _doGet('/status');\r\n }", "function getSystemStatus() {\n requestUrl = 'http://' + address + '/api/' + username + '/';\n sendRequest('lights', 'GET');\n}", "async function getSystemStatus() {\n\n if (systemStatus.resync) {\n await setResyncDetails();\n }\n\n return systemStatus;\n}", "function GetStatusInfo(){\n showBackgroundImage('wait_message');\n getContent('','/cgi-bin/info.cgi?GetStatusInfo','function:SystemStatus');\n}", "status() {\r\n return this.request('GET', 'status/config');\r\n }", "function getStatus() {\n return status;\n }", "static get STATUS() {\n return 0;\n }", "function loadStatus() {\n const status = childProcess.execSync('expressvpn status').toString();\n const notConnected = status.includes('Not connected');\n const connecting = status.includes('Connecting');\n const connected = status.match(/Connected\\sto\\s(.*)/);\n if (notConnected) {\n return 'Not connected';\n } else if (connecting) {\n return 'Connecting...';\n } else if (connected && connected[1]) {\n return connected[1];\n }\n}", "function getStatus() {\n // TODO: perhaps remove this if no other status added\n return status;\n }", "queryStatus( cb = false ) {\n PythonShell.run( './Python/modules/status.py', ( err, results ) => {\n if ( err )\n throw err\n // FIXME: Log this result, but quieted for now:\n // electronicDebug(`rcvd (pyShellUserStatus): ${results}`);\n if ( cb )\n cb( results )\n } )\n }", "static getServerStatus(callback) {\n let apiPath = \"api/1.0/system/servers/status\";\n try {\n let params = {};\n Api.get(apiPath, params, results => {\n callback(super.returnValue(apiPath, results));\n });\n } catch (error) {\n callback(super.catchError(error));\n }\n }", "status() {\n if (this.statusListeners) {\n this.statusListeners.depend();\n }\n\n return this.currentStatus;\n }", "function check_status() {\n var open, ptotal, sample, pid, pname, line, match, tmp, i;\n\n // Handle operation disabled\n if (!controller.settings.en) {\n change_status(0,\"red\",\"<p class='running-text center'>\"+_(\"System Disabled\")+\"</p>\",function(){\n areYouSure(_(\"Do you want to re-enable system operation?\"),\"\",function(){\n showLoading(\"#footer-running\");\n send_to_os(\"/cv?pw=&en=1\").done(function(){\n update_controller(check_status);\n });\n });\n });\n return;\n }\n\n // Handle open stations\n open = {};\n for (i=0; i<controller.status.length; i++) {\n if (controller.status[i]) {\n open[i] = controller.status[i];\n }\n }\n\n if (controller.options.mas) {\n delete open[controller.options.mas-1];\n }\n\n // Handle more than 1 open station\n if (Object.keys(open).length >= 2) {\n ptotal = 0;\n\n for (i in open) {\n if (open.hasOwnProperty(i)) {\n tmp = controller.settings.ps[i][1];\n if (tmp > ptotal) {\n ptotal = tmp;\n }\n }\n }\n\n sample = Object.keys(open)[0];\n pid = controller.settings.ps[sample][0];\n pname = pidname(pid);\n line = \"<div><div class='running-icon'></div><div class='running-text'>\";\n\n line += pname+\" \"+_(\"is running on\")+\" \"+Object.keys(open).length+\" \"+_(\"stations\")+\" \";\n if (ptotal > 0) {\n line += \"<span id='countdown' class='nobr'>(\"+sec2hms(ptotal)+\" \"+_(\"remaining\")+\")</span>\";\n }\n line += \"</div></div>\";\n change_status(ptotal,\"green\",line,function(){\n changePage(\"#status\");\n });\n return;\n }\n\n // Handle a single station open\n match = false;\n for (i=0; i<controller.stations.snames.length; i++) {\n if (controller.settings.ps[i][0] && controller.status[i] && controller.options.mas !== i+1) {\n match = true;\n pid = controller.settings.ps[i][0];\n pname = pidname(pid);\n line = \"<div><div class='running-icon'></div><div class='running-text'>\";\n line += pname+\" \"+_(\"is running on station\")+\" <span class='nobr'>\"+controller.stations.snames[i]+\"</span> \";\n if (controller.settings.ps[i][1] > 0) {\n line += \"<span id='countdown' class='nobr'>(\"+sec2hms(controller.settings.ps[i][1])+\" \"+_(\"remaining\")+\")</span>\";\n }\n line += \"</div></div>\";\n break;\n }\n }\n\n if (match) {\n change_status(controller.settings.ps[i][1],\"green\",line,function(){\n changePage(\"#status\");\n });\n return;\n }\n\n // Handle rain delay enabled\n if (controller.settings.rd) {\n change_status(0,\"red\",\"<p class='running-text center'>\"+_(\"Rain delay until\")+\" \"+dateToString(new Date(controller.settings.rdst*1000))+\"</p>\",function(){\n areYouSure(_(\"Do you want to turn off rain delay?\"),\"\",function(){\n showLoading(\"#footer-running\");\n send_to_os(\"/cv?pw=&rd=0\").done(function(){\n update_controller(check_status);\n });\n });\n });\n return;\n }\n\n // Handle rain sensor triggered\n if (controller.options.urs === 1 && controller.settings.rs === 1) {\n change_status(0,\"red\",\"<p class='running-text center'>\"+_(\"Rain detected\")+\"</p>\");\n return;\n }\n\n // Handle manual mode enabled\n if (controller.settings.mm === 1) {\n change_status(0,\"red\",\"<p class='running-text center'>\"+_(\"Manual mode enabled\")+\"</p>\",function(){\n areYouSure(_(\"Do you want to turn off manual mode?\"),\"\",function(){\n showLoading(\"#footer-running\");\n send_to_os(\"/cv?pw=&mm=0\").done(function(){\n update_controller(check_status);\n });\n });\n });\n return;\n }\n\n $(\"#footer-running\").slideUp();\n}", "getNodeStatus() {\n return this.query('/status', 'GET')\n }", "async get() {\n await api.waitUntil('statusInitialized');\n return _converse.xmppstatus.get('status');\n }", "function getStatus(callback) {\n\tSiad.apiCall('/host', function(result) {\n\t\tupdateStatus(result, callback);\n\t});\n}", "function get_server_status() {\n var target = 'cgi_request.php';\n var data = {\n action: 'is_online'\n };\n var callback = parse_server_status;\n send_ajax_request(target, data, callback, true);\n}", "function status() {\n return list\n }", "static getHumanServerStatus(callback) {\n let apiPath = \"api/1.0/system/human-servers/status\";\n try {\n let params = {};\n Api.get(apiPath, params, results => {\n callback(super.returnValue(apiPath, results));\n });\n } catch (error) {\n callback(super.catchError(error));\n }\n }", "statusBuildinfo() {\r\n return this.request('GET', 'status/buildinfo');\r\n }", "statusRuntimeInfo() {\r\n return this.request('GET', 'status/runtimeinfo');\r\n }", "function statusCheck() {\n var statusLog = document.querySelector(\".status\");\n var status = response.status;\n console.log(status);\n\n statusLog.innerHTML += status;\n }", "function check_status() {\n YUI().use(\"io-base\", function(Y) {\n var url = M.cfg.wwwroot+'/local/rlsiteadmin/mass/addonstatus.php?addoncommand='+$response.file+'&hash='+$response.hash;\n var cfg = {\n method: 'GET',\n on: {\n success: function(id, o) {\n var $status = null;\n YUI().use('json-parse', function (Y) {\n try {\n $status = Y.JSON.parse(o.responseText);\n var status = \"waiting\";\n if ($status.running) {\n status = \"running\";\n } else if (!$status.running && $status.fileexists === false && $status.results) {\n status = \"completed\";\n }\n if (status != \"completed\") {\n update_modal(status);\n setTimeout(function() {\n check_status();\n }, 2000);\n } else {\n $response.results = $status.results;\n complete_feedback();\n }\n }\n catch (e) {\n Y.log(\"Parsing failed.\");\n }\n });\n },\n failure: function(c, o) {\n if (o.status == '503') {\n // Ignore failures caused by this site is upgrading messages.\n setTimeout(function() {\n check_status();\n }, 2000);\n return;\n }\n try {\n $status = Y.JSON.parse(o.responseText);\n complete_feedback();\n } catch (e) {\n // Some other error has occured. The progress bar will now stop moving.\n Y.log(\"Parsing failed.\");\n }\n }\n }\n };\n $addons = Y.io(url, cfg);\n });\n }", "function get_status() {\n var runningTotal = {},\n allPnames = [],\n color = \"\",\n list = \"\",\n tz = window.controller.options.tz-48;\n\n tz = ((tz>=0)?\"+\":\"-\")+pad((Math.abs(tz)/4>>0))+\":\"+((Math.abs(tz)%4)*15/10>>0)+((Math.abs(tz)%4)*15%10);\n \n var header = \"<span id='clock-s' class='nobr'>\"+(new Date(window.controller.settings.devt*1000).toUTCString().slice(0,-4))+\"</span> GMT \"+tz;\n\n runningTotal.c = window.controller.settings.devt;\n\n var master = window.controller.options.mas,\n ptotal = 0;\n\n var open = {};\n $.each(window.controller.status, function (i, stn) {\n if (stn) open[i] = stn;\n });\n open = Object.keys(open).length;\n\n if (master && window.controller.status[master-1]) open--;\n\n $.each(window.controller.stations.snames,function(i, station) {\n var info = \"\";\n if (master == i+1) {\n station += \" (\"+_(\"Master\")+\")\";\n } else if (window.controller.settings.ps[i][0]) {\n var rem=window.controller.settings.ps[i][1];\n if (open > 1) {\n if (rem > ptotal) ptotal = rem;\n } else {\n ptotal+=rem;\n }\n var remm=rem/60>>0,\n rems=rem%60,\n pid = window.controller.settings.ps[i][0],\n pname = pidname(pid);\n if (window.controller.status[i] && (pid!=255&&pid!=99)) runningTotal[i] = rem;\n allPnames[i] = pname;\n info = \"<p class='rem'>\"+((window.controller.status[i]) ? _(\"Running\") : _(\"Scheduled\"))+\" \"+pname;\n if (pid!=255&&pid!=99) info += \" <span id='countdown-\"+i+\"' class='nobr'>(\"+(remm/10>>0)+(remm%10)+\":\"+(rems/10>>0)+(rems%10)+\" \"+_(\"remaining\")+\")</span>\";\n info += \"</p>\";\n }\n if (window.controller.status[i]) {\n color = \"green\";\n } else {\n color = \"red\";\n }\n list += \"<li class='\"+color+\"'><p class='sname'>\"+station+\"</p>\"+info+\"</li>\";\n i++;\n });\n\n var footer = \"\";\n var lrdur = window.controller.settings.lrun[2];\n\n if (lrdur !== 0) {\n var lrpid = window.controller.settings.lrun[1];\n var pname= pidname(lrpid);\n\n footer = '<p>'+pname+' '+_('last ran station')+' '+window.controller.stations.snames[window.controller.settings.lrun[0]]+' '+_('for')+' '+(lrdur/60>>0)+'m '+(lrdur%60)+'s on '+(new Date(window.controller.settings.lrun[3]*1000).toUTCString().slice(0,-4))+'</p>';\n }\n\n if (ptotal) {\n var scheduled = allPnames.length;\n if (!open && scheduled) runningTotal.d = window.controller.options.sdt;\n if (open == 1) ptotal += (scheduled-1)*window.controller.options.sdt;\n allPnames = allPnames.getUnique();\n var numProg = allPnames.length;\n allPnames = allPnames.join(\" \"+_(\"and\")+\" \");\n var pinfo = allPnames+\" \"+((numProg > 1) ? _(\"are\") : _(\"is\"))+\" \"+_(\"running\")+\" \";\n pinfo += \"<br><span id='countdown-p' class='nobr'>(\"+sec2hms(ptotal)+\" remaining)</span>\";\n runningTotal.p = ptotal;\n header += \"<br>\"+pinfo;\n }\n\n var status = $(\"#status_list\");\n status.html(list);\n $(\"#status_header\").html(header);\n $(\"#status_footer\").html(footer);\n if (status.hasClass(\"ui-listview\")) status.listview(\"refresh\");\n window.totals = runningTotal;\n if (window.interval_id !== undefined) clearInterval(window.interval_id);\n if (window.timeout_id !== undefined) clearTimeout(window.timeout_id);\n\n changePage(\"#status\");\n if (window.totals.d !== undefined) {\n delete window.totals.p;\n setTimeout(get_status,window.totals.d*1000);\n }\n update_timers(window.controller.options.sdt);\n}", "get status() {\n return this._kernelStatus;\n }", "getStatus() {\n\t\treturn this.status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this.__status;\n\t}", "get status() {\n\t\treturn this._status;\n\t}", "requestCrostiniInstallerStatus() {}", "function getStatus() {\n return $mmCoursePrefetchDelegate.getModuleStatus(module, courseid, scorm.sha1hash, 0);\n }", "function get_status(callback) {\n csnLow();\n \n var buf1 = new Buffer(1);\n buf1[0] = consts.NOP;\n\n spi.transfer(buf1, new Buffer(1), function(device, buf) {\n csnHigh();\n callback(null,buf[0]);\n });\n\n }", "function checkOnlineStatus(){\n status = navigator.onLine;\n return status;\n }", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "get status () {\n\t\treturn this._status;\n\t}", "function getStatus(req, res) {\n var status = '';\n\t\n status += 'Current Tasks:' + '\\n';\n status += JSON.stringify(currentTasks,null,2) + '\\n';\n\n status += 'Task Queue:' + '\\n';\n status += JSON.stringify(taskQueue,null,2) + '\\n';\n\n status += 'Completed Tasks:' + '\\n';\n status += JSON.stringify(completedTasks,null,2) + '\\n';\n\n res.send(status).end();\n}", "function get_status() {\n var page = $(\"#status\"),\n runningTotal = {},\n allPnames = [],\n color = \"\",\n list = \"\",\n weatherInfo = \"\",\n lastCheck;\n\n // Clear page content on reload\n if ($.mobile.pageContainer.pagecontainer(\"getActivePage\").attr(\"id\") === \"status\") {\n page.find(\".ui-content\").empty();\n }\n\n // Bind delegate handler to stop specific station (supported on firmware 2.1.0+ on Arduino)\n page.off(\"click\",\"li\").on(\"click\",\"li\",function(){\n var el = $(this),\n station = el.index(),\n currentStatus = controller.status[station],\n question;\n\n if (checkOSVersion(210)) {\n if (currentStatus) {\n question = _(\"Do you want to stop the selected station?\");\n } else {\n if (el.find(\"span.nobr\").length) {\n question = _(\"Do you want to unschedule the selected station?\");\n } else {\n return;\n }\n }\n areYouSure(question,controller.stations.snames[station],function(){\n send_to_os(\"/cm?sid=\"+station+\"&en=0&pw=\").done(function(){\n refresh_status();\n showerror(_(\"Station has been stopped\"));\n });\n });\n }\n });\n\n // Bind the refresh button\n page.find(\"div[data-role='header'] > .ui-btn-right\").off(\"click\").on(\"click\",refresh_status);\n\n // Display the system time\n var header = \"<span id='clock-s' class='nobr'>\"+dateToString(new Date(controller.settings.devt*1000))+\"</span>\";\n\n // For OSPi, show the current device temperature\n if (typeof controller.settings.ct === \"string\" && controller.settings.ct !== \"0.0\" && typeof controller.settings.tu === \"string\") {\n header += \" <span>\"+controller.settings.ct+\"&deg;\"+controller.settings.tu+\"</span>\";\n }\n\n // Set the time for the header to the device time\n runningTotal.c = controller.settings.devt;\n\n var master = controller.options.mas,\n ptotal = 0;\n\n // Determine total count of stations open excluding the master\n var open = {};\n $.each(controller.status, function (i, stn) {\n if (stn > 0) {\n open[i] = stn;\n }\n });\n open = Object.keys(open).length;\n\n if (master && controller.status[master-1]) {\n open--;\n }\n\n $.each(controller.stations.snames,function(i, station) {\n var info = \"\";\n\n // Check if station is master\n if (master === i+1) {\n station += \" (\"+_(\"Master\")+\")\";\n } else if (controller.settings.ps[i][0]) {\n // If not, get the remaining time for the station\n var rem=controller.settings.ps[i][1];\n if (open > 1) {\n // If concurrent stations, grab the largest time to be used as program time\n if (rem > ptotal) {\n ptotal = rem;\n }\n } else {\n // Otherwise, add all of the program times together except for a manual program with a time of 1s\n if (controller.settings.ps[i][0] !== 99 && rem !== 1) {\n ptotal+=rem;\n }\n }\n\n var pid = controller.settings.ps[i][0],\n pname = pidname(pid);\n\n // If the station is running, add it's remaining time for updates\n if (controller.status[i] && rem > 0) {\n runningTotal[i] = rem;\n }\n\n // Save program name to list of all program names\n allPnames[i] = pname;\n\n // Generate status line for station\n info = \"<p class='rem center'>\"+((controller.status[i] > 0) ? _(\"Running\")+\" \"+pname : _(\"Scheduled\")+\" \"+(controller.settings.ps[i][2] ? _(\"for\")+\" \"+dateToString(new Date(controller.settings.ps[i][2]*1000)) : pname));\n if (rem>0) {\n // Show the remaining time if it's greater than 0\n info += \" <span id='countdown-\"+i+\"' class='nobr'>(\" + sec2hms(rem) + \" \"+_(\"remaining\")+\")</span>\";\n }\n info += \"</p>\";\n }\n\n // If the station is on, give it color green otherwise red\n if (controller.status[i] > 0) {\n color = \"green\";\n } else {\n color = \"red\";\n }\n\n // Append the station to the list of stations\n list += \"<li class='\"+color+(isStationDisabled(i) ? \" hidden\" : \"\")+\"'><p class='sname center'>\"+station+\"</p>\"+info+\"</li>\";\n });\n\n var footer = \"\";\n var lrdur = controller.settings.lrun[2];\n\n // If last run duration is given, add it to the footer\n if (lrdur !== 0) {\n var lrpid = controller.settings.lrun[1];\n var pname= pidname(lrpid);\n\n footer = \"<p>\"+pname+\" \"+_(\"last ran station\")+\" \"+controller.stations.snames[controller.settings.lrun[0]]+\" \"+_(\"for\")+\" \"+(lrdur/60>>0)+\"m \"+(lrdur%60)+\"s \"+_(\"on\")+\" \"+dateToString(new Date(controller.settings.lrun[3]*1000))+\"</p>\";\n }\n\n // Display header information\n if (ptotal > 1) {\n // If a program is running, show which specific programs and their collective total\n var scheduled = allPnames.length;\n if (!open && scheduled) {\n runningTotal.d = controller.options.sdt;\n }\n if (open === 1) {\n ptotal += (scheduled-1)*controller.options.sdt;\n }\n allPnames = getUnique($.grep(allPnames,function(n){return(n);}));\n var numProg = allPnames.length;\n allPnames = allPnames.join(\" \"+_(\"and\")+\" \");\n var pinfo = allPnames+\" \"+((numProg > 1) ? _(\"are\") : _(\"is\"))+\" \"+_(\"running\")+\" \";\n pinfo += \"<br><span id='countdown-p' class='nobr'>(\"+sec2hms(ptotal)+\" \"+_(\"remaining\")+\")</span>\";\n runningTotal.p = ptotal;\n header += \"<br>\"+pinfo;\n } else if (controller.settings.rd) {\n // Display a rain delay when active\n header +=\"<br>\"+_(\"Rain delay until\")+\" \"+dateToString(new Date(controller.settings.rdst*1000));\n } else if (controller.options.urs === 1 && controller.settings.rs === 1) {\n // Show rain sensor status when triggered\n header +=\"<br>\"+_(\"Rain detected\");\n }\n\n if (checkOSVersion(210)) {\n weatherInfo = \"<div class='ui-grid-b status-daily'>\";\n weatherInfo += \"<div class='center ui-block-a'>\"+controller.options.wl+\"%<br>Water Level</div>\";\n weatherInfo += \"<div class='center ui-block-b'>\"+pad(parseInt(controller.settings.sunrise/60)%24)+\":\"+pad(controller.settings.sunrise%60)+\"<br>Sunrise</div>\";\n weatherInfo += \"<div class='center ui-block-c'>\"+pad(parseInt(controller.settings.sunset/60)%24)+\":\"+pad(controller.settings.sunset%60)+\"<br>Sunset</div>\";\n weatherInfo += \"</div>\";\n }\n\n page.find(\".ui-content\").append(\n $(\"<p class='smaller center'></p>\").html(header),\n weatherInfo,\n $(\"<ul data-role='listview' data-inset='true' id='status_list'></ul>\").html(list).listview(),\n $(\"<p class='smaller center'></p>\").html(footer)\n );\n\n removeTimers();\n\n page.one(\"pagehide\",function(){\n removeTimers();\n page.find(\".ui-header > .ui-btn-right\").off(\"click\");\n page.find(\".ui-content\").empty();\n });\n\n if (runningTotal.d !== undefined) {\n delete runningTotal.p;\n setTimeout(refresh_status,runningTotal.d*1000);\n }\n\n lastCheck = new Date().getTime();\n interval_id = setInterval(function(){\n var now = new Date().getTime(),\n currPage = $(\".ui-page-active\").attr(\"id\"),\n diff = now - lastCheck;\n\n if (diff > 3000) {\n clearInterval(interval_id);\n if (currPage === \"status\") {\n refresh_status();\n }\n }\n lastCheck = now;\n $.each(runningTotal,function(a,b){\n if (b <= 0) {\n delete runningTotal[a];\n if (a === \"p\") {\n if (currPage === \"status\") {\n refresh_status();\n } else {\n clearInterval(interval_id);\n return;\n }\n } else {\n $(\"#countdown-\"+a).parent(\"p\").text(_(\"Station delay\")).parent(\"li\").removeClass(\"green\").addClass(\"red\");\n if (timeout_id !== undefined) {\n clearTimeout(timeout_id);\n }\n timeout_id = setTimeout(refresh_status,(controller.options.sdt || 5)*1000);\n }\n } else {\n if (a === \"c\") {\n ++runningTotal[a];\n $(\"#clock-s\").text(dateToString(new Date(runningTotal[a]*1000)));\n } else {\n --runningTotal[a];\n $(\"#countdown-\"+a).text(\"(\" + sec2hms(runningTotal[a]) + \" \"+_(\"remaining\")+\")\");\n }\n }\n });\n },1000);\n}", "get status() {\n return privates.get(this).status;\n }", "function checkStatus() {\n\n }", "function getTransactionStatus(typeGrp,type,statusGrp,status) {\n\t\t\tvar params = 'typeGrp=' + typeGrp + '&type=' + type + '&statusGrp=' + statusGrp + '&status=' + status;\n//\t\t\tconsole.log(params);\t\t\t\n\t\t\treturn Utils.requestAPI('v5a/admin/availableStatus?_method=GET&', params);\n\t\t}", "function node_status(node, is_sysop, options, num)\n{\n\tvar node_status = node.status;\n\tvar misc = node.misc;\n\tvar output = '';\n\n\tswitch(node_status) {\n\t\tcase NODE_QUIET:\n\t\t\tif(!is_sysop)\n\t\t\t\treturn format(NodeStatus[NODE_WFC],node.aux);\n\t\t\t/* Fall-through */\n\t\tcase NODE_INUSE:\n\t\t{\n\t\t\tif(misc&NODE_EXT) {\n\t\t\t\toutput += extended_status(num);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar user = new User(node.useron);\n\n\t\t\tif(options.username_prefix)\n\t\t\t\toutput += options.username_prefix;\n\t\t\tif(js.global.bbs && (misc&NODE_ANON) && !is_sysop)\n\t\t\t\toutput += bbs.text(UNKNOWN_USER);\n\t\t\telse\n\t\t\t\toutput += user.alias;\n\t\t\tif(options.status_prefix)\n\t\t\t\toutput += options.status_prefix;\n\t\t\toutput += user_age_and_gender(user, options);\n\t\t\toutput += \" \";\n\t\t\tswitch(node.action) {\n\t\t\t\tcase NODE_PCHT:\n\t\t\t\t\tif(node.aux == 0)\n\t\t\t\t\t\toutput += NodeAction[NODE_LCHT];\n\t\t\t\t\telse\n\t\t\t\t\t\toutput += format(NodeAction[node.action], node.aux);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NODE_XTRN:\n\t\t\t\t\tif(node.aux)\n\t\t\t\t\t\toutput += \"running \" + xtrn_name(user.curxtrn);\n\t\t\t\t\telse\n\t\t\t\t\t\toutput += format(NodeAction[node.action], node.aux);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\toutput += format(NodeAction[node.action], node.aux);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(options.connection_prefix)\n\t\t\t\toutput += options.connection_prefix;\n\t\t\toutput += node_connection_desc(node);\n\t\t\tbreak;\n\t\t}\n\t\tcase NODE_LOGON:\n\t\tcase NODE_NEWUSER:\n\t\t\toutput += format(NodeStatus[node_status], node.aux);\n\t\t\toutput += node_connection_desc(node);\n\t\t\tbreak;\n\t\tcase NODE_LOGOUT:\n\t\t\toutput += NodeStatus[node_status];\n\n\t\t\tif(options.username_prefix)\n\t\t\t\toutput += options.username_prefix;\n\t\t\tif(js.global.bbs && (misc&NODE_ANON) && !is_sysop)\n\t\t\t\toutput += bbs.text(UNKNOWN_USER);\n\t\t\telse\n\t\t\t\toutput += system.username(node.useron);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\toutput += format(NodeStatus[node_status], node.aux);\n\t\t\tbreak;\n\t}\n\n\toutput += node_misc(node, is_sysop);\n\n\tif(node.errors && is_sysop) {\n\t\tif(options.errors_prefix)\n\t\t\toutput += options.errors_prefix;\n\t\toutput += format(\" %d error%s\", node.errors, node.errors > 1 ? \"s\" : \"\");\n\t}\n\treturn output;\n}", "async getSysInfo() {\n let response = await this.get('/api/slot/0/sysInfo');\n return Object.assign({}, response.sysInfo.device[0],\n response.sysInfo.network.LAN);\n }", "function getSystem()\n{\n\tvar system = new Array([111,'1号平台','门户服务器'], [111,'1号平台','上游服务器'], [111,'1号平台','下游服务器'], [111,'1号平台','内容传输服务器']);\n\treturn system;\n}", "function check_status() {\n if (!window.controller.settings.en) {\n change_status(0,window.controller.options.sdt,\"red\",\"<p id='running-text' style='text-align:center'>\"+_(\"System Disabled\")+\"</p>\");\n return;\n }\n\n if (window.controller.settings.rd) {\n change_status(0,window.controller.options.sdt,\"red\",\"<p id='running-text' style='text-align:center'>\"+_(\"Rain delay until\")+\" \"+(new Date(window.controller.settings.rdst*1000).toUTCString().slice(0,-4))+\"</p>\");\n return;\n }\n\n if (window.controller.settings.urs && window.controller.settings.rs) {\n change_status(0,window.controller.options.sdt,\"red\",\"<p id='running-text' style='text-align:center'>\"+_(\"Rain detected\")+\"</p>\");\n return;\n }\n\n // Handle open stations\n var open = {};\n $.each(window.controller.status, function (i, stn) {\n if (stn) open[i] = stn;\n });\n\n if (window.controller.options.mas) delete open[window.controller.options.mas-1];\n\n // Handle more than 1 open station\n if (Object.keys(open).length >= 2) {\n var ptotal = 0;\n $.each(open,function (key){\n var tmp = window.controller.settings.ps[key][1];\n if (tmp > ptotal) ptotal = tmp;\n });\n\n var sample = Object.keys(open)[0],\n pid = window.controller.settings.ps[sample][0],\n pname = pidname(pid),\n line = \"<img id='running-icon' width='11px' height='11px' src='img/running.png' /><p id='running-text'>\";\n\n line += pname+\" \"+_(\"is running on\")+\" \"+Object.keys(open).length+\" \"+_(\"stations\")+\" \";\n if (pid!=255&&pid!=99) line += \"<span id='countdown' class='nobr'>(\"+sec2hms(ptotal)+\" \"+_(\"remaining\")+\")</span>\";\n line += \"</p>\";\n change_status(ptotal,window.controller.options.sdt,\"green\",line);\n return;\n }\n\n // Handle a single station open\n var match = false,\n i = 0;\n $.each(window.controller.stations.snames,function (station,name){\n if (window.controller.settings.ps[i][0] && window.controller.status[i] && window.controller.options.mas != i+1) {\n match = true;\n var pid = window.controller.settings.ps[i][0],\n pname = pidname(pid),\n line = \"<img id='running-icon' width='11px' height='11px' src='img/running.png' /><p id='running-text'>\";\n line += pname+\" \"+_(\"is running on station\")+\" <span class='nobr'>\"+name+\"</span> \";\n if (pid!=255&&pid!=99) line += \"<span id='countdown' class='nobr'>(\"+sec2hms(window.controller.settings.ps[i][1])+\" \"+_(\"remaining\")+\")</span>\";\n line += \"</p>\";\n change_status(window.controller.settings.ps[i][1],window.controller.options.sdt,\"green\",line);\n return false;\n }\n i++;\n });\n\n if (match) return;\n\n if (window.controller.settings.mm) {\n change_status(0,window.controller.options.sdt,\"red\",\"<p id='running-text' style='text-align:center'>\"+_(\"Manual mode enabled\")+\"</p>\");\n return;\n }\n\n $(\"#footer-running\").slideUp();\n}", "function getStatus () // string\n{\n if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)\n return \"STATUS,-1,Initializing\";\n else\n return webphone_api.plhandler.GetStatus();\n}", "async function status (workingDir) {\n const git = require('simple-git/promise');\n\n let statusSummary = null;\n try {\n statusSummary = await git(workingDir).status();\n }\n catch (e) {\n // handle the error\n }\n\n return statusSummary;\n}", "function updateStatus () {\n get('services', function (services) {\n dataPackageCache = makeUpdatePackage(services);\n console.log('%s: Sending update.', new Date());\n sendUpdate(dataPackageCache);\n });\n}", "getStatus() {\n return this.status;\n }", "getCurrentStatus() {\n // update state before returning status -- required since setBootDependencyState may have made node changes\n this.iterativelySetAllGraphStates(this.graph);\n let status = new DGGraphStatus(this.graphState, this.bootConfig, this.readyToStartList, this.errorDiag);\n return (status);\n }", "getstatus() {\n return { message: this._message, errors_exists: this._errors_exists };\n }", "function getStatus() {\n sendAuthReq('GET', '/api/status', null, '')\n .then(function(res) {\n var mainBody = document.getElementById('main-body');\n mainBody.innerHTML = res;\n selectIcon('home');\n }).catch(function(err) {\n mainBody.innerHTML = 'Failed to get home page. Please try again later.';\n console.log(err);\n })\n}", "async getAllAvailableStatus() {\n let response = await this.client.get(`${this.baseResource}available-status/`)\n return response.data\n }", "getStatus() {\n const statuses = this.getStatuses();\n\n if (statuses.length === 1) { return statuses[0]; }\n\n sentry.warn('DB has multiple statuses', this.asJSON());\n return statuses[0];\n }", "statusFlags() {\r\n return this.request('GET', 'status/flags');\r\n }", "function getStatuses() {\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function() {\n if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {\n response = JSON.parse(xmlHttp.response);\n if (response.result == 'success') {\n status_info = response.statuses;\n } else {\n status_info = {}\n }\n getFamilies();\n }\n }\n xmlHttp.open(\"GET\", \"http://student04.cse.nd.edu:51042/status/\", true);\n xmlHttp.send(null);\n }", "getStatus(callback) {\n this._connection.query(`SELECT * FROM status`, callback);\n }", "get operationalStatus() {\n\t\treturn this.__operationalStatus;\n\t}", "function getWorkStatus(cookies, uid) {\n return getWorkParam(cookies, uid, 'status');\n }", "function checkStatus() {\n\t$.ajax({\n\n\t\tdataType : 'json',\n\t\theaders : {\n\t\t\tAccept : \"application/json\",\n\t\t\t\"Access-Control-Allow-Origin\" : \"*\"\n\t\t},\n\t\ttype : 'GET',\n\t\turl : '/myapp/config/getStatus',\n\t\tsuccess : function(data) {\n\t\t\t$('#status-table tr').remove();\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>Java Version</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.java_version + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>MediaPlayer Version</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.version + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>Start Time</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.mp_starttime + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>Current Time</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.mp_currenttime + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>Memory Heap Used</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.memory_heap_used + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>Memory NonHeap Used</th> <td class=\"title\">'\n\t\t\t\t\t\t\t+ data.memory_nonheap_used + '</a></td> </tr>');\n\t\t\t$('#status-table > tbody:last').append(\n\t\t\t\t\t'<tr> <th>CPU Time</th> <td class=\"title\">' + data.cpu_time\n\t\t\t\t\t\t\t+ '</a></td> </tr>');\n\t\t\t\n\t\t\t\n\t\t},\n\t\terror : function(result) {\n\t\t\talert(\"Error \" + result);\n\t\t}\n\n\t});\n}", "function getCAStatus() {\n\t$('#mainContainer').html('<div id=\"getCAStatus\"></div>');\n\tsetLoadImage('getCAStatus', '40px', '500px');\n\tsendHTMLAjaxRequest(false, 'getView/getCAStatusPage.html', null, fnDisplayContent, null,'getCAStatus');\n}", "function get_status(statuscallback) {\n phonon.ajax({\n method: 'GET',\n url: localStorage.getItem('current')+'/api?command=status',\n crossDomain: true,\n dataType: 'text',\n success: statuscallback \n });\n}", "function status(mssg) {\n console.log(mssg);\n}", "function showNetworkStatus(){\n // Me muestra en el HTML si tengo conexion a internet o no \n const statusDOM = document.getElementById('NET_STATUS');\n statusDOM.textContent = navigator.onLine ? 'SI' : 'NO';\n}", "function serverStatus() {\n ajax = ajaxObj();\n ajax.onreadystatechange = function() {\n if (this.responseText != \"OK\") {\n pimShowError(this.responseText); \n }\n };\n ajaxGet(ajax, serverStatusURL()); \n}", "function serverStatus(test) {\r\n if (test === 'http://httpstat.us/200'){\r\n return ServerOnline\r\n }else {\r\n return ServerOffline\r\n }\r\n}", "function getStationStatus() {\n return fetch('https://gbfs.citibikenyc.com/gbfs/en/station_status.json').then(res => res.json());\n // return res.json();\n}", "static get status() {\n return {\n success: 200,\n badRequest: 400,\n unauthorized: 401,\n notFound: 404,\n conflict: 409,\n serverError: 500\n }\n }", "getGameStatus() {\n this.setMethod('GET');\n this.setPlayerId();\n return this.getApiResult(`${Config.PLAY_API}/${this.playerId}/status`);\n }", "function get_status(host,trigram,callback) {\r\n $.ajax({\r\n type: \"GET\",\r\n url: \"/api/\"+host+\"/websphere/\"+trigram+\"/was-\"+trigram+\"-1/status\",\r\n success: function (result) { \r\n\t\t\treturn callback(result);\r\n\t\t},\r\n\t\terror: function(err) {\r\n\t\t\treturn callback(err);\r\n\t\t}\r\n });\r\n}", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "get status() {\n return this.getStringAttribute('status');\n }", "function update_status () {\n $timeout(function () {\n var system_status = system_service.get_system_status_by_type(\"flow_in\");\n console.log('hv tgc flowin controller: query system status FlowIn[%s]', system_status);\n\n if (system_status == \"start\") {\n $scope.tgc_lock_state = true;\n $scope.hv_lock_state = true;\n }\n else if (system_status == \"stop\") {\n $scope.hv_lock_state = hv_tgc_service.get_lock_state(\"flow_in\", \"hv\");\n $scope.tgc_lock_state = hv_tgc_service.get_lock_state(\"flow_in\", \"tgc\");\n }\n else {\n console.log('hv tgc flowin controller: received invalid system status - '+system_status);\n }\n }, 0);\n }", "function Status(req, res) {\n\t\tres.json({\n\t\t\tstatus: true\n\t\t});\n}", "async function getStatus () {\n const bet = await db('bets')\n .select('status')\n .where('id', '=', betId)\n .first()\n return bet.status\n }", "function getStatusList() {\n var statusList = [];\n angular.forEach(ctrl.status, function(value, key) {\n if (value) {\n statusList.push(key);\n }\n });\n return statusList;\n }" ]
[ "0.7500388", "0.7364927", "0.7245807", "0.72031385", "0.71700656", "0.70622385", "0.6947817", "0.692985", "0.68494654", "0.67975104", "0.6795094", "0.67863744", "0.6756428", "0.6754721", "0.67516047", "0.6673024", "0.64515346", "0.6401707", "0.6373129", "0.63307744", "0.63129807", "0.6307661", "0.63057166", "0.62763876", "0.6258704", "0.62572145", "0.6240022", "0.6231553", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6223158", "0.6182726", "0.6180512", "0.61157346", "0.6114832", "0.6102482", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.60947263", "0.6044746", "0.60437155", "0.60273844", "0.6025901", "0.601154", "0.60075486", "0.6005526", "0.6004675", "0.597912", "0.5951378", "0.59511924", "0.59428644", "0.59155214", "0.59113306", "0.5906334", "0.5904914", "0.58987844", "0.5894033", "0.5893562", "0.5892268", "0.5884018", "0.58752", "0.58681196", "0.5858706", "0.58450943", "0.5842696", "0.5821548", "0.57997507", "0.57959694", "0.57928514", "0.5767524", "0.5750872", "0.57366157", "0.57345057", "0.571688", "0.571688", "0.571688", "0.571688", "0.571688", "0.571688", "0.571688", "0.571688", "0.5710626", "0.56827325", "0.5674774", "0.56577617" ]
0.6427209
17
\\ Get imagem da camera
function getCameraPicture(imageContainerID, imageSize, isClearImage){ if(isClearImage == true){ $(imageContainerID).attr("src", ""); } //$.ajaxSetup({ cache: false }); $.ajax({ url: ipURL+'/getGateCameraImage?Resolution='+imageSize, type: 'GET', cache: false, headers: { "Authorization": serviceAuth }, beforeSend: function (xhr) { xhr.overrideMimeType('text/plain; charset=x-user-defined'); }, success:function(data,textStatus, jqXHR){ //$(imageContainerID).attr("src", "data:image/jpeg;base64"); var binary = ""; var responseText = jqXHR.responseText; var responseTextLen = responseText.length; for ( i = 0; i < responseTextLen; i++ ) { binary += String.fromCharCode(responseText.charCodeAt(i) & 255) } $(imageContainerID).attr("src", "data:image/jpeg;base64,"+btoa(binary)); var dt = new Date(); $("#GateImageTimeStamp").text( (dt.getHours()<10?'0':'') + dt.getHours() + ":" + (dt.getMinutes()<10?'0':'') + dt.getMinutes() + ":" + (dt.getSeconds()<10?'0':'') + dt.getSeconds()); }, error:function(data){ console.log("Erro a carregar imagem") } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get camera() {return this._p.camera;}", "get camera () {return this._p.camera;}", "function cameraGetPicture() {\n\t navigator.device.capture.captureImage(captureSuccess, captureError, {limit: 1});\n\t}", "get worldCamera() {}", "function getPicture() {\n navigator.camera.getPicture(getPictureSuccess, getPictureError, {\n resQual: 50,\n destinationType: Camera.DestinationType.FILE_URI,\n correctOrientation: true\n })\n}", "getCamera() {\n return this._engine._camera;\n }", "getCamera(){\n return this._camera;\n }", "getCameraMatrix() {\n ...\n }", "function getCamera(){\n document.getElementById('ownGifs').style.display=\"none\"\n document.getElementById('createGif').style.display=\"none\";\n document.getElementById('camera').style.display=\"inline-block\";\n var video = document.querySelector('video');\n stream = navigator.mediaDevices.getUserMedia(constraints)\n .then(function(mediaStream) {\n video.srcObject = mediaStream;\n video.onloadedmetadata = function(e) {\n video.play(); // Starting reproduce video cam\n };\n recorder = RecordRTC(mediaStream, { \n // disable logs\n disableLogs: true,\n type: \"gif\",\n frameRate: 1,\n width: 360,\n hidden: 240,\n quality: 10});\n })\n .catch(function(err) { \n\n }); // always check for errors at the end.\n\n \n}", "getCameraStart() {\n return 5;\n }", "function Camera() {\n\t\n}", "function Camera() {\n\t\n}", "function getPhoto(){\n\tif(navigator.camera){\n\t\toptions={destinationType : 1,\n\t\t\t\t\t\tsourceType : 1,\n\t\t\t\t\t\tallowEdit: true}\n\t\tnavigator.camera.getPicture(getPictureSuccess, getPictureFail, options); \n\t}else{\n\t\timage = \"images/test.jpg\";\n\t\tgetPictureSuccess(image);\n\t}\n}", "getCameraMatrix() {\r\n return this.mCameraMatrix;\r\n }", "function getPhoto() {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: pictureSource.PHOTOLIBRARY });\n }", "function capturePhoto() {\n\tnavigator.camera.getPicture(onSuccess, onFail, { quality : 20, \n\t destinationType : 1, \n\t sourceType : 1, \n\t allowEdit : false,\n\t encodingType: Camera.EncodingType.JPEG,\n\t targetWidth: 1280,\n\t targetHeight: 960 }\n \t); \n }", "function cam() {\n snapBtn.addEventListener('click', enroll);\n // detectButton.addEventListener('click', detect);\n navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n width: 500,\n height: 500\n }\n })\n .then(stream => {\n video.srcObject = stream;\n video.onloadedmetadata = video.play()\n })\n .catch(err => console.error(err));\n}", "getCamera() {\n return this.ship.getCamera();\n //return this.camera;\n }", "function showCamera(arg) {\n\n\ttry {\n\t\tvar success = true;\n\t\tif (OS_IOS) {\n\t\t\tvar success = Titanium.Media.isCameraAccessible();\n\t\t}\n\t\tif (success) {\n\t\t\tTitanium.Media.showCamera({\n\t\t\t\tsuccess : photoFattchSuccess,\n\t\t\t\tcancel : function() {\n\t\t\t\t\tTi.API.info(' Cancelled ');\n\t\t\t\t},\n\t\t\t\terror : function(error) {\n\t\t\t\t\tif (error.code == 2) {\n\t\t\t\t\t\tAlloy.Globals.ShowAlert(Alloy.Globals.VTaxSelectedLanguage.attachMedia, Alloy.Globals.VTaxSelectedLanguage.cameraNotAvail);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tallowEditing : true,\n\t\t\t\tsaveToPhotoGallery : true,\n\t\t\t\tmediaTypes : arrMediaTypes,\n\t\t\t});\n\t\t} else {\n\t\t\tAlloy.Globals.ShowAlert(Alloy.Globals.VTaxSelectedLanguage.camera, Alloy.Globals.VTaxSelectedLanguage.cameraNotAccess);\n\t\t}\n\t} catch(ex) {\n\t}\n\n}", "function getAnimalPhoto() { \n\n\tnavigator.camera.getPicture(onPhotoURISuccess,\n\tonFail,\n\t{ quality:50,\n\t destinationType : navigator.camera.DestinationType.FILE_URI,\n\t sourceType : navigator.camera.PictureSourceType.PHOTOLIBRARY\n\t});\n}", "function Camera() {\n\n}", "function get_pic_npd(id) {\n\tvar div_id=\"npd_image_div_\"+id;\n\ttemp_image_div=div_id;\n\t//var image = document.getElementById(temp_image_div);\n\tvar hidden_name=\"npd_image_name_hidden_\" + id ;\n\tvar tempTime = $.now();\n\tnpd_image_name=tempTime.toString()+localStorage.selectedOutlet+id.toString()+\"_npd.jpg\";\n\t$(\"#\"+hidden_name).val(npd_image_name);\n\tnavigator.camera.getPicture(onSuccessNpd, onFailNpd, { quality: 50,\n\t\ttargetWidth: 300,\n\t\tdestinationType: Camera.DestinationType.FILE_URI,correctOrientation: true });\n\t // targetHeight: 512,\n}", "function getCamera(eye, at, up) {\n var m_rot = getRotation(eye, at, up);\n var m_trans = getTranslation(eye);\n return mult(m_rot, m_trans);\n}", "function FindUserAvatar()\n{\n var scene = framework.Scene().MainCameraScene();\n if (scene && client.IsConnected())\n return scene.EntityByName(\"Avatar\" + client.connectionId);\n else\n return null;\n}", "function getCameraSize()\n{\n\t// Figure out the part of the video we need to grab;\n\tsourceWidth = gbWidth * 3.5;\n\tsourceHeight = gbHeight * 3.5;\n\t\n\tif (sourceWidth > video.videoWidth)\n\t{\n\t\tvar targetHeightRatio = gbHeight/gbWidth;\n\t\tsourceWidth = video.videoWidth;\n\t\tsouceHeight = Math.floor(video.videoWidth * targetHeightRatio);\n\t}\n\t\n\tsourceX = Math.floor((video.videoWidth/2) - (sourceWidth/2));\n\tsourceY = Math.floor((video.videoHeight/2) - (sourceHeight/2));\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onSuccess, onFail, { quality: 50, \n destinationType: destinationType.DATA_URL,\n sourceType: source });\n \n }", "function getCameraMatrix() {\n var matrix = [];\n console.log(\"CamMatrix: \");\n console.log(cam.cameraMatrix.mat4);\n for(var i = 0; i < cam.cameraMatrix.mat4; i++) {\n matrix[i] = cam.cameraMatrix.mat4[i];\n }\n console.log(matrix);\n return matrix;\n}", "function loadCamera() {\n // setup camera capture\n videoInput = createCapture(VIDEO);\n videoInput.size(400, 300);\n videoInput.position(0, 0);\n videoInput.id(\"v\");\n var mv = document.getElementById(\"v\");\n mv.muted = true;\n}", "function getPhoto(source)\r\n{\r\n\tnavigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, destinationType: destinationType.FILE_URI, sourceType: source });\r\n}", "function capturePhoto(){\n\t navigator.camera.getPicture(picOnSuccess, picOnFailure, {\n\t quality: 20,\n\t destinationType: destinationType.FILE_URI,\n\t sourceType: pictureSource.CAMERA,\n\t correctOrientation: true\n\t });\n\t}", "function openCamera() {\n navigator.camera.getPicture(onSuccess, onFail, { quality: 50,\n destinationType: Camera.DestinationType.FILE_URI });\n\n function onSuccess(imageURI) {\n console.log(imageURI);\n $(\"#camimage\").attr(\"src\", imageURI);\n $(\"#camimage\").responsiveImg();\n }\n\n function onFail(message) {\n app.showAlert('Error taking picture', 'Error');\n } \n}", "function camera() {\n console.log(this.cameraBrand);\n}", "function selectPicture() {\n navigator.camera.getPicture(\n function(uri) {\n var img = document.getElementById('camera_image');\n img.style.visibility = \"visible\";\n \n\t\t\t\t\n img.src = uri;\n },\n function(e) {\n console.log(\"Error getting picture: \" + e);\n },\n { quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI , sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY});\n }", "function capturePhoto() {\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, {\n quality: 50, destinationType: Camera.DestinationType.FILE_URI\n });\n }", "function capturePhotoForm() {\n navigator.camera.getPicture(onPhotoDataSuccess3, onFail3, { quality: 100, destinationType: Camera.DestinationType.FILE_URI });\n}", "function chooseFromGallery(){\n navigator.camera.getPicture(videoTakenFromGallerySuccess,videoTakenFromGalleryFailed,{ sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,\n mediaType:navigator.camera.MediaType.ALLMEDIA,allowEdit:true,\n });\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });\n }", "function getPhoto(source) {\n\t // Retrieve image file location from specified source\n\t navigator.camera.getPicture(onPhotoURISuccess, onFail1, { quality: 50, \n\t destinationType: Camera.DestinationType.DATA_URL,\n\t sourceType: source });\n\t }", "function getCameraElement() {\r\n var camera = document.elements.findElementByTypeId(\"Microsoft.VisualStudio.3D.PerspectiveCamera\");\r\n return camera;\r\n}", "function library(halaman)\n{\n navigator.camera.getPicture(onSuccess, onFail, {\n quality: 50,\n destinationType: Camera.DestinationType.FILE_URI,\n sourceType: Camera.PictureSourceType.PHOTOLIBRARY,\n encodingType: Camera.EncodingType.PNG,\n mediaType: Camera.MediaType.PICTURE,\n correctOrientation: true\n }); \n function onSuccess(imageData) { \n $$(\"#\"+ halaman +\"_propic\").attr('src', imageData);\n $$(\"#\"+ halaman +\"_propic\").css({'width':'100px', 'height':'100px'});\n }\n function onFail(message) { \n app.dialog.alert('Failed because: ' + message);\n }\n TutupModal('modgambar_' + halaman);\n}", "function getPhoto(caller) {\n\tgetPhotoCaller=caller\n // Take picture using device camera and retrieve image as base64-encoded string\n\t//alert(\"about to take photo\"+DeviceStorageDirectory)\n\t\n navigator.camera.getPicture(onGetPhotoDataSuccess, onGetPhotoDataFail, { quality: 50 });\n}", "function camera_maxCurrent() {\n// var pos = xrender.camera.view.toArray();\n// return(pos[2][3]);\n return(xrender.camera.view[14]);\n}", "async function setupCamera() {\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\r\n throw new Error(\r\n 'Browser API navigator.mediaDevices.getUserMedia not available');\r\n }\r\n\r\n const camera = document.getElementById('camera');\r\n camera.width = cameraWidth;\r\n camera.height = cameraHeight;\r\n\r\n const mobile = isMobile();\r\n\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n 'audio': false,\r\n 'video': {\r\n facingMode: 'user',\r\n width: mobile ? undefined : cameraWidth,\r\n height: mobile ? undefined : cameraHeight,\r\n },\r\n });\r\n camera.srcObject = stream;\r\n\r\n return new Promise((resolve) => {\r\n camera.onloadedmetadata = () => {\r\n resolve(camera);\r\n };\r\n });\r\n}", "async function getCameraImage() {\n const response = await fetch(api_url + productNumber);\n const data = await response.json();\n\n const cameraImage = document.createElement(\"img\");\n cameraImage.alt = \"Picture of a \" + data.name + \" camera\";\n cameraImage.src = data.imageUrl;\n cameraImage.className = \"camera-details-img\";\n\n document.getElementById(\"product-image\").appendChild(cameraImage);\n await getCameraDetails();\n}", "function setupCamera() {\n return _setupCamera.apply(this, arguments);\n}", "function CameraData_CameraData()\n{\n\t//our current screen\n\tthis.State = __SIMULATOR.StateManager.CurrentState;\n\t//the default action of this screen\n\tthis.Action = this.State.ListOfPaths[0];\n\t//the current tutorial parameter collection\n\tthis.Parameters = __SIMULATOR.GetCameraParameters();\n}", "function capturePhoto2() {\n navigator.camera.getPicture(onPhotoDataSuccess2, onFail2, { quality: 100, destinationType: Camera.DestinationType.FILE_URI });\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, \n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }", "get cameras(): Array<PerspectiveCamera> {\n return this._cameras;\n }", "function proxyCordovaCamera() {\n\tif (IS_MOCKMOBILE) {\n\t\tconsole.log(\"*** HTML5 Camera Capture ***\");\n\t\tnavigator.camera = {\n\t\t\tgetPicture : localFileInput\n\t\t};\n\t}\n}", "function capturePhoto() {\n sessionStorage.removeItem('imagepath');\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 50, destinationType: Camera.DestinationType.FILE_URI, cameraDirection: 1});\n // Github says \"Any cameraDirection value results in a back-facing photo\". So fuck.\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 70,\n destinationType: destinationType.DATA_URI });\n }", "function getImage() {\n\t\n\t \n\t\n\t//alert( navigator.camera.DestinationType.FILE_URI );\n\t//abort;\n\t \n\t\t// Retrieve image file location from specified source\n\t navigator.camera.getPicture(uploadPhoto, function(message) {\n\t\t\t\t\talert('get picture failed');\n\t\t\t\t},{\n\t\t\t\t\tquality: 50, \n\t\t\t\t\tdestinationType: navigator.camera.DestinationType.FILE_URI,\n\t\t\t\t\tsourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY\n\t\t\t\t});\n\n}", "async function getImage() {\n const img = await webcam.capture();\n const processedImg =\n tf.tidy(() => img.expandDims(0).toFloat().div(127).sub(1));\n img.dispose();\n return processedImg;\n}", "async function getImage() {\n const img = await webcam.capture();\n const processedImg =\n tf.tidy(() => img.expandDims(0).toFloat().div(127).sub(1));\n img.dispose();\n return processedImg;\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoSuccess, onFail, { quality: 50,\n destinationType: destinationType.DATA_URL });\n }", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, {\n quality: 30,\n targetWidth: 600,\n targetHeight: 600,\n destinationType: destinationType.FILE_URI,\n sourceType: source\n });\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, \n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { \n\t quality: 80, \n\t destinationType: Camera.DestinationType.FILE_URI \n });\n}", "async snapshot() {\n const img = await this.webcam.capture();\n const processedImg =\n tf.tidy(() => img.expandDims(0).toFloat().div(127).sub(1));\n img.dispose();\n return processedImg;\n }", "updateCamera() {\n this.camera = this.cameras.get(this.currentCameraID);\n this.interface.setActiveCamera(this.camera);\n }", "function getZoomImage(){\n return getImageCanvii();\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,\n destinationType: destinationType.DATA_URL });\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,\n destinationType: destinationType.DATA_URL });\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,\n destinationType: destinationType.DATA_URL });\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, {\n quality: 50,\n destinationType: DESTINATION_TYPE.DATA_URL\n });\n}", "function getPhoto(source) {\n\n\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 25,\n destinationType: destinationType.DATA_URL });\n}", "async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'environment',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}", "async function setupCamera() {\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight\n }\n })\n video.srcObject = stream\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video)\n }\n })\n}", "function captureCamera_candidate(callback) {\n navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(function(camera) {\n callback(camera);\n }).catch(function(error) {\n alert('Unable to capture your camera. Please check console logs.');\n console.error(error);\n });\n}", "function startCamera() {\n Webcam.set({\n width: 320,\n height: 240,\n image_format: 'jpeg',\n jpeg_quality: 90\n });\n Webcam.attach('#my_camera');\n}", "function gotMedia(mediaStream) {\n const mediaStreamTrack = mediaStream.getVideoTracks()[0];\n const imageCapture = new ImageCapture(mediaStreamTrack);\n video.src = window.URL.createObjectURL(mediaStream);\n \n return imageCapture;\n console.log(imageCapture);\n }", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onFail, {quality: 50,\n destinationType: destinationType.DATA_URL});\n}", "function capturePhoto() {\n // Take picture using device camera and retrieve image as base64-encoded string\n navigator.camera.getPicture(onPhotoDataSuccess, onCameraFail, { quality: 50,\n\tdestinationType: destinationType.DATA_URL });\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, {quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: source});\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, \n destinationType: destinationType.FILE_URI,\n sourceType: source });\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, \n destinationType: destinationType.FILE_URI,\n sourceType: source });\n}", "function capturaImg(){\n\t var path;\n\t\n\t navigator.device.capture.captureImage(function captureSuccess(mediaFiles) {\n \n path = mediaFiles[0].fullPath; \n pgAlert('captura de imagen',path); \n subirarchivo(path); \n \n },function captureError(error) {\n \n pgAlert('Error',error.code); \n \n }, {limit: 1});\n \n \n\t\n\t\n}", "function getLayoutCamera(camera) {\n\t return {\n\t up: {x: camera.up[0], y: camera.up[1], z: camera.up[2]},\n\t center: {x: camera.center[0], y: camera.center[1], z: camera.center[2]},\n\t eye: {x: camera.eye[0], y: camera.eye[1], z: camera.eye[2]}\n\t };\n\t}", "function getLayoutCamera(camera) {\n\t return {\n\t up: {x: camera.up[0], y: camera.up[1], z: camera.up[2]},\n\t center: {x: camera.center[0], y: camera.center[1], z: camera.center[2]},\n\t eye: {x: camera.eye[0], y: camera.eye[1], z: camera.eye[2]}\n\t };\n\t}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, \n destinationType: destinationType.FILE_URI,\n sourceType: source });\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 70,\n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }", "async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, {\n quality: 80,\n destinationType: destinationType.FILE_URI,\n sourceType: source\n });\n}", "async function setupCamera() {\n let depthStream = await DepthCamera.getDepthStream();\n const depthVideo = document.getElementById('depthStream');\n depthVideo.srcObject = depthStream;\n return DepthCamera.getCameraCalibration(depthStream);\n}", "function capturePhoto(name) {\n navigator.camera.getPicture(onSuccess(name), onFail, {\n quality: 50,\n destinationType: Camera.DestinationType.FILE_URI\n });\n}", "async function connect_camera() {\n\t\ttry {\n\t\t\tlet stream = await navigator.mediaDevices.getUserMedia({\n\t\t\t\tvideo: { facingMode: \"user\" },\n\t\t\t\taudio: false\n\t\t\t});\n\t\t\tvideo_element.srcObject = stream;\n\t\t\tvideo_element.setAttribute('playsinline', true);\n\t\t\tvideo_element.setAttribute('controls', true);\n\t\t\t// remove controls separately\n\t\t\tsetTimeout(function() { video_element.removeAttribute('controls'); });\n\t\t} catch(error) {\n\t\t\tconsole.error(\"Got an error while looking for video camera: \" + error);\n\t\t\treturn null;\n\t\t}\n\t}", "function _createCamera() {\n\t\tvar camera = new ImageSurface({\n\t\t\tsize : [this.options.cameraWidth,true],\n\t\t\tcontent : 'src/img/camera.png',\n\t\t\tproperties : {\n\t\t\t\twidth : '100%'\n\t\t\t}\n\t\t});\n\n\t\tvar cameraModifer = new StateModifier({\n\t\t\torigin : [0.5, 0],\n\t\t\talign : [0.5, 0],\n\t\t\ttransform : Transform.behind\n\t\t});\n\n\t\tthis.add(cameraModifer).add(camera);\n\t}", "function getImageData(){\n\n }", "async function setupCamera() {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const video = document.getElementById('webcam-video');\n video.width = videoWidth;\n video.height = videoHeight;\n\n // const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight,\n },\n });\n video.srcObject = stream;\n\n return new Promise((resolve) => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n}", "async function getCameraInfo() {\n let res = await fetch(url);\n let data = await res.json();\n data.map((camera) => displayAllCameras(camera));\n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onCameraFail, { quality: 50,\n\tdestinationType: destinationType.FILE_URI,\n\tsourceType: source });\n}", "function onDeviceReady() {\n pictureSource=navigator.camera.PictureSourceType;\n destinationType=navigator.camera.DestinationType; \n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, {\n quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: source\n });\n}", "function capturePhotoEdit() {\n // Take picture using device camera, allow edit, and retrieve image as base64-encoded string \n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true }); \n}", "function capturePhotoEdit() {\n // Take picture using device camera, allow edit, and retrieve image as base64-encoded string \n navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true }); \n}", "function getPhoto(source) {\n // Retrieve image file location from specified source\n navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,\n destinationType: destinationType.FILE_URI,\n sourceType: source });\n }" ]
[ "0.71363646", "0.70856506", "0.6644587", "0.66222286", "0.6549515", "0.6488358", "0.64038366", "0.636859", "0.63017297", "0.6299966", "0.62418777", "0.62418777", "0.62076735", "0.6155746", "0.613556", "0.6132741", "0.611746", "0.6099124", "0.60692906", "0.6048769", "0.60406965", "0.60389197", "0.6037786", "0.6032487", "0.6028864", "0.60170925", "0.6003198", "0.5998323", "0.5986285", "0.59574974", "0.595155", "0.5950582", "0.59419245", "0.5934565", "0.59286493", "0.5909899", "0.58985335", "0.5887536", "0.5878726", "0.5868227", "0.5864473", "0.5858074", "0.5852034", "0.5849666", "0.5829617", "0.58130896", "0.5808404", "0.57913333", "0.57830083", "0.57818294", "0.57803804", "0.5780128", "0.5780128", "0.5779862", "0.577544", "0.5774683", "0.5774683", "0.5769519", "0.57643455", "0.57629627", "0.5759985", "0.57595813", "0.575558", "0.574998", "0.5748006", "0.5748006", "0.57441634", "0.57415354", "0.57388633", "0.5732611", "0.5731659", "0.5728943", "0.571991", "0.57160294", "0.5714636", "0.5710767", "0.5710593", "0.57097894", "0.5707316", "0.5707316", "0.5704307", "0.5695329", "0.5695329", "0.5694777", "0.56945395", "0.56922525", "0.5690465", "0.5689574", "0.5684319", "0.5679152", "0.5675884", "0.56674767", "0.56648475", "0.5657544", "0.5653718", "0.5652545", "0.56504136", "0.5649502", "0.56487095", "0.56487095", "0.56443983" ]
0.0
-1
the loop defined by the union of segments between the crossing of the start segment (s, s+ 1) and the end segment (e, e + 1) note that some calculations are inaccurate as we assume the loop starts at point s and ends at point e. These inaccuracy is neglectable
function Loop(s,e){ var i, vel = 0; var minA = 1000000000, maxA = 0; var locs = []; this.entry = s; this.exit = e; this.altDiff = 0; this.avgSpeed = 0; this.length = 0; for (i = s; i < e + 1; i++){ vel += pointarray[i].vel; if (pointarray[i].ele < minA){ minA = pointarray[i].ele; } if (pointarray[i].ele > maxA){ maxA = pointarray[i].ele; } locs[i - s] = pointarray[i].LatLng; } // get the intersection between starting and closing segment and augment the resulting // path by this point to get a circle. Note that the first element of the path gets // replaced by this intersection point var crossing = getIntersection(s,e); locs[0] = google.maps.geometry.spherical.interpolate(pointarray[s].LatLng, pointarray[s+1].LatLng, crossing); locs[e - s + 1] = locs[0]; this.locs = locs; this.avgSpeed = vel / (e - s + 1); this.altDiff = maxA - minA; this.area = google.maps.geometry.spherical.computeSignedArea(locs); this.length = google.maps.geometry.spherical.computeLength(locs); // this is somewhat inaccurate, see the introductory comment this.timeEntry = pointarray[this.entry].time; this.timeExit = pointarray[this.exit].time; var duration = (this.timeExit - this.timeEntry)/1000; this.bankAngle = Math.atan((K_factor * this.avgSpeed) / duration) * 180 / 3.14; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function segments_union(segment_1, segment_2){\n var max_segment_1, min_segment_1, max_segment_2, min_segment_2, absolute_max, absolute_min;\n //Case 1: vertical segments\n var vertical = is_vertical_or_quasi_vertical(segment_1); //equivalently is_vertical_or_quasi_vertical(segment_2)\n if(vertical){\n\n if(parseFloat(segment_1[0][1]) >= parseFloat(segment_1[1][1])){\n max_segment_1 = segment_1[0]; min_segment_1 = segment_1[1];\n }\n else{\n max_segment_1 = segment_1[1]; min_segment_1 = segment_1[0];\n }\n if(parseFloat(segment_2[0][1]) >= parseFloat(segment_2[1][1])){\n max_segment_2 = segment_2[0]; min_segment_2 = segment_2[1];\n }\n else{\n max_segment_2 = segment_2[1]; min_segment_2 = segment_2[0];\n }\n\n if(parseFloat(max_segment_1[1]) >= parseFloat(max_segment_2[1])){\n absolute_max = max_segment_1;\n }\n else{\n absolute_max = max_segment_2;\n }\n if(parseFloat(min_segment_1[1]) < parseFloat(min_segment_2[1])){\n absolute_min = min_segment_1;\n }\n else{\n absolute_min = min_segment_2;\n }\n\n return [absolute_min, absolute_max];\n }\n\n //Case 2: non vertical segments\n if(parseFloat(segment_1[0][0]) >= parseFloat(segment_1[1][0])){\n max_segment_1 = segment_1[0]; min_segment_1 = segment_1[1];\n }\n else{\n max_segment_1 = segment_1[1]; min_segment_1 = segment_1[0];\n }\n if(parseFloat(segment_2[0][0]) >= parseFloat(segment_2[1][0])){\n max_segment_2 = segment_2[0]; min_segment_2 = segment_2[1];\n }\n else{\n max_segment_2 = segment_2[1]; min_segment_2 = segment_2[0];\n }\n\n if(parseFloat(max_segment_1[0]) >= parseFloat(max_segment_2[0])){\n absolute_max = max_segment_1;\n }\n else{\n absolute_max = max_segment_2;\n }\n if(parseFloat(min_segment_1[0]) < parseFloat(min_segment_2[0])){\n absolute_min = min_segment_1;\n }\n else{\n absolute_min = min_segment_2;\n }\n\n return [absolute_min, absolute_max];\n}", "function range(s, e, by){\n var arr = [];\n for(i = s; !((s<e && i>e) || (s>e && i<e));){\n arr.push(i);\n if(by == null){\n if(s<e)\n i++;\n else\n i--;\n }\n else\n i+=by;\n }\n return arr;\n}", "resolveSegmentSegment(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n const result = [];\n const isHorizontal1 = ax2 - ax1 > ay2 - ay1;\n const isHorizontal2 = bx2 - bx1 > by2 - by1;\n\n if (isHorizontal1 && isHorizontal2 &&\n by1 === ay1 &&\n ((ax1 <= bx2 && ax1 >= bx1) || (ax2 <= bx2 && ax2 >= bx1) || (bx1 <= ax2 && bx1 >= ax1) || (bx2 <= ax2 && bx2 >= ax1))) {\n\n if (bx1 < ax1) result.push(bx1, by1, ax1, by1);\n if (bx2 > ax2) result.push(ax2, by2, bx2, by2);\n\n } else if (!isHorizontal1 && isHorizontal2 &&\n by1 >= ay1 && by1 < ay2 &&\n ((ax1 <= bx2 && ax1 >= bx1) || (ax2 <= bx2 && ax2 >= bx1) || (bx1 <= ax2 && bx1 >= ax1) || (bx2 <= ax2 && bx2 >= ax1))) {\n\n if (bx1 < ax1) result.push(bx1, by1, ax1, by1);\n if (bx2 > ax2) result.push(ax2 + 1, by2, bx2, by2);\n\n } else if (!isHorizontal1 && !isHorizontal2 &&\n ax1 === bx2 &&\n ((by1 <= ay2 && by1 >= ay1) || (by2 <= ay2 && by2 >= ay1) || (ay1 <= by2 && ay1 >= by1) || (ay2 <= by2 && ay2 >= by1))) {\n\n if (by1 < ay1) result.push(bx1, by1, bx1, ay1);\n if (by2 > ay2) result.push(bx2, ay2, bx2, by2);\n\n } else if (isHorizontal1 && !isHorizontal2 &&\n bx1 >= ax1 && bx1 < ax2 &&\n ((ay2 <= by2 && ay2 >= by1) || (ay1 <= by2 && ay1 >= by1) || (by2 <= ay2 && by2 >= ay1) || (by1 <= ay2 && by1 >= ay1))) {\n\n if (by1 < ay1) result.push(bx1, by1, bx1, ay1);\n if (by2 > ay2) result.push(bx2, ay2 + 1, bx2, by2);\n\n } else { // segments do not intersect\n result.push(bx1, by1, bx2, by2);\n }\n\n return result;\n }", "function calcEndsForEdge(config, s, offset) {\n let cellDim = cellSize.current;\n let begin = vec2.create(), end = vec2.create();\n switch(config) {\n case 3:\n case 12:\n {\n let t1 = invLerp(s[0], s[3], 1);\n let t2 = invLerp(s[1], s[2], 1);\n let ob = getSampleLoc(offset);\n let oe = getSampleLoc(offset + 1);\n let Y = vec2.fromValues(0, cellDim);\n vec2.scaleAndAdd(begin, ob, Y, t1);\n vec2.scaleAndAdd(end, oe, Y, t2);\n }\n break;\n case 6:\n case 9:\n {\n let t1 = invLerp(s[1], s[0], 1);\n let t2 = invLerp(s[2], s[3], 1);\n let ob = getSampleLoc(offset + 1);\n let oe = getSampleLoc(offset + samples.cols + 1);\n let X = vec2.fromValues(-cellDim, 0);\n vec2.scaleAndAdd(begin, ob, X, t1);\n vec2.scaleAndAdd(end, oe, X, t2);\n }\n break;\n }\n return [begin, end];\n}", "function addSegEndsFromSequences(){\n //Add all the starting segEnds and internal segJoins\n for(var i=0;i<seqArr.length;i++){\n var length=parseInt(seqArr[i]['length']),\n seqId=seqArr[i]['id'];\n segEndArr[segEndArr.length]=[seqId,0,'POS_STRAND']\n segEndArr[segEndArr.length]=[seqId,length-1,'NEG_STRAND']\n segJoinArr[segJoinArr.length]=[[seqId,0,'POS_STRAND'],[seqId,length-1,'NEG_STRAND'],'internal',length]\n }\n segmentize();\n}", "removeSegmentsIntersections(tunnels, isWalls) {\n const walls = this.walls;\n let startWallsLength = 0;\n let newWallsAmount = walls.length - startWallsLength;\n\n while (newWallsAmount > 0) {\n startWallsLength = walls.length;\n for (let j = 0; j < walls.length; j += 4) {\n for (let i = 0; i < (isWalls ? j : tunnels.length); i += 4) {\n const pieces = this.resolveSegmentSegment(\n tunnels[i], tunnels[i + 1], tunnels[i + 2], tunnels[i + 3],\n walls[j], walls[j + 1], walls[j + 2], walls[j + 3]\n );\n if (pieces.length < 4) { // empty walls will be removed in removeZeroLengthWalls()\n walls[j] = 0;\n walls[j + 1] = 0;\n walls[j + 2] = 0;\n walls[j + 3] = 0;\n } else {\n walls[j] = pieces[0];\n walls[j + 1] = pieces[1];\n walls[j + 2] = pieces[2];\n walls[j + 3] = pieces[3];\n\n if (pieces.length > 4) {\n walls.push(pieces[4]);\n walls.push(pieces[5]);\n walls.push(pieces[6]);\n walls.push(pieces[7]);\n }\n }\n }\n }\n newWallsAmount = walls.length - startWallsLength;\n }\n }", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n var prevX;\n var prevY;\n var cpx0;\n var cpy0;\n var cpx1;\n var cpy1;\n var idx = start;\n var k = 0;\n\n for (; k < segLen; k++) {\n var x = points[idx * 2];\n var y = points[idx * 2 + 1];\n\n if (idx >= allLen || idx < 0) {\n break;\n }\n\n if (isPointNull(x, y)) {\n if (connectNulls) {\n idx += dir;\n continue;\n }\n\n break;\n }\n\n if (idx === start) {\n ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n cpx0 = x;\n cpy0 = y;\n } else {\n var dx = x - prevX;\n var dy = y - prevY; // Ignore tiny segment.\n\n if (dx * dx + dy * dy < 0.5) {\n idx += dir;\n continue;\n }\n\n if (smooth > 0) {\n var nextIdx = idx + dir;\n var nextX = points[nextIdx * 2];\n var nextY = points[nextIdx * 2 + 1]; // Ignore duplicate point\n\n while (nextX === x && nextY === y && k < segLen) {\n k++;\n nextIdx += dir;\n idx += dir;\n nextX = points[nextIdx * 2];\n nextY = points[nextIdx * 2 + 1];\n x = points[idx * 2];\n y = points[idx * 2 + 1];\n dx = x - prevX;\n dy = y - prevY;\n }\n\n var tmpK = k + 1;\n\n if (connectNulls) {\n // Find next point not null\n while (isPointNull(nextX, nextY) && tmpK < segLen) {\n tmpK++;\n nextIdx += dir;\n nextX = points[nextIdx * 2];\n nextY = points[nextIdx * 2 + 1];\n }\n }\n\n var ratioNextSeg = 0.5;\n var vx = 0;\n var vy = 0;\n var nextCpx0 = void 0;\n var nextCpy0 = void 0; // Is last point\n\n if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n cpx1 = x;\n cpy1 = y;\n } else {\n vx = nextX - prevX;\n vy = nextY - prevY;\n var dx0 = x - prevX;\n var dx1 = nextX - x;\n var dy0 = y - prevY;\n var dy1 = nextY - y;\n var lenPrevSeg = void 0;\n var lenNextSeg = void 0;\n\n if (smoothMonotone === 'x') {\n lenPrevSeg = Math.abs(dx0);\n lenNextSeg = Math.abs(dx1);\n var dir_1 = vx > 0 ? 1 : -1;\n cpx1 = x - dir_1 * lenPrevSeg * smooth;\n cpy1 = y;\n nextCpx0 = x + dir_1 * lenNextSeg * smooth;\n nextCpy0 = y;\n } else if (smoothMonotone === 'y') {\n lenPrevSeg = Math.abs(dy0);\n lenNextSeg = Math.abs(dy1);\n var dir_2 = vy > 0 ? 1 : -1;\n cpx1 = x;\n cpy1 = y - dir_2 * lenPrevSeg * smooth;\n nextCpx0 = x;\n nextCpy0 = y + dir_2 * lenNextSeg * smooth;\n } else {\n lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\n ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\n nextCpx0 = x + vx * smooth * ratioNextSeg;\n nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n // Avoid exceeding extreme after smoothing.\n\n nextCpx0 = mathMin(nextCpx0, mathMax(nextX, x));\n nextCpy0 = mathMin(nextCpy0, mathMax(nextY, y));\n nextCpx0 = mathMax(nextCpx0, mathMin(nextX, x));\n nextCpy0 = mathMax(nextCpy0, mathMin(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\n vx = nextCpx0 - x;\n vy = nextCpy0 - y;\n cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n // Avoid exceeding extreme after smoothing.\n\n cpx1 = mathMin(cpx1, mathMax(prevX, x));\n cpy1 = mathMin(cpy1, mathMax(prevY, y));\n cpx1 = mathMax(cpx1, mathMin(prevX, x));\n cpy1 = mathMax(cpy1, mathMin(prevY, y)); // Adjust next cp0 again.\n\n vx = x - cpx1;\n vy = y - cpy1;\n nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n }\n }\n\n ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n cpx0 = nextCpx0;\n cpy0 = nextCpy0;\n } else {\n ctx.lineTo(x, y);\n }\n }\n\n prevX = x;\n prevY = y;\n idx += dir;\n }\n\n return k;\n}", "slither() {\n // nextDir will be the NEW direction of the segment being processed in each iteration of the loop below\n let nextDir = this.getHead().direction;\n for ( let s of this.segments ) {\n // Update the segment's position to its next position\n s.gridPosition = s.nextPosition();\n\n const oldDir = s.direction; // Remember its current direction so we can use it as the next nextDir\n s.direction = nextDir; // Update the segment's direction to the nextDir (which was the previous segments direction)\n nextDir = oldDir; // Finally, set up nextDir for the next iteration\n }\n }", "calculateEndpoints(head = this.head, tail = this.tail) {\n const curve = new Curve(head, this.controlPt, tail);\n const incrementsArray = [0.001, 0.005, 0.01, 0.05];\n let increment = incrementsArray.pop();\n let t = 0;\n // let iterations = 0;\n while (increment && t < 0.5) {\n // iterations++;\n const pt = curve.bezier(t);\n if (this.tail.contains(pt)) {\n t += increment;\n } else {\n t -= increment;\n increment = incrementsArray.pop();\n t += increment || 0;\n }\n }\n // console.log('itertions: ' + iterations);\n this.endPt = curve.bezier(t);\n this.startPt = curve.bezier(1 - t);\n }", "function sumConsecutives(s) {\n \n}", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n\t var prevX;\n\t var prevY;\n\t var cpx0;\n\t var cpy0;\n\t var cpx1;\n\t var cpy1;\n\t var idx = start;\n\t var k = 0;\n\t\n\t for (; k < segLen; k++) {\n\t var x = points[idx * 2];\n\t var y = points[idx * 2 + 1];\n\t\n\t if (idx >= allLen || idx < 0) {\n\t break;\n\t }\n\t\n\t if (isPointNull(x, y)) {\n\t if (connectNulls) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t break;\n\t }\n\t\n\t if (idx === start) {\n\t ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n\t cpx0 = x;\n\t cpy0 = y;\n\t } else {\n\t var dx = x - prevX;\n\t var dy = y - prevY; // Ignore tiny segment.\n\t\n\t if (dx * dx + dy * dy < 0.5) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t if (smooth > 0) {\n\t var nextIdx = idx + dir;\n\t var nextX = points[nextIdx * 2];\n\t var nextY = points[nextIdx * 2 + 1];\n\t var tmpK = k + 1;\n\t\n\t if (connectNulls) {\n\t // Find next point not null\n\t while (isPointNull(nextX, nextY) && tmpK < segLen) {\n\t tmpK++;\n\t nextIdx += dir;\n\t nextX = points[nextIdx * 2];\n\t nextY = points[nextIdx * 2 + 1];\n\t }\n\t }\n\t\n\t var ratioNextSeg = 0.5;\n\t var vx = 0;\n\t var vy = 0;\n\t var nextCpx0 = void 0;\n\t var nextCpy0 = void 0; // Is last point\n\t\n\t if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n\t cpx1 = x;\n\t cpy1 = y;\n\t } else {\n\t vx = nextX - prevX;\n\t vy = nextY - prevY;\n\t var dx0 = x - prevX;\n\t var dx1 = nextX - x;\n\t var dy0 = y - prevY;\n\t var dy1 = nextY - y;\n\t var lenPrevSeg = void 0;\n\t var lenNextSeg = void 0;\n\t\n\t if (smoothMonotone === 'x') {\n\t lenPrevSeg = Math.abs(dx0);\n\t lenNextSeg = Math.abs(dx1);\n\t cpx1 = x - lenPrevSeg * smooth;\n\t cpy1 = y;\n\t nextCpx0 = x + lenPrevSeg * smooth;\n\t nextCpy0 = y;\n\t } else if (smoothMonotone === 'y') {\n\t lenPrevSeg = Math.abs(dy0);\n\t lenNextSeg = Math.abs(dy1);\n\t cpx1 = x;\n\t cpy1 = y - lenPrevSeg * smooth;\n\t nextCpx0 = x;\n\t nextCpy0 = y + lenPrevSeg * smooth;\n\t } else {\n\t lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n\t lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\t\n\t ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n\t cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n\t cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\t\n\t nextCpx0 = x + vx * smooth * ratioNextSeg;\n\t nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t nextCpx0 = mathMin$5(nextCpx0, mathMax$5(nextX, x));\n\t nextCpy0 = mathMin$5(nextCpy0, mathMax$5(nextY, y));\n\t nextCpx0 = mathMax$5(nextCpx0, mathMin$5(nextX, x));\n\t nextCpy0 = mathMax$5(nextCpy0, mathMin$5(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\t\n\t vx = nextCpx0 - x;\n\t vy = nextCpy0 - y;\n\t cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n\t cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t cpx1 = mathMin$5(cpx1, mathMax$5(prevX, x));\n\t cpy1 = mathMin$5(cpy1, mathMax$5(prevY, y));\n\t cpx1 = mathMax$5(cpx1, mathMin$5(prevX, x));\n\t cpy1 = mathMax$5(cpy1, mathMin$5(prevY, y)); // Adjust next cp0 again.\n\t\n\t vx = x - cpx1;\n\t vy = y - cpy1;\n\t nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n\t nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n\t }\n\t }\n\t\n\t ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n\t cpx0 = nextCpx0;\n\t cpy0 = nextCpy0;\n\t } else {\n\t ctx.lineTo(x, y);\n\t }\n\t }\n\t\n\t prevX = x;\n\t prevY = y;\n\t idx += dir;\n\t }\n\t\n\t return k;\n\t }", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n var prevX;\n var prevY;\n var cpx0;\n var cpy0;\n var cpx1;\n var cpy1;\n var idx = start;\n var k = 0;\n\n for (; k < segLen; k++) {\n var x = points[idx * 2];\n var y = points[idx * 2 + 1];\n\n if (idx >= allLen || idx < 0) {\n break;\n }\n\n if (isPointNull(x, y)) {\n if (connectNulls) {\n idx += dir;\n continue;\n }\n\n break;\n }\n\n if (idx === start) {\n ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n cpx0 = x;\n cpy0 = y;\n } else {\n var dx = x - prevX;\n var dy = y - prevY; // Ignore tiny segment.\n\n if (dx * dx + dy * dy < 0.5) {\n idx += dir;\n continue;\n }\n\n if (smooth > 0) {\n var nextIdx = idx + dir;\n var nextX = points[nextIdx * 2];\n var nextY = points[nextIdx * 2 + 1];\n var tmpK = k + 1;\n\n if (connectNulls) {\n // Find next point not null\n while (isPointNull(nextX, nextY) && tmpK < segLen) {\n tmpK++;\n nextIdx += dir;\n nextX = points[nextIdx * 2];\n nextY = points[nextIdx * 2 + 1];\n }\n }\n\n var ratioNextSeg = 0.5;\n var vx = 0;\n var vy = 0;\n var nextCpx0 = void 0;\n var nextCpy0 = void 0; // Is last point\n\n if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n cpx1 = x;\n cpy1 = y;\n } else {\n vx = nextX - prevX;\n vy = nextY - prevY;\n var dx0 = x - prevX;\n var dx1 = nextX - x;\n var dy0 = y - prevY;\n var dy1 = nextY - y;\n var lenPrevSeg = void 0;\n var lenNextSeg = void 0;\n\n if (smoothMonotone === 'x') {\n lenPrevSeg = Math.abs(dx0);\n lenNextSeg = Math.abs(dx1);\n cpx1 = x - lenPrevSeg * smooth;\n cpy1 = y;\n nextCpx0 = x + lenPrevSeg * smooth;\n nextCpy0 = y;\n } else if (smoothMonotone === 'y') {\n lenPrevSeg = Math.abs(dy0);\n lenNextSeg = Math.abs(dy1);\n cpx1 = x;\n cpy1 = y - lenPrevSeg * smooth;\n nextCpx0 = x;\n nextCpy0 = y + lenPrevSeg * smooth;\n } else {\n lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\n ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\n nextCpx0 = x + vx * smooth * ratioNextSeg;\n nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n // Avoid exceeding extreme after smoothing.\n\n nextCpx0 = mathMin(nextCpx0, mathMax(nextX, x));\n nextCpy0 = mathMin(nextCpy0, mathMax(nextY, y));\n nextCpx0 = mathMax(nextCpx0, mathMin(nextX, x));\n nextCpy0 = mathMax(nextCpy0, mathMin(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\n vx = nextCpx0 - x;\n vy = nextCpy0 - y;\n cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n // Avoid exceeding extreme after smoothing.\n\n cpx1 = mathMin(cpx1, mathMax(prevX, x));\n cpy1 = mathMin(cpy1, mathMax(prevY, y));\n cpx1 = mathMax(cpx1, mathMin(prevX, x));\n cpy1 = mathMax(cpy1, mathMin(prevY, y)); // Adjust next cp0 again.\n\n vx = x - cpx1;\n vy = y - cpy1;\n nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n }\n }\n\n ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n cpx0 = nextCpx0;\n cpy0 = nextCpy0;\n } else {\n ctx.lineTo(x, y);\n }\n }\n\n prevX = x;\n prevY = y;\n idx += dir;\n }\n\n return k;\n}", "function computeSegHorizontals(segs, eventOrderSpecs) {\n // IMPORTANT TO CLEAR OLD RESULTS :(\n for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {\n var seg = segs_2[_i];\n seg.level = null;\n seg.forwardCoord = null;\n seg.backwardCoord = null;\n seg.forwardPressure = null;\n }\n\n segs = Object(_fullcalendar_common__WEBPACK_IMPORTED_MODULE_1__[\"sortEventSegs\"])(segs, eventOrderSpecs);\n var level0;\n var levels = buildSlotSegLevels(segs);\n computeForwardSlotSegs(levels);\n\n if (level0 = levels[0]) {\n for (var _a = 0, level0_1 = level0; _a < level0_1.length; _a++) {\n var seg = level0_1[_a];\n computeSlotSegPressures(seg);\n }\n\n for (var _b = 0, level0_2 = level0; _b < level0_2.length; _b++) {\n var seg = level0_2[_b];\n computeSegForwardBack(seg, 0, 0, eventOrderSpecs);\n }\n }\n\n return segs;\n } // Builds an array of segments \"levels\". The first level will be the leftmost tier of segments if the calendar is", "computeControlSegments() {\n if (this.controlSteps.length) {\n this.controlSegments = [];\n let segment = { start : 0, end : 0, human : this.controlSteps[0] }\n for (let i = 0; i < this.controlSteps.length; ++i) {\n const humanStep = this.controlSteps[i];\n if (humanStep != segment.human) {\n this.controlSegments.push(segment);\n segment = { start : i, end : i, human : humanStep };\n } else {\n segment.end = i;\n }\n }\n this.controlSegments.push(segment);\n }\n }", "function calcEndsForCorner(config, s, offset) {\n let origin = getSampleLoc(offset);\n let cellDim = cellSize.current;\n let begin = vec2.create(), end = vec2.create(), t1, t2;\n let X = vec2.fromValues(cellDim, 0), Y = vec2.fromValues(0, cellDim);\n switch (config) {\n // origin is IN; its sample ≥ 1, both right-top and left-bottom are OUT as\n // their samples ≤ 1; do inverse interpolation to find the parameter such\n // that the sample is 1; where the function is satified i.e. the figure’s\n // boundary. However, this isn’t the true boundary but a linear\n // approximation. Use this parameter to get final point given the extremes\n // -- origin and begin/end in each axis.\n case 1:\n case 14:\n {\n let t1 = invLerp(s[0], s[1], 1);\n let t2 = invLerp(s[0], s[3], 1);\n vec2.scaleAndAdd(begin, origin, X, t1);\n vec2.scaleAndAdd(end, origin, Y, t2);\n }\n break;\n case 2:\n case 13:\n {\n origin[0] += cellDim;\n let t1 = invLerp(s[1], s[0], 1);\n let t2 = invLerp(s[1], s[2], 1);\n vec2.scaleAndAdd(begin, origin, X, -t1);\n vec2.scaleAndAdd(end, origin, Y, t2);\n }\n break;\n case 4:\n case 11:\n {\n origin[0] += cellDim, origin[1] += cellDim;\n let t1 = invLerp(s[2], s[3], 1);\n let t2 = invLerp(s[2], s[1], 1);\n vec2.scaleAndAdd(begin, origin, X, -t1);\n vec2.scaleAndAdd(end, origin, Y, -t2);\n }\n break;\n case 7:\n case 8:\n {\n origin[1] += cellDim;\n let t1 = invLerp(s[3], s[2], 1);\n let t2 = invLerp(s[3], s[0], 1);\n vec2.scaleAndAdd(begin, origin, X, t1);\n vec2.scaleAndAdd(end, origin, Y, -t2);\n }\n }\n return [begin, end];\n}", "function closestPointS_2Segments(A0,A1,B0,B1){\n\tvar u = A1.clone().sub(A0),\n\t\tv = B1.clone().sub(B0),\n\t\tw = A0.clone().sub(B0),\n\t\ta = Vec3.dot(u,u), // always >= 0\n\t\tb = Vec3.dot(u,v),\n\t\tc = Vec3.dot(v,v), // always >= 0\n\t\td = Vec3.dot(u,w),\n\t\te = Vec3.dot(v,w),\n\t\tD = a*c - b*b, // always >= 0\n \tsc, sN, sD = D, // sc = sN / sD, default sD = D >= 0\n \ttc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\n\n \t// compute the line parameters of the two closest points\n if(D < 0.000001){ // the lines are almost parallel\n sN = 0.0; // force using point P0 on segment S1\n sD = 1.0; // to prevent possible division by 0.0 later\n tN = e;\n tD = c;\n }else{ // get the closest points on the infinite lines\n sN = (b*e - c*d);\n tN = (a*e - b*d);\n if(sN < 0.0){ // sc < 0 => the s=0 edge is visible\n sN = 0.0;\n tN = e;\n tD = c;\n }else if (sN > sD){ // sc > 1 => the s=1 edge is visible\n sN = sD;\n tN = e + b;\n tD = c;\n }\n }\n\n if (tN < 0.0){ // tc < 0 => the t=0 edge is visible\n tN = 0.0;\n // recompute sc for this edge\n if (-d < 0.0)\t\tsN = 0.0;\n else if (-d > a)\tsN = sD;\n else{\n sN = -d;\n sD = a;\n }\n }else if(tN > tD){ // tc > 1 => the t=1 edge is visible\n tN = tD;\n // recompute sc for this edge\n if((-d + b) < 0.0)\t\tsN = 0;\n else if ((-d + b) > a)\tsN = sD;\n else{\n sN = (-d + b);\n sD = a;\n }\n }\n\n // finally do the division to get sc and tc\n sc = (Math.abs(sN) < 0.000001 ? 0.0 : sN / sD);\n tc = (Math.abs(tN) < 0.000001 ? 0.0 : tN / tD);\n\n // get the difference of the two closest points\n //Vector dP = w + (sc * u) - (tc * v); // = S1(sc) - S2(tc)\n\n\treturn [ u.scale(sc).add(A0), v.scale(tc).add(B0) ];\n}", "calculateNumberHorizonSlices(stops) {\n let sum = 1;\n for(let i = 2; i <= stops; i++) {\n sum += i;\n }\n return sum;\n }", "function computeSlotSegCollisions(seg,otherSegs,results){if(results===void 0){results=[];}for(var i=0;i<otherSegs.length;i++){if(isSlotSegCollision(seg,otherSegs[i])){results.push(otherSegs[i]);}}return results;}// Do these segments occupy the same vertical space?", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n var forwardSegs = seg.forwardSegs;\n var i;\n\n if (seg.forwardCoord === undefined) { // not already computed\n\n if (!forwardSegs.length) {\n\n // if there are no forward segments, this segment should butt up against the edge\n seg.forwardCoord = 1;\n }\n else {\n\n // sort highest pressure first\n forwardSegs.sort(compareForwardSlotSegs);\n\n // this segment's forwardCoord will be calculated from the backwardCoord of the\n // highest-pressure forward segment.\n computeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n seg.forwardCoord = forwardSegs[0].backwardCoord;\n }\n\n // calculate the backwardCoord from the forwardCoord. consider the series\n seg.backwardCoord = seg.forwardCoord -\n (seg.forwardCoord - seriesBackwardCoord) / // available width for series\n (seriesBackwardPressure + 1); // # of segments in the series\n\n // use this segment's coordinates to computed the coordinates of the less-pressurized\n // forward segments\n for (i = 0; i < forwardSegs.length; i++) {\n computeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n }\n }\n }", "clipEar(listofseg){\n\t\tlet copypoint = listofseg.map(function(e){\n\t\t\treturn e.a\n\t\t})\n\t\tfor (let i=0; i<listofseg.length;i++){\n\t\t\tlet sega = listofseg[i];\n\t\t\tlet segb;\n\t\t\tlet copy = copypoint.map((x=>x));\n\t\t\tif (i=== listofseg.length-1){\n\t\t\t\tsegb = listofseg[0]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsegb = listofseg[i+1]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t}\n\t\t\tlet notfound = true;\n\t\t\tfor (let j=0; j<copy.length;j++){\n\t\t\t\tif (this.checkTriangle(sega, segb, copy[j])){\n\t\t\t\t\tnotfound = false\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (notfound){\n\t\t\t\tthis.segList.push([sega, segb])\n\t\t\t\tif (i=== listofseg.length-1){\n\t\t\t\t\tlistofseg.pop();\n\t\t\t\t\tlistofseg.shift();\n\t\t\t\t\treturn listofseg.splice(0,0,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn listofseg.splice(i,2,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function rangeToSegments(start, end) {\n\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(start);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(end); // an exclusive value\n\t\tvar endTimeMS = +end.time();\n\t\tif (endTimeMS && endTimeMS >= nextDayThreshold) {\n\t\t\trangeDayOffsetEnd++;\n\t\t}\n\t\trangeDayOffsetEnd = Math.max(rangeDayOffsetEnd, rangeDayOffsetStart + 1);\n\n\t\t// first and last cell offset for the given date range\n\t\t// \"last\" implies inclusivity\n\t\tvar rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);\n\t\tvar rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;\n\n\t\t// loop through all the rows in the view\n\t\tfor (var row=0; row<rowCnt; row++) {\n\n\t\t\t// first and last cell offset for the row\n\t\t\tvar rowCellOffsetFirst = row * colCnt;\n\t\t\tvar rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;\n\n\t\t\t// get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row\n\t\t\tvar segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);\n\t\t\tvar segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);\n\n\t\t\t// make sure segment's offsets are valid and in view\n\t\t\tif (segmentCellOffsetFirst <= segmentCellOffsetLast) {\n\n\t\t\t\t// translate to cells\n\t\t\t\tvar segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);\n\t\t\t\tvar segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);\n\n\t\t\t\t// view might be RTL, so order by leftmost column\n\t\t\t\tvar cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();\n\n\t\t\t\t// Determine if segment's first/last cell is the beginning/end of the date range.\n\t\t\t\t// We need to compare \"day offset\" because \"cell offsets\" are often ambiguous and\n\t\t\t\t// can translate to multiple days, and an edge case reveals itself when we the\n\t\t\t\t// range's first cell is hidden (we don't want isStart to be true).\n\t\t\t\tvar isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;\n\t\t\t\tvar isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively\n\n\t\t\t\tsegments.push({\n\t\t\t\t\trow: row,\n\t\t\t\t\tleftCol: cols[0],\n\t\t\t\t\trightCol: cols[1],\n\t\t\t\t\tisStart: isStart,\n\t\t\t\t\tisEnd: isEnd\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn segments;\n\t}", "function rangeToSegments(start, end) {\n\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(start);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(end); // an exclusive value\n\t\tvar endTimeMS = +end.time();\n\t\tif (endTimeMS && endTimeMS >= nextDayThreshold) {\n\t\t\trangeDayOffsetEnd++;\n\t\t}\n\t\trangeDayOffsetEnd = Math.max(rangeDayOffsetEnd, rangeDayOffsetStart + 1);\n\n\t\t// first and last cell offset for the given date range\n\t\t// \"last\" implies inclusivity\n\t\tvar rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);\n\t\tvar rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;\n\n\t\t// loop through all the rows in the view\n\t\tfor (var row=0; row<rowCnt; row++) {\n\n\t\t\t// first and last cell offset for the row\n\t\t\tvar rowCellOffsetFirst = row * colCnt;\n\t\t\tvar rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;\n\n\t\t\t// get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row\n\t\t\tvar segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);\n\t\t\tvar segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);\n\n\t\t\t// make sure segment's offsets are valid and in view\n\t\t\tif (segmentCellOffsetFirst <= segmentCellOffsetLast) {\n\n\t\t\t\t// translate to cells\n\t\t\t\tvar segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);\n\t\t\t\tvar segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);\n\n\t\t\t\t// view might be RTL, so order by leftmost column\n\t\t\t\tvar cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();\n\n\t\t\t\t// Determine if segment's first/last cell is the beginning/end of the date range.\n\t\t\t\t// We need to compare \"day offset\" because \"cell offsets\" are often ambiguous and\n\t\t\t\t// can translate to multiple days, and an edge case reveals itself when we the\n\t\t\t\t// range's first cell is hidden (we don't want isStart to be true).\n\t\t\t\tvar isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;\n\t\t\t\tvar isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively\n\n\t\t\t\tsegments.push({\n\t\t\t\t\trow: row,\n\t\t\t\t\tleftCol: cols[0],\n\t\t\t\t\trightCol: cols[1],\n\t\t\t\t\tisStart: isStart,\n\t\t\t\t\tisEnd: isEnd\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn segments;\n\t}", "function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {\n var ux = x1 - x0;\n var uy = y1 - y0;\n var vx = x3 - x2;\n var vy = y3 - y2;\n var wx = x0 - x2;\n var wy = y0 - y2;\n var a = ux * ux + uy * uy;\n var b = ux * vx + uy * vy;\n var c = vx * vx + vy * vy;\n var d = ux * wx + uy * wy;\n var e = vx * wx + vy * wy;\n var D = a * c - b * b;\n\n var sc, sN, tc, tN;\n var sD = D;\n var tD = D;\n\n if (D === 0) {\n sN = 0;\n sD = 1;\n tN = e;\n tD = c;\n } else {\n sN = b * e - c * d;\n tN = a * e - b * d;\n if (sN < 0) {\n sN = 0;\n tN = e;\n tD = c;\n } else if (sN > sD) {\n sN = sD;\n tN = e + b;\n tD = c;\n }\n }\n\n if (tN < 0.0) {\n tN = 0.0;\n if (-d < 0.0) sN = 0.0;\n else if (-d > a) sN = sD;\n else {\n sN = -d;\n sD = a;\n }\n } else if (tN > tD) {\n tN = tD;\n if ((-d + b) < 0.0) sN = 0;\n else if (-d + b > a) sN = sD;\n else {\n sN = -d + b;\n sD = a;\n }\n }\n\n sc = sN === 0 ? 0 : sN / sD;\n tc = tN === 0 ? 0 : tN / tD;\n\n var cx = (1 - sc) * x0 + sc * x1;\n var cy = (1 - sc) * y0 + sc * y1;\n var cx2 = (1 - tc) * x2 + tc * x3;\n var cy2 = (1 - tc) * y2 + tc * y3;\n var dx = cx2 - cx;\n var dy = cy2 - cy;\n\n return dx * dx + dy * dy;\n}", "function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {\n var ux = x1 - x0;\n var uy = y1 - y0;\n var vx = x3 - x2;\n var vy = y3 - y2;\n var wx = x0 - x2;\n var wy = y0 - y2;\n var a = ux * ux + uy * uy;\n var b = ux * vx + uy * vy;\n var c = vx * vx + vy * vy;\n var d = ux * wx + uy * wy;\n var e = vx * wx + vy * wy;\n var D = a * c - b * b;\n\n var sc, sN, tc, tN;\n var sD = D;\n var tD = D;\n\n if (D === 0) {\n sN = 0;\n sD = 1;\n tN = e;\n tD = c;\n } else {\n sN = b * e - c * d;\n tN = a * e - b * d;\n if (sN < 0) {\n sN = 0;\n tN = e;\n tD = c;\n } else if (sN > sD) {\n sN = sD;\n tN = e + b;\n tD = c;\n }\n }\n\n if (tN < 0.0) {\n tN = 0.0;\n if (-d < 0.0) sN = 0.0;\n else if (-d > a) sN = sD;\n else {\n sN = -d;\n sD = a;\n }\n } else if (tN > tD) {\n tN = tD;\n if ((-d + b) < 0.0) sN = 0;\n else if (-d + b > a) sN = sD;\n else {\n sN = -d + b;\n sD = a;\n }\n }\n\n sc = sN === 0 ? 0 : sN / sD;\n tc = tN === 0 ? 0 : tN / tD;\n\n var cx = (1 - sc) * x0 + sc * x1;\n var cy = (1 - sc) * y0 + sc * y1;\n var cx2 = (1 - tc) * x2 + tc * x3;\n var cy2 = (1 - tc) * y2 + tc * y3;\n var dx = cx2 - cx;\n var dy = cy2 - cy;\n\n return dx * dx + dy * dy;\n}", "function _segseg (out, p1, p2, p3, p4) {\n let x1 = p1[0]\n let y1 = p1[1]\n let x2 = p2[0]\n let y2 = p2[1]\n let x3 = p3[0]\n let y3 = p3[1]\n let x4 = p4[0]\n let y4 = p4[1]\n\n let a1, a2, b1, b2, c1, c2 // Coefficients of line eqns.\n let r1, r2, r3, r4 // 'Sign' values\n let denom, offset // Intermediate values\n let x, y // Intermediate return values\n\n // Compute a1, b1, c1, where line joining points 1 and 2\n // is \"a1 x + b1 y + c1 = 0\".\n a1 = y2 - y1\n b1 = x1 - x2\n c1 = x2 * y1 - x1 * y2\n\n // Compute r3 and r4.\n r3 = a1 * x3 + b1 * y3 + c1\n r4 = a1 * x4 + b1 * y4 + c1\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ( r3 !== 0 && r4 !== 0 && ((r3 >= 0 && r4 >= 0) || (r3 < 0 && r4 < 0)))\n return DONT_INTERSECT\n\n // Compute a2, b2, c2\n a2 = y4 - y3\n b2 = x3 - x4\n c2 = x4 * y3 - x3 * y4\n\n // Compute r1 and r2\n r1 = a2 * x1 + b2 * y1 + c2\n r2 = a2 * x2 + b2 * y2 + c2\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if (r1 !== 0 && r2 !== 0 && ((r1 >= 0 && r2 >= 0) || (r1 < 0 && r2 < 0)))\n return DONT_INTERSECT\n\n // Line segments intersect: compute intersection point.\n denom = a1 * b2 - a2 * b1\n\n if (denom === 0)\n return COLINEAR\n\n offset = denom < 0 ? - denom / 2 : denom / 2\n\n x = b1 * c2 - b2 * c1\n y = a2 * c1 - a1 * c2\n\n out[0] = ( x < 0 ? x : x ) / denom\n out[1] = ( y < 0 ? y : y ) / denom\n \n return DO_INTERSECT\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {\n\tvar forwardSegs = seg.forwardSegs;\n\tvar i;\n\n\tif (seg.forwardCoord === undefined) { // not already computed\n\n\t\tif (!forwardSegs.length) {\n\n\t\t\t// if there are no forward segments, this segment should butt up against the edge\n\t\t\tseg.forwardCoord = 1;\n\t\t}\n\t\telse {\n\n\t\t\t// sort highest pressure first\n\t\t\tforwardSegs.sort(compareForwardSlotSegs);\n\n\t\t\t// this segment's forwardCoord will be calculated from the backwardCoord of the\n\t\t\t// highest-pressure forward segment.\n\t\t\tcomputeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);\n\t\t\tseg.forwardCoord = forwardSegs[0].backwardCoord;\n\t\t}\n\n\t\t// calculate the backwardCoord from the forwardCoord. consider the series\n\t\tseg.backwardCoord = seg.forwardCoord -\n\t\t\t(seg.forwardCoord - seriesBackwardCoord) / // available width for series\n\t\t\t(seriesBackwardPressure + 1); // # of segments in the series\n\n\t\t// use this segment's coordinates to computed the coordinates of the less-pressurized\n\t\t// forward segments\n\t\tfor (i=0; i<forwardSegs.length; i++) {\n\t\t\tcomputeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);\n\t\t}\n\t}\n}", "function matchSegment(seg1, seg2, r, result) {\n var a = seg1[0],\n b = seg1[1],\n c = seg2[0],\n d = seg2[1],\n len = result.length;\n\n var ap = closePoint(a, c, d, r),\n bp = closePoint(b, c, d, r);\n\n // a----b\n // c---ap---bp---d\n if (ap !== null && bp !== null) return true; // fully covered\n\n var cp = closePoint(c, a, b, r),\n dp = closePoint(d, a, b, r);\n\n if (cp !== null && cp === dp) return false; // degenerate case, no overlap\n\n if (cp !== null && dp !== null) {\n var cpp = segPoint(a, b, cp);\n var dpp = segPoint(a, b, dp);\n\n if (equals(cpp, dpp)) return false; // degenerate case\n\n // a---cp---dp---b\n // c----d\n if (cp < dp) {\n if (!equals(a, cpp)) result.push([a, cpp]);\n if (!equals(dpp, b)) result.push([dpp, b]);\n\n // a---dp---cp---b\n // d----c\n } else {\n if (!equals(a, dpp)) result.push([a, dpp]);\n if (!equals(cpp, b)) result.push([cpp, b]);\n }\n\n } else if (cp !== null) {\n var cpp = segPoint(a, b, cp);\n\n // a----cp---b\n // d---ap---c\n if (ap !== null && !equals(a, cpp)) result.push([cpp, b]);\n\n // a---cp---b\n // c----bp---d\n else if (bp !== null && !equals(cpp, b)) result.push([a, cpp]);\n\n } else if (dp !== null) {\n var dpp = segPoint(a, b, dp);\n\n // a---dp---b\n // d----bp---c\n if (bp !== null && !equals(dpp, b)) result.push([a, dpp]);\n\n // a----dp---b\n // c---ap---d\n else if (ap !== null && !equals(a, dpp)) result.push([dpp, b]);\n }\n\n return result.length !== len; // segment processed\n}", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {\r\n var ux = x1 - x0;\r\n var uy = y1 - y0;\r\n var vx = x3 - x2;\r\n var vy = y3 - y2;\r\n var wx = x0 - x2;\r\n var wy = y0 - y2;\r\n var a = ux * ux + uy * uy;\r\n var b = ux * vx + uy * vy;\r\n var c = vx * vx + vy * vy;\r\n var d = ux * wx + uy * wy;\r\n var e = vx * wx + vy * wy;\r\n var D = a * c - b * b;\r\n\r\n var sc, sN, tc, tN;\r\n var sD = D;\r\n var tD = D;\r\n\r\n if (D === 0) {\r\n sN = 0;\r\n sD = 1;\r\n tN = e;\r\n tD = c;\r\n } else {\r\n sN = b * e - c * d;\r\n tN = a * e - b * d;\r\n if (sN < 0) {\r\n sN = 0;\r\n tN = e;\r\n tD = c;\r\n } else if (sN > sD) {\r\n sN = sD;\r\n tN = e + b;\r\n tD = c;\r\n }\r\n }\r\n\r\n if (tN < 0.0) {\r\n tN = 0.0;\r\n if (-d < 0.0) sN = 0.0;\r\n else if (-d > a) sN = sD;\r\n else {\r\n sN = -d;\r\n sD = a;\r\n }\r\n } else if (tN > tD) {\r\n tN = tD;\r\n if (-d + b < 0.0) sN = 0;\r\n else if (-d + b > a) sN = sD;\r\n else {\r\n sN = -d + b;\r\n sD = a;\r\n }\r\n }\r\n\r\n sc = sN === 0 ? 0 : sN / sD;\r\n tc = tN === 0 ? 0 : tN / tD;\r\n\r\n var cx = (1 - sc) * x0 + sc * x1;\r\n var cy = (1 - sc) * y0 + sc * y1;\r\n var cx2 = (1 - tc) * x2 + tc * x3;\r\n var cy2 = (1 - tc) * y2 + tc * y3;\r\n var dx = cx2 - cx;\r\n var dy = cy2 - cy;\r\n\r\n return dx * dx + dy * dy;\r\n}", "function F(a,b){var c=G.getRowCnt(),d=G.getColCnt(),e=[],f=B(a),g=B(b),h=+b.time();h&&h>=M&&g++,g=Math.max(g,f+1);\n// loop through all the rows in the view\nfor(var i=C(f),j=C(g)-1,k=0;k<c;k++){\n// first and last cell offset for the row\nvar l=k*d,m=l+d-1,n=Math.max(i,l),o=Math.min(j,m);\n// make sure segment's offsets are valid and in view\nif(n<=o){\n// translate to cells\nvar p=D(n),q=D(o),r=[p.col,q.col].sort(),s=y(n)==f,t=y(o)+1==g;// +1 for comparing exclusively\ne.push({row:k,leftCol:r[0],rightCol:r[1],isStart:s,isEnd:t})}}return e}", "get _physicalEnd(){return(this._physicalStart+this._physicalCount-1)%this._physicalCount;}", "size(){ return this.end-this.start }", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "blocksTravelled(){\n let horizontal = Math.abs(eastWest.indexOf(this.beginningLocation.horizontal) - eastWest.indexOf(this.endingLocation.horizontal))\n let vertical = Math.abs(parseInt(this.beginningLocation.vertical)-parseInt(this.endingLocation.vertical))\n return (horizontal + vertical);\n }", "function computeSegCoords(segs, dayDate, slatCoords, eventMinHeight, eventOrderSpecs) {\n computeSegVerticals(segs, dayDate, slatCoords, eventMinHeight);\n return computeSegHorizontals(segs, eventOrderSpecs); // requires top/bottom from computeSegVerticals\n } // For each segment in an array, computes and assigns its top and bottom properties", "function countWaysToSplit(s) {\n let counter = 0;\n for (let i = 1; i < s.length - 1; i++) {\n const a = s.slice(0, i);\n for (let j = i + 1; j < s.length; j++) {\n const b = s.slice(i, j);\n const c = s.slice(j, s.length);\n const ab = a + b;\n const bc = b + c;\n const ca = c + a;\n if (ab != bc && bc != ca && ca != ab) {\n counter++;\n }\n }\n }\n return counter;\n}", "function computeLowerBound(offsets, firsts) {\n\tlet o = new Set();\n\tlet hasPos = false;\n\tlet hasNeg = false;\n\tfor (let i = 0; i<offsets.length; i++){\n\t\tif(offsets[i]!=0){\n\t\t\tif (offsets[i]>0) {\n\t\t\t\thasPos = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\thasNeg = true;\n\t\t\t}\n\t\t\to.add(offsets[i]);\n\t\t\t/*if (firsts[i]) {\n\t\t\t\tlet stack_offsets = new Set();\n\t\t\t\tlet j = i-1;\n\t\t\t\tlet k = i+1;\n\t\t\t\twhile (j > 0 && offsets[j] > offsets[i]){\n\t\t\t\t\tstack_offsets.add(offsets[j]);\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\twhile(k<offsets.length && offsets[k] < offsets[i]) {\n\t\t\t\t\tstack_offsets.add(offsets[k]);\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t\tif (stack_offsets.has(0)) {\n\t\t\t\t\to.add(0);\n\t\t\t\t}\n\t\t\t}*/\n\t\t}\n\t}\n\t/*if (hasPos && hasNeg) {\n\t\to.add(0);\n\t}*/\n\treturn (o.size==0) ? 0 : o.size+1//one extra for initial transfer to the back bed;\n}", "get _physicalEnd(){return(this._physicalStart+this._physicalCount-1)%this._physicalCount}", "function sequenceSum(start,finish,step){\n let sum=0;\n for (let i=start;i<=finish;i+=step){\n sum += i;\n }\n console.log(\"#1: \" + sum);\n}", "static spans(sets, from, to, iterator, \n /**\n When given and greater than -1, only points of at least this\n size are taken into account.\n */\n minPointSize = -1) {\n let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;\n let openRanges = cursor.openStart;\n for (;;) {\n let curTo = Math.min(cursor.to, to);\n if (cursor.point) {\n let active = cursor.activeForPoint(cursor.to);\n let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);\n iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);\n openRanges = Math.min(cursor.openEnd(curTo), active.length);\n }\n else if (curTo > pos) {\n iterator.span(pos, curTo, cursor.active, openRanges);\n openRanges = cursor.openEnd(curTo);\n }\n if (cursor.to > to)\n return openRanges + (cursor.point && cursor.to > to ? 1 : 0);\n pos = cursor.to;\n cursor.next();\n }\n }", "function opgave7(start, end){\n var arrayen = [];\n while(start<end){\n arrayen.push(start);\n start++;\n }\n arrayen.push(start);\n return arrayen;\n \n}", "function unionSegments(segment1, segment2) {\n return [\n Math.min(segment1[0], segment2[0]),\n Math.max(segment1[1], segment2[1]),\n ];\n}", "length(){ return this.end-this.start }", "* getOperations (startSS) {\n // TODO: use bounds here!\n if (startSS == null) {\n startSS = {}\n }\n var send = []\n\n var endSV = yield* this.getStateVector()\n for (var endState of endSV) {\n var user = endState.user\n if (user === '_') {\n continue\n }\n var startPos = startSS[user] || 0\n if (startPos > 0) {\n // There is a change that [user, startPos] is in a composed Insertion (with a smaller counter)\n // find out if that is the case\n var firstMissing = yield* this.getInsertion([user, startPos])\n if (firstMissing != null) {\n // update startPos\n startPos = firstMissing.id[1]\n startSS[user] = startPos\n }\n }\n yield* this.os.iterate(this, [user, startPos], [user, Number.MAX_VALUE], function * (op) {\n op = Y.Struct[op.struct].encode(op)\n if (op.struct !== 'Insert') {\n send.push(op)\n } else if (op.right == null || op.right[1] < (startSS[op.right[0]] || 0)) {\n // case 1. op.right is known\n var o = op\n // Remember: ?\n // -> set op.right\n // 1. to the first operation that is known (according to startSS)\n // 2. or to the first operation that has an origin that is not to the\n // right of op.\n // For this we maintain a list of ops which origins are not found yet.\n var missing_origins = [op]\n var newright = op.right\n while (true) {\n if (o.left == null) {\n op.left = null\n send.push(op)\n if (!Y.utils.compareIds(o.id, op.id)) {\n o = Y.Struct[op.struct].encode(o)\n o.right = missing_origins[missing_origins.length - 1].id\n send.push(o)\n }\n break\n }\n o = yield* this.getInsertion(o.left)\n // we set another o, check if we can reduce $missing_origins\n while (missing_origins.length > 0 && Y.utils.matchesId(o, missing_origins[missing_origins.length - 1].origin)) {\n missing_origins.pop()\n }\n if (o.id[1] < (startSS[o.id[0]] || 0)) {\n // case 2. o is known\n op.left = Y.utils.getLastId(o)\n send.push(op)\n break\n } else if (Y.utils.matchesId(o, op.origin)) {\n // case 3. o is op.origin\n op.left = op.origin\n send.push(op)\n op = Y.Struct[op.struct].encode(o)\n op.right = newright\n if (missing_origins.length > 0) {\n console.log('This should not happen .. :( please report this')\n }\n missing_origins = [op]\n } else {\n // case 4. send o, continue to find op.origin\n var s = Y.Struct[op.struct].encode(o)\n s.right = missing_origins[missing_origins.length - 1].id\n s.left = s.origin\n send.push(s)\n missing_origins.push(o)\n }\n }\n }\n })\n }\n return send.reverse()\n }", "function drawSegmentsOverLine(start, end, totalPts) {\n\n var percIncrement = 1 / (totalPts - 1);\n var drawPerc = 0;\n var pt;\n for (var i = 0; i < totalPts; i++) {\n drawPerc = percIncrement * i;\n pt = midpoint(start.x, start.y, end.x, end.y, drawPerc);\n circle(pt.x, pt.y);\n }\n\n }", "function subarrayWithGivenSum(arr, s) {\n // brute force\n for (let i = 0; i < arr.length; i++) {\n let currSum = 0;\n for (let j = i; j < arr.length; j++) {\n currSum += arr[j];\n if (currSum === s) return [i, j];\n }\n }\n return [-1, -1];\n // two pointer\n // let start = 0, end = 0;\n // let currSum = 0;\n // while (start < arr.length && end < arr.length) {\n // currSum += arr[end];\n // if (currSum === s) return [start, end];\n // if (currSum + arr[end] > s) start++;\n // else if (currSum + arr[end] < s) end++;\n // }\n // while (start < arr.length) {\n // currSum -= arr[start]\n // if (currSum === s) return [start, end];\n // start++;\n // }\n}", "function sum() {\n return mid + final;\n}", "function inSegment(xP, yP) {\r\n }", "function c(e){var a,l,c,u=i.length/3,h=e.extractPoints(t),d=h.shape,p=h.holes;// check direction of vertices\nif(!1===Xr.isClockWise(d))// also check if holes are in the opposite direction\nfor(d=d.reverse(),a=0,l=p.length;a<l;a++)c=p[a],!0===Xr.isClockWise(c)&&(p[a]=c.reverse());var f=Xr.triangulateShape(d,p);// join vertices of inner and outer paths to a single array\nfor(a=0,l=p.length;a<l;a++)c=p[a],d=d.concat(c);// vertices, normals, uvs\nfor(a=0,l=d.length;a<l;a++){var m=d[a];i.push(m.x,m.y,0),r.push(0,0,1),o.push(m.x,m.y)}// incides\nfor(a=0,l=f.length;a<l;a++){var g=f[a],v=g[0]+u,y=g[1]+u,x=g[2]+u;n.push(v,y,x),s+=3}}", "function computeSlotSegPressures(seg){var forwardSegs=seg.forwardSegs;var forwardPressure=0;var i;var forwardSeg;if(seg.forwardPressure===undefined){// not already computed\nfor(i=0;i<forwardSegs.length;i++){forwardSeg=forwardSegs[i];// figure out the child's maximum forward path\ncomputeSlotSegPressures(forwardSeg);// either use the existing maximum, or use the child's forward pressure\n// plus one (for the forwardSeg itself)\nforwardPressure=Math.max(forwardPressure,1+forwardSeg.forwardPressure);}seg.forwardPressure=forwardPressure;}}// Find all the segments in `otherSegs` that vertically collide with `seg`.", "function solution(A, S) {\n // write your code in JavaScript (Node.js 8.9.4\n let result = 0;\n if(A.length<1){\n return result; //base case\n }\n //dymamic\n let runningSum = 0;\n for(let i=0; i<A.length; i++){\n let el = A[i];\n \n runningSum+=el;\n \n // if(el>S){\n // continue;\n // }\n // else if(el===S){\n // result++;\n // }\n // else {\n // remaining=S-el;\n //get left and right of S\n result+= solution(A.slice(0,i), S);\n result+= solution(A.slice(i+1), S);\n //}\n }\n if(Math.floor(runningSum/A.length)===S){\n result++;\n }\n \n \n return result;\n //solutionHelper(A,S,0, A.length-1);\n}", "get excludeCollinear(){\n\t\tlet list = this.segList2D;\n\t\tlet newlist = [];\n\t\tfor (let i=0; i<list.length; i++){\n\t\t\tlet thisseg = list[i];\n\t\t\tlet x0 = thisseg.a[0];\n\t\t\tlet y0 = thisseg.a[1];\n\t\t\tlet x1 = thisseg.b[0];\n\t\t\tlet y1 = thisseg.b[1];\n\t\t\tlet nextseg\n\t\t\tif (i === list.length-1){\n\t\t\t\tnextseg = list[0];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnextseg = list[i+1];\n\t\t\t}\n\t\t\tlet a0 = nextseg.a[0];\n\t\t\tlet b0 = nextseg.a[1];\n\t\t\tlet a1 = nextseg.b[0];\n\t\t\tlet b1 = nextseg.b[1];\n\t\t\tlet xy = Math.round((y1-y0)/(x1-x0)*1000000)/1000000;\n\t\t\tlet ab = Math.round((b1-b0)/(a1-a0)*1000000)/1000000;\n\t\t\tif (xy !== ab){\n\t\t\t\tnewlist.push(thisseg);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif (i===list.length-1){\n\t\t\t\t\tnewlist.shift();\n\t\t\t\t}\n\t\t\t\tnewlist.push({a:[x0,y0],b:[a1,b1]})\n\t\t\t}\n\t\t}\n\t\treturn newlist;\n\t}", "function unionRanges(range1, range2) {\n let i = 0;\n let j = 0;\n const union = [];\n while (i < range1.length && j < range2.length) {\n if (segmentsOverlap(range1[i], range2[j])) {\n let overlap = unionSegments(range1[i], range2[j]);\n i += 1;\n j += 1;\n while (i < range1.length && segmentsOverlap(overlap, range1[i])) {\n overlap = unionSegments(overlap, range1[i]);\n i += 1;\n }\n while (j < range2.length && segmentsOverlap(overlap, range2[j])) {\n overlap = unionSegments(overlap, range2[j]);\n j += 1;\n }\n union.push(overlap);\n } else if (range1[i][0] <= range2[j][0]) {\n union.push(range1[i].slice(0));\n i += 1;\n } else {\n union.push(range2[j].slice(0));\n j += 1;\n }\n }\n while (i < range1.length) {\n union.push(range1[i].slice(0));\n i += 1;\n }\n while (j < range2.length) {\n union.push(range2[j].slice(0));\n j += 1;\n }\n return union;\n}", "function lhseg(r,c) {\n if(c-1<0){\n return(null)\n } else {\n return([r,c-1])\n }\n}", "function rangeToSegments(startDate, endDate) {\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(startDate);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(endDate); // exclusive\n\n\t\t// first and last cell offset for the given date range\n\t\t// \"last\" implies inclusivity\n\t\tvar rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);\n\t\tvar rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;\n\n\t\t// loop through all the rows in the view\n\t\tfor (var row=0; row<rowCnt; row++) {\n\n\t\t\t// first and last cell offset for the row\n\t\t\tvar rowCellOffsetFirst = row * colCnt;\n\t\t\tvar rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;\n\n\t\t\t// get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row\n\t\t\tvar segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);\n\t\t\tvar segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);\n\n\t\t\t// make sure segment's offsets are valid and in view\n\t\t\tif (segmentCellOffsetFirst <= segmentCellOffsetLast) {\n\n\t\t\t\t// translate to cells\n\t\t\t\tvar segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);\n\t\t\t\tvar segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);\n\n\t\t\t\t// view might be RTL, so order by leftmost column\n\t\t\t\tvar cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();\n\n\t\t\t\t// Determine if segment's first/last cell is the beginning/end of the date range.\n\t\t\t\t// We need to compare \"day offset\" because \"cell offsets\" are often ambiguous and\n\t\t\t\t// can translate to multiple days, and an edge case reveals itself when we the\n\t\t\t\t// range's first cell is hidden (we don't want isStart to be true).\n\t\t\t\tvar isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;\n\t\t\t\tvar isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively\n\n\t\t\t\tsegments.push({\n\t\t\t\t\trow: row,\n\t\t\t\t\tleftCol: cols[0],\n\t\t\t\t\trightCol: cols[1],\n\t\t\t\t\tisStart: isStart,\n\t\t\t\t\tisEnd: isEnd\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn segments;\n\t}", "function rangeToSegments(startDate, endDate) {\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(startDate);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(endDate); // exclusive\n\n\t\t// first and last cell offset for the given date range\n\t\t// \"last\" implies inclusivity\n\t\tvar rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);\n\t\tvar rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;\n\n\t\t// loop through all the rows in the view\n\t\tfor (var row=0; row<rowCnt; row++) {\n\n\t\t\t// first and last cell offset for the row\n\t\t\tvar rowCellOffsetFirst = row * colCnt;\n\t\t\tvar rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;\n\n\t\t\t// get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row\n\t\t\tvar segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);\n\t\t\tvar segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);\n\n\t\t\t// make sure segment's offsets are valid and in view\n\t\t\tif (segmentCellOffsetFirst <= segmentCellOffsetLast) {\n\n\t\t\t\t// translate to cells\n\t\t\t\tvar segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);\n\t\t\t\tvar segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);\n\n\t\t\t\t// view might be RTL, so order by leftmost column\n\t\t\t\tvar cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();\n\n\t\t\t\t// Determine if segment's first/last cell is the beginning/end of the date range.\n\t\t\t\t// We need to compare \"day offset\" because \"cell offsets\" are often ambiguous and\n\t\t\t\t// can translate to multiple days, and an edge case reveals itself when we the\n\t\t\t\t// range's first cell is hidden (we don't want isStart to be true).\n\t\t\t\tvar isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;\n\t\t\t\tvar isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively\n\n\t\t\t\tsegments.push({\n\t\t\t\t\trow: row,\n\t\t\t\t\tleftCol: cols[0],\n\t\t\t\t\trightCol: cols[1],\n\t\t\t\t\tisStart: isStart,\n\t\t\t\t\tisEnd: isEnd\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn segments;\n\t}", "function rangeToSegments(startDate, endDate) {\n\t\tvar rowCnt = t.getRowCnt();\n\t\tvar colCnt = t.getColCnt();\n\t\tvar segments = []; // array of segments to return\n\n\t\t// day offset for given date range\n\t\tvar rangeDayOffsetStart = dateToDayOffset(startDate);\n\t\tvar rangeDayOffsetEnd = dateToDayOffset(endDate); // exclusive\n\n\t\t// first and last cell offset for the given date range\n\t\t// \"last\" implies inclusivity\n\t\tvar rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);\n\t\tvar rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;\n\n\t\t// loop through all the rows in the view\n\t\tfor (var row=0; row<rowCnt; row++) {\n\n\t\t\t// first and last cell offset for the row\n\t\t\tvar rowCellOffsetFirst = row * colCnt;\n\t\t\tvar rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;\n\n\t\t\t// get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row\n\t\t\tvar segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);\n\t\t\tvar segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);\n\n\t\t\t// make sure segment's offsets are valid and in view\n\t\t\tif (segmentCellOffsetFirst <= segmentCellOffsetLast) {\n\n\t\t\t\t// translate to cells\n\t\t\t\tvar segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);\n\t\t\t\tvar segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);\n\n\t\t\t\t// view might be RTL, so order by leftmost column\n\t\t\t\tvar cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();\n\n\t\t\t\t// Determine if segment's first/last cell is the beginning/end of the date range.\n\t\t\t\t// We need to compare \"day offset\" because \"cell offsets\" are often ambiguous and\n\t\t\t\t// can translate to multiple days, and an edge case reveals itself when we the\n\t\t\t\t// range's first cell is hidden (we don't want isStart to be true).\n\t\t\t\tvar isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;\n\t\t\t\tvar isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively\n\n\t\t\t\tsegments.push({\n\t\t\t\t\trow: row,\n\t\t\t\t\tleftCol: cols[0],\n\t\t\t\t\trightCol: cols[1],\n\t\t\t\t\tisStart: isStart,\n\t\t\t\t\tisEnd: isEnd\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn segments;\n\t}", "function handleBlock(startArr,startOffsetM,startOffsetNextM,destArr,destOffsetM,destOffsetNextM,undefined){// slice out the block we need\nvar startArrTemp=startArr.slice(startOffsetM,startOffsetNextM||undefined),destArrTemp=destArr.slice(destOffsetM,destOffsetNextM||undefined);var i=0,posStart={pos:[0,0],start:[0,0]},posDest={pos:[0,0],start:[0,0]};do{// convert shorthand types to long form\nstartArrTemp[i]=simplyfy.call(posStart,startArrTemp[i]);destArrTemp[i]=simplyfy.call(posDest,destArrTemp[i]);// check if both shape types match\n// 2 elliptical arc curve commands ('A'), are considered different if the\n// flags (large-arc-flag, sweep-flag) don't match\nif(startArrTemp[i][0]!=destArrTemp[i][0]||startArrTemp[i][0]=='M'||startArrTemp[i][0]=='A'&&(startArrTemp[i][4]!=destArrTemp[i][4]||startArrTemp[i][5]!=destArrTemp[i][5])){// if not, convert shapes to beziere\nArray.prototype.splice.apply(startArrTemp,[i,1].concat(toBeziere.call(posStart,startArrTemp[i])));Array.prototype.splice.apply(destArrTemp,[i,1].concat(toBeziere.call(posDest,destArrTemp[i])));}else{// only update positions otherwise\nstartArrTemp[i]=setPosAndReflection.call(posStart,startArrTemp[i]);destArrTemp[i]=setPosAndReflection.call(posDest,destArrTemp[i]);}// we are at the end at both arrays. stop here\nif(++i==startArrTemp.length&&i==destArrTemp.length)break;// destArray is longer. Add one element\nif(i==startArrTemp.length){startArrTemp.push(['C',posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1]]);}// startArr is longer. Add one element\nif(i==destArrTemp.length){destArrTemp.push(['C',posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1]]);}}while(true);// return the updated block\nreturn{start:startArrTemp,dest:destArrTemp};}// converts shorthand types to long form", "function d(b,c,d){\n// where the DOM nodes will eventually end up\nvar f,g,j=T(),m=c?a(\"<div/>\"):j,n=e(b);\n// calculate the desired `left` and `width` properties on each segment object\n// build the HTML string. relies on `left` property\n// render the HTML. innerHTML is considerably faster than jQuery's .html()\n// retrieve the individual elements\n// if we were appending, and thus using a temporary container,\n// re-attach elements to the real container.\n// assigns each element to `segment.event`, after filtering them through user callbacks\n// Calculate the left and right padding+margin for each element.\n// We need this for setting each element's desired outer width, because of the W3C box model.\n// It's important we do this in a separate pass from acually setting the width on the DOM elements\n// because alternating reading/writing dimensions causes reflow for every iteration.\n// Set the width of each element\n// Grab each element's outerHeight (setVerticals uses this).\n// To get an accurate reading, it's important to have each element's width explicitly set already.\n// Set the top coordinate on each element (requires segment.outerHeight)\nreturn h(n),f=i(n),m[0].innerHTML=f,g=m.children(),c&&j.append(g),k(n,g),xa(n,function(a,b){a.hsides=t(b,!0)}),xa(n,function(a,b){b.width(Math.max(0,a.outerWidth-a.hsides))}),xa(n,function(a,b){a.outerHeight=b.outerHeight(!0)}),l(n,d),n}", "function computeSegHorizontals(segs, eventOrderSpecs) {\n // IMPORTANT TO CLEAR OLD RESULTS :(\n for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {\n var seg = segs_2[_i];\n seg.level = null;\n seg.forwardCoord = null;\n seg.backwardCoord = null;\n seg.forwardPressure = null;\n }\n segs = sortEventSegs(segs, eventOrderSpecs);\n var level0;\n var levels = buildSlotSegLevels(segs);\n computeForwardSlotSegs(levels);\n if ((level0 = levels[0])) {\n for (var _a = 0, level0_1 = level0; _a < level0_1.length; _a++) {\n var seg = level0_1[_a];\n computeSlotSegPressures(seg);\n }\n for (var _b = 0, level0_2 = level0; _b < level0_2.length; _b++) {\n var seg = level0_2[_b];\n computeSegForwardBack(seg, 0, 0, eventOrderSpecs);\n }\n }\n return segs;\n }", "function line_line_intersection_vecs(p,q,r,s) {\n\tvar r_cross_s = vec2_crossprod( r, s ); //it's a scalar, representing z.\n\tif(r_cross_s === 0)\n\t{\n\t\tconsole.log(\"parallel?\",r,s)\n\t\treturn 0;\n\t}\n\t\n\tvar r_over_r_cross_s = r.clone();\n\tvar s_over_r_cross_s = s.clone();\n\t\n\tvar p_to_q = q.clone();\n\tp_to_q.sub(p);\n\t\n\tvar u = vec2_crossprod(p_to_q,r_over_r_cross_s);\n\tvar t = vec2_crossprod(p_to_q,s_over_r_cross_s);\n\t\n\tu /= r_cross_s;\n\tt /= r_cross_s;\n\t\n//\tif( 0 <= u && u <= 1 \n//\t && 0 <= t && t <= 1 ){\n//\t\t//answer is inside both line segments\n//\t}\n\n\tvar answer = p.clone();\n\tanswer.addScaledVector(r, t);\n\treturn answer;\n}", "function handleBlock(startArr,startOffsetM,startOffsetNextM,destArr,destOffsetM,destOffsetNextM,undefined$1){// slice out the block we need\nvar startArrTemp=startArr.slice(startOffsetM,startOffsetNextM||undefined$1),destArrTemp=destArr.slice(destOffsetM,destOffsetNextM||undefined$1);var i=0,posStart={pos:[0,0],start:[0,0]},posDest={pos:[0,0],start:[0,0]};do{// convert shorthand types to long form\nstartArrTemp[i]=simplyfy.call(posStart,startArrTemp[i]);destArrTemp[i]=simplyfy.call(posDest,destArrTemp[i]);// check if both shape types match\n// 2 elliptical arc curve commands ('A'), are considered different if the\n// flags (large-arc-flag, sweep-flag) don't match\nif(startArrTemp[i][0]!=destArrTemp[i][0]||startArrTemp[i][0]=='M'||startArrTemp[i][0]=='A'&&(startArrTemp[i][4]!=destArrTemp[i][4]||startArrTemp[i][5]!=destArrTemp[i][5])){// if not, convert shapes to beziere\nArray.prototype.splice.apply(startArrTemp,[i,1].concat(toBeziere.call(posStart,startArrTemp[i])));Array.prototype.splice.apply(destArrTemp,[i,1].concat(toBeziere.call(posDest,destArrTemp[i])));}else{// only update positions otherwise\nstartArrTemp[i]=setPosAndReflection.call(posStart,startArrTemp[i]);destArrTemp[i]=setPosAndReflection.call(posDest,destArrTemp[i]);}// we are at the end at both arrays. stop here\nif(++i==startArrTemp.length&&i==destArrTemp.length)break;// destArray is longer. Add one element\nif(i==startArrTemp.length){startArrTemp.push(['C',posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1],posStart.pos[0],posStart.pos[1]]);}// startArr is longer. Add one element\nif(i==destArrTemp.length){destArrTemp.push(['C',posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1],posDest.pos[0],posDest.pos[1]]);}}while(true);// return the updated block\nreturn{start:startArrTemp,dest:destArrTemp};}// converts shorthand types to long form", "function getSpine(cs) {\n var a = cs[1]\n var w = detag(a)\n var rs = Array(w - 1).fill()\n for (var i = 0; i < w - 1; i++) {\n var x = cs[3 + i]\n var t = tagOf(x)\n if (R != t)\n throw \"*** getSpine: unexpected tag=\" + t\n rs[i] = detag(x)\n }\n//trace('getSpine', cs, rs)\n return rs;\n}", "function main() {\n var testCases = nextInt();\n var AC, AJ, DC, JK, full, DCSUm, JKSum, res, gaps, gapsDC, gapsJK;\n\n for (var testCase = 1; testCase <= testCases; ++testCase) {\n res = 0;\n AC = nextInt();\n AJ = nextInt();\n\n DC = [];\n for (var i = 0; i < AC; i++) {\n DC.push({\n start: nextInt(),\n end: nextInt(),\n parent: 0\n });\n }\n\n JK = [];\n for (var i = 0; i < AJ; i++) {\n JK.push({\n start: nextInt(),\n end: nextInt(),\n parent: 1\n });\n }\n\n full = DC.concat(JK).sort((a, b) => a.start - b.start);\n\n DCSUm = full.filter(interv => interv.parent === 0).reduce((a, b) => a + (b.end - b.start), 0);\n JKSum = full.filter(interv => interv.parent === 1).reduce((a, b) => a + (b.end - b.start), 0);\n\n gapsDC = [];\n gapsJK = [];\n for (let i = 0; i < full.length; i++) {\n if (i === full.length - 1) {\n if (full[i].parent !== full[0].parent) {\n res++;\n } else {\n let gap = 24 * 60 + (full[0].start - full[i].end);\n full[i].parent ? gapsJK.push(gap) : gapsDC.push(gap);\n }\n } else {\n if (full[i].parent !== full[i + 1].parent) {\n res++;\n } else {\n let gap = full[i + 1].start - full[i].end;\n full[i].parent ? gapsJK.push(gap) : gapsDC.push(gap);\n }\n }\n }\n\n\n gapsDC = gapsDC.sort((a, b) => a - b);\n gapsJK = gapsJK.sort((a, b) => a - b);\n // console.log(DCSUm, JKSum, gapsDC, gapsJK);\n\n while (DCSUm <= 12 * 60 && gapsDC.length > 0) {\n DCSUm += gapsDC.shift();\n }\n\n if (DCSUm > 12 * 60) {\n res += (gapsDC.length + 1) * 2;\n }\n\n // console.log(DCSUm, gapsDC);\n\n while (JKSum <= 12 * 60 && gapsJK.length > 0) {\n JKSum += gapsJK.shift();\n }\n\n if (JKSum > 12 * 60) {\n res += (gapsJK.length + 1) * 2;\n }\n\n // console.log(JKSum, gapsJK);\n\n\n // console.log(res);\n\n\n print(\"Case #\" + testCase + \": \" + (res < 2 ? 2 : res));\n }\n}", "function _subtract(a, b, r, s) {\n\n\t\tfor (var i = 0; i < s; i++) {\n\n\t\t\tfor (var j = 0; j < s; j++) {\n\n\t\t\t\tr[s*i + j] = OP.subtract(a[s*i + j], b[s*i + j]);\n\n\t\t\t}\n\n\t\t}\n\n\t}", "function solution(A) {\n // Create prefix sum table\n const pSumsA = [0];\n for (let i = 0; i < A.length; i++){\n pSumsA[i+1] = pSumsA[i] + A[i];\n\n }\n console.log(pSumsA)\n\n // Iterate through slices by end point, finding the minimum av and tracking it\n let minAvg = Number.MAX_SAFE_INTEGER;\n let minAvgStart = 0;\n let currStart = 0;\n for(let end = 2; end < A.length; end++) { // start at 2 since that's the end of smallest 2-array\n\n }\n\n\n}", "function fresh_seg_or_upward_cusp() {\r\n\t\t\t// trCurrent has at most 1 upper neighbor\r\n\t\t\t//\tand should also have at least 1, since the high-point trapezoid\r\n\t\t\t//\thas been split off another one, which is now above\r\n\t\t\tvar trUpper = trCurrent.uL || trCurrent.uR;\r\n\r\n\t\t\t// trNewLeft and trNewRight CANNOT have been extended from above\r\n\t\t\tif ( trUpper.dL && trUpper.dR ) {\r\n\t\t\t\t// upward cusp: top forms a triangle\r\n\r\n\t\t\t\t// ATTENTION: the decision whether trNewLeft or trNewRight is the\r\n\t\t\t\t//\ttriangle trapezoid formed by the two segments has already been taken\r\n\t\t\t\t//\twhen selecting trCurrent as the left or right lower neighbor to trUpper !!\r\n\r\n\t\t\t\tif ( trCurrent == trUpper.dL ) {\r\n\t\t\t\t\t//\t*** Case: FUC_UC_LEFT; prev: ----\r\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg to the left!\" );\r\n\t\t\t\t\t//\t\t upper\r\n\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t//\t\t + \\\r\n\t\t\t\t\t//\t NL + \\\r\n\t\t\t\t\t//\t\t +\tNR \\\r\n\t\t\t\t\t//\t\t+\t\t\\\r\n\t\t\t\t\ttrNewRight.uL\t= null;\t\t\t// setAbove; trNewRight.uR, trNewLeft unchanged\r\n\t\t\t\t\ttrUpper.dL\t\t= trNewLeft;\t// setBelow; dR: unchanged, NEVER null\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: FUC_UC_RIGHT; prev: ----\r\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg from the right!\" );\r\n\t\t\t\t\t//\t\t upper\r\n\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t//\t\t / +\r\n\t\t\t\t\t//\t\t / +\t NR\r\n\t\t\t\t\t//\t\t /\tNL +\r\n\t\t\t\t\t//\t\t/\t\t+\r\n\t\t\t\t\ttrNewLeft.uR\t= null;\t\t\t// setAbove; trNewLeft.uL, trNewRight unchanged\r\n\t\t\t\t\ttrUpper.dR\t\t= trNewRight;\t// setBelow; dL: unchanged, NEVER null\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t//\t*** Case: FUC_FS; prev: \"splitOffLower\"\r\n\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: fresh segment, high adjacent segment still missing\" );\r\n\t\t\t\t//\t\t upper\r\n\t\t\t\t// -------*-------\r\n\t\t\t\t//\t\t +\r\n\t\t\t\t//\t NL +\r\n\t\t\t\t//\t\t +\tNR\r\n\t\t\t\t//\t\t+\r\n\t\t\t\ttrNewRight.uL = null;\t\t\t// setAbove; trNewLeft unchanged, set by \"splitOffLower\"\r\n\t\t\t\ttrNewRight.uR = trUpper;\r\n\t\t\t\ttrUpper.dR = trNewRight;\t\t// setBelow; trUpper.dL unchanged, set by \"splitOffLower\"\r\n\t\t\t}\r\n \t\t}", "function fresh_seg_or_upward_cusp() {\r\n\t\t\t// trCurrent has at most 1 upper neighbor\r\n\t\t\t//\tand should also have at least 1, since the high-point trapezoid\r\n\t\t\t//\thas been split off another one, which is now above\r\n\t\t\tvar trUpper = trCurrent.uL || trCurrent.uR;\r\n\r\n\t\t\t// trNewLeft and trNewRight CANNOT have been extended from above\r\n\t\t\tif ( trUpper.dL && trUpper.dR ) {\r\n\t\t\t\t// upward cusp: top forms a triangle\r\n\r\n\t\t\t\t// ATTENTION: the decision whether trNewLeft or trNewRight is the\r\n\t\t\t\t//\ttriangle trapezoid formed by the two segments has already been taken\r\n\t\t\t\t//\twhen selecting trCurrent as the left or right lower neighbor to trUpper !!\r\n\r\n\t\t\t\tif ( trCurrent == trUpper.dL ) {\r\n\t\t\t\t\t//\t*** Case: FUC_UC_LEFT; prev: ----\r\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg to the left!\" );\r\n\t\t\t\t\t//\t\t upper\r\n\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t//\t\t + \\\r\n\t\t\t\t\t//\t NL + \\\r\n\t\t\t\t\t//\t\t +\tNR \\\r\n\t\t\t\t\t//\t\t+\t\t\\\r\n\t\t\t\t\ttrNewRight.uL\t= null;\t\t\t// setAbove; trNewRight.uR, trNewLeft unchanged\r\n\t\t\t\t\ttrUpper.dL\t\t= trNewLeft;\t// setBelow; dR: unchanged, NEVER null\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: FUC_UC_RIGHT; prev: ----\r\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg from the right!\" );\r\n\t\t\t\t\t//\t\t upper\r\n\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t//\t\t / +\r\n\t\t\t\t\t//\t\t / +\t NR\r\n\t\t\t\t\t//\t\t /\tNL +\r\n\t\t\t\t\t//\t\t/\t\t+\r\n\t\t\t\t\ttrNewLeft.uR\t= null;\t\t\t// setAbove; trNewLeft.uL, trNewRight unchanged\r\n\t\t\t\t\ttrUpper.dR\t\t= trNewRight;\t// setBelow; dL: unchanged, NEVER null\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\t//\t*** Case: FUC_FS; prev: \"splitOffLower\"\r\n\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: fresh segment, high adjacent segment still missing\" );\r\n\t\t\t\t//\t\t upper\r\n\t\t\t\t// -------*-------\r\n\t\t\t\t//\t\t +\r\n\t\t\t\t//\t NL +\r\n\t\t\t\t//\t\t +\tNR\r\n\t\t\t\t//\t\t+\r\n\t\t\t\ttrNewRight.uL = null;\t\t\t// setAbove; trNewLeft unchanged, set by \"splitOffLower\"\r\n\t\t\t\ttrNewRight.uR = trUpper;\r\n\t\t\t\ttrUpper.dR = trNewRight;\t\t// setBelow; trUpper.dL unchanged, set by \"splitOffLower\"\r\n\t\t\t}\r\n \t\t}", "function GetClipSegments(clip_intervals, block_size, hop_size, x_length) {\n var clip_segments = [];\n var num_clip_segments = 0;\n\n var in_segment = false;\n var start_idx = 0;\n var stop_idx = start_idx + block_size - 1;\n var block_idx = 0;\n\n var segment_start_idx = -1;\n var segment_stop_idx = -1;\n while(stop_idx < x_length) {\n // We are in a segment.\n if(in_segment) {\n // We leave the segment. Store it and move on.\n if(!AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n }\n // We are not in a segment.\n else {\n // We have entered a segment.\n if(AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = true;\n segment_start_idx = block_idx;\n }\n }\n\n block_idx++;\n start_idx = start_idx + hop_size;\n stop_idx = start_idx + block_size - 1;\n }\n\n // If we end while in a segment, we need to leave the segment and push the segment.\n if(in_segment) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n\n return clip_segments;\n }", "function fresh_seg_or_upward_cusp() {\n\t\t\t// trCurrent has at most 1 upper neighbor\n\t\t\t//\tand should also have at least 1, since the high-point trapezoid\n\t\t\t//\thas been split off another one, which is now above\n\t\t\tvar trUpper = trCurrent.uL || trCurrent.uR;\n\n\t\t\t// trNewLeft and trNewRight CANNOT have been extended from above\n\t\t\tif ( trUpper.dL && trUpper.dR ) {\n\t\t\t\t// upward cusp: top forms a triangle\n\n\t\t\t\t// ATTENTION: the decision whether trNewLeft or trNewRight is the\n\t\t\t\t//\ttriangle trapezoid formed by the two segments has already been taken\n\t\t\t\t//\twhen selecting trCurrent as the left or right lower neighbor to trUpper !!\n\n\t\t\t\tif ( trCurrent == trUpper.dL ) {\n\t\t\t\t\t//\t*** Case: FUC_UC_LEFT; prev: ----\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg to the left!\" );\n\t\t\t\t\t//\t\t upper\n\t\t\t\t\t// -------*-------\n\t\t\t\t\t//\t\t + \\\n\t\t\t\t\t//\t NL + \\\n\t\t\t\t\t//\t\t +\tNR \\\n\t\t\t\t\t//\t\t+\t\t\\\n\t\t\t\t\ttrNewRight.uL\t= null;\t\t\t// setAbove; trNewRight.uR, trNewLeft unchanged\n\t\t\t\t\ttrUpper.dL\t\t= trNewLeft;\t// setBelow; dR: unchanged, NEVER null\n\t\t\t\t} else {\n\t\t\t\t\t//\t*** Case: FUC_UC_RIGHT; prev: ----\n\t\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: upward cusp, new seg from the right!\" );\n\t\t\t\t\t//\t\t upper\n\t\t\t\t\t// -------*-------\n\t\t\t\t\t//\t\t / +\n\t\t\t\t\t//\t\t / +\t NR\n\t\t\t\t\t//\t\t /\tNL +\n\t\t\t\t\t//\t\t/\t\t+\n\t\t\t\t\ttrNewLeft.uR\t= null;\t\t\t// setAbove; trNewLeft.uL, trNewRight unchanged\n\t\t\t\t\ttrUpper.dR\t\t= trNewRight;\t// setBelow; dL: unchanged, NEVER null\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//\t*** Case: FUC_FS; prev: \"splitOffLower\"\n\t\t\t\t// console.log( \"fresh_seg_or_upward_cusp: fresh segment, high adjacent segment still missing\" );\n\t\t\t\t//\t\t upper\n\t\t\t\t// -------*-------\n\t\t\t\t//\t\t +\n\t\t\t\t//\t NL +\n\t\t\t\t//\t\t +\tNR\n\t\t\t\t//\t\t+\n\t\t\t\ttrNewRight.uL = null;\t\t\t// setAbove; trNewLeft unchanged, set by \"splitOffLower\"\n\t\t\t\ttrNewRight.uR = trUpper;\n\t\t\t\ttrUpper.dR = trNewRight;\t\t// setBelow; trUpper.dL unchanged, set by \"splitOffLower\"\n\t\t\t}\n \t\t}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function _winding(point,vs) {\n\n //Is a line from v1 to v2 entirely left of point p, entirely right of it, or neither?\n //A = difference in X from v1 to v2\n //B = difference in in Y from v1 to p\n //C = difference in X from v1 to p\n //D = difference in Y from v1 to v2\n //If AB > CD, it's strictly to the left of p in the direction v1->v2\n //If AB < CD, it's strictly to the right of p in the direction v1->v2\n function dir(v1,v2,p) {\n return (v2[0] - v1[0]) * (p[1] - v1[1]) - (p[0] - v1[0]) * (v2[1] - v1[1])\n }\n\n function isLeft(v1,v2,p) {\n return dir(v1,v2,p) > 0;\n }\n\n function isRight(v1,v2,p) {\n return dir(v1,v2,p) < 0;\n }\n\n var w = 0;\n\n //Need to compare last point connecting back to first\n if (vs[vs.length-1][0] !== vs[0][0] || vs[vs.length-1][1] !== vs[0][1]) {\n vs = vs.slice(0);\n vs.push(vs[0]);\n }\n\n //For each segment\n for (var i = 0, l = vs.length - 1; i < l; i++) {\n\n //Check upward\n if (vs[i][1] <= point[1]) {\n if (vs[i+1][1] > point[1] && isLeft(vs[i],vs[i+1],point)) {\n w++;\n }\n // Check downward\n } else if (vs[i+1][1] <= point[1] && isRight(vs[i],vs[i+1],point)) {\n w--;\n }\n\n }\n\n return w !== 0;\n\n }", "function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n var t1 = 1 - t;\n var t13 = Math.pow(t1, 3);\n var t12 = Math.pow(t1, 2);\n var t2 = t * t;\n var t3 = t2 * t;\n var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;\n var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;\n var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);\n var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);\n var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);\n var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);\n var ax = t1 * p1x + t * c1x;\n var ay = t1 * p1y + t * c1y;\n var cx = t1 * c2x + t * p2x;\n var cy = t1 * c2y + t * p2y;\n var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI;\n\n if (mx > nx || my < ny) {\n alpha += 180;\n }\n\n return {\n x: x,\n y: y,\n m: { x: mx, y: my },\n n: { x: nx, y: ny },\n start: { x: ax, y: ay },\n end: { x: cx, y: cy },\n alpha: alpha\n };\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link$1(subject);\n link$1(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function findSegmentIndex(t, parameterSubdivision)\n{\n var x = t;\n var index = 0;\n var rawX = t;\n\n for(var i = 0; i < parameterSubdivision.length; i++)\n {\n if(x - parameterSubdivision[i] < 0)\n {\n index = i + 1;\n x = THREE.Math.clamp(x / parameterSubdivision[i], 0, 1);\n break;\n }\n else\n {\n x -= parameterSubdivision[i];\n rawX -= parameterSubdivision[i];\n }\n }\n\n return [index, x, rawX];\n}", "function minglemerge(Av,Ax,s,e,b){\n \n if(e-s>mergcach.length) mergcach=new Array(ntain((e-s)*3,0,Av.length))\n for(var h=0,j=s,ee=e-s;h<ee; ) mergcach[h++]=Ax[j++] \n \n var wrpos=e-1, clonx=e-s-1, hipt=s-1, bhipt=hipt, lep=1 \n\n ///skip to first insert \n while( (clonx>=0) && !compar( Av[Ax[hipt]],Av[mergcach[clonx]] ) ) // is not jdest\n { clonx--,wrpos-- } \n \n while(clonx>=0)// ix of copyel to place\n {\n bhipt=hipt\n \n while( (hipt>=b) && compar( Av[Ax[hipt]],Av[mergcach[clonx]] ) ) // is not jdest\n { hipt-- } \n \n for(var c=bhipt,d=c+wrpos-bhipt; c>hipt; ){\n Ax[d--]=Ax[c--] \n }\n \n wrpos-=(bhipt-hipt)\n Ax[wrpos]=mergcach[clonx]\n wrpos--,clonx--\n \n }//while\n\n return wrpos<b? s-wrpos+1 : s-wrpos //merge underflowed\n //returns ... dunnonow...\n }", "function computeSegVerticals(segs, dayDate, slatCoords, eventMinHeight) {\n for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {\n var seg = segs_1[_i];\n seg.top = slatCoords.computeDateTop(seg.start, dayDate);\n seg.bottom = Math.max(seg.top + (eventMinHeight || 0), // yuck\n slatCoords.computeDateTop(seg.end, dayDate));\n }\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [], clip = [], i, n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n for ((i = 0, n = clip.length); i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n // Find first unvisited intersection.\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for ((i = 0, n = points.length); i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "scanEdges(fromPosition, halfWidth, scanDirection) {\n let from1 = fromPosition.clone()\n from1.x -= halfWidth\n let from2 = fromPosition.clone()\n from2.x += halfWidth\n let interDown = this.getIntersections(from1, scanDirection.clone())\n let interDown2 = this.getIntersections(from2, scanDirection.clone())\n return interDown.concat(interDown2)\n }", "countSumOfRange() {\n \twhile (this.rangeStart <= this.rangeFinish) {\n this.sum = this.sum + this.rangeStart;\n this.rangeStart++;\n }\n this.resultSum.textContent = this.sum;\n }", "function update_edge_divisions(P) {\n for (var e_idx = 0; e_idx < data_edges.length; e_idx++) {\n\n if (P == 1) {\n subdivision_points_for_edge[e_idx].push(data_nodes[data_edges[e_idx].source]); // source\n subdivision_points_for_edge[e_idx].push(edge_midpoint(data_edges[e_idx])); // mid point\n subdivision_points_for_edge[e_idx].push(data_nodes[data_edges[e_idx].target]); // target\n } else {\n\n var divided_edge_length = compute_divided_edge_length(e_idx);\n var segment_length = divided_edge_length / (P + 1);\n var current_segment_length = segment_length;\n var new_subdivision_points = [];\n new_subdivision_points.push(data_nodes[data_edges[e_idx].source]); //source\n\n for (var i = 1; i < subdivision_points_for_edge[e_idx].length; i++) {\n var old_segment_length = euclidean_distance(subdivision_points_for_edge[e_idx][i], subdivision_points_for_edge[e_idx][i - 1]);\n\n while (old_segment_length > current_segment_length) {\n var percent_position = current_segment_length / old_segment_length;\n var new_subdivision_point_x = subdivision_points_for_edge[e_idx][i - 1].x;\n var new_subdivision_point_y = subdivision_points_for_edge[e_idx][i - 1].y;\n\n new_subdivision_point_x += percent_position * (subdivision_points_for_edge[e_idx][i].x - subdivision_points_for_edge[e_idx][i - 1].x);\n new_subdivision_point_y += percent_position * (subdivision_points_for_edge[e_idx][i].y - subdivision_points_for_edge[e_idx][i - 1].y);\n new_subdivision_points.push({ 'x': new_subdivision_point_x,\n 'y': new_subdivision_point_y });\n\n old_segment_length -= current_segment_length;\n current_segment_length = segment_length;\n }\n current_segment_length -= old_segment_length;\n }\n new_subdivision_points.push(data_nodes[data_edges[e_idx].target]); //target\n subdivision_points_for_edge[e_idx] = new_subdivision_points;\n }\n }\n }", "function update_edge_divisions(P) {\n for (var e_idx = 0; e_idx < data_edges.length; e_idx++) {\n\n if (P == 1) {\n subdivision_points_for_edge[e_idx].push(data_nodes[data_edges[e_idx].source]); // source\n subdivision_points_for_edge[e_idx].push(edge_midpoint(data_edges[e_idx])); // mid point\n subdivision_points_for_edge[e_idx].push(data_nodes[data_edges[e_idx].target]); // target\n } else {\n\n var divided_edge_length = compute_divided_edge_length(e_idx);\n var segment_length = divided_edge_length / (P + 1);\n var current_segment_length = segment_length;\n var new_subdivision_points = [];\n new_subdivision_points.push(data_nodes[data_edges[e_idx].source]); //source\n\n for (var i = 1; i < subdivision_points_for_edge[e_idx].length; i++) {\n var old_segment_length = euclidean_distance(subdivision_points_for_edge[e_idx][i], subdivision_points_for_edge[e_idx][i - 1]);\n\n while (old_segment_length > current_segment_length) {\n var percent_position = current_segment_length / old_segment_length;\n var new_subdivision_point_x = subdivision_points_for_edge[e_idx][i - 1].x;\n var new_subdivision_point_y = subdivision_points_for_edge[e_idx][i - 1].y;\n\n new_subdivision_point_x += percent_position * (subdivision_points_for_edge[e_idx][i].x - subdivision_points_for_edge[e_idx][i - 1].x);\n new_subdivision_point_y += percent_position * (subdivision_points_for_edge[e_idx][i].y - subdivision_points_for_edge[e_idx][i - 1].y);\n new_subdivision_points.push({ 'x': new_subdivision_point_x,\n 'y': new_subdivision_point_y });\n\n old_segment_length -= current_segment_length;\n current_segment_length = segment_length;\n }\n current_segment_length -= old_segment_length;\n }\n new_subdivision_points.push(data_nodes[data_edges[e_idx].target]); //target\n subdivision_points_for_edge[e_idx] = new_subdivision_points;\n }\n }\n }", "function Wn(e,t,a){for(var n=[],r=R(e.first,0),f=r,o=0;o<t.length;o++){var i=t[o],s=$n(i.from,r,f),c=$n(qn(i),r,f);if(r=i.to,f=c,\"around\"==a){var u=e.sel.ranges[o],l=P(u.head,u.anchor)<0;n[o]=new Di(l?c:s,l?s:c)}else n[o]=new Di(s,s)}return new Oi(n,e.sel.primIndex)}", "function rangeRover(arr) { \n let min = Math.min(arr[0], arr[1]), max = Math.max(arr[0], arr[1]);\n //th\n // let emptyArr = [];\n // return (max - min +1) * (max + min)/2;\n let sum = max;\n for (var i = min; i < max; i++) {\n sum += i;\n }\n return sum;\n}", "function stc(arr){\n var x = 0;\n for(var e=0; e<arr.length/2; e+=2){\n x = arr[e];\n arr[e] = arr[arr.length-1-e];\n arr[arr.length-1-e] = x;\n }\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function _sum(a, b, r, s) {\n\t\n\t\tfor (var i = 0; i < s; i++) {\n\n\t\t\tfor (var j = 0; j < s; j++) {\n\n\t\t\t\tr[s*i + j] = OP.sum(a[s*i + j], b[s*i + j]);\n\n\t\t\t}\n\n\t\t}\n\n\t}", "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 Y(e,t){var n,i;for(z=e.length;--z>=0;){n=z,(i=z-1)<0&&(i=e.length-1);//console.log('b', i,j, i-1, k,vertices.length);\nvar r=0,o=m+2*b;for(r=0;r<o;r++){var a=U*r,s=U*(r+1);J(t+n+a,t+i+a,t+i+s,t+n+s)}}}", "length() { return this.end-this.start }", "function sumOfRangeClever (start, end, step){\r\n\tvar array = [];\r\n\tvar sum = 0;\r\n\t\r\n\tif (step < 0) {\r\n\t\tstep = -step; //This will make sure the for loops do not cause aS stack overflow!\r\n\t}\r\n\t\r\n\t//if start < end, then simply increment until value is less than or equal to the hightest value (end)\r\n\tif (start < end) {\r\n\t\tfor (let i = start; i <= end; i = i + step) {\r\n\t\t\tarray.push(i);\r\n\t\t}\r\n } else { //if start > end then simply decrement (instead of incrementing) until value is greater than or equal to the lowest value (end)\r\n\t\t\r\n\t\tfor (let i = start; i >= end; i = i - step) {\r\n\t\t\tarray.push(i);\r\n\t\t}\r\n } else { //=> start = end set the array to start (or end, doesn't matter)\r\n\t\tarray = [start];\r\n\t\t\r\n\t}\r\n\t\r\n\t//sum the values in the newly formed array \r\n for(var value of array){\r\n sum = sum + value;\r\n }\r\n return ({\"array\": array, \"sum\": sum});\r\n\t\r\n}", "function sumAll(arr) {\r\n\tvar min = function (a, b) {\r\n\t\treturn Math.min(a, b);\r\n\t};\r\n\tvar max = function (a, b) {\r\n\t\treturn Math.max(a, b);\r\n\t};\r\n\tvar start = arr.reduce(min);\r\n\tvar end = arr.reduce(max);\r\n\tconsole.log(start + \":\" + end);\r\n\tvar result = 0;\r\n\tfor (var i = 0; i <= end - start; i++) {\r\n\t\tresult += start + i\r\n\t}\r\n\treturn result;\r\n}", "iterGaps(f) {\n for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0) {\n f(posA, posB, len);\n posB += len;\n }\n else {\n posB += ins;\n }\n posA += len;\n }\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n\n var t1 = 1 - t, t13 = Math.pow(t1, 3), t12 = Math.pow(t1, 2), t2 = t * t,\n t3 = t2 * t, x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x +\n t3 * p2x, y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y +\n t3 * p2y, mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),\n my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),\n nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),\n ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),\n ax = t1 * p1x + t * c1x, ay = t1 * p1y + t * c1y,\n cx = t1 * c2x + t * p2x, cy = t1 * c2y + t * p2y,\n alpha = (90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI);\n\n if (mx > nx || my < ny) { alpha += 180; }\n\n return { x: x, y: y, m: { x: mx, y: my }, n: { x: nx, y: ny },\n start: { x: ax, y: ay }, end: { x: cx, y: cy }, alpha: alpha\n };\n}" ]
[ "0.5828836", "0.58039796", "0.5770281", "0.57188535", "0.5711386", "0.56746256", "0.5576355", "0.55449784", "0.55337733", "0.5526796", "0.55220765", "0.5513046", "0.5456952", "0.5441841", "0.5438785", "0.5362485", "0.5356646", "0.53422916", "0.5335512", "0.5333205", "0.531184", "0.531184", "0.5294657", "0.5294657", "0.527733", "0.52771723", "0.52771723", "0.52771723", "0.52771723", "0.52771723", "0.52771723", "0.5259113", "0.5241596", "0.52193576", "0.521667", "0.5201621", "0.5187748", "0.5177865", "0.5177473", "0.5168216", "0.51611996", "0.51608914", "0.51552814", "0.5144526", "0.51403445", "0.5133286", "0.5130773", "0.51234025", "0.51230556", "0.5120511", "0.5118326", "0.5112529", "0.51112384", "0.51083124", "0.51074356", "0.51038647", "0.5089513", "0.5088514", "0.5083744", "0.50770456", "0.50770456", "0.50770456", "0.5074981", "0.5061792", "0.50583535", "0.5056206", "0.50534695", "0.50533473", "0.5045968", "0.504536", "0.5038143", "0.5035466", "0.5035466", "0.5028636", "0.50205", "0.5015858", "0.5012411", "0.50026816", "0.49916992", "0.49889782", "0.49879876", "0.49863353", "0.49852344", "0.49786615", "0.49785224", "0.49709746", "0.49709746", "0.49705213", "0.49687594", "0.4968525", "0.4964804", "0.4962813", "0.49611565", "0.4956956", "0.4953455", "0.49505827", "0.4949461", "0.49428797", "0.4940136", "0.49391374" ]
0.57162195
4
set the planes marker in the map using the selected position in the chart view
function setPlanePosition( i ){ var k = i + offset; // offset is adjusted to the first index in the currently filtered // segment when this segment is displayed if (planePosition != null && k >= 0 && k < pointarray.length){ planePosition.setPosition(pointarray[k].LatLng); $("#heading").text(new String(pointarray[k].heading.toFixed()) + " °"); $("#groundspeed").text(new String(pointarray[k].vel.toFixed()) + " kts"); $("#altitude").text(new String(pointarray[k].ele.toFixed()) + " ft"); $("#climbrate").text(new String(pointarray[k].feetPerMinute.toFixed()) + "\tft/min"); planePositionIndex = k; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function panblanPark(){\n map.setView(new ol.View({\n center: blancoParkMercator,\n zoom: 19\n }));\n}", "function panAquSpCen(){\n map.setView(new ol.View({\n center: aquSpMercator,\n zoom: 19\n }));\n}", "function setMarker(){\n\n \tif (current_marker!=null) {\n\n \t\tmap0.setView(current_marker, 16, {\n \t\t\treset : true,\n \t\t\tanimate :true\n \t\t});\n\n \t\taddMarker(0, map0, current_marker);\n\n \t\t//map1.setView(current_marker);\n \t\taddMarker(1, map1, current_marker);\n\n \t\t//map2.setView(current_marker);\n \t\taddMarker(2, map2, current_marker);\n\n \t}\n\n }", "function panballPark(){\n map.setView(new ol.View({\n center: ballParkMercator,\n zoom: 19\n }));\n}", "function panAqua(){\n map.setView(new ol.View({\n center: aquSpMercator,\n zoom: 19\n }));\n}", "function panAlk(){\n map.setView(new ol.View({\n center: alkMercator,\n zoom: 19\n }));\n\n}", "function panAcadGar(){\n map.setView(new ol.View({\n center: acadStGarMercator,\n zoom: 19\n }));\n}", "function panAngel(){\n map.setView(new ol.View({\n center: angelHallMercator,\n zoom: 19\n }));\n}", "function panAg(){\n map.setView(new ol.View({\n center: agBuildingMercator,\n zoom: 19\n }));\n}", "function panBlan(){\n map.setView(new ol.View({\n center: blanHallMercator,\n zoom: 19\n }));\n}", "function panbobStand(){\n map.setView(new ol.View({\n center: bobStadMercator,\n zoom: 19\n }));\n}", "function panArnHall(){\n map.setView(new ol.View({\n center: arnHallMercator,\n zoom: 19\n }));\n}", "function setPointOnMap(ax, ay) {\n myMap.geoObjects.removeAll();\n var onePoint = new ymaps.Placemark(\n [ay, ax], {},\n {\n preset: \"islands#redIcon\",\n });\n\n myMap.geoObjects.add(onePoint);\n myMap.setCenter([ay, ax], 16);\n}", "function setMarker(evt) {\n if (!routeMode) return;\n\n !$scope.curRoute.path && setPolyline();\n\n if (!$scope.curRoute.selected) {\n $scope.toggleRouteSelected(true);\n }\n\n var position = evt.latLng;\n var path = $scope.curRoute.path.getPath();\n\n // Because path is an MVCArray, we can simply append a new coordinate\n // and it will automatically appear.\n path.push(position);\n\n $scope.curRoute.points = routeToArray($scope.curRoute.path);\n\n renderMarker(position, path.j.length - 1);\n\n $scope.$apply(position);\n }", "function panAcad(){\n map.setView(new ol.View({\n center: acaServiceMercator,\n zoom: 19\n }));\n}", "function panBare(){\n map.setView(new ol.View({\n center: bareHallMercator,\n zoom: 19\n }));\n}", "function showPosition(position) {\n currentPosition.coords.latitude = position.coords.latitude\n currentPosition.coords.longitude = position.coords.longitude\n $scope.map = { center: { latitude: position.coords.latitude, longitude: position.coords.longitude }, zoom: 10 }\n markers[0] = {\n latitude: currentPosition.coords.latitude,\n longitude: currentPosition.coords.longitude,\n id: currentPosition.id,\n icon: {\n url: '../../images/google-maps-hi.png',\n scaledSize: new google.maps.Size(25, 40)\n },\n zindex: 1\n }\n }", "show(map) {\n this.marker_obj.setMap(map ? map.map_obj : null);\n }", "function panBexH(){\n map.setView(new ol.View({\n center: bexHallMercator,\n zoom: 19\n }));\n}", "function adjustSelectedInfoBlockPosition() {\n if (typeof Planes === 'undefined' || typeof SelectedPlane === 'undefined' || Planes === null) {\n return;\n }\n\n var selectedPlane = Planes[SelectedPlane];\n\n if (selectedPlane === undefined || selectedPlane === null || selectedPlane.marker === undefined || selectedPlane.marker === null) {\n return;\n }\n\n try {\n // Get marker position\n var marker = selectedPlane.marker;\n var markerCoordinates = selectedPlane.marker.getGeometry().getCoordinates();\n\t\tvar markerPosition = OLMap.getPixelFromCoordinate(markerCoordinates);\n\t\t\n // Get map size\n var mapCanvas = $('#map_canvas');\n var mapExtent = getExtent(0, 0, mapCanvas.width(), mapCanvas.height());\n\n // Check for overlap\n if (isPointInsideExtent(markerPosition[0], markerPosition[1], infoBoxExtent)) {\n // Array of possible new positions for info box\n var candidatePositions = [];\n candidatePositions.push( { x: 40, y: 60 } );\n candidatePositions.push( { x: 40, y: markerPosition[1] + 80 } );\n\n // Find new position\n for (var i = 0; i < candidatePositions.length; i++) {\n var candidatePosition = candidatePositions[i];\n var candidateExtent = getExtent(candidatePosition.x, candidatePosition.y, infoBox.outerWidth(), infoBox.outerHeight());\n\n if (!isPointInsideExtent(markerPosition[0], markerPosition[1], candidateExtent) && isPointInsideExtent(candidatePosition.x, candidatePosition.y, mapExtent)) {\n // Found a new position that doesn't overlap marker - move box to that position\n infoBox.css(\"left\", candidatePosition.x);\n infoBox.css(\"top\", candidatePosition.y);\n return;\n }\n }\n }\n } \n catch(e) { }\n}", "setMapClickable(){\n\t\tthis.mainChart.mapClickable();\n\t}", "function showMarkers() {\n\n setAllMap(map);\n\n}", "function panAcaServ(){\n map.setView(new ol.View({\n center: acaService,\n zoom: 19\n }));\n}", "selectMarkers() {\n const coordList = this.model.get('coordinateList');\n\n this.mapControl.getLayers().item(1).getSource().getFeatures().forEach((feature, i) => {\n const coordItem = coordList.at(i);\n\n if (coordItem.get('selected')) {\n feature.setStyle(new ol.style.Style({\n image: new ol.style.Icon({\n anchorXUnits: 'fraction',\n anchorYUnits: 'pixels',\n src: SELECTED_MARKER_SRC\n })\n }));\n } else if (feature.getStyle() !== null) {\n feature.setStyle(null);\n }\n });\n }", "function showMarkers() {\n setAllMap(map);\n }", "function zControlBattleMapInitialze(position)\n{\n zObjectBattleMapLatLng[\"gamrLat\"] = position.coords.latitude;\n zObjectBattleMapLatLng[\"gamrLng\"] = position.coords.longitude;\n \n var mapOptions = {\n center: { lat: zObjectBattleMapLatLng[\"gamrLat\"], lng: zObjectBattleMapLatLng[\"gamrLng\"]},\n zoom: 18,\t/* 1(World Views) - 20(Tight View)*/\n mapTypeId: google.maps.MapTypeId.SATELLITE\n };\n \n zObjectBattleMap = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);\n zObjectBattleMap.setTilt(45);\n \n zObjectBattleMapGamer = new google.maps.Marker(\n {\n position: new google.maps.LatLng(zObjectBattleMapLatLng[\"gamrLat\"], zObjectBattleMapLatLng[\"gamrLng\"]),\n map: zObjectBattleMap,\n title: 'Hello World!'\n });\n \n zObjectBattleMapLatLng[\"crntLat\"] = zObjectBattleMapLatLng[\"gamrLat\"];\n zObjectBattleMapLatLng[\"crntLng\"] = zObjectBattleMapLatLng[\"gamrLng\"];\n}", "function panTmh(){\n map.setView(new ol.View({\n center: tmhMercator,\n zoom: 19\n }));\n}", "function showMarkers() {\n setMapOnAll(map);\n \n }", "function showMarkers() {\n setAllMap(map);\n}", "function showMarkers() {\n setAllMap(map);\n}", "function showMarkers() {\n setAllMap(map);\n}", "function showMarkers() {\n setAllMap(map);\n}", "function setSelectedMarker(id) {\n // Use in the widget 'Details'.\n $scope.meterSelected = meters.list[id];\n }", "function showMarkers() {\n\t\t\t \n\t\t\t setAllMap(map);\n\t\t\t\n\t\t\t}", "function initViewMap() {\n view_map = new google.maps.Map(document.getElementById('view_map'), {\n zoom: 18,\n center: init_pos\n });\n view_marker = new google.maps.Marker({\n map: view_map\n });\n}", "function limpiarSeleccion() {\n \"use strict\";\n\n map.setView(new L.LatLng(4.5, -73.0), 6);\n map.eachLayer(function (layer) {\n map.removeLayer(layer);\n });\n map.addLayer(positron);\n map.addLayer(positronLabels);\n map.addLayer(NodosLayer);\n}", "function park(position){\n setDetail(selected, 'lat', position.lat());\n setDetail(selected, 'lng', position.lng());\n var markerId = 'marker'+selected;\n clearMarkers();\n $('#map_canvas').gmap('addMarker', {'markerId':markerId,\n 'position': position,\n 'icon' : icons[getUnitDetail(selected, 'type')],\n 'draggable': true,\n 'clickable': true,\n 'animation': google.maps.Animation.DROP}).dragend( function(event) {\n // Drag handler //\n park(event.latLng);\n }).click( function(event){\n // Click Handler // \n $('#map_canvas').gmap('openInfoWindow', { content : getUnitDetail(selected, 'adress') }, this);\n });\n getAdress(position);\n }", "function setMapMarker(map, vehid) {\n switch (vehid) {\n case 1:\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(map);\n }\n break;\n case 2:\n for (var i = 0; i < markers2.length; i++) {\n markers2[i].setMap(map);\n }\n break;\n case 3:\n for (var i = 0; i < markers3.length; i++) {\n markers3[i].setMap(map);\n }\n break;\n default:\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(map);\n }\n for (var i = 0; i < markers2.length; i++) {\n markers2[i].setMap(map);\n }\n for (var i = 0; i < markers3.length; i++) {\n markers3[i].setMap(map);\n }\n }\n\n}", "setMap(map) {\n super.setMap(map);\n this.map = map;\n this.map.on('postrender', () => {\n this.renderPanel();\n });\n }", "function setMarker(data) {\n // body...\n if (data.boolTest === true) {\n data.visible(true);\n data.marker.setMap(map);\n } else {\n data.visible(false);\n data.marker.setMap(null);\n }\n}", "function showMarkers() {\n setMapOnAll(ourMap);\n}", "function showMarkers() {\n\tsetAllMap(map);\n}", "function showMarkers() {\n\t setAllMap(map);\n\t}", "function showMarkers() {\n\t setAllMap(map);\n\t}", "function showMarker() {\n // var bounds = new google.maps.LatLngBounds();\n // Extend the boundaries of the map for each marker and display the marker\n for (var i = 0; i < $ctrl.markers.length; i++) {\n $ctrl.markers[i].setMap(map);\n // bounds.extend($ctrl.markers[i].position);\n }\n // map.fitBounds(bounds);\n }", "function zoomToPoint(e) {\n var layer = e.target;\n var latLng = layer.getLatLng();\n map.setView(latLng, 15);\n}", "function viewchange() \n{\n // keep map centered on shuttle's marker\n var latlng = new google.maps.LatLng(shuttle.position.latitude, shuttle.position.longitude);\n map.setCenter(latlng);\n bus.setPosition(latlng);\n}", "function viewchange() \n{\n // keep map centered on shuttle's marker\n var latlng = new google.maps.LatLng(shuttle.position.latitude, shuttle.position.longitude);\n map.setCenter(latlng);\n bus.setPosition(latlng);\n}", "function showMarkers() {\r\n setMapOnAll(map);\r\n }", "function initMap() {\n\n let infoHotel = getHotelVisualizar();\n\n let latitudHotel = Number(infoHotel['latitud']);\n let longitudHotel = Number(infoHotel['longitud']);\n\n\n let posicionCentral = { lat: latitudHotel, lng: longitudHotel };\n\n let opciones = {\n zoom: 16,\n center: posicionCentral,\n mapTypeControl: false\n\n }\n\n //Creacion de mapa\n let mapa = new google.maps.Map(document.getElementById('mapaHotel'), opciones);\n\n //Marker\n let marker = new google.maps.Marker({\n position: posicionCentral,\n map: mapa,\n });\n}", "function showMarkers() {\r\n setMapOnAll(map);\r\n}", "function onMarkerCreated(marker) {\n var object = markerObjects;\n object.transform( marker.matrix );\n view.add( object );\n }", "source_map_point(lat, lng) {\n this.vectorLayer = new ol.layer.Vector({\n source: new ol.source.Vector({\n features: [\n new ol.Feature({\n geometry: new ol.geom.Point(ol.proj.transform([parseFloat(lng), parseFloat(lat)], \"EPSG:4326\", \"EPSG:3857\"))\n })\n ]\n }),\n style: new ol.style.Style({\n image: new ol.style.Icon({\n anchor: [0.5, 0.5],\n anchorXUnits: \"fraction\",\n anchorYUnits: \"fraction\",\n src: \"assets/green.svg\"\n })\n })\n });\n this.map.addLayer(this.vectorLayer);\n this.vectorLayer.set(\"name\", \"selectvector\");\n }", "function showMarkers(map) {\n setAllMap(map);\n}", "function ReSet(){\n\ttransform.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\ttransform.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\ttransform.position.z = ((transform.position.z * 20037508.34 / 180)/100)-iniRef.z; \n\tcam.position.x = ((tempLon * 20037508.34 / 180)/100)-iniRef.x;\n\tcam.position.z = System.Math.Log(System.Math.Tan((90 + tempLat) * System.Math.PI / 360)) / (System.Math.PI / 180);\n\tcam.position.z = ((cam.position.z * 20037508.34 / 180)/100)-iniRef.z; \n}", "function setLocation(position){\n\tcurrentPosition = { lat: position.coords.latitude, lng: position.coords.longitude};\n\tcurrentMarker = new google.maps.Marker({\n position: currentPosition,\n map: map,\n title: \"\"\n });\n currentMarker.setMap(map);\n\tmap.panTo(currentPosition);\n}", "function createPlaneMarker(flight, color) {\n // Convert UTC time from when flight was requested to local time\n let localTime = new Date(flight.time).toLocaleString();\n\n // Text for popup\n let contentString = `<h1>${flight.callsign}</h1>` +\n `<p>Origin Country: ${flight.origin_country}</p>` +\n `<p>Time Queried: ${localTime}</p>`;\n\n // Create popup\n const infowindow = new google.maps.InfoWindow({\n content: contentString,\n });\n\n // Create the plane marker\n const marker = new google.maps.Marker({\n position: new google.maps.LatLng(\n flight.latitude,\n flight.longitude\n ),\n title: flight.callsign,\n icon: {\n path: planeIcon,\n fillColor: color,\n fillOpacity: .6,\n strokeWeight: 0,\n scale: .7,\n rotation: flight.heading,\n strokeOpacity: 1.0,\n strokeWeight: 2,\n\n },\n\n map: map,\n });\n\n // Bind popup to marker\n marker.addListener(\"click\", () => {\n infowindow.open(map, marker);\n });\n\n flightMarkers.push(marker);\n}", "function showMarkers() {\n setMapOnAll(mainMap);\n}", "function chooseMap(ilmakuva) {\n // Set the label to the aerial imagery name\n map.setLayoutProperty(currentLayer, 'visibility', 'none');\n currentLayer = toggleableLayers[0]['layers'][ilmakuva];\n map.setLayoutProperty(currentLayer, 'visibility', 'visible');\n document.getElementById('slider-label').textContent = currentLayer;\n }", "function showMarkers() {\n marker.setMap(map);\n}", "function vehicleDisplay(pos){\n console.log(\"Adding car markers\");\n if(driveMarker.length===0){\n emptyMarkerArray(pos);\n }\n else if (driveMarker.length!==0 && driveMarker.length < pos.length){\n shorterMarkerArray(pos);\n } \n else{\n equalMarkerArray(pos);\n }\n }", "function addPositionMarker(lon, lat, targetArray) {\n console.log('lon:', lon);\n console.log('lat:', lat);\n var iconFeature = new Feature({\n geometry: new Point(transform([lon, lat], 'EPSG:4326', 'EPSG:3857'))\n });\n if (targetArray === \"myPos\") {\n positionArray.addFeature(iconFeature);\n }\n else if (targetArray === \"clickedArray\") {\n clickedArray.addFeature(iconFeature);\n }\n else if (targetArray === \"searchResult\") {\n searchResultArray.addFeature(iconFeature);\n }\n}", "function showMarkers() {\n setMapOnAll(mapa);\n}", "function changeLayersDraw() {\n \tshowloading();\n var mapurl = PM_XAJAX_LOCATION + 'x_load.php?'+SID+'&zoom_type=zoompoint';\n updateMap(mapurl);\n}", "function showMarkers() {\n // setMapOnAll(map);\n removeLine();\n}", "SetMarkers(allData) {\n allData.forEach((item) => {\n this.MAPMarker.SetMapMarker(item.marker, this.DrawnMap);\n });\n }", "function replaceMap() {\n //check is coordinates values are empty or not\n if ((document.getElementById(\"longi\").value) & (document.getElementById(\"lat\").value)) {\n\n map.center = [parseFloat((document.getElementById(\"longi\")).value), parseFloat((document.getElementById(\"lat\")).value)];\n\n // same point without altitude\n var point1 = new maptalks.Marker(\n [parseFloat((document.getElementById(\"longi\")).value), parseFloat((document.getElementById(\"lat\")).value)]\n );\n map.removeLayer(markerLayer);\n if (markerLayer1) {\n map.removeLayer(markerLayer1);\n }\n // var d = new Date();\n // var t = d.getTime();\n // new maptalks.VectorLayer(t, point1).addTo(map);\n markerLayer1 = new maptalks.VectorLayer('vector', point1).addTo(map);\n\n changeView();\n\n console.log(map);\n\n function changeView() {\n map.animateTo({\n center: [parseFloat((document.getElementById(\"longi\")).value), parseFloat((document.getElementById(\"lat\")).value)],\n zoom: 13,\n pitch: 0,\n bearing: 20\n }, {\n duration: 5000\n });\n setTimeout(function() {\n map.animateTo({\n center: [parseFloat((document.getElementById(\"longi\")).value), parseFloat((document.getElementById(\"lat\")).value)],\n zoom: 18,\n pitch: 0,\n bearing: 0\n }, {\n duration: 7000\n });\n }, 7000);\n }\n } else {\n alert(\"Please enter the Coordinate values\");\n }\n}", "function markMap() {\n for (let key in Memory.warControl) {\n if (Memory.warControl[key]) {\n new RoomVisual(key).text(\n Memory.warControl[key].type,\n 25,\n 25,\n {align: 'left', opacity: 0.8}\n );\n }\n if (Memory.warControl[key].siegePoint) {\n new RoomVisual(Memory.warControl[key].siegePoint).text(\n 'Siegepoint',\n 25,\n 25,\n {align: 'left', opacity: 0.8}\n );\n }\n }\n}", "function placeMarkerAndPanTo(latLng, map) {\nvar marker = new google.maps.Marker({\n position: latLng,\n map: map\n});\nmap.panTo(latLng);\n}", "function flyToLocation(govMap,osmMap,clicked_id){\n \n // Destroy the canvas contents of the previous chart\n if (chart != null) {\n chart.destroy();\n };\n \n var bounds = [\n [-80.10757,35.78710],[-74.03844,41.84473]\n ];\n osmMap.setMaxBounds(bounds);\n govMap.setMaxBounds(bounds);\n \n // Fly to Alexandria\n if (clicked_id == 'flyAlexandria') {\n govMap.flyTo({\n center:[-77.08628,38.81854],\n zoom: 12\n });\n \n \n var bounds = [\n [-80.10757,35.78710],[-74.03844,41.84473]\n ];\n osmMap.setMaxBounds(bounds);\n govMap.setMaxBounds(bounds);\n \n // Set color codes for the chart\n var colorCodes = ['rgba(238, 138, 101, 0.3)','rgba(238, 138, 101, 1)'];\n \n // Generate a new chart with the color codes of the border\n chart = createChart(colorCodes,AlexandriaProp);\n\n\n }\n else if (clicked_id == 'flyHenrico') {\n var bounds = [\n [-80.10757,35.78710],[-74.03844,41.84473]\n ];\n osmMap.setMaxBounds(bounds);\n govMap.setMaxBounds(bounds);\n \n \n govMap.flyTo({\n center:[-77.39478,37.58435],\n zoom:10\n });\n \n // Set color codes for the chart\n var colorCodes = ['rgba(102, 102, 153, 0.3)','rgba(102, 102, 153, 1)'];\n \n // Generate a new chart with the color codes of the border\n chart = createChart(colorCodes,HenricoProp);\n \n }\n else {\n var bounds = [\n [-80.10757,35.78710],[-74.03844,41.84473]\n ];\n osmMap.setMaxBounds(bounds);\n govMap.setMaxBounds(bounds);\n \n govMap.flyTo({\n center:[-79.18038,37.40087],\n zoom: 10\n \n });\n \n // Set the color codes for the chart\n var colorCodes = ['rgba(51, 255, 102, 0.3)','rgba(51, 255, 102, 1)'];\n // Generate a new chart with the color codes of the border\n chart = createChart(colorCodes,LynchburgProp);\n \n };\n \n \n}", "function setMode(m) {\n\t\tmode = m;\n\t\tmarkers.setMode(m);\n\t\tif (m == GLOBE.PickMode) {\n\t\t\tatmosphere.setVisibility(false);\n\t\t\tsphere.setTexture(pickTexture);\n\t\t} else if (m == GLOBE.HeatMode) {\n\t\t\tatmosphere.setVisibility(true);\n\t\t\tsphere.setTexture(borderTexture);\n\t\t} else {\t// MapMode\n\t\t\tatmosphere.setVisibility(true);\n\t\t\tsphere.setTexture(mapTexture);\n\t\t}\n\t}", "function selectMarker(place) {\n google.maps.event.trigger(markers[place.index], 'click');\n}", "function showMarkers() {\r\n setMapOnAll(map);\r\n}", "function showMarkers() {\r\n setMapOnAll(map);\r\n}", "function showMarkers() {\r\n setMapOnAll(map);\r\n}", "function placeCenterAndPin(){\n setCenterAndMarker();\n initMap();\n }", "function setup(map) {\n //$(\".feature-btn\").tooltip({ placement: 'right', title: 'Charts'});\n //map.addControl(new ChartControl());\n refresh();\n var layers = JSON.parse(localStorage.getItem(\"sk-load-charts\"));\n if (!layers) return;\n layers = jQuery.grep(layers, function(value) {\n addChartLayer(map, value.key, value.type, value.scale);\n });\n}", "function updateCustomMarkers( event ) {\n // get map object\n var map = event.chart;\n\n // go through all of the images\n for ( var x in map.dataProvider.images ) {\n // get MapImage object\n var image = map.dataProvider.images[ x ];\n\n // check if it has corresponding HTML element\n if ( 'undefined' == typeof image.externalElement )\n image.externalElement = createCustomMarker( image );\n\n // reposition the element accoridng to coordinates\n var xy = map.coordinatesToStageXY( image.longitude, image.latitude );\n image.externalElement.style.top = xy.y + 'px';\n image.externalElement.style.left = xy.x + 'px';\n // image.externalElement.style.top = map.latitudeToY( image.latitude ) + 'px';\n // image.externalElement.style.left = map.longitudeToX( image.longitude ) + 'px';\n }\n }", "function showMarkers() {\n setMapOnAll(guhMap);\n}", "function setMarker(place) {\n var img = 'image/22-blue-dot.png';\n var marker = new google.maps.Marker({\n map: map,\n name: place.name,\n position: place.geometry.location,\n place_id: place.place_id,\n animation: google.maps.Animation.DROP,\n icon:img \n }); \n if (place.vicinity !== undefined) {\n address = place.vicinity;\n } else if (place.formatted_address !== undefined) {\n address = place.formatted_address;\n } \n var contentString = '<div style=\"font-weight: 300\">' + place.name + '</div><div>' + \n address + '</div>' + self.fourSquareAPI;\n\n google.maps.event.addListener(marker, 'click', function() { \n infowindow.setContent(contentString); \n infowindow.open(map, this);\n map.panTo(marker.position); \n marker.setAnimation(google.maps.Animation.BOUNCE);\n setTimeout(function(){marker.setAnimation(null);\n }, 1300);\n \n });\n\n markers.push(marker);\n return markers;\n }", "function showMarkers() {\r\n setMapOnAll(map);\r\n }", "function SetMarkerForMap(latLng) {\n\tvar startMarker = null;\n\tvar endMarker = null;\n\n\t//icon for marker\n\tvar startMarkerIcon = null;\n\tvar endMarkerIcon = null;\n\n\t//set current selected path maker\n\tswitch (currentSelectedPathType) {\n\t\tcase 1:\n\t\t\tstartMarker = firstPathStartPointMarker;\n\t\t\tendMarker = firstPathEndPointMarker;\n\t\t\tstartMarkerIcon = \"img/p1_start_pin.png\";\n\t\t\tendMarkerIcon = \"img/p1_end_pin.png\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tstartMarker = secondPathStartPointMarker;\n\t\t\tendMarker = secondPathEndPointMarker;\n\t\t\tstartMarkerIcon = \"img/p2_start_pin.png\";\n\t\t\tendMarkerIcon = \"img/p2_end_pin.png\";\n\t\t\tbreak;\n\t}\n\n\t//set current selected path point marker\n\tswitch (currentSelectedMarkerType) {\n\t\tcase 1:\n\t\t\tif (startMarker != null)\n\t\t\t\tstartMarker.setMap(null);\n\n\t\t\tstartMarker = new google.maps.Marker({\n\t\t\t\tposition: latLng,\n\t\t\t\tmap: map,\n\t\t\t\ticon: startMarkerIcon,\n\t\t\t\ttitle: 'Start Point'\n\t\t\t});\n\n\t\t\t//set marker info to selected marker\n\t\t\tSetMarkerInfo(1, latLng);\n\n\t\t\t//set marker status\n\t\t\tSetMarkerStatus(currentSelectedPathType, 0);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (endMarker != null)\n\t\t\t\tendMarker.setMap(null);\n\n\t\t\tendMarker = new google.maps.Marker({\n\t\t\t\tposition: latLng,\n\t\t\t\tmap: map,\n\t\t\t\ticon: endMarkerIcon,\n\t\t\t\ttitle: 'End Point'\n\t\t\t});\n\n\t\t\t//set marker info to selected marker\n\t\t\tSetMarkerInfo(2, latLng);\n\n\t\t\t//set marker status\n\t\t\tSetMarkerStatus(currentSelectedPathType, 0);\n\t\t\tbreak;\n\t}\n\n\t//store select condition to variable\n\tswitch (currentSelectedPathType) {\n\t\tcase 1:\n\t\t\tfirstPathStartPointMarker = startMarker;\n\t\t\tfirstPathEndPointMarker = endMarker;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tsecondPathStartPointMarker = startMarker;\n\t\t\tsecondPathEndPointMarker = endMarker;\n\t\t\tbreak;\n\t}\n}", "function addPlaceMarks() {\n // first init layer\n if (gazetteerLayer == null) {\n gazetteerLayer = new WorldWind.RenderableLayer(\"GazetteerLayer\"); \n\n for (var i = 0; i < availableRegionsCSV.length; i++) { \n // create a marker for each point\n var name = availableRegionsCSV[i].name;\n var latitude = availableRegionsCSV[i].center_lat;\n var longitude = availableRegionsCSV[i].center_lon; \n var diameter = parseFloat(availableRegionsCSV[i].diameter);\n\n var labelAltitudeThreshold = 0; \n\n if (diameter >= 0 && diameter < 10) { \n labelAltitudeThreshold = 1.1e3;\n } else if (diameter > 10 && diameter < 20) {\n labelAltitudeThreshold = 1.7e3;\n } else if (diameter >= 20 && diameter < 40) {\n labelAltitudeThreshold = 1.2e4;\n } else if (diameter >= 40 && diameter < 60) {\n labelAltitudeThreshold = 1.7e4;\n } else if (diameter >= 60 && diameter < 80) {\n labelAltitudeThreshold = 1.2e5;\n } else if (diameter >= 80 && diameter < 100) {\n labelAltitudeThreshold = 1.7e5;\n } else if (diameter >= 100 && diameter < 200) {\n labelAltitudeThreshold = 1.2e6;\n } else if (diameter >= 200 && diameter < 400) {\n labelAltitudeThreshold = 1.7e6;\n } else if (diameter >= 400 && diameter < 600) {\n labelAltitudeThreshold = 1.2e7;\n } else if (diameter >= 600 && diameter < 1000) {\n labelAltitudeThreshold = 1.7e7;\n } else if (diameter >= 1000 && diameter < 1400) {\n labelAltitudeThreshold = 1.2e8;\n } else if (diameter >= 1400 && diameter < 2000) {\n labelAltitudeThreshold = 1.7e8;\n } else {\n labelAltitudeThreshold = 1.2e9;\n }\n\n\n var placemark = new WorldWind.Placemark(new WorldWind.Position(latitude, longitude, 10), true, null);\n placemark.label = name;\n placemark.altitudeMode = WorldWind.RELATIVE_TO_GROUND; \n\n placemark.eyeDistanceScalingThreshold = labelAltitudeThreshold - 1e5;\n placemark.eyeDistanceScalingLabelThreshold = labelAltitudeThreshold;\n\n var placemarkAttributes = new WorldWind.PlacemarkAttributes(); \n placemarkAttributes.labelAttributes.color = new WorldWind.Color(0.43, 0.93, 0.97, 1);\n placemarkAttributes.labelAttributes.depthTest = false;\n placemarkAttributes.labelAttributes.scale = 1.2;\n placemarkAttributes.imageScale = 0.8;\n placemarkAttributes.imageSource = \"html/images/close.png\"; \n\n placemark.attributes = placemarkAttributes;\n\n\n // as they are small and slow\n if (diameter < MIN_DEFAULT_LOAD) {\n placemark.enabled = false;\n }\n\n var obj = {\"diameter\": diameter};\n placemark.userProperties = obj;\n\n\n // add place mark to layer\n gazetteerLayer.addRenderable(placemark); \n } \n\n // Marker layer\n wwd.insertLayer(10, gazetteerLayer);\n\n } else { \n if (isShowGazetteer === false) {\n gazetteerLayer.enabled = false; \n } else { \n gazetteerLayer.enabled = true;\n }\n } \n }", "function showMarkers() {\r\n setMapOnAll(map);\r\n }", "function changePosition(x, y, zoom) {\r\n var newPos = aMap.createPosition(x, y);\r\n // goto point\r\n map.setCenter(newPos);\r\n //set zoom\r\n map.setZoom(parseInt(zoom) || 10);\r\n}", "function updateCustomMarkers( event ) {\r\n // get map object\r\n var map = event.chart;\r\n\r\n // go through all of the images\r\n for ( var x in map.dataProvider.images ) {\r\n // get MapImage object\r\n var image = map.dataProvider.images[ x ];\r\n\r\n // check if it has corresponding HTML element\r\n if ( 'undefined' == typeof image.externalElement )\r\n image.externalElement = createCustomMarker( image );\r\n\r\n // reposition the element accoridng to coordinates\r\n var xy = map.coordinatesToStageXY( image.longitude, image.latitude );\r\n image.externalElement.style.top = xy.y + 'px';\r\n image.externalElement.style.left = xy.x + 'px';\r\n }\r\n}", "function updateCustomMarkers( event ) {\r\n // get map object\r\n var map = event.chart;\r\n\r\n // go through all of the images\r\n for ( var x in map.dataProvider.images ) {\r\n // get MapImage object\r\n var image = map.dataProvider.images[ x ];\r\n\r\n // check if it has corresponding HTML element\r\n if ( 'undefined' == typeof image.externalElement )\r\n image.externalElement = createCustomMarker( image );\r\n\r\n // reposition the element accoridng to coordinates\r\n var xy = map.coordinatesToStageXY( image.longitude, image.latitude );\r\n image.externalElement.style.top = xy.y + 'px';\r\n image.externalElement.style.left = xy.x + 'px';\r\n }\r\n}", "function actualizarUbicacion(){\n map.removeMarkers();\n var myMarker_oringe={\n icon: iconOrigin,\n animation: google.maps.Animation.DROP,\n color: '#FF0000',\n lat: currentPosition.lat(),\n lng: currentPosition.lng(),\n title: 'Origen',\n infoWindow: {\n content: '<p>Origen</p>'\n }\n };\n map.addMarker(myMarker_oringe);\n $('[name=\"lan\"]').val(currentPosition.lat());\n $('[name=\"lot\"]').val(currentPosition.lng());\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}", "function showMarkers() {\n setMapOnAll(map);\n}" ]
[ "0.6529476", "0.6505528", "0.6450405", "0.6436074", "0.63727903", "0.6346302", "0.6320233", "0.62810385", "0.6136053", "0.61084455", "0.6055648", "0.60529345", "0.60199285", "0.60024774", "0.5979785", "0.59593457", "0.5913965", "0.59015435", "0.5888769", "0.5874749", "0.58346915", "0.5801521", "0.57929814", "0.5784675", "0.57550764", "0.575267", "0.57308453", "0.57304955", "0.5725134", "0.57164717", "0.57164717", "0.57164717", "0.5710006", "0.5708946", "0.570391", "0.56973493", "0.5674492", "0.5664019", "0.5649061", "0.5623423", "0.5623306", "0.5619812", "0.56195426", "0.56195426", "0.5616332", "0.56035405", "0.5603341", "0.5603341", "0.55819243", "0.55762684", "0.557078", "0.5569867", "0.55697215", "0.5568816", "0.5559385", "0.5555564", "0.55495524", "0.55480605", "0.5544255", "0.55441505", "0.554266", "0.55420476", "0.554008", "0.55362844", "0.5532145", "0.553185", "0.5528673", "0.55252737", "0.5522164", "0.5521998", "0.55189455", "0.5509733", "0.55091345", "0.55091345", "0.55091345", "0.5507718", "0.550718", "0.550432", "0.55016583", "0.5496397", "0.54932976", "0.54906976", "0.5490133", "0.5489845", "0.54764193", "0.5475415", "0.5475415", "0.54746073", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086", "0.54738086" ]
0.6765788
0
get the bounds of any segment in the track
function getBounds(firstIndex, lastIndex) { var maxlat = 0; var maxlng = 0; var minlat = 10000; var minlng = 10000; var bounds; for (var i = firstIndex; i < lastIndex; i++) { var lat = pointarray[i].LatLng.lat(); var lng = pointarray[i].LatLng.lng(); if (lat > maxlat) { maxlat = lat; } if (lat < minlat) { minlat = lat; } if (lng > maxlng) { maxlng = lng; } if (lng < minlng) { minlng = lng; } } bounds = new google.maps.LatLngBounds(new google.maps.LatLng(minlat, minlng), new google.maps.LatLng(maxlat, maxlng)); return bounds;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get bounds() {}", "get localBounds() {}", "get boundsValue() {}", "function bounds() {\n return {\n start: conductor.displayStart(),\n end: conductor.displayEnd(),\n domain: conductor.domain().key\n };\n }", "get bounds () {\n const xMin = Math.min.apply(null, this.pointArr.map(pt => pt.x))\n const yMin = Math.min.apply(null, this.pointArr.map(pt => pt.y))\n const xMax = Math.max.apply(null, this.pointArr.map(pt => pt.x))\n const yMax = Math.max.apply(null, this.pointArr.map(pt => pt.y))\n\n return {\n x: xMin,\n y: yMin,\n width: xMax - xMin,\n height: yMax - yMax\n }\n }", "getBounds() {}", "get bounds() { return this._bounds; }", "getLatLngBounds() {\n let bounds = new google.maps.LatLngBounds();\n // If the flight is big just having the two end points will cut off part of the route\n for(let i = 0; i <= 1; i+= 0.1) {\n bounds.extend(this.getIntermediatePoint(i));\n }\n return bounds;\n }", "function get_bounds(){\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\t\n\t\t\t\t\tsw_lat : map.getBounds().getSouthWest().lat(),\n\t\t\t\t\t\n\t\t\t\t\tsw_lng : map.getBounds().getSouthWest().lng(),\n\t\t\t\t\t\n\t\t\t\t\tne_lat : map.getBounds().getNorthEast().lat(),\n\t\t\t\t\t\n\t\t\t\t\tne_lng : map.getBounds().getNorthEast().lng()\n\t\t\t\t\n\t\t\t\t};\n\t\t\t\n\t\t\t}", "bounds() {\n const _bounds = new HRect(this.rect);\n _bounds.offsetTo(0, 0);\n return _bounds;\n }", "function getBounds(elem) {\n\t\tif (elem.find('.motion-path').length) {\n\t\t\telem.find('.motion-path').css({ 'display': 'none' })\n\t\t}\n\t\t\n\t\t//var bounds = elem.get(0).getBoundingClientRect();\n\t\tvar bounds = elem.get(0).getBBox();\n\t\t\n\t\tif (elem.find('.motion-path').length) {\n\t\t\telem.find('.motion-path').css({ 'display': '' })\n\t\t}\n\t\t\n\t\tif (elem.is('[data-width]')) {\n\t\t\tbounds.width = parseInt(elem.attr('data-width'));\n\t\t}\n\t\t\n\t\treturn bounds;\n\t}", "boundsForStroke (stroke) {\n const length = stroke.length\n if (length === 0) return []\n let lo = Object.assign({}, stroke[0])\n let hi = Object.assign({}, stroke[0])\n for (let i = 1; i < length; ++i) {\n var point = stroke[i]\n for (let prop in point) {\n lo[prop] = Math.min(lo[prop], point[prop])\n hi[prop] = Math.max(hi[prop], point[prop])\n }\n }\n return [lo.x, lo.y, hi.x, hi.y]\n }", "bounds() {\n if(this.isEmpty()) return null;\n // maximum boundaries possible\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n\n return [min, max] = this.forEachNode( (currentNode) => {\n if(currentNode.value < min) min = currentNode.value;\n if(currentNode.value > max) max = currentNode.value;\n return [min, max]\n }, min, max)\n \n }", "function getClippingBBox(bounds) {\n return [[bounds.xmin, bounds.ymin],\n [bounds.xmin, bounds.ymax],\n [bounds.xmax, bounds.ymax],\n [bounds.xmax, bounds.ymin]];\n }", "_calculateBounds()\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }", "function getBounds(bounds){\n\t var bbox = [];\n\t\n\t bbox.push(parseFloat(bounds.attrib[\"minlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"minlat\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlat\"]));\n\t\n\t return bbox;\n\t}", "function findBoundaries() {\n\tgoogle.maps.event.addListener(map, 'bounds_changed', function() {\n\t \tconst bounds = map.getBounds();\n\t \tconst NE = bounds.getNorthEast();\n\t\tconst SW = bounds.getSouthWest();\n\t\tconst coordinates = [`${SW}`, `${NE}`];\n\t\tconst fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => e.split(', ')).flat();\n\t\tconst parsed = fixed.map(e => parseFloat(e));\n\t\t[parsed[0], parsed[1]] = [parsed[1], parsed[0]];\n\t\t[parsed[2], parsed[3]] = [parsed[3], parsed[2]];\n\t\tconst formattedBounds = parsed.join();\n\t\tgetWheelMapNodes(formattedBounds);\n\t});\n}", "_calculateBounds() {\n var trim = this._texture.trim;\n var orig = this._texture.orig;\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height)) {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }", "get bounds() {\n // Optimization to reduct calculations.\n // The result should be exactly the same if this is removed.\n if (this._bounds !== undefined) {\n return this._bounds;\n }\n\n if (this.$el == null) {\n return this.preAttachedBounds;\n }\n else {\n return Bounds.fromAttrs(this.$el.attrs);\n }\n }", "function getBounds(feature) {\n var bounds = { min: [999, 999], max: [-999, -999] };\n\n _.each(feature, function(path) {\n _.each(path, function(point) {\n point = map.latLngToLayerPoint(new L.LatLng(point.x, point.y));\n\n bounds.min[0] = Math.min(bounds.min[0], point.x);\n bounds.min[1] = Math.min(bounds.min[1], point.y);\n bounds.max[0] = Math.max(bounds.max[0], point.x);\n bounds.max[1] = Math.max(bounds.max[1], point.y);\n });\n });\n\n return bounds;\n }", "get bounds() {\r\n\t\treturn {\r\n\t\t\tx: this.origin.x * (this.tileSize + this.spacing),\r\n\t\t\ty: this.origin.y * (this.tileSize + this.spacing),\r\n\t\t\tw: this.w * (this.tileSize + this.spacing) - this.spacing,\r\n\t\t\th: this.h * (this.tileSize + this.spacing) - this.spacing\r\n\t\t};\r\n\t}", "function getBounds (points) {\n\n var north = Infinity, south = 0, east = 0, west = Infinity;\n\n points.forEach(function(point){\n if (point.x < west) west = point.x;\n if (point.x > east) east = point.x;\n if (point.y < north) north = point.y;\n if (point.y > south) south = point.y;\n });\n\n return {north: north, south: south, east: east, west: west};\n}", "set bounds(value) {}", "getBoundingBox()\r\n\t{\r\n\t\tif ( this.vpos.length == 0 ) return null;\r\n\t\tvar min = [...this.vpos[0]];\r\n\t\tvar max = [...this.vpos[0]];\r\n\t\tfor ( var i=1; i<this.vpos.length; ++i ) \r\n\t\t{\r\n\t\t\tfor ( var j=0; j<3; ++j ) \r\n\t\t\t{\r\n\t\t\t\tif ( min[j] > this.vpos[i][j] ) min[j] = this.vpos[i][j];\r\n\t\t\t\tif ( max[j] < this.vpos[i][j] ) max[j] = this.vpos[i][j];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { min: min, max: max };\r\n\t}", "function getMapBounds(){\n\tvar bounds = myMap.getBounds();\n\tvar nWlat = bounds.getNorthWest().lat;\n\tvar nWlon = bounds.getNorthWest().lng;\n\tvar sElat = bounds.getSouthEast().lat;\n\tvar sElon = bounds.getSouthEast().lng;\n\tvar boundArray = [nWlat,nWlon, sElat, sElon];\n\treturn boundArray\n}", "function getLngBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LNG_MIN?GEO_BOUNDS.LNG_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LNG_MAX?GEO_BOUNDS.LNG_MAX:a[1]+PADDING;return[b,c]}", "function getLngBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LNG_MIN?GEO_BOUNDS.LNG_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LNG_MAX?GEO_BOUNDS.LNG_MAX:a[1]+PADDING;return[b,c]}", "function getBoundingBox () {\n let boundingBox = map.getBounds()\n xmin = parseFloat(boundingBox._sw.lng)\n ymin = parseFloat(boundingBox._sw.lat)\n xmax = parseFloat(boundingBox._ne.lng)\n ymax = parseFloat(boundingBox._ne.lat)\n\n //console.log(`${xmin}, ${ymin}, ${xmax}, ${ymax}`)\n}", "function getStartEnd(boundingPoly) {\n function helper(axis, func) {\n let result = boundingPoly.vertices[0][axis];\n for (let i = 1; i < 4; i++) {\n const current = boundingPoly.vertices[i][axis];\n result = func(result, current);\n }\n return result;\n }\n\n const minX = helper('x', Math.min);\n const minY = helper('y', Math.min);\n const maxX = helper('x', Math.max);\n const maxY = helper('y', Math.max);\n\n return [{ x: minX, y: minY }, { x: maxX, y: maxY }];\n}", "function et2_bounds(_top, _bottom)\n{\n\treturn {\n\t\t\"top\": _top,\n\t\t\"bottom\": _bottom\n\t};\n}", "clipSegment(start, end, log=false) {\n const size = this.settings.maxRadius\n const radStart = start.magnitude()\n const radEnd = end.magnitude()\n\n if (radStart < size && radEnd < size) {\n if (log) { console.log('line is inside limits') }\n return []\n }\n\n const intersections = this.getIntersections(start, end)\n if (!intersections.intersection) {\n if (log) { console.log('line is outside limits') }\n return [end]\n }\n\n if (intersections.points[0].on && intersections.points[1].on) {\n let point = intersections.points[0].point\n let otherPoint = intersections.points[1].point\n\n if (log) { console.log('line is outside limits, but intersects within limits') }\n return [\n ...this.tracePerimeter(point, otherPoint),\n otherPoint,\n end\n ]\n }\n\n if (radStart <= size) {\n const point1 = (intersections.points[0].on && Math.abs(intersections.points[0].point - start) > 0.0001) ? intersections.points[0].point : intersections.points[1].point\n if (log) { console.log('start is inside limits') }\n return [ point1, end ]\n } else {\n const point1 = intersections.points[0].on ? intersections.points[0].point : intersections.points[1].point\n if (log) { console.log('end is inside limits') }\n return [ start, point1 ]\n }\n }", "getBounds() {\n return new Rectangle(new Point(this.x, this.y), new Vector(0, 0));\n }", "_calculateBounds() {\n this.calculateVertices();\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }", "getBounds() {\n return this.state[CIRCLE].getBounds()\n }", "_getTrackStartAndEnd() {\n const that = this;\n let trackStart,\n offset = that.$.track.getBoundingClientRect();\n\n if (that.orientation === 'horizontal') {\n const scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;\n trackStart = offset.left + scrollLeft;\n }\n else {\n const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n trackStart = offset.top + scrollTop;\n }\n\n const trackEnd = trackStart + that._measurements.trackLength,\n pxRange = trackEnd - trackStart;\n\n that._trackStart = trackStart;\n that._trackEnd = trackEnd;\n that._valuePerPx = that._numericProcessor.getValuePerPx(that._range, pxRange);\n }", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "calculateBounds() {\n var minX = Infinity;\n var maxX = -Infinity;\n var minY = Infinity;\n var maxY = -Infinity;\n if (this.graphicsData.length) {\n var shape = null;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data = this.graphicsData[i];\n var type = data.type;\n var lineWidth = data.lineStyle ? data.lineStyle.width : 0;\n shape = data.shape;\n if (type === ShapeSettings_1.ShapeSettings.SHAPES.RECT || type === ShapeSettings_1.ShapeSettings.SHAPES.RREC) {\n x = shape.x - (lineWidth / 2);\n y = shape.y - (lineWidth / 2);\n w = shape.width + lineWidth;\n h = shape.height + lineWidth;\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.CIRC) {\n x = shape.x;\n y = shape.y;\n w = shape.radius + (lineWidth / 2);\n h = shape.radius + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.ELIP) {\n x = shape.x;\n y = shape.y;\n w = shape.width + (lineWidth / 2);\n h = shape.height + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else {\n // POLY\n var points = shape.points;\n var x2 = 0;\n var y2 = 0;\n var dx = 0;\n var dy = 0;\n var rw = 0;\n var rh = 0;\n var cx = 0;\n var cy = 0;\n for (var j = 0; j + 2 < points.length; j += 2) {\n x = points[j];\n y = points[j + 1];\n x2 = points[j + 2];\n y2 = points[j + 3];\n dx = Math.abs(x2 - x);\n dy = Math.abs(y2 - y);\n h = lineWidth;\n w = Math.sqrt((dx * dx) + (dy * dy));\n if (w < 1e-9) {\n continue;\n }\n rw = ((h / w * dy) + dx) / 2;\n rh = ((h / w * dx) + dy) / 2;\n cx = (x2 + x) / 2;\n cy = (y2 + y) / 2;\n minX = cx - rw < minX ? cx - rw : minX;\n maxX = cx + rw > maxX ? cx + rw : maxX;\n minY = cy - rh < minY ? cy - rh : minY;\n maxY = cy + rh > maxY ? cy + rh : maxY;\n }\n }\n }\n }\n else {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n var padding = this.boundsPadding;\n this._bounds.minX = minX - padding;\n this._bounds.maxX = maxX + padding;\n this._bounds.minY = minY - padding;\n this._bounds.maxY = maxY + padding;\n }", "_calculateBounds() {\n // FILL IN//\n }", "function compute_bound(bbox) {\n var offset = 0.01;\n var southWest = new L.LatLng(bbox[0][0] - offset, bbox[0][1] - offset);\n var northEast = new L.LatLng(bbox[2][0] + offset, bbox[2][1] + offset);\n return new L.LatLngBounds(southWest, northEast);\n}", "function getBoundariesFor(obj) {\r\n\t\treturn {\r\n\t\t\ttop: obj.center.y - (obj.size.height / 2.5),\r\n\t\t\tbottom: obj.center.y + (obj.size.height / 2.5),\r\n\t\t\tleft: obj.center.x - (obj.size.width / 2.5),\r\n\t\t\tright: obj.center.x + (obj.size.width / 2.5)\r\n\t\t};\r\n\t}", "function BoundingBoxRect() { }", "function boundPoints(points) {\n\t var bounds = new Array(points.length)\n\t for(var i=0; i<points.length; ++i) {\n\t var p = points[i]\n\t bounds[i] = [ p[0], p[1], p[0], p[1] ]\n\t }\n\t return bounds\n\t}", "function boundPoints(points) {\n\t var bounds = new Array(points.length)\n\t for(var i=0; i<points.length; ++i) {\n\t var p = points[i]\n\t bounds[i] = [ p[0], p[1], p[0], p[1] ]\n\t }\n\t return bounds\n\t}", "function getBoundsOfThing(thing){\n\tvar testTopLeft, testBottomRight;\n\t//Get the initial bounds of the object. If there's only one object in the array, this is all we'll need.\n\tvar topLeft = thing[0].resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\tvar bottomRight = thing[0].resolve(AnchorPoint.BOTTOM_RIGHT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\tif(thing.length > 1){\n\t\tfor(var counter = 1; counter < thing.length; counter++){\n\t\t\ttestTopLeft = thing[counter].resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\t\t\ttestBottomRight = thing[counter].resolve(AnchorPoint.BOTTOM_RIGHT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\t\t\tif(testTopLeft[0] < topLeft[0]){\n\t\t\t\ttopLeft[0] = testTopLeft[0];\n\t\t\t}\n\t\t\tif(testTopLeft[1] < topLeft[1]){\n\t\t\t\ttopLeft[1] = testTopLeft[1];\n\t\t\t}\n\t\t\tif(testBottomRight[0] > bottomRight[0]){\n\t\t\t\tbottomRight[0] = testBottomRight[0];\n\t\t\t}\n\t\t\tif(testBottomRight[1] > bottomRight[1]){\n\t\t\t\tbottomRight[1] = testBottomRight[1];\n\t\t\t}\n\t\t}\n\t}\n\treturn new Array(topLeft, bottomRight);\n}", "function boundPoints(points) {\n var bounds = new Array(points.length)\n for(var i=0; i<points.length; ++i) {\n var p = points[i]\n bounds[i] = [ p[0], p[1], p[0], p[1] ]\n }\n return bounds\n}", "function getBounds(group) {\n var minX = pv.min(group, function(d) { return d.x || 0 }); // or 0 in case falsy value in data\n var maxX = pv.max(group, function(d) { return d.x || 0 });\n var minY = pv.min(group, function(d) { return d.y || 0 });\n var maxY = pv.max(group, function(d) { return d.y || 0 });\n return { minX:minX, minY:minY, maxX:maxX, maxY:maxY };\n}", "function getBounds(features) {\n var bounds = { min: [999, 999], max: [-999, -999] };\n\n _.each(features, function(element) {\n var point = map.latLngToLayerPoint(element.LatLng);\n\n bounds.min[0] = Math.min(bounds.min[0], point.x);\n bounds.min[1] = Math.min(bounds.min[1], point.y);\n bounds.max[0] = Math.max(bounds.max[0], point.x);\n bounds.max[1] = Math.max(bounds.max[1], point.y);\n });\n\n return bounds;\n }", "function boundPoints (points) {\n var bounds = new Array(points.length)\n for (var i = 0; i < points.length; ++i) {\n var p = points[i]\n bounds[i] = [\n nextafter(p[0], -Infinity),\n nextafter(p[1], -Infinity),\n nextafter(p[0], Infinity),\n nextafter(p[1], Infinity)\n ]\n }\n return bounds\n}", "getBounds() {\n const bounds = this.options.bounds\n ? L.latLngBounds(this.options.bounds)\n : this._clusters.getBounds()\n\n if (bounds.isValid()) {\n return toLngLatBounds(bounds)\n }\n }", "getBounds(bounds) {\n if (this.objects !== undefined) {\n for (let i = 0; i < this.objects.length; i++) {\n this.objects[i].getBounds(bounds);\n }\n }\n }", "function BoundingBox() {\n var bounds = map.getBounds().getSouthWest().lng + \",\" + map.getBounds().getSouthWest().lat + \",\" + map.getBounds().getNorthEast().lng + \",\" + map.getBounds().getNorthEast().lat;\n return bounds;\n}", "calculateBounds() {\n this.tagsSectionsMap = this.tags.map((tag) => {\n const rect = tag.getBoundingClientRect();\n const top = Math.floor(rect.top + window.scrollY);\n\n return {\n top,\n tag,\n };\n });\n }", "carregaBoundaries() {\n\n //Modifica o tamanho do estagio baseado no tamanho do elemento div do bird\n this.maxBoundsWidth = this.getEstagio().clientWidth - this.getBird().getTamanhoWidth();\n this.maxBoundsHeight = this.getEstagio().clientHeight - this.getBird().getTamanhoHeight();\n\n // console.log(\"Max width da arena: \" + this.maxBoundsWidth);\n // console.log(\"Max height da arena: \" + this.maxBoundsHeight);\n\n //Verifico se o passaro esta dentro as boundaries(caso o usuario de resize)\n this.estaForaDasBounds()\n }", "function getBoundingRectLocs (center, grid) {\n var jQueryDoc = $(window.document),\n jQH = jQueryDoc.height(),\n jQW = jQueryDoc.width(),\n R = jQH/jQW,\n size = (grid ||.002);\n\n center.latitude = Math.round(center.latitude/(2*size))*(2*size);\n center.longitude = Math.round(center.longitude/(2*size/R))*(2*size/R);\n\n return [\n center.latitude + size,\n center.longitude - size/R,\n center.latitude - size,\n center.longitude + size/R\n ];\n\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "function getVesselInCamArea() {\n var bounds = new google.maps.LatLngBounds(passat_sw, passat_ne);\n var vesselInBounds = 'undefined';\n\n $.each(markersArray, function (index, marker) {\n if (bounds.contains(marker.getPosition()) && marker.vessel.status == 'MOVING') {\n vesselInBounds = marker;\n // break for jquery each\n return false;\n }\n });\n\n if (vesselInBounds && vesselInBounds != 'undefined') {\n return vesselInBounds;\n } else {\n return null;\n }\n}", "function findPathsBounds(docRef, penPathRef) {\n var tlX, tlY, blX, blY, brX, brY, trX, trY;\n var i;\n var pathValid = true;\n var bounds = new Array();\n\n if (penPathRef.subPathItems.length != 1) {\n alert(\"findPathsBounds() Path [\" + penPathRef.name + \"] has multiple subpaths\");\n return(bounds);\n }\n for (i=0; i<penPathRef.subPathItems[0].pathPoints.length; i++) {\n if (penPathRef.subPathItems[0].pathPoints[i].kind != PointKind.CORNERPOINT) {\n pathValid = false; // not a rectangle\n break;\n }\n }\n if (pathValid && penPathRef.subPathItems[0].pathPoints.length == 4) {\n //-----------------------------\n // path has exactly four points\n //-----------------------------\n tlX = penPathRef.subPathItems[0].pathPoints[0].anchor[0];\n tlY = penPathRef.subPathItems[0].pathPoints[0].anchor[1];\n blX = penPathRef.subPathItems[0].pathPoints[1].anchor[0];\n blY = penPathRef.subPathItems[0].pathPoints[1].anchor[1];\n brX = penPathRef.subPathItems[0].pathPoints[2].anchor[0];\n brY = penPathRef.subPathItems[0].pathPoints[2].anchor[1];\n trX = penPathRef.subPathItems[0].pathPoints[3].anchor[0];\n trY = penPathRef.subPathItems[0].pathPoints[3].anchor[1];\n bounds[0] = Math.round(tlX); // X\n bounds[1] = Math.round(tlY); // Y\n bounds[2] = Math.round(brX - tlX); // W\n bounds[3] = Math.round(brY - tlY); // H\n bounds[4] = penPathRef.name; // name\n } else {\n alert(\"findPathsBounds() Path [\" + penPathRef.name + \"] is not a rectangle\");\n }\n return(bounds);\n}", "function getBounds(coordArr) {\n\t\t\tlet leftBound;\n\t\t\tlet rightBound;\n\t\t\tlet upperBound;\n\t\t\tlet lowerBound;\n\t\t\tcoordArr.forEach((pt, i) => {\n\t\t\t\tconst { x, y } = pt;\n\t\t\t\tif (i === 0) {\n\t\t\t\t\t// Sets default values\n\t\t\t\t\tleftBound = rightBound = x;\n\t\t\t\t\tupperBound = lowerBound = y;\n\t\t\t\t} else {\n\t\t\t\t\tleftBound = Math.min(leftBound, x);\n\t\t\t\t\trightBound = Math.max(rightBound, x);\n\t\t\t\t\tupperBound = Math.min(upperBound, y);\n\t\t\t\t\tlowerBound = Math.max(lowerBound, y);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tleftBound,\n\t\t\t\trightBound,\n\t\t\t\tupperBound,\n\t\t\t\tlowerBound\n\t\t\t};\n\t\t}", "function getMapBounds() {\r\n\t\t//return app.location.bounds;\r\n\t\treturn app.map.map.getBounds();\r\n\t}", "function getBoundsForArray(a)\n{\n\tvar maxlat = 0;\n\tvar\tmaxlng = 0;\n\tvar\tminlat = 10000;\n\tvar\tminlng = 10000;\n\tvar bounds;\n\t\n\tfor (var i = 0; i < a.length; i++)\n\t{\n\t\tvar lat = a[i].lat();\n\t\tvar lng = a[i].lng();\n\t\tif (lat > maxlat)\n\t\t{\n\t\t\tmaxlat = lat;\n\t\t} \n\t\tif (lat < minlat)\n\t\t{\n\t\t\tminlat = lat;\n\t\t}\n\t\tif (lng > maxlng)\n\t\t{\n\t\t\tmaxlng = lng;\n\t\t}\n\t\tif (lng < minlng)\n\t\t{\n\t\t\tminlng = lng;\n\t\t}\n\t}\n\t\n\tbounds = new google.maps.LatLngBounds(new google.maps.LatLng(minlat, minlng), \n\t\t\t\t\t\t\t\t\t\t new google.maps.LatLng(maxlat, maxlng));\t\n\t\n\treturn bounds;\n}", "function getPixelRange() {\r\n\t\t$this = $['mapsettings'].element;\r\n\t\tvar xstart = 0;\r\n\t\tvar ystart = 0;\r\n\t\tif($['mapsettings'].initLeft<0) xstart = Math.abs($['mapsettings'].initLeft);\r\n\t\tif($['mapsettings'].initTop<0) ystart = Math.abs($['mapsettings'].initTop);\r\n\t\txstart = getFirstXPosInRange(xstart);\r\n\t\t// Makes sure that ystart values are multiples of 256 and start before viewport\r\n\t\tif(ystart%256!=0) ystart=((parseInt(ystart/256))-1)*256;\r\n\t\tvar xend = $this.innerWidth() - $['mapsettings'].initLeft;\r\n\t\tvar yend = $this.innerHeight() - $['mapsettings'].initTop;\r\n\t\treturn {\r\n\t\t\t\"start\": {\r\n\t\t\t\t\"x\": xstart,\r\n\t\t\t\t\"y\": ystart\r\n\t\t\t},\r\n\t\t\t\"end\": {\r\n\t\t\t\t\"x\": xend,\r\n\t\t\t\t\"y\": yend\r\n\t\t\t}\r\n\t\t};\r\n\t}", "setBounds() {\n let x = this.position.getX();\n let y = this.position.getY();\n let s = Game.Settings().UnitSize;\n let hs = s / 2;\n\n //generate Individual Bounds\n this.bounds = new Bounds(x - hs, y - hs, x + hs, y + hs);\n }", "function boundingsection(sections) {\n return sections.getBoundingClientRect().top;\n}", "getBounds() {\n throw \"Abstract method\" \n }", "function getBoundsSearchFunction(boxes) {\n var index, Flatbush;\n if (!boxes.length) {\n // Unlike rbush, flatbush doesn't allow size 0 indexes; workaround\n return function() {return [];};\n }\n Flatbush = require$1('flatbush');\n index = new Flatbush(boxes.length);\n boxes.forEach(function(ring) {\n var b = ring.bounds;\n index.add(b.xmin, b.ymin, b.xmax, b.ymax);\n });\n index.finish();\n\n function idxToObj(i) {\n return boxes[i];\n }\n\n // Receives xmin, ymin, xmax, ymax parameters\n // Returns subset of original @bounds array\n return function(a, b, c, d) {\n return index.search(a, b, c, d).map(idxToObj);\n };\n }", "get localBounds() {\n return {\n x: this.x, //I changed this, it was \"x: 0,\"\n y: this.y, //I changed this, it was \"y: 0,\"\n width: this.width,\n height: this.height\n } \n }", "get boundingBox() {\n }", "function boundEdges(points, edges) {\n\t var bounds = new Array(edges.length)\n\t for(var i=0; i<edges.length; ++i) {\n\t var e = edges[i]\n\t var a = points[e[0]]\n\t var b = points[e[1]]\n\t bounds[i] = [\n\t Math.min(a[0], b[0]),\n\t Math.min(a[1], b[1]),\n\t Math.max(a[0], b[0]),\n\t Math.max(a[1], b[1]) ]\n\t }\n\t return bounds\n\t}", "function boundEdges(points, edges) {\n\t var bounds = new Array(edges.length)\n\t for(var i=0; i<edges.length; ++i) {\n\t var e = edges[i]\n\t var a = points[e[0]]\n\t var b = points[e[1]]\n\t bounds[i] = [\n\t Math.min(a[0], b[0]),\n\t Math.min(a[1], b[1]),\n\t Math.max(a[0], b[0]),\n\t Math.max(a[1], b[1]) ]\n\t }\n\t return bounds\n\t}", "function normBounds( bounds ) {\n\n\t\tfor ( var i = ticks.length; i >= 0; i-- ) {\n\t\t\tif ( bounds[0] + unit / 2 >= ticks[i] ) {\n\t\t\t\tbounds[0] = ticks[i] - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor ( var i = 0; i <= ticks.length; i++ ) {\n\t\t\tif ( bounds[1] - unit / 2 <= ticks[i] ) {\n\t\t\t\tbounds[1] = ticks[i] + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn bounds;\n\t}", "function getExtendedBounds(bnds){\n // get the coordinates for the sake of readability\n var swlat = bnds._southWest.lat;\n var swlng = bnds._southWest.lng;\n var nelat = bnds._northEast.lat;\n var nelng = bnds._northEast.lng;\n\n // Increase size of bounding box in each direction by 50%\n swlat = swlat - Math.abs(0.5*(swlat - nelat)) > -90 ? swlat - Math.abs(0.5*(swlat - nelat)) : -90;\n swlng = swlng - Math.abs(0.5*(swlng - nelng)) > -180 ? swlng - Math.abs(0.5*(swlng - nelng)) : -180;\n nelat = nelat + Math.abs(0.5*(swlat - nelat)) < 90 ? nelat + Math.abs(0.5*(swlat - nelat)) : 90;\n nelng = nelng + Math.abs(0.5*(swlng - nelng)) < 180 ? nelng + Math.abs(0.5*(swlng - nelng)) : 180;\n\n return L.latLngBounds(L.latLng(swlat, swlng), L.latLng(nelat, nelng));\n }", "function getPointBounds(p, radius) {\n return [p[0] - radius, p[1] - radius, p[0] + radius, p[1] + radius];\n }", "function currentBounds(){var cntr=element?element.parent():null;var parent=cntr?cntr.parent():null;return parent?self.clientRect(parent):null;}", "function getBoundParams(){\n var bounds = map.getBounds(),\n padding = .00;\n console.log(bounds);\n return { neLat: (bounds._northEast.lat + padding).toFixed(6),\n neLon: (bounds._northEast.lng + padding).toFixed(6),\n swLat: (bounds._southWest.lat - padding).toFixed(6),\n swLon: (bounds._southWest.lng - padding).toFixed(6)\n }\n }", "defineMapBounds() {\n \n const coordinates = this.state.options.map(i => i.coordinates);\n\n let maxX = 0,\n minX = 0,\n maxY = 0,\n minY = 0;\n\n coordinates.forEach(coord => {\n if (coord[0] > maxY) {\n maxY = coord[0];\n }\n \n if (coord[0] < minY) {\n minY = coord[0];\n }\n\n if (coord[1] > maxX) {\n maxX = coord[1];\n }\n \n if (coord[1] < minX) {\n minX = coord[1];\n }\n })\n\n // Bounds are defined by two coordinates:\n // position1: the most W and N\n // position2: the most E and S\n this.setState({\n bounds: [[maxY, minX], [minY, maxX]],\n center: [(maxY - minY) / 2, (maxX - minX) / 2]\n })\n }", "function getBounds(x, y, z) {\n\t\ty = Math.pow(2, z) - y - 1; // Translate Y value\n\t\t\n\t\tvar resolution = (CIRCUMFERENCE / TILE_SIZE) / Math.pow(2, z); // meters per pixel\n\t\t\n\t\tvar swPoint = getMercatorCoord(x, y, resolution);\n\t\tvar nePoint = getMercatorCoord(x + 1, y + 1, resolution);\n\t\t\n\t\tvar bounds = {\n\t\t\t\tswX : swPoint.x,\n\t\t\t\tswY : swPoint.y,\n\t\t\t\tneX : nePoint.x,\n\t\t\t\tneY : nePoint.y\n\t\t};\n\t\t\n\t\treturn bounds;\n\t}", "function _getBounds ( collection, bounds ) {\n var clipGroupElems, i, j;\n\n if ( collection.typename != 'GroupItem' ) { // ����� ��������� ������� �����������\n return collection.geometricBounds;\n }\n if ( collection.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = collection.pathItems;\n\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n return bounds;\n }\n\n // ������ ��� ����������� ����� => ���� �� ��������� ������\n for ( j = 0; j < collection.pageItems.length; j++ ) {\n\n var el = collection.pageItems [ j ];\n\n if ( el.typename != 'GroupItem' ) { // ����� pageItem ����� ������\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n continue;\n }\n bounds = _compareBounds ( el, bounds );\n }\n\n if ( el.typename == 'GroupItem' && el.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = el.pathItems;\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n continue;\n }\n\n if ( el.typename == 'GroupItem' && !el.groupItems && !el.clipped ) { // ������ ��� ����� � ��� �����\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n// bounds = getBoundsExtend ( el.pageItems, bounds );\n continue;\n }\n bounds = _compareBounds ( el.geometricBounds, bounds );\n continue;\n }\n\n if ( el.typename == 'GroupItem' && el.groupItems ) { // ������ ��� �����, �� � �������� => ��������\n for ( var l = 0; l < el.pageItems.length; l++ ) {\n /* if ( bounds == '' ) {\n bounds = getBoundsExtend ( el.pageItems[l], '' );\n }*/\n bounds = getBoundsExtend ( el.pageItems[ l ], bounds );\n }\n continue;\n }\n }\n return bounds;\n\n // �������� � ������� ����� ������� geometricBounds ��������\n function _compareBounds ( elem, boundsToCompare ) {\n var elemBounds = elem.geometricBounds;\n elemBounds[ 0 ] < boundsToCompare[ 0 ] ? boundsToCompare[ 0 ] = elemBounds[ 0 ] : '';\n elemBounds[ 1 ] > boundsToCompare[ 1 ] ? boundsToCompare[ 1 ] = elemBounds[ 1 ] : '';\n elemBounds[ 2 ] > boundsToCompare[ 2 ] ? boundsToCompare[ 2 ] = elemBounds[ 2 ] : '';\n elemBounds[ 3 ] < boundsToCompare[ 3 ] ? boundsToCompare[ 3 ] = elemBounds[ 3 ] : '';\n return boundsToCompare;\n }\n }", "getLoopBounds(index) {\n this.maxX = MIN_FLOAT;\n this.maxY = MIN_FLOAT;\n this.minX = MAX_FLOAT;\n this.minY = MAX_FLOAT;\n //get extreems and load into PVector Array\n for (let i = 0; i < this.loop.body.size(); i++) {\n if (this.maxX < this.loop.body[i].loc.x + 4) this.maxX = loop.body[i].loc.x;\n if (this.maxY < this.loop.body[i].loc.y) this.maxY = loop.body[i].loc.y;\n if (this.minX > this.loop.body[i].loc.x - 4) this.minX = loop.body[i].loc.x;\n if (this.minY > this.loop.body[i].loc.y) this.minY = loop.body[i].loc.y;\n }\n this.loopBounds[0].x = this.maxX;\n this.loopBounds[0].y = this.maxY;\n this.loopBounds[1].x = this.minX;\n this.loopBounds[1].y = this.minY;\n }", "function Bounds()\n{\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n}", "function getLatBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LAT_MIN?GEO_BOUNDS.LAT_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LAT_MAX?GEO_BOUNDS.LAT_MAX:a[1]+PADDING;return[b,c]}", "function getLatBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LAT_MIN?GEO_BOUNDS.LAT_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LAT_MAX?GEO_BOUNDS.LAT_MAX:a[1]+PADDING;return[b,c]}", "function getMinMax() {\n var minPt = pts[0];\n var maxPt = pts[0];\n for (var i=1; i<pts.length; i++) {\n minPt = minPt.$min( pts[i] );\n }\n for (i=1; i<pts.length; i++) {\n maxPt = maxPt.$max( pts[i] );\n }\n nextRect.set( minPt).to( maxPt );\n}", "estaForaDasBounds() {\n if (this.getBird().getPosHeigth() > this.getMaxHeightArena()) {\n // console.log(\"height do passaro fora dos bounds (abaixo)\");\n this.getBird().setPosHeight(this.getMaxHeightArena());\n } else if (this.getBird().getPosWidth() > this.getMaxWidthArena()) {\n // console.log(\"width do passaro fora dos bounds (direita)\");\n this.getBird().setPosWidth(this.getMaxWidthArena());\n }\n }", "function GetClipSegments(clip_intervals, block_size, hop_size, x_length) {\n var clip_segments = [];\n var num_clip_segments = 0;\n\n var in_segment = false;\n var start_idx = 0;\n var stop_idx = start_idx + block_size - 1;\n var block_idx = 0;\n\n var segment_start_idx = -1;\n var segment_stop_idx = -1;\n while(stop_idx < x_length) {\n // We are in a segment.\n if(in_segment) {\n // We leave the segment. Store it and move on.\n if(!AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n }\n // We are not in a segment.\n else {\n // We have entered a segment.\n if(AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = true;\n segment_start_idx = block_idx;\n }\n }\n\n block_idx++;\n start_idx = start_idx + hop_size;\n stop_idx = start_idx + block_size - 1;\n }\n\n // If we end while in a segment, we need to leave the segment and push the segment.\n if(in_segment) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n\n return clip_segments;\n }", "get nearClipPlane() {}", "bbox() {\n var maxX = -Infinity;\n var maxY = -Infinity;\n var minX = Infinity;\n var minY = Infinity;\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX);\n maxY = Math.max(el[1], maxY);\n minX = Math.min(el[0], minX);\n minY = Math.min(el[1], minY);\n });\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }", "function cloudBounds(bounds, d) {\n var b0 = bounds[0],\n b1 = bounds[1];\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\n }", "function myGetBounds(myPage, myDocument)\n{\n var array = new Array()\n var item = 0;\n with (myDocument.documentPreferences)\n {\n var myPageHeight = pageHeight;\n var myPageWidth = pageWidth;\n }\n\n with(myPage.marginPreferences)\n {\n var myX1 = left;\n var myY1 = top;\n var myY2 = bottom;\n var myX2 = right;\n }\n\n array[item++] = myY1;\n array[item++] = myX1;\n array[item++] = myPageHeight - myY2;\n array[item++] = myPageWidth - myX2;\n\n return array;\n}", "function S(){var e=le.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][n.ort];return 0===n.ort?e.width||le[t]:e.height||le[t]}", "function boundEdges(points, edges) {\n var bounds = new Array(edges.length)\n for(var i=0; i<edges.length; ++i) {\n var e = edges[i]\n var a = points[e[0]]\n var b = points[e[1]]\n bounds[i] = [\n Math.min(a[0], b[0]),\n Math.min(a[1], b[1]),\n Math.max(a[0], b[0]),\n Math.max(a[1], b[1]) ]\n }\n return bounds\n}", "function getPlaneBoundaryIntercepts() {\n // boundary case, handle separately\n if (!isFinite(m)) {\n return {\n xBoundary1: pt1.canvasPosX,\n yBoundary1: 0,\n xBoundary2: pt1.canvasPosX,\n yBoundary2: plane.height\n };\n }\n // Using y=mx+b to find bounds. Negatives account for opposite y direction\n let bound1y = (-1 * m * (plane.width / 2)) - (b * gridSpacing);\n let bound2y = (m * (plane.width / 2)) - (b * gridSpacing);\n return {\n // we found boundary ints above with x = 0 and width (notice I accounted\n // for the origin offset in that calculation)\n xBoundary1: 0,\n // height / 2 is accounting for the origin being offset\n yBoundary1: bound2y + (plane.height/2),\n xBoundary2: plane.width,\n yBoundary2: bound1y + (plane.height/2)\n };\n}", "function getBounds() {\n let body = d3.select('body');\n let bounds = body.node().getBoundingClientRect();\n\n let bound = {height: bounds.height, width: bounds.width, margin:\n {top: 50, right: 30, bottom: 30, left: 100}};\n\n bound.height -= 100; // because of header\n bound.width -= (bound.margin.left + bound.margin.right);\n bound.height -= (bound.margin.top + bound.margin.bottom);\n\n return bound;\n}", "function R(){var e=s.getBoundingClientRect(),n=\"offset\"+[\"Width\",\"Height\"][t.ort];return 0===t.ort?e.width||s[n]:e.height||s[n]}", "_calculateBounds() {\n this.finishPoly();\n var lb = this.geometry.bounds;\n this._bounds.addFrame(this.transform, lb.minX, lb.minY, lb.maxX, lb.maxY);\n }", "function bounds(objects) {\n var x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n function boundGeometry(geometry) {\n if (geometry != null && hasOwnProperty.call(boundGeometryType, geometry.type)) boundGeometryType[geometry.type](geometry);\n }\n\n var boundGeometryType = {\n GeometryCollection: function(o) { o.geometries.forEach(boundGeometry); },\n Point: function(o) { boundPoint(o.coordinates); },\n MultiPoint: function(o) { o.coordinates.forEach(boundPoint); },\n LineString: function(o) { boundLine(o.arcs); },\n MultiLineString: function(o) { o.arcs.forEach(boundLine); },\n Polygon: function(o) { o.arcs.forEach(boundLine); },\n MultiPolygon: function(o) { o.arcs.forEach(boundMultiLine); }\n };\n\n function boundPoint(coordinates) {\n var x = coordinates[0],\n y = coordinates[1];\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n function boundLine(coordinates) {\n coordinates.forEach(boundPoint);\n }\n\n function boundMultiLine(coordinates) {\n coordinates.forEach(boundLine);\n }\n\n for (var key in objects) {\n boundGeometry(objects[key]);\n }\n\n return x1 >= x0 && y1 >= y0 ? [x0, y0, x1, y1] : undefined;\n}", "function boundEdges (points, edges) {\n var bounds = new Array(edges.length)\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i]\n var a = points[e[0]]\n var b = points[e[1]]\n bounds[i] = [\n nextafter(Math.min(a[0], b[0]), -Infinity),\n nextafter(Math.min(a[1], b[1]), -Infinity),\n nextafter(Math.max(a[0], b[0]), Infinity),\n nextafter(Math.max(a[1], b[1]), Infinity)\n ]\n }\n return bounds\n}", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }" ]
[ "0.778627", "0.7188192", "0.71379304", "0.6851803", "0.6806722", "0.6705719", "0.6702594", "0.6664514", "0.6460486", "0.6445773", "0.6420555", "0.6400514", "0.633647", "0.62954897", "0.6283144", "0.6263674", "0.6257252", "0.6253886", "0.6192765", "0.612273", "0.61054575", "0.6099891", "0.60899264", "0.6059254", "0.6049913", "0.6035119", "0.6035119", "0.601253", "0.60001653", "0.5989804", "0.5985693", "0.59706306", "0.596747", "0.5960314", "0.59602845", "0.5952437", "0.594135", "0.5899587", "0.5894157", "0.5881563", "0.5878201", "0.58779633", "0.58779633", "0.58725953", "0.5871477", "0.5855185", "0.5833919", "0.5830286", "0.5822363", "0.58206356", "0.58172804", "0.58038133", "0.5789387", "0.57805556", "0.5775304", "0.5775304", "0.5772042", "0.5771879", "0.5754304", "0.575115", "0.57349813", "0.5721806", "0.5714795", "0.5707437", "0.5701445", "0.5699866", "0.5698713", "0.5698581", "0.56797457", "0.56797457", "0.5679459", "0.5676013", "0.5656751", "0.5648779", "0.56481594", "0.5641745", "0.56344503", "0.562493", "0.56211567", "0.5613615", "0.56124485", "0.56124485", "0.5611042", "0.5603335", "0.55994946", "0.55906224", "0.55669296", "0.55650705", "0.5563167", "0.55615914", "0.5560687", "0.5549191", "0.55447733", "0.55438334", "0.55276513", "0.5526257", "0.5518647", "0.5513595", "0.5513595", "0.5513595" ]
0.57873607
53
get the bounds of any segment in the track
function getBoundsForArray(a) { var maxlat = 0; var maxlng = 0; var minlat = 10000; var minlng = 10000; var bounds; for (var i = 0; i < a.length; i++) { var lat = a[i].lat(); var lng = a[i].lng(); if (lat > maxlat) { maxlat = lat; } if (lat < minlat) { minlat = lat; } if (lng > maxlng) { maxlng = lng; } if (lng < minlng) { minlng = lng; } } bounds = new google.maps.LatLngBounds(new google.maps.LatLng(minlat, minlng), new google.maps.LatLng(maxlat, maxlng)); return bounds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get bounds() {}", "get localBounds() {}", "get boundsValue() {}", "function bounds() {\n return {\n start: conductor.displayStart(),\n end: conductor.displayEnd(),\n domain: conductor.domain().key\n };\n }", "get bounds () {\n const xMin = Math.min.apply(null, this.pointArr.map(pt => pt.x))\n const yMin = Math.min.apply(null, this.pointArr.map(pt => pt.y))\n const xMax = Math.max.apply(null, this.pointArr.map(pt => pt.x))\n const yMax = Math.max.apply(null, this.pointArr.map(pt => pt.y))\n\n return {\n x: xMin,\n y: yMin,\n width: xMax - xMin,\n height: yMax - yMax\n }\n }", "getBounds() {}", "get bounds() { return this._bounds; }", "getLatLngBounds() {\n let bounds = new google.maps.LatLngBounds();\n // If the flight is big just having the two end points will cut off part of the route\n for(let i = 0; i <= 1; i+= 0.1) {\n bounds.extend(this.getIntermediatePoint(i));\n }\n return bounds;\n }", "function get_bounds(){\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\t\n\t\t\t\t\tsw_lat : map.getBounds().getSouthWest().lat(),\n\t\t\t\t\t\n\t\t\t\t\tsw_lng : map.getBounds().getSouthWest().lng(),\n\t\t\t\t\t\n\t\t\t\t\tne_lat : map.getBounds().getNorthEast().lat(),\n\t\t\t\t\t\n\t\t\t\t\tne_lng : map.getBounds().getNorthEast().lng()\n\t\t\t\t\n\t\t\t\t};\n\t\t\t\n\t\t\t}", "bounds() {\n const _bounds = new HRect(this.rect);\n _bounds.offsetTo(0, 0);\n return _bounds;\n }", "function getBounds(elem) {\n\t\tif (elem.find('.motion-path').length) {\n\t\t\telem.find('.motion-path').css({ 'display': 'none' })\n\t\t}\n\t\t\n\t\t//var bounds = elem.get(0).getBoundingClientRect();\n\t\tvar bounds = elem.get(0).getBBox();\n\t\t\n\t\tif (elem.find('.motion-path').length) {\n\t\t\telem.find('.motion-path').css({ 'display': '' })\n\t\t}\n\t\t\n\t\tif (elem.is('[data-width]')) {\n\t\t\tbounds.width = parseInt(elem.attr('data-width'));\n\t\t}\n\t\t\n\t\treturn bounds;\n\t}", "boundsForStroke (stroke) {\n const length = stroke.length\n if (length === 0) return []\n let lo = Object.assign({}, stroke[0])\n let hi = Object.assign({}, stroke[0])\n for (let i = 1; i < length; ++i) {\n var point = stroke[i]\n for (let prop in point) {\n lo[prop] = Math.min(lo[prop], point[prop])\n hi[prop] = Math.max(hi[prop], point[prop])\n }\n }\n return [lo.x, lo.y, hi.x, hi.y]\n }", "bounds() {\n if(this.isEmpty()) return null;\n // maximum boundaries possible\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n\n return [min, max] = this.forEachNode( (currentNode) => {\n if(currentNode.value < min) min = currentNode.value;\n if(currentNode.value > max) max = currentNode.value;\n return [min, max]\n }, min, max)\n \n }", "function getClippingBBox(bounds) {\n return [[bounds.xmin, bounds.ymin],\n [bounds.xmin, bounds.ymax],\n [bounds.xmax, bounds.ymax],\n [bounds.xmax, bounds.ymin]];\n }", "_calculateBounds()\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }", "function getBounds(bounds){\n\t var bbox = [];\n\t\n\t bbox.push(parseFloat(bounds.attrib[\"minlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"minlat\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlon\"]));\n\t bbox.push(parseFloat(bounds.attrib[\"maxlat\"]));\n\t\n\t return bbox;\n\t}", "function findBoundaries() {\n\tgoogle.maps.event.addListener(map, 'bounds_changed', function() {\n\t \tconst bounds = map.getBounds();\n\t \tconst NE = bounds.getNorthEast();\n\t\tconst SW = bounds.getSouthWest();\n\t\tconst coordinates = [`${SW}`, `${NE}`];\n\t\tconst fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => e.split(', ')).flat();\n\t\tconst parsed = fixed.map(e => parseFloat(e));\n\t\t[parsed[0], parsed[1]] = [parsed[1], parsed[0]];\n\t\t[parsed[2], parsed[3]] = [parsed[3], parsed[2]];\n\t\tconst formattedBounds = parsed.join();\n\t\tgetWheelMapNodes(formattedBounds);\n\t});\n}", "_calculateBounds() {\n var trim = this._texture.trim;\n var orig = this._texture.orig;\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height)) {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }", "get bounds() {\n // Optimization to reduct calculations.\n // The result should be exactly the same if this is removed.\n if (this._bounds !== undefined) {\n return this._bounds;\n }\n\n if (this.$el == null) {\n return this.preAttachedBounds;\n }\n else {\n return Bounds.fromAttrs(this.$el.attrs);\n }\n }", "function getBounds(feature) {\n var bounds = { min: [999, 999], max: [-999, -999] };\n\n _.each(feature, function(path) {\n _.each(path, function(point) {\n point = map.latLngToLayerPoint(new L.LatLng(point.x, point.y));\n\n bounds.min[0] = Math.min(bounds.min[0], point.x);\n bounds.min[1] = Math.min(bounds.min[1], point.y);\n bounds.max[0] = Math.max(bounds.max[0], point.x);\n bounds.max[1] = Math.max(bounds.max[1], point.y);\n });\n });\n\n return bounds;\n }", "get bounds() {\r\n\t\treturn {\r\n\t\t\tx: this.origin.x * (this.tileSize + this.spacing),\r\n\t\t\ty: this.origin.y * (this.tileSize + this.spacing),\r\n\t\t\tw: this.w * (this.tileSize + this.spacing) - this.spacing,\r\n\t\t\th: this.h * (this.tileSize + this.spacing) - this.spacing\r\n\t\t};\r\n\t}", "function getBounds (points) {\n\n var north = Infinity, south = 0, east = 0, west = Infinity;\n\n points.forEach(function(point){\n if (point.x < west) west = point.x;\n if (point.x > east) east = point.x;\n if (point.y < north) north = point.y;\n if (point.y > south) south = point.y;\n });\n\n return {north: north, south: south, east: east, west: west};\n}", "set bounds(value) {}", "getBoundingBox()\r\n\t{\r\n\t\tif ( this.vpos.length == 0 ) return null;\r\n\t\tvar min = [...this.vpos[0]];\r\n\t\tvar max = [...this.vpos[0]];\r\n\t\tfor ( var i=1; i<this.vpos.length; ++i ) \r\n\t\t{\r\n\t\t\tfor ( var j=0; j<3; ++j ) \r\n\t\t\t{\r\n\t\t\t\tif ( min[j] > this.vpos[i][j] ) min[j] = this.vpos[i][j];\r\n\t\t\t\tif ( max[j] < this.vpos[i][j] ) max[j] = this.vpos[i][j];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { min: min, max: max };\r\n\t}", "function getMapBounds(){\n\tvar bounds = myMap.getBounds();\n\tvar nWlat = bounds.getNorthWest().lat;\n\tvar nWlon = bounds.getNorthWest().lng;\n\tvar sElat = bounds.getSouthEast().lat;\n\tvar sElon = bounds.getSouthEast().lng;\n\tvar boundArray = [nWlat,nWlon, sElat, sElon];\n\treturn boundArray\n}", "function getLngBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LNG_MIN?GEO_BOUNDS.LNG_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LNG_MAX?GEO_BOUNDS.LNG_MAX:a[1]+PADDING;return[b,c]}", "function getLngBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LNG_MIN?GEO_BOUNDS.LNG_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LNG_MAX?GEO_BOUNDS.LNG_MAX:a[1]+PADDING;return[b,c]}", "function getBoundingBox () {\n let boundingBox = map.getBounds()\n xmin = parseFloat(boundingBox._sw.lng)\n ymin = parseFloat(boundingBox._sw.lat)\n xmax = parseFloat(boundingBox._ne.lng)\n ymax = parseFloat(boundingBox._ne.lat)\n\n //console.log(`${xmin}, ${ymin}, ${xmax}, ${ymax}`)\n}", "function getStartEnd(boundingPoly) {\n function helper(axis, func) {\n let result = boundingPoly.vertices[0][axis];\n for (let i = 1; i < 4; i++) {\n const current = boundingPoly.vertices[i][axis];\n result = func(result, current);\n }\n return result;\n }\n\n const minX = helper('x', Math.min);\n const minY = helper('y', Math.min);\n const maxX = helper('x', Math.max);\n const maxY = helper('y', Math.max);\n\n return [{ x: minX, y: minY }, { x: maxX, y: maxY }];\n}", "function et2_bounds(_top, _bottom)\n{\n\treturn {\n\t\t\"top\": _top,\n\t\t\"bottom\": _bottom\n\t};\n}", "clipSegment(start, end, log=false) {\n const size = this.settings.maxRadius\n const radStart = start.magnitude()\n const radEnd = end.magnitude()\n\n if (radStart < size && radEnd < size) {\n if (log) { console.log('line is inside limits') }\n return []\n }\n\n const intersections = this.getIntersections(start, end)\n if (!intersections.intersection) {\n if (log) { console.log('line is outside limits') }\n return [end]\n }\n\n if (intersections.points[0].on && intersections.points[1].on) {\n let point = intersections.points[0].point\n let otherPoint = intersections.points[1].point\n\n if (log) { console.log('line is outside limits, but intersects within limits') }\n return [\n ...this.tracePerimeter(point, otherPoint),\n otherPoint,\n end\n ]\n }\n\n if (radStart <= size) {\n const point1 = (intersections.points[0].on && Math.abs(intersections.points[0].point - start) > 0.0001) ? intersections.points[0].point : intersections.points[1].point\n if (log) { console.log('start is inside limits') }\n return [ point1, end ]\n } else {\n const point1 = intersections.points[0].on ? intersections.points[0].point : intersections.points[1].point\n if (log) { console.log('end is inside limits') }\n return [ start, point1 ]\n }\n }", "getBounds() {\n return new Rectangle(new Point(this.x, this.y), new Vector(0, 0));\n }", "_calculateBounds() {\n this.calculateVertices();\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }", "getBounds() {\n return this.state[CIRCLE].getBounds()\n }", "_getTrackStartAndEnd() {\n const that = this;\n let trackStart,\n offset = that.$.track.getBoundingClientRect();\n\n if (that.orientation === 'horizontal') {\n const scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;\n trackStart = offset.left + scrollLeft;\n }\n else {\n const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n trackStart = offset.top + scrollTop;\n }\n\n const trackEnd = trackStart + that._measurements.trackLength,\n pxRange = trackEnd - trackStart;\n\n that._trackStart = trackStart;\n that._trackEnd = trackEnd;\n that._valuePerPx = that._numericProcessor.getValuePerPx(that._range, pxRange);\n }", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "calculateBounds() {\n var minX = Infinity;\n var maxX = -Infinity;\n var minY = Infinity;\n var maxY = -Infinity;\n if (this.graphicsData.length) {\n var shape = null;\n var x = 0;\n var y = 0;\n var w = 0;\n var h = 0;\n for (var i = 0; i < this.graphicsData.length; i++) {\n var data = this.graphicsData[i];\n var type = data.type;\n var lineWidth = data.lineStyle ? data.lineStyle.width : 0;\n shape = data.shape;\n if (type === ShapeSettings_1.ShapeSettings.SHAPES.RECT || type === ShapeSettings_1.ShapeSettings.SHAPES.RREC) {\n x = shape.x - (lineWidth / 2);\n y = shape.y - (lineWidth / 2);\n w = shape.width + lineWidth;\n h = shape.height + lineWidth;\n minX = x < minX ? x : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y < minY ? y : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.CIRC) {\n x = shape.x;\n y = shape.y;\n w = shape.radius + (lineWidth / 2);\n h = shape.radius + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else if (type === ShapeSettings_1.ShapeSettings.SHAPES.ELIP) {\n x = shape.x;\n y = shape.y;\n w = shape.width + (lineWidth / 2);\n h = shape.height + (lineWidth / 2);\n minX = x - w < minX ? x - w : minX;\n maxX = x + w > maxX ? x + w : maxX;\n minY = y - h < minY ? y - h : minY;\n maxY = y + h > maxY ? y + h : maxY;\n }\n else {\n // POLY\n var points = shape.points;\n var x2 = 0;\n var y2 = 0;\n var dx = 0;\n var dy = 0;\n var rw = 0;\n var rh = 0;\n var cx = 0;\n var cy = 0;\n for (var j = 0; j + 2 < points.length; j += 2) {\n x = points[j];\n y = points[j + 1];\n x2 = points[j + 2];\n y2 = points[j + 3];\n dx = Math.abs(x2 - x);\n dy = Math.abs(y2 - y);\n h = lineWidth;\n w = Math.sqrt((dx * dx) + (dy * dy));\n if (w < 1e-9) {\n continue;\n }\n rw = ((h / w * dy) + dx) / 2;\n rh = ((h / w * dx) + dy) / 2;\n cx = (x2 + x) / 2;\n cy = (y2 + y) / 2;\n minX = cx - rw < minX ? cx - rw : minX;\n maxX = cx + rw > maxX ? cx + rw : maxX;\n minY = cy - rh < minY ? cy - rh : minY;\n maxY = cy + rh > maxY ? cy + rh : maxY;\n }\n }\n }\n }\n else {\n minX = 0;\n maxX = 0;\n minY = 0;\n maxY = 0;\n }\n var padding = this.boundsPadding;\n this._bounds.minX = minX - padding;\n this._bounds.maxX = maxX + padding;\n this._bounds.minY = minY - padding;\n this._bounds.maxY = maxY + padding;\n }", "_calculateBounds() {\n // FILL IN//\n }", "function compute_bound(bbox) {\n var offset = 0.01;\n var southWest = new L.LatLng(bbox[0][0] - offset, bbox[0][1] - offset);\n var northEast = new L.LatLng(bbox[2][0] + offset, bbox[2][1] + offset);\n return new L.LatLngBounds(southWest, northEast);\n}", "function getBoundariesFor(obj) {\r\n\t\treturn {\r\n\t\t\ttop: obj.center.y - (obj.size.height / 2.5),\r\n\t\t\tbottom: obj.center.y + (obj.size.height / 2.5),\r\n\t\t\tleft: obj.center.x - (obj.size.width / 2.5),\r\n\t\t\tright: obj.center.x + (obj.size.width / 2.5)\r\n\t\t};\r\n\t}", "function BoundingBoxRect() { }", "function boundPoints(points) {\n\t var bounds = new Array(points.length)\n\t for(var i=0; i<points.length; ++i) {\n\t var p = points[i]\n\t bounds[i] = [ p[0], p[1], p[0], p[1] ]\n\t }\n\t return bounds\n\t}", "function boundPoints(points) {\n\t var bounds = new Array(points.length)\n\t for(var i=0; i<points.length; ++i) {\n\t var p = points[i]\n\t bounds[i] = [ p[0], p[1], p[0], p[1] ]\n\t }\n\t return bounds\n\t}", "function getBoundsOfThing(thing){\n\tvar testTopLeft, testBottomRight;\n\t//Get the initial bounds of the object. If there's only one object in the array, this is all we'll need.\n\tvar topLeft = thing[0].resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\tvar bottomRight = thing[0].resolve(AnchorPoint.BOTTOM_RIGHT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\tif(thing.length > 1){\n\t\tfor(var counter = 1; counter < thing.length; counter++){\n\t\t\ttestTopLeft = thing[counter].resolve(AnchorPoint.TOP_LEFT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\t\t\ttestBottomRight = thing[counter].resolve(AnchorPoint.BOTTOM_RIGHT_ANCHOR, CoordinateSpaces.PASTEBOARD_COORDINATES)[0];\n\t\t\tif(testTopLeft[0] < topLeft[0]){\n\t\t\t\ttopLeft[0] = testTopLeft[0];\n\t\t\t}\n\t\t\tif(testTopLeft[1] < topLeft[1]){\n\t\t\t\ttopLeft[1] = testTopLeft[1];\n\t\t\t}\n\t\t\tif(testBottomRight[0] > bottomRight[0]){\n\t\t\t\tbottomRight[0] = testBottomRight[0];\n\t\t\t}\n\t\t\tif(testBottomRight[1] > bottomRight[1]){\n\t\t\t\tbottomRight[1] = testBottomRight[1];\n\t\t\t}\n\t\t}\n\t}\n\treturn new Array(topLeft, bottomRight);\n}", "function boundPoints(points) {\n var bounds = new Array(points.length)\n for(var i=0; i<points.length; ++i) {\n var p = points[i]\n bounds[i] = [ p[0], p[1], p[0], p[1] ]\n }\n return bounds\n}", "function getBounds(group) {\n var minX = pv.min(group, function(d) { return d.x || 0 }); // or 0 in case falsy value in data\n var maxX = pv.max(group, function(d) { return d.x || 0 });\n var minY = pv.min(group, function(d) { return d.y || 0 });\n var maxY = pv.max(group, function(d) { return d.y || 0 });\n return { minX:minX, minY:minY, maxX:maxX, maxY:maxY };\n}", "function getBounds(features) {\n var bounds = { min: [999, 999], max: [-999, -999] };\n\n _.each(features, function(element) {\n var point = map.latLngToLayerPoint(element.LatLng);\n\n bounds.min[0] = Math.min(bounds.min[0], point.x);\n bounds.min[1] = Math.min(bounds.min[1], point.y);\n bounds.max[0] = Math.max(bounds.max[0], point.x);\n bounds.max[1] = Math.max(bounds.max[1], point.y);\n });\n\n return bounds;\n }", "function boundPoints (points) {\n var bounds = new Array(points.length)\n for (var i = 0; i < points.length; ++i) {\n var p = points[i]\n bounds[i] = [\n nextafter(p[0], -Infinity),\n nextafter(p[1], -Infinity),\n nextafter(p[0], Infinity),\n nextafter(p[1], Infinity)\n ]\n }\n return bounds\n}", "getBounds() {\n const bounds = this.options.bounds\n ? L.latLngBounds(this.options.bounds)\n : this._clusters.getBounds()\n\n if (bounds.isValid()) {\n return toLngLatBounds(bounds)\n }\n }", "getBounds(bounds) {\n if (this.objects !== undefined) {\n for (let i = 0; i < this.objects.length; i++) {\n this.objects[i].getBounds(bounds);\n }\n }\n }", "function BoundingBox() {\n var bounds = map.getBounds().getSouthWest().lng + \",\" + map.getBounds().getSouthWest().lat + \",\" + map.getBounds().getNorthEast().lng + \",\" + map.getBounds().getNorthEast().lat;\n return bounds;\n}", "calculateBounds() {\n this.tagsSectionsMap = this.tags.map((tag) => {\n const rect = tag.getBoundingClientRect();\n const top = Math.floor(rect.top + window.scrollY);\n\n return {\n top,\n tag,\n };\n });\n }", "carregaBoundaries() {\n\n //Modifica o tamanho do estagio baseado no tamanho do elemento div do bird\n this.maxBoundsWidth = this.getEstagio().clientWidth - this.getBird().getTamanhoWidth();\n this.maxBoundsHeight = this.getEstagio().clientHeight - this.getBird().getTamanhoHeight();\n\n // console.log(\"Max width da arena: \" + this.maxBoundsWidth);\n // console.log(\"Max height da arena: \" + this.maxBoundsHeight);\n\n //Verifico se o passaro esta dentro as boundaries(caso o usuario de resize)\n this.estaForaDasBounds()\n }", "function getBounds(firstIndex, lastIndex)\n{\nvar maxlat = 0;\n\tvar\tmaxlng = 0;\n\tvar\tminlat = 10000;\n\tvar\tminlng = 10000;\n\tvar bounds;\n\t\n\tfor (var i = firstIndex; i < lastIndex; i++)\n\t{\n\t\tvar lat = pointarray[i].LatLng.lat();\n\t\tvar lng = pointarray[i].LatLng.lng();\n\t\tif (lat > maxlat)\n\t\t{\n\t\t\tmaxlat = lat;\n\t\t} \n\t\tif (lat < minlat)\n\t\t{\n\t\t\tminlat = lat;\n\t\t}\n\t\tif (lng > maxlng)\n\t\t{\n\t\t\tmaxlng = lng;\n\t\t}\n\t\tif (lng < minlng)\n\t\t{\n\t\t\tminlng = lng;\n\t\t}\n\t}\n\t\n\tbounds = new google.maps.LatLngBounds(new google.maps.LatLng(minlat, minlng), \n\t\t\t\t\t\t\t\t\t\t new google.maps.LatLng(maxlat, maxlng));\t\n\t\n\treturn bounds;}", "function getBoundingRectLocs (center, grid) {\n var jQueryDoc = $(window.document),\n jQH = jQueryDoc.height(),\n jQW = jQueryDoc.width(),\n R = jQH/jQW,\n size = (grid ||.002);\n\n center.latitude = Math.round(center.latitude/(2*size))*(2*size);\n center.longitude = Math.round(center.longitude/(2*size/R))*(2*size/R);\n\n return [\n center.latitude + size,\n center.longitude - size/R,\n center.latitude - size,\n center.longitude + size/R\n ];\n\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "getBounds(){\n let rect = new Rectangle()\n\t\trect.setRect(this.x, this.y, this.size, this.size)\n\t\treturn rect\n }", "function getVesselInCamArea() {\n var bounds = new google.maps.LatLngBounds(passat_sw, passat_ne);\n var vesselInBounds = 'undefined';\n\n $.each(markersArray, function (index, marker) {\n if (bounds.contains(marker.getPosition()) && marker.vessel.status == 'MOVING') {\n vesselInBounds = marker;\n // break for jquery each\n return false;\n }\n });\n\n if (vesselInBounds && vesselInBounds != 'undefined') {\n return vesselInBounds;\n } else {\n return null;\n }\n}", "function findPathsBounds(docRef, penPathRef) {\n var tlX, tlY, blX, blY, brX, brY, trX, trY;\n var i;\n var pathValid = true;\n var bounds = new Array();\n\n if (penPathRef.subPathItems.length != 1) {\n alert(\"findPathsBounds() Path [\" + penPathRef.name + \"] has multiple subpaths\");\n return(bounds);\n }\n for (i=0; i<penPathRef.subPathItems[0].pathPoints.length; i++) {\n if (penPathRef.subPathItems[0].pathPoints[i].kind != PointKind.CORNERPOINT) {\n pathValid = false; // not a rectangle\n break;\n }\n }\n if (pathValid && penPathRef.subPathItems[0].pathPoints.length == 4) {\n //-----------------------------\n // path has exactly four points\n //-----------------------------\n tlX = penPathRef.subPathItems[0].pathPoints[0].anchor[0];\n tlY = penPathRef.subPathItems[0].pathPoints[0].anchor[1];\n blX = penPathRef.subPathItems[0].pathPoints[1].anchor[0];\n blY = penPathRef.subPathItems[0].pathPoints[1].anchor[1];\n brX = penPathRef.subPathItems[0].pathPoints[2].anchor[0];\n brY = penPathRef.subPathItems[0].pathPoints[2].anchor[1];\n trX = penPathRef.subPathItems[0].pathPoints[3].anchor[0];\n trY = penPathRef.subPathItems[0].pathPoints[3].anchor[1];\n bounds[0] = Math.round(tlX); // X\n bounds[1] = Math.round(tlY); // Y\n bounds[2] = Math.round(brX - tlX); // W\n bounds[3] = Math.round(brY - tlY); // H\n bounds[4] = penPathRef.name; // name\n } else {\n alert(\"findPathsBounds() Path [\" + penPathRef.name + \"] is not a rectangle\");\n }\n return(bounds);\n}", "function getBounds(coordArr) {\n\t\t\tlet leftBound;\n\t\t\tlet rightBound;\n\t\t\tlet upperBound;\n\t\t\tlet lowerBound;\n\t\t\tcoordArr.forEach((pt, i) => {\n\t\t\t\tconst { x, y } = pt;\n\t\t\t\tif (i === 0) {\n\t\t\t\t\t// Sets default values\n\t\t\t\t\tleftBound = rightBound = x;\n\t\t\t\t\tupperBound = lowerBound = y;\n\t\t\t\t} else {\n\t\t\t\t\tleftBound = Math.min(leftBound, x);\n\t\t\t\t\trightBound = Math.max(rightBound, x);\n\t\t\t\t\tupperBound = Math.min(upperBound, y);\n\t\t\t\t\tlowerBound = Math.max(lowerBound, y);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tleftBound,\n\t\t\t\trightBound,\n\t\t\t\tupperBound,\n\t\t\t\tlowerBound\n\t\t\t};\n\t\t}", "function getMapBounds() {\r\n\t\t//return app.location.bounds;\r\n\t\treturn app.map.map.getBounds();\r\n\t}", "function getPixelRange() {\r\n\t\t$this = $['mapsettings'].element;\r\n\t\tvar xstart = 0;\r\n\t\tvar ystart = 0;\r\n\t\tif($['mapsettings'].initLeft<0) xstart = Math.abs($['mapsettings'].initLeft);\r\n\t\tif($['mapsettings'].initTop<0) ystart = Math.abs($['mapsettings'].initTop);\r\n\t\txstart = getFirstXPosInRange(xstart);\r\n\t\t// Makes sure that ystart values are multiples of 256 and start before viewport\r\n\t\tif(ystart%256!=0) ystart=((parseInt(ystart/256))-1)*256;\r\n\t\tvar xend = $this.innerWidth() - $['mapsettings'].initLeft;\r\n\t\tvar yend = $this.innerHeight() - $['mapsettings'].initTop;\r\n\t\treturn {\r\n\t\t\t\"start\": {\r\n\t\t\t\t\"x\": xstart,\r\n\t\t\t\t\"y\": ystart\r\n\t\t\t},\r\n\t\t\t\"end\": {\r\n\t\t\t\t\"x\": xend,\r\n\t\t\t\t\"y\": yend\r\n\t\t\t}\r\n\t\t};\r\n\t}", "setBounds() {\n let x = this.position.getX();\n let y = this.position.getY();\n let s = Game.Settings().UnitSize;\n let hs = s / 2;\n\n //generate Individual Bounds\n this.bounds = new Bounds(x - hs, y - hs, x + hs, y + hs);\n }", "function boundingsection(sections) {\n return sections.getBoundingClientRect().top;\n}", "getBounds() {\n throw \"Abstract method\" \n }", "function getBoundsSearchFunction(boxes) {\n var index, Flatbush;\n if (!boxes.length) {\n // Unlike rbush, flatbush doesn't allow size 0 indexes; workaround\n return function() {return [];};\n }\n Flatbush = require$1('flatbush');\n index = new Flatbush(boxes.length);\n boxes.forEach(function(ring) {\n var b = ring.bounds;\n index.add(b.xmin, b.ymin, b.xmax, b.ymax);\n });\n index.finish();\n\n function idxToObj(i) {\n return boxes[i];\n }\n\n // Receives xmin, ymin, xmax, ymax parameters\n // Returns subset of original @bounds array\n return function(a, b, c, d) {\n return index.search(a, b, c, d).map(idxToObj);\n };\n }", "get localBounds() {\n return {\n x: this.x, //I changed this, it was \"x: 0,\"\n y: this.y, //I changed this, it was \"y: 0,\"\n width: this.width,\n height: this.height\n } \n }", "get boundingBox() {\n }", "function boundEdges(points, edges) {\n\t var bounds = new Array(edges.length)\n\t for(var i=0; i<edges.length; ++i) {\n\t var e = edges[i]\n\t var a = points[e[0]]\n\t var b = points[e[1]]\n\t bounds[i] = [\n\t Math.min(a[0], b[0]),\n\t Math.min(a[1], b[1]),\n\t Math.max(a[0], b[0]),\n\t Math.max(a[1], b[1]) ]\n\t }\n\t return bounds\n\t}", "function boundEdges(points, edges) {\n\t var bounds = new Array(edges.length)\n\t for(var i=0; i<edges.length; ++i) {\n\t var e = edges[i]\n\t var a = points[e[0]]\n\t var b = points[e[1]]\n\t bounds[i] = [\n\t Math.min(a[0], b[0]),\n\t Math.min(a[1], b[1]),\n\t Math.max(a[0], b[0]),\n\t Math.max(a[1], b[1]) ]\n\t }\n\t return bounds\n\t}", "function normBounds( bounds ) {\n\n\t\tfor ( var i = ticks.length; i >= 0; i-- ) {\n\t\t\tif ( bounds[0] + unit / 2 >= ticks[i] ) {\n\t\t\t\tbounds[0] = ticks[i] - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor ( var i = 0; i <= ticks.length; i++ ) {\n\t\t\tif ( bounds[1] - unit / 2 <= ticks[i] ) {\n\t\t\t\tbounds[1] = ticks[i] + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn bounds;\n\t}", "function getExtendedBounds(bnds){\n // get the coordinates for the sake of readability\n var swlat = bnds._southWest.lat;\n var swlng = bnds._southWest.lng;\n var nelat = bnds._northEast.lat;\n var nelng = bnds._northEast.lng;\n\n // Increase size of bounding box in each direction by 50%\n swlat = swlat - Math.abs(0.5*(swlat - nelat)) > -90 ? swlat - Math.abs(0.5*(swlat - nelat)) : -90;\n swlng = swlng - Math.abs(0.5*(swlng - nelng)) > -180 ? swlng - Math.abs(0.5*(swlng - nelng)) : -180;\n nelat = nelat + Math.abs(0.5*(swlat - nelat)) < 90 ? nelat + Math.abs(0.5*(swlat - nelat)) : 90;\n nelng = nelng + Math.abs(0.5*(swlng - nelng)) < 180 ? nelng + Math.abs(0.5*(swlng - nelng)) : 180;\n\n return L.latLngBounds(L.latLng(swlat, swlng), L.latLng(nelat, nelng));\n }", "function getPointBounds(p, radius) {\n return [p[0] - radius, p[1] - radius, p[0] + radius, p[1] + radius];\n }", "function currentBounds(){var cntr=element?element.parent():null;var parent=cntr?cntr.parent():null;return parent?self.clientRect(parent):null;}", "function getBoundParams(){\n var bounds = map.getBounds(),\n padding = .00;\n console.log(bounds);\n return { neLat: (bounds._northEast.lat + padding).toFixed(6),\n neLon: (bounds._northEast.lng + padding).toFixed(6),\n swLat: (bounds._southWest.lat - padding).toFixed(6),\n swLon: (bounds._southWest.lng - padding).toFixed(6)\n }\n }", "defineMapBounds() {\n \n const coordinates = this.state.options.map(i => i.coordinates);\n\n let maxX = 0,\n minX = 0,\n maxY = 0,\n minY = 0;\n\n coordinates.forEach(coord => {\n if (coord[0] > maxY) {\n maxY = coord[0];\n }\n \n if (coord[0] < minY) {\n minY = coord[0];\n }\n\n if (coord[1] > maxX) {\n maxX = coord[1];\n }\n \n if (coord[1] < minX) {\n minX = coord[1];\n }\n })\n\n // Bounds are defined by two coordinates:\n // position1: the most W and N\n // position2: the most E and S\n this.setState({\n bounds: [[maxY, minX], [minY, maxX]],\n center: [(maxY - minY) / 2, (maxX - minX) / 2]\n })\n }", "function getBounds(x, y, z) {\n\t\ty = Math.pow(2, z) - y - 1; // Translate Y value\n\t\t\n\t\tvar resolution = (CIRCUMFERENCE / TILE_SIZE) / Math.pow(2, z); // meters per pixel\n\t\t\n\t\tvar swPoint = getMercatorCoord(x, y, resolution);\n\t\tvar nePoint = getMercatorCoord(x + 1, y + 1, resolution);\n\t\t\n\t\tvar bounds = {\n\t\t\t\tswX : swPoint.x,\n\t\t\t\tswY : swPoint.y,\n\t\t\t\tneX : nePoint.x,\n\t\t\t\tneY : nePoint.y\n\t\t};\n\t\t\n\t\treturn bounds;\n\t}", "function _getBounds ( collection, bounds ) {\n var clipGroupElems, i, j;\n\n if ( collection.typename != 'GroupItem' ) { // ����� ��������� ������� �����������\n return collection.geometricBounds;\n }\n if ( collection.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = collection.pathItems;\n\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n return bounds;\n }\n\n // ������ ��� ����������� ����� => ���� �� ��������� ������\n for ( j = 0; j < collection.pageItems.length; j++ ) {\n\n var el = collection.pageItems [ j ];\n\n if ( el.typename != 'GroupItem' ) { // ����� pageItem ����� ������\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n continue;\n }\n bounds = _compareBounds ( el, bounds );\n }\n\n if ( el.typename == 'GroupItem' && el.clipped ) { // ������ � ������ => ���� �����\n clipGroupElems = el.pathItems;\n for ( i = 0; i < clipGroupElems.length; i++ ) {\n if ( clipGroupElems[ i ].clipping ) {\n if ( bounds == '' ) {\n bounds = clipGroupElems[ i ].geometricBounds;\n continue;\n }\n bounds = _compareBounds ( clipGroupElems[ i ], bounds );\n }\n }\n continue;\n }\n\n if ( el.typename == 'GroupItem' && !el.groupItems && !el.clipped ) { // ������ ��� ����� � ��� �����\n if ( bounds == '' ) {\n bounds = el.geometricBounds;\n// bounds = getBoundsExtend ( el.pageItems, bounds );\n continue;\n }\n bounds = _compareBounds ( el.geometricBounds, bounds );\n continue;\n }\n\n if ( el.typename == 'GroupItem' && el.groupItems ) { // ������ ��� �����, �� � �������� => ��������\n for ( var l = 0; l < el.pageItems.length; l++ ) {\n /* if ( bounds == '' ) {\n bounds = getBoundsExtend ( el.pageItems[l], '' );\n }*/\n bounds = getBoundsExtend ( el.pageItems[ l ], bounds );\n }\n continue;\n }\n }\n return bounds;\n\n // �������� � ������� ����� ������� geometricBounds ��������\n function _compareBounds ( elem, boundsToCompare ) {\n var elemBounds = elem.geometricBounds;\n elemBounds[ 0 ] < boundsToCompare[ 0 ] ? boundsToCompare[ 0 ] = elemBounds[ 0 ] : '';\n elemBounds[ 1 ] > boundsToCompare[ 1 ] ? boundsToCompare[ 1 ] = elemBounds[ 1 ] : '';\n elemBounds[ 2 ] > boundsToCompare[ 2 ] ? boundsToCompare[ 2 ] = elemBounds[ 2 ] : '';\n elemBounds[ 3 ] < boundsToCompare[ 3 ] ? boundsToCompare[ 3 ] = elemBounds[ 3 ] : '';\n return boundsToCompare;\n }\n }", "getLoopBounds(index) {\n this.maxX = MIN_FLOAT;\n this.maxY = MIN_FLOAT;\n this.minX = MAX_FLOAT;\n this.minY = MAX_FLOAT;\n //get extreems and load into PVector Array\n for (let i = 0; i < this.loop.body.size(); i++) {\n if (this.maxX < this.loop.body[i].loc.x + 4) this.maxX = loop.body[i].loc.x;\n if (this.maxY < this.loop.body[i].loc.y) this.maxY = loop.body[i].loc.y;\n if (this.minX > this.loop.body[i].loc.x - 4) this.minX = loop.body[i].loc.x;\n if (this.minY > this.loop.body[i].loc.y) this.minY = loop.body[i].loc.y;\n }\n this.loopBounds[0].x = this.maxX;\n this.loopBounds[0].y = this.maxY;\n this.loopBounds[1].x = this.minX;\n this.loopBounds[1].y = this.minY;\n }", "function Bounds()\n{\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n}", "function getLatBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LAT_MIN?GEO_BOUNDS.LAT_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LAT_MAX?GEO_BOUNDS.LAT_MAX:a[1]+PADDING;return[b,c]}", "function getLatBoundsForSingleCoordinate(a){var b=a[0]-PADDING<GEO_BOUNDS.LAT_MIN?GEO_BOUNDS.LAT_MIN:a[0]-PADDING,c=a[1]+PADDING>GEO_BOUNDS.LAT_MAX?GEO_BOUNDS.LAT_MAX:a[1]+PADDING;return[b,c]}", "function getMinMax() {\n var minPt = pts[0];\n var maxPt = pts[0];\n for (var i=1; i<pts.length; i++) {\n minPt = minPt.$min( pts[i] );\n }\n for (i=1; i<pts.length; i++) {\n maxPt = maxPt.$max( pts[i] );\n }\n nextRect.set( minPt).to( maxPt );\n}", "estaForaDasBounds() {\n if (this.getBird().getPosHeigth() > this.getMaxHeightArena()) {\n // console.log(\"height do passaro fora dos bounds (abaixo)\");\n this.getBird().setPosHeight(this.getMaxHeightArena());\n } else if (this.getBird().getPosWidth() > this.getMaxWidthArena()) {\n // console.log(\"width do passaro fora dos bounds (direita)\");\n this.getBird().setPosWidth(this.getMaxWidthArena());\n }\n }", "function GetClipSegments(clip_intervals, block_size, hop_size, x_length) {\n var clip_segments = [];\n var num_clip_segments = 0;\n\n var in_segment = false;\n var start_idx = 0;\n var stop_idx = start_idx + block_size - 1;\n var block_idx = 0;\n\n var segment_start_idx = -1;\n var segment_stop_idx = -1;\n while(stop_idx < x_length) {\n // We are in a segment.\n if(in_segment) {\n // We leave the segment. Store it and move on.\n if(!AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n }\n // We are not in a segment.\n else {\n // We have entered a segment.\n if(AreOverlapping(clip_intervals, start_idx, stop_idx)) {\n in_segment = true;\n segment_start_idx = block_idx;\n }\n }\n\n block_idx++;\n start_idx = start_idx + hop_size;\n stop_idx = start_idx + block_size - 1;\n }\n\n // If we end while in a segment, we need to leave the segment and push the segment.\n if(in_segment) {\n in_segment = false;\n segment_stop_idx = block_idx - 1;\n\n var new_segment = { start:segment_start_idx , stop:segment_stop_idx };\n clip_segments[num_clip_segments] = new_segment;\n num_clip_segments++;\n\n segment_start_idx = -1;\n segment_stop_idx = -1;\n }\n\n return clip_segments;\n }", "get nearClipPlane() {}", "bbox() {\n var maxX = -Infinity;\n var maxY = -Infinity;\n var minX = Infinity;\n var minY = Infinity;\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX);\n maxY = Math.max(el[1], maxY);\n minX = Math.min(el[0], minX);\n minY = Math.min(el[1], minY);\n });\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }", "function cloudBounds(bounds, d) {\n var b0 = bounds[0],\n b1 = bounds[1];\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\n }", "function myGetBounds(myPage, myDocument)\n{\n var array = new Array()\n var item = 0;\n with (myDocument.documentPreferences)\n {\n var myPageHeight = pageHeight;\n var myPageWidth = pageWidth;\n }\n\n with(myPage.marginPreferences)\n {\n var myX1 = left;\n var myY1 = top;\n var myY2 = bottom;\n var myX2 = right;\n }\n\n array[item++] = myY1;\n array[item++] = myX1;\n array[item++] = myPageHeight - myY2;\n array[item++] = myPageWidth - myX2;\n\n return array;\n}", "function S(){var e=le.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][n.ort];return 0===n.ort?e.width||le[t]:e.height||le[t]}", "function boundEdges(points, edges) {\n var bounds = new Array(edges.length)\n for(var i=0; i<edges.length; ++i) {\n var e = edges[i]\n var a = points[e[0]]\n var b = points[e[1]]\n bounds[i] = [\n Math.min(a[0], b[0]),\n Math.min(a[1], b[1]),\n Math.max(a[0], b[0]),\n Math.max(a[1], b[1]) ]\n }\n return bounds\n}", "function getPlaneBoundaryIntercepts() {\n // boundary case, handle separately\n if (!isFinite(m)) {\n return {\n xBoundary1: pt1.canvasPosX,\n yBoundary1: 0,\n xBoundary2: pt1.canvasPosX,\n yBoundary2: plane.height\n };\n }\n // Using y=mx+b to find bounds. Negatives account for opposite y direction\n let bound1y = (-1 * m * (plane.width / 2)) - (b * gridSpacing);\n let bound2y = (m * (plane.width / 2)) - (b * gridSpacing);\n return {\n // we found boundary ints above with x = 0 and width (notice I accounted\n // for the origin offset in that calculation)\n xBoundary1: 0,\n // height / 2 is accounting for the origin being offset\n yBoundary1: bound2y + (plane.height/2),\n xBoundary2: plane.width,\n yBoundary2: bound1y + (plane.height/2)\n };\n}", "function getBounds() {\n let body = d3.select('body');\n let bounds = body.node().getBoundingClientRect();\n\n let bound = {height: bounds.height, width: bounds.width, margin:\n {top: 50, right: 30, bottom: 30, left: 100}};\n\n bound.height -= 100; // because of header\n bound.width -= (bound.margin.left + bound.margin.right);\n bound.height -= (bound.margin.top + bound.margin.bottom);\n\n return bound;\n}", "function R(){var e=s.getBoundingClientRect(),n=\"offset\"+[\"Width\",\"Height\"][t.ort];return 0===t.ort?e.width||s[n]:e.height||s[n]}", "_calculateBounds() {\n this.finishPoly();\n var lb = this.geometry.bounds;\n this._bounds.addFrame(this.transform, lb.minX, lb.minY, lb.maxX, lb.maxY);\n }", "function bounds(objects) {\n var x0 = Infinity,\n y0 = Infinity,\n x1 = -Infinity,\n y1 = -Infinity;\n\n function boundGeometry(geometry) {\n if (geometry != null && hasOwnProperty.call(boundGeometryType, geometry.type)) boundGeometryType[geometry.type](geometry);\n }\n\n var boundGeometryType = {\n GeometryCollection: function(o) { o.geometries.forEach(boundGeometry); },\n Point: function(o) { boundPoint(o.coordinates); },\n MultiPoint: function(o) { o.coordinates.forEach(boundPoint); },\n LineString: function(o) { boundLine(o.arcs); },\n MultiLineString: function(o) { o.arcs.forEach(boundLine); },\n Polygon: function(o) { o.arcs.forEach(boundLine); },\n MultiPolygon: function(o) { o.arcs.forEach(boundMultiLine); }\n };\n\n function boundPoint(coordinates) {\n var x = coordinates[0],\n y = coordinates[1];\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n\n function boundLine(coordinates) {\n coordinates.forEach(boundPoint);\n }\n\n function boundMultiLine(coordinates) {\n coordinates.forEach(boundLine);\n }\n\n for (var key in objects) {\n boundGeometry(objects[key]);\n }\n\n return x1 >= x0 && y1 >= y0 ? [x0, y0, x1, y1] : undefined;\n}", "function boundEdges (points, edges) {\n var bounds = new Array(edges.length)\n for (var i = 0; i < edges.length; ++i) {\n var e = edges[i]\n var a = points[e[0]]\n var b = points[e[1]]\n bounds[i] = [\n nextafter(Math.min(a[0], b[0]), -Infinity),\n nextafter(Math.min(a[1], b[1]), -Infinity),\n nextafter(Math.max(a[0], b[0]), Infinity),\n nextafter(Math.max(a[1], b[1]), Infinity)\n ]\n }\n return bounds\n}", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }", "function currentBounds() {\n var cntr = element ? element.parent() : null;\n var parent = cntr ? cntr.parent() : null;\n\n return parent ? self.clientRect(parent) : null;\n }" ]
[ "0.778627", "0.7188192", "0.71379304", "0.6851803", "0.6806722", "0.6705719", "0.6702594", "0.6664514", "0.6460486", "0.6445773", "0.6420555", "0.6400514", "0.633647", "0.62954897", "0.6283144", "0.6263674", "0.6257252", "0.6253886", "0.6192765", "0.612273", "0.61054575", "0.6099891", "0.60899264", "0.6059254", "0.6049913", "0.6035119", "0.6035119", "0.601253", "0.60001653", "0.5989804", "0.5985693", "0.59706306", "0.596747", "0.5960314", "0.59602845", "0.5952437", "0.594135", "0.5899587", "0.5894157", "0.5881563", "0.5878201", "0.58779633", "0.58779633", "0.58725953", "0.5871477", "0.5855185", "0.5833919", "0.5830286", "0.5822363", "0.58206356", "0.58172804", "0.58038133", "0.5789387", "0.57873607", "0.57805556", "0.5775304", "0.5775304", "0.5772042", "0.5771879", "0.5754304", "0.575115", "0.5721806", "0.5714795", "0.5707437", "0.5701445", "0.5699866", "0.5698713", "0.5698581", "0.56797457", "0.56797457", "0.5679459", "0.5676013", "0.5656751", "0.5648779", "0.56481594", "0.5641745", "0.56344503", "0.562493", "0.56211567", "0.5613615", "0.56124485", "0.56124485", "0.5611042", "0.5603335", "0.55994946", "0.55906224", "0.55669296", "0.55650705", "0.5563167", "0.55615914", "0.5560687", "0.5549191", "0.55447733", "0.55438334", "0.55276513", "0.5526257", "0.5518647", "0.5513595", "0.5513595", "0.5513595" ]
0.57349813
61
return true if (i,i+1) crosses (k,k+1)
function isCrossing(i, k){ if ( i == k || i == k + 1 || i == k - 1){ return false; } var path1 = [pointarray[i].LatLng, pointarray[i + 1].LatLng, pointarray[k].LatLng]; var path2 = [pointarray[i].LatLng, pointarray[i + 1].LatLng, pointarray[k + 1].LatLng]; var path3 = [pointarray[k].LatLng, pointarray[k + 1].LatLng, pointarray[i].LatLng]; var path4 = [pointarray[k].LatLng, pointarray[k + 1].LatLng, pointarray[i + 1].LatLng]; var area1 = google.maps.geometry.spherical.computeSignedArea(path1); var area2 = google.maps.geometry.spherical.computeSignedArea(path2); var area3 = google.maps.geometry.spherical.computeSignedArea(path3); var area4 = google.maps.geometry.spherical.computeSignedArea(path4); var s1 = area1 * area2; var s2 = area3 * area4; if ((s1 < 0) && (s2 < 0)) { // exclude some pathological cases // otherwise rounding errors in computeSignedArea can lead // two wrong results if (s1 < -1 && s2 < -1){ return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function containsCloseNums(nums, k) {\n for (let i = 0; i < nums.length; i++) {\n for (let j = 0; j < nums.length; j++) {\n if (i !== j && nums[i] === nums[j]) {\n return Math.abs(i - j) <= k\n }\n }\n }\n return false\n}", "function containDuplication(arr,k){\n if(arr.length===0)\n return false;\n let index1=0;\n let index2=0\n for(let i=0;i<arr.length;i++){\n for(let j=i+1;j<arr.length;j++){\n if(arr[i]===arr[j]){\n index1=i;\n index2=j\n } \n }\n if(index2-index1<=k) return true;\n }\n return false;\n}", "function pairs(k, arr) {\n let count = 0\n for (let i=0; i< arr.length-1; i++) {\n for (let j=i+1; j<arr.length; j++) {\n if ((arr[i] - arr[j]) == k || (arr[j] - arr[i]) == k) {\n count++\n }\n }\n }\n return count\n}", "function place(res, k) {\n\tvar abs = Math.abs;\n\tfor (var i = 0; i < k; i++) {\n\t\tif (res[i] == res[k] || abs(res[i] - res[k]) == abs(i - k))\n\t\t\treturn false;\n\t}\n\treturn true;\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 pairsTooLong(k, arr) {\n // declare count to track number of pairs\n let count = 0\n // loop to get through values, omitting last value (no comparison)\n for (let i = 0; i < arr.length - 1; i ++) {\n // loop to compare, j determined by value of i\n for (let j = i + 1; j < arr.length; j ++) {\n let diff = Math.abs(arr[i] - arr[j])\n\n if (diff == k) {\n count = count + 1\n }\n }\n }\n // return count\n // (or)\n console.log('Final count: ', count)\n}", "threesum1(arr) {\n\n var l = arr.length;\n for (var i = 0; i < l - 2; i++) {\n for (var j = i + 1; j < l - 1; j++) {\n for (var k = j + 1; k < l; k++) {\n if (arr[i] + arr[j] + arr[k] == 0) {\n console.log(arr[i] + \",\" + arr[j] + \",\" + arr[k] + \" is a triplet\")\n }\n\n\n }\n }\n }\n }", "function isValid(board, row, col, k) {\n for (let i = 0; i < 9; i++) {\n const m = 3 * Math.floor(row / 3) + Math.floor(i / 3);\n const n = 3 * Math.floor(col / 3) + (i % 3);\n if (board[row][i] == k || board[i][col] == k || board[m][n] == k) {\n return false;\n }\n }\n return true;\n}", "function twin(array){\n for(var i = 0; i < array.length; i+=2){\n if(array[i]!== array[i+1]){\n return false;}\n }return true;\n}", "function containsNearbyDuplicate(nums, k) {\n const numsMap = new Map();\n for (let i = 0; i < nums.length; i += 1) {\n const num = nums[i];\n if (numsMap.has(num) && i - numsMap.get(num) <= k) {\n return true;\n } else {\n numsMap.set(num, i);\n }\n }\n return false;\n }", "function countPairs(numbers, k) {\n var pairCount = 0;\n\n for(var i = 0; i< numbers.lenght; i++ ) {\n for(var j = i +1; j < numbers.lenght; j++ ) {\n // console.log( \"i\",numbers[i], \"j\",numbers[j])\n if(numbers[i] + k == numbers[j]) {\n pairCount++\n }\n }\n }\n return pairCount;\n}", "function validation(arr, y, x) {\n for (let k = 0; k < arr[y].length; k++) {\n if (arr[y][x] === arr[y][k] && x!==k) {\n return false;\n }\n }\n for (let m = 0; m < arr[x].length; m++) {\n if (arr[y][x] === arr[m][x] && y!==m) {\n return false;\n }\n }\n if (x < 3 && y < 3) {\n for (k = 0; k < 3; k++) {\n next:\n for (m = 0; m < 3; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n } \n if (x >= 3 && x < 6 && y < 3) {\n for (k = 0 ; k < 3; k++) {\n next:\n for (m = 3; m < 6; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n } \n if (x >= 6 && y < 3) {\n for (k = 0 ; k < 3; k++) {\n next:\n for (m = 6; m < 9; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n } \n }\n }\n if (x < 3 && y >= 3 && y < 6) {\n for (k = 3; k < 6; k++) {\n next:\n for (m = 0; m < 3; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n } \n if (x >= 3 && x < 6 && y >= 3 && y < 6) {\n for (k = 3; k < 6; k++) {\n next:\n for (m = 3; m < 6; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n }\n if (x >= 6 && y >= 3 && y < 6) {\n for (k = 3; k < 6; k++) {\n next:\n for (m = 6; m < 9; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n } \n if (x < 3 && y >= 6) {\n for (k = 6; k < 9; k++) {\n next:\n for (m = 0; m < 3; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n } \n if (x >=3 && x < 6 && y >= 6) {\n for (k = 6; k < 9; k++) {\n next:\n for (m = 3; m < 6; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n }\n if (x >= 6 && y >= 6) {\n for (k = 6; k < 9; k++) {\n next:\n for (m = 6; m < 9; m++) {\n if (y === k && x === m) {\n continue next;\n }\n if(arr[y][x] === arr[k][m]) {\n return false;\n }\n }\n } \n }\n return arr;\n }", "function testK(k) {\n let commonDivisor = (num) => {\n return mul.some((item) => (num % item[0] === 0));\n };\n return Array.prototype.every.call(s, (item, index) => (commonDivisor(k + index) === (item === '0')));\n }", "function appleBoxes(k) {\n var red = 0, yel = 0;\nfor (var i = 1; i <= k; i ++){\nif(i % 2 == 0){\n red += i * i;\n} else {\n yel += i * i;\n}\n}\n return red-yel;\n}", "function checkHori(curArray, posArray) {\n for (var iter = 0; iter < curArray.length; iter++) {\n for (var i = 0; i < posArray.length; i++) {\n if (posArray[i][0] === curArray[iter][0] &&\n (posArray[i][1] === curArray[iter][1] + 1 ||\n posArray[i][1] === curArray[iter][1] - 1 ||\n posArray[i][1] === curArray[iter][1])) {\n\n return true;\n }\n }\n }\n\n return false;\n\n}", "function checkVert(curArray, posArray) {\n for (var iter = 0; iter < curArray.length; iter++) {\n for (var i = 0; i < posArray.length; i++) {\n if (posArray[i][1] === curArray[iter][1] &&\n (posArray[i][0] === curArray[iter][0] + 1 ||\n posArray[i][0] === curArray[iter][0] - 1 ||\n posArray[i][0] === curArray[iter][0])) {\n\n return true;\n }\n }\n }\n\n return false;\n\n}", "function balancePoint(arr){\n for(let i = 0; i < arr.length; i++){\n let sumLeft=0, sumRight=0;\n for(let j = 0; j < i; j++){\n sumLeft += arr[j];\n } \n for(let j=arr.length - 1; j >= i; j--){\n sumRight += arr[j];\n }\n if(sumLeft === sumRight) return true;\n }\n return false;\n}", "function isContaineWinCombination(arr, val) {\n let counter = 0;\n let firstCell;\n let lastCell;\n for (let i = 0; i < arr.length; i++) {\n if ( counter === 0) {\n firstCell = arr[i]\n }\n\n if (arr[i].val === val) {\n counter++;\n if (counter === count) {\n lastCell = arr[i];\n printLine(\n countCoordinate(firstCell.j),\n countCoordinate(firstCell.i),\n countCoordinate(lastCell.j),\n countCoordinate(lastCell.i));\n return true\n }\n } else {\n counter = 0;\n }\n }\n return false ;\n}", "function tentukanDeretAritmatika(arr) {\n // you can only write your code here!\n let x = arr.slice(-1).pop() - arr.slice(-2, -1).pop();\n let y = true;\n\n for (let i = arr.length-1; i > 0; i--) {\n if (x !== (arr[i] - arr[i-1])) {\n y = false;\n }\n }\n return y;\n}", "function crossAbove(serie1,serie2,n){\n\t\tvar res = [];\n\t\tvar succ;\n\t\t\n\t\tif (serie1.length<serie2.length)\n\t\t\tserie2 = trimmer(serie2,serie1.length);\n\t\t\n\t\tif (serie2.length<serie1.length)\n\t\t\tserie1 = trimmer(serie1,serie2.length);\n\t\t\t\t\n\t\tfor (var i=n-1;i<serie1.length;i++){\n\t\t\tsucc = true;\n\t\t\tfor (var j=1;j<n;j++){\n\t\t\t\tif (serie1[i-j] < serie2[i-j])\n\t\t\t\t\tcontinue;\n\t\t\t\telse{\t\t\n\t\t\t\t\tsucc = false;\n\t\t\t\t\tbreak;\t\n\t\t\t\t}\n\t\t\t}\t\n\t\t\t\n\t\t\tres.push (succ && (serie1[i] > serie2[i]));\t\t\t\n\t\t}\n\n\t\treturn res;\n\t}", "function inTriangle(arr){\n var c1 = crossProduct(arr[0], findPoint, arr[1]);\n var c2 = crossProduct(arr[1], findPoint, arr[2]);\n var c3 = crossProduct(arr[2], findPoint, arr[0]);\n if(c1*c2 >= 0 && c2*c3 >= 0 && c3*c1 >= 0){\n return true;\n }else{\n return false;\n }\n}", "function checkDiag(curArray, posArray) {\n for (var iter = 0; iter < curArray.length; iter++) {\n for (var i = 0; i < posArray.length; i++) {\n if (\n ((posArray[i][0] === curArray[iter][0] + 1) &&\n (posArray[i][1] === curArray[iter][1] - 1)) ||\n ((posArray[i][0] === curArray[iter][0] - 1) &&\n (posArray[i][1] === curArray[iter][1] + 1)) ||\n ((posArray[i][0] === curArray[iter][0] - 1) &&\n (posArray[i][1] === curArray[iter][1] - 1)) ||\n ((posArray[i][0] === curArray[iter][0] + 1) &&\n (posArray[i][1] === curArray[iter][1] + 1))\n ) {\n\n return true;\n }\n }\n }\n\n return false;\n\n}", "function interleave(k) {\n\tif (k < 0) {\n\t\treturn -2*k;\n\t} else {\n\t\treturn 2*k + 1;\n\t}\n}", "function check(len_i, time_i, len_j, time_j) {\n if (Math.abs(len_i - len_j) >= Math.abs(time_i - time_j)) {\n return true;\n }\n return false;\n}", "function countPairs(numbers, k) {\n let count = 0;\n const set = new Set(numbers);\n let arr = [...set];\n arr.sort((a, b) => a-b);\n\n let left = 0;\n let right = 1;\n\n while (right < numbers.length) {\n const sum = arr[left] + k;\n if (sum < arr[right]) {\n if (right - left === 1) {\n right++\n }\n left++\n } else if (sum > arr[right]) {\n right++\n } else {\n count++;\n left++;\n right++;\n }\n }\n return count;\n}", "function solution(A) {\n let result = false\n // write your code in JavaScript (Node.js 8.9.4)\n let i = 0;\n let j = (A.length - 1);\n let couter = 0;\n for (i = (j - 1); i > 0; i-- , j--) {\n if (A[i] < A[j]) {\n couter++;\n }\n }\n\n result = (couter >= 2) ? false : true\n return result;\n}", "isUnbreakable(x, y) {\n if (x == 0 || x == this.rows - 1 || y == 0 || y == this.columns - 1) // all the cells around\n return true;\n else\n if (y % 2 == 0 && x % 2 == 0) // one cell / 2\n return true;\n return false;\n }", "isOver(board) {\n const length = board.length\n\n for (let i = 0; i < length; i++) {\n for (let j = 0; j < length; j++) {\n if (board[i][j] === 0) {\n return false\n }\n else if (i !== length - 1 && board[i][j] === board[i + 1][j]) {\n return false\n }\n else if (j !== length - 1 && board[i][j] === board[i][j + 1]) {\n return false\n }\n }\n }\n return true\n }", "function balancePoint(arr){\n let sum = 0;\n for(let i = 0; i<arr.length; i++){\n sum += arr[i];\n }\n let checkSum = 0;\n for(let i=0; i<arr.length; i++){\n checkSum += arr[i];\n if(checkSum == sum/2){\n return true;\n }\n }\n return false;\n}", "function twins(myArray){\n var copy= myArray.slice();\n copy.sort();\n for(let i=1;i<=copy.length;i++){\n if(i%2==1){\n if(copy[i]!=copy[i-1]){return false};\n if(copy[i]==copy[i+1]){return false};\n }\n }\n return true;\n}", "function crossedFinalValue() {\n\n var pathLength = context.maxValue - context.minValue;\n\n if ( context.finalValue !== null) {\n if (adjustedStepSize >= pathLength) {\n //We've wrapped more than once. We've definitely hit any final value\n return true; \n } else if ( curFrameState.firstTime ) {\n //It's our first time through and we haven't wrapped all the way around\n //Never stop\n return false;\n }\n \n if (didWrap) {\n //If we've wrapped and the new and old values are both on the same side\n //of the final value, that means we've crossed the final value as part\n //of our wrap.\n if (((newValue >= context.finalValue) && (oldValue >= context.finalValue)) ||\n ((newValue <= context.finalValue) && (oldValue <= context.finalValue )))\n {\n return true;\n }\n } else {\n\n //If we haven't wrapped and the new and old values are opposite sides\n //of the final value, that means we have crossed the final value in\n //this step\n if (((newValue >= context.finalValue) && (context.finalValue >= oldValue)) ||\n ((oldValue >= context.finalValue) && (context.finalValue >= newValue)))\n {\n return true;\n }\n }\n }\n\n return false;\n }", "function checkVertical() {\n for (let rowIndex = 0; rowIndex < config.edgeY; rowIndex++) {\n for (let columnIndex = 0; columnIndex < gameBoard[0].length; columnIndex++) {\n cell = gameBoard[rowIndex][columnIndex];\n if (cell !== 0) {\n if (cell === gameBoard[rowIndex + 1][columnIndex] && cell === gameBoard[rowIndex + 2][columnIndex] && cell === gameBoard[rowIndex + 3][columnIndex]) {\n return true\n }\n }\n }\n }\n}", "isCoveredBy(ranges: Interval[]): boolean {\n var remaining = this.clone();\n for (var i = 0; i < ranges.length; i++) {\n var r = ranges[i];\n if (i && r.start < ranges[i - 1].start) {\n throw 'isCoveredBy must be called with sorted ranges';\n }\n if (r.start > remaining.start) {\n return false; // A position has been missed and there's no going back.\n }\n remaining.start = r.stop + 1;\n if (remaining.length() <= 0) {\n return true;\n }\n }\n return false;\n }", "function inProducer(x, y) {\r\n return (x >= 3 && x <= 4 && y >= 3 && y <= 4);\r\n}", "function hasPairWithSum(array, sum) {\n var length = array.length;\n for (var i = 0; i < length - 1; i++) { // start-index : 0 , end-index : 10 - 1 (9)\n for (var j = i + 1; j < length; j++) { // start-index : 1 , end-index : 10\n if (array[i] + array[j] === sum) {\n console.log(true);\n return true;\n }\n }\n }\n return false;\n}", "function balancePoint(arr){\n for (var i = 1; i < arr.length; i++){\n var left = 0;\n var right = 0;\n for (var leftidx = 0; leftidx < i; leftidx++){\n left += arr[leftidx];\n }\n for (var rightidx = i; rightidx < arr.length; rightidx++){\n right += arr[rightidx];\n }\n if (left == right){\n return true;\n }\n }\n return false;\n}", "function kMove(color, start, end) {\n var dif1 = start[0] - end[0];\n var dif2 = start[1] - end[1];\n \n if (Math.abs(dif1) >= 2 || Math.abs(dif2) >= 2) {\n return false;\n } else if (isSquareOccupied(end[0], end[1])) {\n return take(color, end[0], end[1]);\n }\n return true;\n}", "collided(p) {\n if (p.x + p.size / 2 >= this.x && p.x - p.size / 2 <= this.x + this.width) {\n if (!this.isTop && p.y + p.size / 2 >= this.topY) {\n return true;\n } \n if (this.isTop && p.y - p.size / 2 <= this.bottomY) {\n return true;\n } \n }\n return false;\n }", "function getMaxLessThanK(n,k){\n if(n >= 2 && k >= 2) {\n let newArr = Array();\n let numArr = Array.from(Array(n), (x, index) => index + 1);\n\n for(let i = 0; i < numArr.length; i++){\n for(let j = 1; j < numArr.length - 1; j++){\n //newArr.push();\n if(((numArr[i] & numArr[j]) !== 0) && (numArr[i] & numArr[j]) < k){\n newArr.push((numArr[i] & numArr[j]));\n }\n }\n }\n }\n\n return Math.max(...newArr);\n}", "function evenlySpaced(a,b,c){\n var arr = [a, b, c];\n var max = Math.max(a, b, c);\n var min = Math.min(a, b, c);\n if(arr.includes((min + max)/2)){\n return true;\n }else{\n return false;\n }\n}", "isPercolated () {\n var topPercolateIndex = this.size\n var bottomPercolateIndex = this.size + 1\n\n var topPercolateArranges = this.grid.slice(0, 1)[0]\n .map((value, x) =>\n value && [topPercolateIndex, this.width * x]\n ).filter(v => v)\n\n var bottomPercolateArranges = this.grid.slice(-1)[0]\n .map((value, x) =>\n value && [bottomPercolateIndex, (this.grid.length-1) * this.width + x]\n ).filter(v => v)\n\n // console.log('topPercolateArranges', topPercolateArranges);\n // console.log('bottomPercolateArranges', bottomPercolateArranges);\n\n // padds arranges like this: double means has arrange (e.g. \\\\)\n //\n // top_percolate (pad)\n // // | \\\\\n // X - X\n // X X X\n // - X X\n // \\ || //\n // bottom_percolate (pad)\n\n var paddedArranges = [\n ...topPercolateArranges,\n ...this.arranges,\n ...bottomPercolateArranges,\n ]\n\n // find if topPercolate is connected to bottomPercolate, which are appeneded at the end, hence we pass {n} as `this.size + 2`\n return (new UnionFind.QuickFind(\n this.size + 2,\n paddedArranges\n )).find(topPercolateIndex, bottomPercolateIndex)\n }", "function overlapsCheck(table){\r\n if(table.length==1){\r\n return false;\r\n\r\n }else{\r\n for(var k=1; k<table.length;i=k++){\r\n var start=table[k][1];\r\n var end=table[k][2];\r\n for(var j=k-1;j>=0; j--){\r\n if((table[j][1]<=start&&start<=table[j][2]) || (table[j][1]<=end&&end<=table[j][2])){\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n}", "function evenlySpaced(a, b, c) {\n return (a - b == c - a) || (b - a == c - b) || (c - b == a - c);\n}", "function isTriangle(a, b, c) {\n if (a + b > c && a + c > b && b + c > a) {\n return true\n } else {\n return false\n }\n}", "function isGameOver(){\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\treturn false;//If any block has zero return false\r\n\t\t\t}\r\n\t\t\t//If any consecutive blocks are same return false\r\n\t\t\tif(i!== (size-1) && grid[i][j] == grid[i+1][j]){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t//If any consecutive blocks are same return false\r\n\t\t\tif(j!== (size-1) && grid[i][j] == grid[i][j+1]){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn true;\r\n}", "IsOnBoard (ii, jj)\r\n { if (ii<0) return(false);\r\n if (ii>7) return(false);\r\n if (jj<0) return(false);\r\n if (jj>7) return(false);\r\n return(true);\r\n }", "function checkResult(list, k) {\r\n // First, we are linking through each number in the list to select one.\r\n for (let i = 0, len = list.length; i < len; i++) {\r\n // Now that we are ready to select one, comparing it with every other number in the list.\r\n for (let j = 0; j < len; j++) {\r\n // If this number + any other number in the list == k, then result is true.\r\n if (list[i]+list[j] == k) return true\r\n }\r\n };\r\n\r\n // We've made it this far, which means none of the two numbers == k.\r\n return false\r\n}", "function triangleNumber1(nums) {\n const len = nums.length\n let z = 0\n\n for (let i = 0; i < len - 2; i++) {\n for (let j = i + 1; j < len - 1; j++) {\n for (let k = j + 1; k < len; k++) {\n if (\n nums[i] + nums[j] > nums[k] &&\n nums[i] + nums[k] > nums[j] &&\n nums[j] + nums[k] > nums[i] &&\n nums[i] - nums[j] < nums[k] &&\n nums[i] - nums[k] < nums[j] &&\n nums[j] - nums[k] < nums[i]\n ) {\n z++\n }\n }\n }\n }\n return z\n}", "function checkDuplicate(key,iv){\r\n var cellno=iv.id.slice(5,iv.id.length+1)\r\n var row=Math.floor(cellno/9)+1\r\n var col=cellno%9\r\n if(col===0){\r\n row--\r\n col=9\r\n }\r\n for(var i=0;i<9;i++){\r\n if(grid[row-1][i]===key)\r\n return false\r\n }\r\n for(var i=0;i<9;i++){\r\n if(grid[i][col-1]===key)\r\n return false\r\n }\r\n console.log(col+' '+row)\r\n var Rowstart=(row-1)-(row-1)%3\r\n var Colstart=(col-1)-(col-1)%3\r\n for(var i=Rowstart;i<Rowstart+3;i++){\r\n for(var j=Colstart;j<Colstart+3;j++)\r\n if(grid[i][j]===key)\r\n return false\r\n }\r\n return true\r\n}", "function isSafe(i,j,n){\n for(let k=0;k<N;k++){\n if(board[k][j]==n||board[i][k]==n){\n console.log(\"inside issafe\");\n foundYa(i,j);\n return false;\n }\n }\n let s = Math.sqrt(N);\n let rs = i - i%s;\n let cs = j -j%s;\n for(i = 0;i<s;i++){\n for(j = 0;j<s;j++){\n if(board[i+rs][j+cs]==n){\n return false;\n }\n }\n }\n return true;\n}", "function check4InRow(array){\n for (var i=0; i<(array.length-3); i++) {\n if ( array[i].value !== 0 && \n (array[i].value === array[i+1].value) && \n (array[i+1].value === array[i+2].value) && \n (array[i+2].value === array [i+3].value)){\n end = true;\n endGame(array, i);\n return;\n };\n };\n}", "function validTriangle(a, b, c){\n var values = [a*a,b*b,c*c];\n var y,z;\n var flag = false;\n for(var x = 0;x<3;x++){\n y = (x + 1)%3;\n z = (x + 2)%3;\n if (( (values[x] + values[y] == values[z]) || (a == b && a == c) || ( (b == c && b == a) || (a==b || b ==c || c == a) ) ) && a != 0 && b != 0 && c != 0 && a + b > c && c + a > b && c + b > a){\n flag = true;\n }\n }\n return flag;\n}", "function isPair(roll1, roll2){\n return roll1 === roll2;\n}", "checkFinish(data, k) {\n for (var i = 0; i < k; i++) {\n if (!this.compareArray(data[i].k, data[i].temp)) {\n return false\n }\n }\n return true;\n }", "function cantorPairing(k1, k2) {\n\treturn ((((k1+k2) * (k1+k2+1)) / 2) + k2);\n}", "function checkDuplicate(arr, k){\n var res = true;\n if(arr.length > 1){\n for(var j = 0; j < arr.length; j++){\n if(arr[j] == k){\n //console.log(\"duplicate vertex\");\n res = false;\n break;\n }\n else{\n res = true;\n //console.log(\"ok vertex\");\n }\n }\n }\n return res;\n }", "function checkDiagonal(position){\n //for position array, we are comparing change in index with change in value\n for(var i = 0; i < position.length; i++){\n for(var j = i + 1; j < position.length; j++){\n //i is the first piece, j are the ones after\n if (j - i == Math.abs(position[j] - position[i])) {\n return false;\n }\n }\n }\n return true;\n}", "function crossBelow(serie1,serie2,n){\n\t\tvar res = [];\n\t\tvar succ;\n\t\t\n\t\tif (serie1.length<serie2.length)\n\t\t\tserie2 = trimmer(serie2,serie1.length);\n\t\t\n\t\tif (serie2.length<serie1.length)\n\t\t\tserie1 = trimmer(serie1,serie2.length);\n\t\t\t\t\n\t\tfor (var i=n-1;i<serie1.length;i++){\n\t\t\tsucc = true;\n\t\t\tfor (var j=1;j<n;j++){\n\t\t\t\tif (serie1[i-j] > serie2[i-j])\n\t\t\t\t\tcontinue;\n\t\t\t\telse{\t\t\n\t\t\t\t\tsucc = false;\n\t\t\t\t\tbreak;\t\n\t\t\t\t}\n\t\t\t}\t\n\t\t\t\n\t\t\tres.push (succ && (serie1[i] < serie2[i]));\t\t\t\n\t\t}\n\n\t\treturn res;\n\t}", "function nextTo(x1, y1, x2, y2) {\n if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1)\n return true;\n return false;\n}", "function is_triangle(a,b,c){\n if (a <= 0 || b <=0 || c <= 0){\n return false\n } else if ((a+b)>c && (a+c > b) && (c+b > a)){\n return true\n } else{\n return false\n }\n}", "function foundPatternCross(stateCount, moduleSize) {\r\n\t\t var maxVariance = moduleSize / 2;\r\n\t\t for (var i = 0; i < 3; i++) {\r\n\t\t if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) {\r\n\t\t return false;\r\n\t\t }\r\n\t\t }\r\n\t\t return true;\r\n\t\t}", "function scoresIncreasing(scores){\n for (let i = 0; i <= scores.length - 2; i++) {\n if (scores[i + 1] - scores[i] < 0) {\n return false;\n }\n }\n return true;\n}", "anyLinesCross(vectors) {\n let newVecs = [];\n for (let v of vectors) {\n newVecs.push(v);\n }\n newVecs.push(vectors[0]);\n for (let i = 0; i < newVecs.length - 1; i++) {\n for (let j = i + 1; j < newVecs.length - 1; j++) {\n if (i === j || j + 1 === i || i + 1 === j || (i === 0 && j === newVecs.length - 2)) {\n continue;\n }\n if (this.linesCross(newVecs[i].x, newVecs[i].y, newVecs[i + 1].x, newVecs[i + 1].y, newVecs[j].x, newVecs[j].y, newVecs[j + 1].x, newVecs[j + 1].y)) {\n return true;\n }\n }\n }\n return false;\n }", "function isStraight(cards) {\n cards = [...new Set(cards)];\n const cards1 = cards.sort((a, b) => a - b);\n const cards2 = cards.map((x) => (x == 14 ? 1 : x)).sort((a, b) => a - b);\n for (let j = 0; j < cards.length - 4; j++)\n if (\n [cards1, cards2].some((cards) =>\n [j + 1, j + 2, j + 3, j + 4].every((i) => cards[i] - cards[i - 1] == 1)\n )\n )\n return true;\n return false;\n}", "function notATriangle(a, b, c) {\n if ((a + b) <= c || (a + c) <= b || (b + c) <= a) return true;\n}", "function averagePair(arr, num) {\n const total = num * 2;\n let front = 0;\n let back = arr.length - 1;\n\n while (front < back) {\n if (arr[front] + arr[back] === total) {\n return true;\n }\n if (arr[front] + arr[back] > total) {\n back--;\n }\n if (arr[front] + arr[back] < total) {\n front++;\n }\n }\n return false;\n}", "function almostStrictlyIncreasing(arr) {\n\n let hasRemove = false;\n let curr = arr[0]; // creating a pointer to compare three elements at a time\n\n for (let i = 1; i < arr.length; i++) { // one for loop makes it O(n)\n\n if (curr < arr[i]) { // we want to always be storing the smallest of the 3 elements we are looking at\n curr = arr[i];\n }\n else {\n\n if (hasRemove) {\n return false;\n }\n if (i < 2) { //edge case\n curr = arr[i]\n } else {\n curr = arr[i] <= arr[i - 2] ? curr : arr[i];\n // console.log(curr);\n }\n hasRemove = true;\n }\n }\n return true;\n}", "IsConvex()\n {\n\n let foundNegative = false;\n let foundPositive = false;\n for (let i = 0; i < this.vertices.length; i++)\n {\n // get 3 adjacent vertices\n let a = this.vertices[i];\n let b = this.vertices[(i + 1) % this.vertices.length];\n let c = this.vertices[(i + 2) % this.vertices.length];\n\n Vector.Cross();\n\n // if 1st pair, establish \n\n }\n }", "function checkPairPlus(hand) {\n let pointArray = [];\n for (let card of hand) {\n pointArray.push(card.point);\n }\n pointArray.sort((a, b) => {\n return a - b;\n });\n let checkPair = new Set(pointArray);\n if (checkPair.size > 3) return;\n if (pointArray[1] != pointArray[2] && checkPair.size == 2) {\n // showHand(hand, \"Pair with pair card\");\n return true;\n }\n\n if (\n (pointArray[2] - pointArray[1] == 1 &&\n pointArray[1] - pointArray[0] == 1) ||\n (pointArray[3] - pointArray[2] == 1 && pointArray[2] - pointArray[1] == 1)\n ) {\n if (checkSuit(hand) > 0) return true;\n // showHand(hand, \"Pairs with suited and connected side cards\");\n }\n}", "function luckBalance(k, contests) {\n\n let luck = 0\n\n let mustWinContests = []\n for (let i = 0; i < contests.length; i++) {\n if (contests[i][1] === 1) {\n mustWinContests.push(contests[i])\n }\n }\n mustWinContests = mustWinContests.sort(function(a, b){return a[0]-b[0]}).splice(0, mustWinContests.length - k)\n\n // for (let i = 0; i < contests.length; i++) {\n // if (mustWinContests.includes(contests[i]) === true){\n // luck--\n // } else {\n // luck++\n // }\n // }\n\n for (let i = 0; i < contests.length; i++) {\n luck += contests[i][0]\n }\n\n for (let i = 0; i < mustWinContests.length; i ++) {\n luck = luck - (2 * mustWinContests[i][0])\n }\n\n return luck\n}", "function chkGameOver(board) {\n let change = false;\n for (let i = 0; i < board.length; i++) {\n for (let j = 0; j < board[0].length; j++) {\n if ((i + 1) < board.length) {\n if (board[i][j] == board[i + 1][j]) {\n change = true;\n break;\n }\n }\n if ((i - 1) >= 0) {\n if (board[i][j] == board[i - 1][j]) {\n change = true;\n break;\n }\n }\n if ((j + 1) < board[0].length) {\n if (board[i][j] == board[i][j + 1]) {\n change = true;\n break;\n }\n }\n if ((j - 1) >= 0) {\n if (board[i][j] == board[i][j - 1]) {\n change = true;\n break;\n }\n }\n }\n }\n return change;\n}", "function divisibleSumPairs(n, k, ar) {\n let result = 0;\n for (let i = 0; i < ar.length - 1; i++) {\n for (let j = i + 1; j < ar.length; j++) {\n if ((ar[i] + ar[j]) % k == 0) {\n result++\n }\n \n console.log(`cycle ${i} -- ${j} ----> result: ${result}`);\n }\n }\n\n console.log(result);\n return result\n}", "function checkWiningRowMove(p) {\n //0,1,2 3,4,5 6,7,8\n var ret = false;\n var r1 = _matrix[0][0] + _matrix[0][1] + _matrix[0][2];\n var r2 = _matrix[1][0] + _matrix[1][1] + _matrix[1][2];\n var r3 = _matrix[2][0] + _matrix[2][1] + _matrix[2][2];\n\n if (r1 === p.repeat(3) || r2 === p.repeat(3) || r3 === p.repeat(3) ) ret = true;\n\n return ret;\n }", "function is_safe_cross()\n{\n\tif (frog.lane == 0) {\n\t\tif(frog.x > slots[0].start && (frog.x + frog.w) < slots[0].end && \n\t\t !slots[0].isfull) {\n\t\t\t\tslots[0].isfull = 1;\n\t\t\t\tslots.lastfilled = 0;\n\t\t\t\treturn 1;\n\t\t}\n\t\telse if(frog.x > slots[1].start && (frog.x + frog.w) < slots[1].end && \n\t\t !slots[1].isfull) {\n\t\t\t\tslots[1].isfull = 1;\n\t\t\t\tslots.lastfilled = 1;\n\t\t\t\treturn 1;\n\t\t}\n\t\telse if(frog.x > slots[2].start && (frog.x + frog.w) < slots[2].end && \n\t\t !slots[2].isfull) {\n\t\t\t\tslots[2].isfull = 1;\n\t\t\t\tslots.lastfilled = 2;\n\t\t\t\treturn 1;\n\t\t}\n\t\telse if(frog.x > slots[3].start && (frog.x + frog.w) < slots[3].end && \n\t\t !slots[3].isfull) {\n\t\t\t\tslots[3].isfull = 1;\n\t\t\t\tslots.lastfilled = 3;\n\t\t\t\treturn 1;\n\t\t}\n\t\telse if(frog.x > slots[4].start && (frog.x + frog.w) < slots[4].end && \n\t\t !slots[4].isfull) {\n\t\t\t\tslots[4].isfull = 1;\n\t\t\t\tslots.lastfilled = 4;\n\t\t\t\treturn 1;\n\t\t}\n\t\telse { return 0; }\n\t}\n\treturn 1;\n}", "function checkPreviousDiv(mas_a, mas_b, temp_a, temp_b) {\r\n for (var k = 0; k < mas_a.length; k++) {\r\n if (temp_a == mas_a[k] && temp_b == mas_b[k]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}", "function testJackpot(jackpotarr){\n for(let i = 0; i<jackpotarr.length-1; i++){\n if(jackpotarr[i] !== jackpotarr[i+1]){\n return false;\n }\n }\n return true;\n}", "function checkUpRight(arr) {\n var counter = 1;\n for (var x = 1; x < arr.length; x++) {\n if(col + x < 7 && row + x < 6) {\n if (arr[col][row] === arr[col + x][row + x]) {\n counter++;\n if (counter === 4) {\n console.log('UpRight winner');\n $(\"#you-won\").show(\"slow\").addClass('slide', 3000);\n counter = 1;\n }\n }\n }\n if ((row - x > -1 && col - x > -1)) {\n if (arr[col][row] === arr[col - x][row - x]) {\n counter++;\n if (counter === 4) {\n console.log('LeftUp winner');\n $(\"#you-won\").show(\"slow\").addClass('slide', 3000);\n counter = 1;\n }\n }\n }\n if (counter === 1) {\n return;\n }\n }\n}", "function notBlockVertically(col, row1, row2) {\n for (var i = row1 + 1; i < row2; i++) {\n if (all_numbers[i][col]) {\n return false;\n }\n }\n return true;\n}", "checkCollide(pos1, pos2){\n if (Math.abs(pos1[0] - pos2[0]) < 50 &&\n pos1[1] === pos2[1]){\n\n return true;\n } else {\n return false;\n }\n }", "function divisibleSumPairs(n, k, ar) {\nlet pairs = 0;\nfor(let i=0;i<n;i++){\n for(let j=i+1;j<n;j++){\n if((ar[i]+ar[j])%k == 0){\n pairs++;\n }\n }\n}\nconsole.log(pairs);\nreturn pairs;\n}", "function check_vertical(row, col, color) {\n let count = 1\n let temp = row\n while (row > 0) {\n let $down_cell = get_cell(--row, col)\n if ($down_cell.css('backgroundColor') == color) {\n count += 1\n console.log('count +++ down')\n }\n else {\n break\n }\n }\n row = temp\n while (row < that.row) {\n let $up_cell = get_cell(++row, col)\n if ($up_cell.css('backgroundColor') == color) {\n count += 1\n console.log('count +++ right')\n }\n else {\n break\n }\n }\n if (count >= 4) {\n return true\n }\n return false\n }", "function checkUpLeft(arr){\n var counter = 1;\n for (var x = 1; x < arr.length; x++) {\n if(row + x < 6 && col - x > -1) {\n if (arr[col][row] === arr[col - x][row + x]) {\n counter++;\n if (counter === 4) {\n console.log('LeftUp winner');\n $(\"#you-won\").show(\"slow\").addClass('slide', 3000);\n counter = 1;\n }\n }\n }\n if ((row - x > -1 && col + x < 7)) {\n if (arr[col][row] === arr[col + x][row - x]) {\n counter++;\n if (counter === 4) {\n console.log('LeftUp winner');\n $(\"#you-won\").show(\"slow\").addClass('slide', 3000);\n counter = 1;\n }\n }\n }\n if (counter === 1) {\n return;\n }\n }\n}", "function isTriangle(a,b,c){\n \n let fierst =( a+b) > c;\n let second =( a+c) > b;\n let third =( b+c) > a;\n if(fierst && second && third){\n return true;\n }else return false\n \n}", "function verticalWinCheck() {\r\n for (var col = 0; col < 7; col++) {\r\n for (var row = 0; row < 3; row++) {\r\n if (colorMatchCheck(returnColor(row,col), returnColor(row+1,col) ,returnColor(row+2,col), returnColor(row+3,col))) {\r\n console.log('vertical');\r\n reportWin(row,col);\r\n return true;\r\n }else {\r\n continue;\r\n }\r\n }\r\n }\r\n}", "static victory(x, board, victoryCondition) {\n let y = board.getColumnHeight(x) - 1;\n let token = board.getToken(x, y);\n let directionResults = 0;\n for (let i = 0; i < Game.directions.length; i++) {\n directionResults += Game.consecutivePieces(x, y, token, board, victoryCondition, Game.directions[i]);\n if (directionResults + 1 >= victoryCondition) {\n return true;\n }\n if (i % 2 != 0) {\n directionResults = 0;\n }\n }\n return false;\n }", "function findPair(arr, n) {\n arr.sort((a, b) => a - b);\n let num = Math.abs(n);\n let i = 0;\n let j = 1;\n\n while (j < arr.length) {\n let difference = Math.abs(arr[i] - arr[j]);\n\n if (difference === num) return true;\n\n if (difference > num && i === j - 1) {\n i++;\n j++;\n }\n if (difference > num) {\n i++;\n } else {\n j++;\n }\n }\n return false;\n}", "function jumpingOnClouds(c) {\n let count = 0;\n let i = 0;\n while(true) {\n if((i + 2 < c.length) && (c[i+2] === 0)) {\n i += 2;\n } else if((i+1 < c.length)) {\n i++;\n } else {\n break;\n }\n count++;\n }\n return count;\n }", "function pairs(ar) {\n var count = 0;\n for (var x = 0; x < ar.length; x += 2) {\n if (ar[x] - 1 === ar[x + 1] || ar[x] + 1 === ar[x + 1]) {\n count++\n }\n }\n return count;\n}", "function onSegment (pi, pj, pk) {\n return Math.min(pi[0], pj[0]) <= pk[0] &&\n pk[0] <= Math.max(pi[0], pj[0]) &&\n Math.min(pi[1], pj[1]) <= pk[1] &&\n pk[1] <= Math.max(pi[1], pj[1]);\n}", "function arrayCircleCheck(iRows, iCols, iStartRow, iStartCol) {\n var i;\n var j;\n\n\n isMatch = true;\n\n for (i = iStartRow; i < iStartRow + iRows; i++) {\n for (j = iStartCol; j < iStartCol + iCols; j++) {\n if (iValues[i % iMapRows][j % iMapCols] == 0) {\n isMatch = false;\n } \n }\n } \n\n return isMatch;\n}", "function isGameOver(gridValue) {\n for (let i = 1; i < gridValue.length - 1; i++) {\n for (let j = 1; j < gridValue.length - 1; j++) {\n if ((gridValue[i][j] === gridValue[i + 1][j])\n || (gridValue[i][j] === gridValue[i - 1][j])\n || (gridValue[i][j] === gridValue[i][j + 1])\n || (gridValue[i][j] === gridValue[i][j - 1])) {\n return false;\n }\n }\n }\n return false;\n}", "function getMaxLessThanK(n,k) {\n if(k >= 2) {\n let a = 1;\n let newArr = Array();\n while(n > a) {\n let b = a + 1;\n while(n >= b) {\n if( (a & b) < k ){\n newArr.push(a & b);\n }\n b++;\n }\n a++;\n }\n return Math.max(...newArr);\n }\n}", "function checkVertical(){\n let array = [gameSize];\n for (let i = 0; i < gameSize; i++) {\n for (let j = 0; j < gameSize; j++) {\n array[j] = gameField[j][i];\n }\n if(isContaineWinCombination(array, \"X\")) {\n printWinner();\n return true;\n }\n if (isContaineWinCombination(array, \"0\")) {\n printWinner();\n return true;\n }\n }\n return false;\n}", "checkCollide(obj1, obj2) {\n\t\tif(\tobj1.x < obj2.x + obj2.width &&\n\t\t\tobj1.x + obj1.width > obj2.x) {\n\t\t\t\tif(\tobj1.y < obj2.y + obj2.height &&\n\t\t\t\t\tobj1.y + obj1.height > obj2.y) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\t\t\n\t\t}\n\t\treturn false;\n\t}", "function pairSum(numbers, k) {\n\n}", "function judge(grid){\n for(var i = 0; i < row; i++){\n for(var j = 0; j < col; j++){\n if(grid[i][j]){\n return false;\n }\n }\n }\n return true;\n}", "function findConsqSums(arr, k) {\n let sol=[]\n let lptr=0;\n let rptr=0;\n while(sum(arr,lptr,rptr)<k){\n rptr++;\n }\n while (lptr<arr.length){\n let s=sum(arr,lptr,((rptr<arr.length)?rptr:arr.length-1))\n if(s==k){\n sol.push(arr.slice(lptr, rptr+1))\n rptr++;\n while(arr[rptr]===0){\n sol.push(arr.slice(lptr, rptr+1))\n rptr++;\n console.log(\"inner\",sum(arr,lptr,rptr))\n }\n }\n else if(s>k){\n lptr++;\n }\n else if(s<k){\n if(rptr<arr.length){\n rptr++;\n }\n else{\n break;\n }\n }\n console.log(\"outer\",sum(arr,lptr,rptr))\n }\n return sol;\n}", "function snake_inside(snake, rows, cols) {\n for (var i = 0; i < snake.length; i++) {\n row = snake[i][0];\n col = snake[i][1];\n if (row < 0 || col < 0 || row > rows - 1 || col > cols - 1) {\n return false;\n }\n }\n return true;\n}", "function verticalWinCheck() {\n for(var col=0;col<7;col++) {\n for(var row=0;row<3;row++) {\n if(colorMatchCheck(returnColor(row,col),returnColor(row+1,col),returnColor(row+2,col))) {\n console.log('vertical');\n reportWin(row,col);\n return true;\n }else {\n continue;\n }\n }\n }\n}", "static intersect_cube(p, margin = 0) {\n return p.every(value => value >= -1 - margin && value <= 1 + margin);\n }" ]
[ "0.62931365", "0.62828517", "0.62527996", "0.62113714", "0.6109504", "0.5946809", "0.59088993", "0.587759", "0.5803817", "0.5799639", "0.5791983", "0.5776205", "0.57043606", "0.565883", "0.5657893", "0.56131077", "0.56079686", "0.5554067", "0.5546994", "0.5545171", "0.55305815", "0.55175906", "0.55103624", "0.5507917", "0.5503272", "0.550281", "0.54926413", "0.5492634", "0.54837084", "0.5450495", "0.54489625", "0.54369175", "0.54348356", "0.5426919", "0.54243577", "0.5423312", "0.541326", "0.5406145", "0.54041165", "0.53981596", "0.5395207", "0.53942096", "0.5391573", "0.5386613", "0.5383871", "0.53831136", "0.5375214", "0.5372584", "0.5370511", "0.5366481", "0.5355254", "0.5350273", "0.53315717", "0.53309315", "0.53282726", "0.53203493", "0.5317032", "0.53136754", "0.53108615", "0.5310075", "0.53021955", "0.52836156", "0.52824676", "0.5280333", "0.5278164", "0.5274447", "0.5264721", "0.5264543", "0.52598834", "0.525442", "0.52507114", "0.5249068", "0.5244879", "0.52446353", "0.52425975", "0.5242131", "0.52365714", "0.5230675", "0.5226241", "0.52109015", "0.5206833", "0.52033466", "0.51996183", "0.51956993", "0.5194864", "0.5193299", "0.51893896", "0.5184665", "0.5184086", "0.51815534", "0.5175828", "0.5171264", "0.51684666", "0.51672244", "0.5166358", "0.51658154", "0.51638895", "0.516111", "0.516104", "0.515662" ]
0.705261
0
when segments (i,i+1) and (k,k+1) cross each other, return the intersection point as the interpolation on the first segment (i,i+1) determine the intersection point by the Cramerrule
function getIntersection (i, k) { var det = dx(i,i + 1) * dy(k,k + 1) - dx(k, k +1 ) * dy(i, i + 1); var s = dx(i,k) * dy (k,k + 1) - dx(k,k + 1) * dy(i, k); s = s / det; var t = dy(i,k) * dx (i,i + 1) - dy(i,i + 1) * dx(i, k); t = t / det; return s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cubicSegmentIntersections(px1, py1, px2, py2, px3, py3, px4, py4, x1, y1, x2, y2) {\n var intersections = [];\n // Find line equation coefficients.\n var A = y1 - y2;\n var B = x2 - x1;\n var C = x1 * (y2 - y1) - y1 * (x2 - x1);\n // Find cubic Bezier curve equation coefficients from control points.\n var bx = bezierCoefficients(px1, px2, px3, px4);\n var by = bezierCoefficients(py1, py2, py3, py4);\n var a = A * bx[0] + B * by[0]; // t^3\n var b = A * bx[1] + B * by[1]; // t^2\n var c = A * bx[2] + B * by[2]; // t\n var d = A * bx[3] + B * by[3] + C; // 1\n var roots = polyRoots_1.cubicRoots(a, b, c, d);\n // Verify that the roots are within bounds of the linear segment.\n for (var i = 0; i < roots.length; i++) {\n var t = roots[i];\n var tt = t * t;\n var ttt = t * tt;\n // Find the cartesian plane coordinates for the parametric root `t`.\n var x = bx[0] * ttt + bx[1] * tt + bx[2] * t + bx[3];\n var y = by[0] * ttt + by[1] * tt + by[2] * t + by[3];\n // The parametric cubic roots we found are intersection points\n // with an infinite line, and so the x/y coordinates above are as well.\n // Make sure the x/y is also within the bounds of the given segment.\n var s = void 0;\n if (x1 !== x2) {\n s = (x - x1) / (x2 - x1);\n }\n else { // the line is vertical\n s = (y - y1) / (y2 - y1);\n }\n if (s >= 0 && s <= 1) {\n intersections.push({ x: x, y: y });\n }\n }\n return intersections;\n}", "function getLineSegmentsIntersection (out, p0, p1, p2, p3) {\n\n var s1_x, s1_y, s2_x, s2_y;\n s1_x = p1[0] - p0[0];\n s1_y = p1[1] - p0[1];\n s2_x = p3[0] - p2[0];\n s2_y = p3[1] - p2[1];\n\n var s, t;\n s = (-s1_y * (p0[0] - p2[0]) + s1_x * (p0[1] - p2[1])) / (-s2_x * s1_y + s1_x * s2_y);\n t = ( s2_x * (p0[1] - p2[1]) - s2_y * (p0[0] - p2[0])) / (-s2_x * s1_y + s1_x * s2_y);\n if (s >= 0 && s <= 1 && t >= 0 && t <= 1) { // Collision detected\n var intX = p0[0] + (t * s1_x);\n var intY = p0[1] + (t * s1_y);\n out[0] = intX;\n out[1] = intY;\n return t;\n }\n return -1; // No collision\n}", "computeControlPoints(K)\n {\n let p1=new Array();\n let p2=new Array();\n let n = K.length-1;\n let i,m;\n\n /*rhs vector*/\n let a=new Array();\n let b=new Array();\n let c=new Array();\n let r=new Array();\n\n /*left most segment*/\n a[0]=0;\n b[0]=2;\n c[0]=1;\n r[0] = K[0]+2*K[1];\n\n /*internal segments*/\n for (i = 1; i < n - 1; i++)\n {\n a[i]=1;\n b[i]=4;\n c[i]=1;\n r[i] = 4 * K[i] + 2 * K[i+1];\n }\n\n /*right segment*/\n a[n-1]=2;\n b[n-1]=7;\n c[n-1]=0;\n r[n-1] = 8*K[n-1]+K[n];\n\n /*solves Ax=b with the Thomas algorithm (from Wikipedia)*/\n for (i = 1; i < n; i++)\n {\n m = a[i]/b[i-1];\n b[i] = b[i] - m * c[i - 1];\n r[i] = r[i] - m*r[i-1];\n }\n\n p1[n-1] = r[n-1]/b[n-1];\n for (i = n - 2; i >= 0; --i)\n p1[i] = (r[i] - c[i] * p1[i+1]) / b[i];\n\n /*we have p1, now compute p2*/\n for (i=0;i<n-1;i++)\n p2[i]=2*K[i+1]-p1[i+1];\n\n p2[n-1]=0.5*(K[n]+p1[n-1]);\n\n return {p1:p1, p2:p2};\n }", "function getLineSegmentsIntersection(out, p0, p1, p2, p3) {\n\n var s1_x, s1_y, s2_x, s2_y;\n s1_x = p1[0] - p0[0];\n s1_y = p1[1] - p0[1];\n s2_x = p3[0] - p2[0];\n s2_y = p3[1] - p2[1];\n\n var s, t;\n s = (-s1_y * (p0[0] - p2[0]) + s1_x * (p0[1] - p2[1])) / (-s2_x * s1_y + s1_x * s2_y);\n t = (s2_x * (p0[1] - p2[1]) - s2_y * (p0[0] - p2[0])) / (-s2_x * s1_y + s1_x * s2_y);\n if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {\n // Collision detected\n var intX = p0[0] + t * s1_x;\n var intY = p0[1] + t * s1_y;\n out[0] = intX;\n out[1] = intY;\n return t;\n }\n return -1; // No collision\n }", "function computeControlPoints(K) {\n var i, m,\n p1 = new Array(),\n p2 = new Array(),\n n = K.length - 1,\n /*rhs vector*/\n a = new Array(),\n b = new Array(),\n c = new Array(),\n r = new Array();\n /*left most segment*/\n a[0] = 0;\n b[0] = 2;\n c[0] = 1;\n r[0] = K[0] + 2 * K[1];\n /*internal segments*/\n for (i = 1; i < n - 1; i++) {\n a[i] = 1;\n b[i] = 4;\n c[i] = 1;\n r[i] = 4 * K[i] + 2 * K[i + 1];\n }\n\n /*right segment*/\n a[n - 1] = 2;\n b[n - 1] = 7;\n c[n - 1] = 0;\n r[n - 1] = 8 * K[n - 1] + K[n];\n /*solves Ax=b with the Thomas algorithm (from Wikipedia)*/\n for (i = 1; i < n; i++) {\n m = a[i] / b[i - 1];\n b[i] = b[i] - m * c[i - 1];\n r[i] = r[i] - m * r[i - 1];\n }\n\n p1[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) {\n p1[i] = (r[i] - c[i] * p1[i + 1]) / b[i];\n }\n\n /*we have p1, now compute p2*/\n for (i = 0; i < n - 1; i++) {\n p2[i] = 2 * K[i + 1] - p1[i + 1];\n }\n p2[n - 1] = 0.5 * (K[n] + p1[n - 1]);\n return {p1: p1, p2: p2};\n }", "function labelSegmentIntersection(pk, vk, li, vi, pi) {\n // translate so we can assume that point is in the centre\n pk = { x: pk.x - pi.x - li.offsetX, y: pk.y - pi.y - li.offsetY };\n // TODO handle parallel lines\n // The time interval where they meet is connected so it is enough to find the end points. This must occur when either the corners of the label intersect or when\n const intersections = [];\n // the end points of the segment intersect\n for (let x of [-li.width / 2, li.width / 2]) {\n for (let y of [-li.height / 2, li.height / 2]) {\n let intersection = segmentSegmentIntersection({ x, y }, vi, pk, vk);\n // Intersects inside the segment\n if (intersection && intersection.s >= 0 && intersection.s <= 1) {\n intersections.push(intersection.t);\n }\n\n // Given a point to we take the side coming from it in counter clockwise\n let side;\n if (x * y < 0) {\n side = { x: 0, y: -2 * y };\n } else {\n side = { x: -2 * x, y: 0 };\n }\n intersection = segmentSegmentIntersection({ x, y }, side, pk, vi);\n if (intersection && intersection.t >= 0 && intersection.t <= 1) {\n intersections.push(-intersection.s);\n //// The side covers the point in the future\n //if (intersection.s < 0) {\n // intersections.push(Number.POSITIVE_INFINITY)\n //}\n }\n intersection = segmentSegmentIntersection({ x, y }, side, { x: pk.x + vk.x, y: pk.y + vk.y }, vi);\n if (intersection && intersection.t >= 0 && intersection.t <= 1) {\n intersections.push(-intersection.s);\n }\n }\n }\n var min = intersections.reduce((a, b) => Math.min(a, b), Number.POSITIVE_INFINITY);\n var max = intersections.reduce((a, b) => Math.max(a, b), Number.NEGATIVE_INFINITY);\n min = Math.max(min, 0);\n return interval(min, max);\n}", "function computeControlPoints(K)\r\n{\r\n\tp1=new Array();\r\n\tp2=new Array();\r\n\tn = K.length-1;\r\n\t\r\n\t/*rhs vector*/\r\n\ta=new Array();\r\n\tb=new Array();\r\n\tc=new Array();\r\n\tr=new Array();\r\n\t\r\n\t/*left most segment*/\r\n a[0]=0;\r\n b[0]=2;\r\n c[0]=1;\r\n r[0] = K[0]+2*K[1];\r\n\r\n\t/*internal segments*/\r\n\tfor (i = 1; i < n - 1; i++)\r\n\t{\r\n\t\ta[i]=1;\r\n\t\tb[i]=4;\r\n\t\tc[i]=1;\r\n\t\tr[i] = 4 * K[i] + 2 * K[i+1];\r\n\t}\r\n\t\t\t\r\n\t/*right segment*/\r\n a[n-1]=2;\r\n b[n-1]=7;\r\n c[n-1]=0;\r\n r[n-1] = 8*K[n-1]+K[n];\r\n\t\r\n\t/*solves Ax=b with the Thomas algorithm (from Wikipedia)*/\r\n\tfor (i = 1; i < n; i++)\r\n\t{\r\n\t\tm = a[i]/b[i-1];\r\n\t\tb[i] = b[i] - m * c[i - 1];\r\n\t\tr[i] = r[i] - m*r[i-1];\r\n\t}\r\n \r\n\tp1[n-1] = r[n-1]/b[n-1];\r\n\tfor (i = n - 2; i >= 0; --i)\r\n\t\tp1[i] = (r[i] - c[i] * p1[i+1]) / b[i];\r\n\t\t\r\n\t/*we have p1, now compute p2*/\r\n\tfor (i=0;i<n-1;i++)\r\n\t\tp2[i]=2*K[i+1]-p1[i+1];\r\n\t\r\n\tp2[n-1]=0.5*(K[n]+p1[n-1]);\r\n\t\r\n\treturn {p1:p1, p2:p2};\r\n}", "function segmentSegmentIntersection(pi, vi, pj, vj /* Vector of the segment */) {\n // (vi -vj)(t, s)^T = (pj - pi)\n var det = -(vi.x * vj.y - vj.x * vi.y);\n if (det === 0) {\n // Parallel lines\n // Test this\n if ((pi.x - pj.x) * vj.y - (pi.j - pj.y) * vj.x !== 0) return null; // Line does not belong\n // TODO concurrent lines\n throw new Error('Parallel lines not allowed'); // This must be handled out of the algorithm\n }\n const t = (-(pj.x - pi.x) * vj.y + (pj.y - pi.y) * vj.x) / det;\n const s = (-(pj.x - pi.x) * vi.y + (pj.y - pi.y) * vi.x) / det;\n return { t, s };\n}", "getIntersection(other) {\n // Get equations describing lines (ax + bx = c),\n // then solve for a point - if no solution, no intersection.\n this.getLineParameters()\n other.getLineParameters()\n const denom = this.b * other.a - other.b * this.a\n // If denominator is zero, no solution, so no intersection (ie lines are parallel)\n // You can see that the slopes are the same because if a/b == a'/b' then denom=0\n if (denom === 0)\n return null\n // Lines intersect, but need to check if intersecting point is actually within \n // both line segments bounding boxes.\n const x = (this.b * other.c - other.b * this.c) / denom\n const y = (this.c * other.a - other.c * this.a) / denom\n // console.log(x, this.x1, this.x2)\n if (!this.pointInBounds(x, y)) return null\n if (!other.pointInBounds(x, y)) return null\n // Must be on both line segments so return intersection\n const intersectPoint = new Point2D(x, y)\n return intersectPoint\n }", "function segmentIntersection(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n var d = (ax2 - ax1) * (by2 - by1) - (ay2 - ay1) * (bx2 - bx1);\n if (d === 0) { // The lines are parallel.\n return null;\n }\n var ua = ((bx2 - bx1) * (ay1 - by1) - (ax1 - bx1) * (by2 - by1)) / d;\n var ub = ((ax2 - ax1) * (ay1 - by1) - (ay2 - ay1) * (ax1 - bx1)) / d;\n if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n return {\n x: ax1 + ua * (ax2 - ax1),\n y: ay1 + ua * (ay2 - ay1)\n };\n }\n return null; // The intersection point is outside either or both segments.\n}", "function line_line_intersection_vecs(p,q,r,s) {\n\tvar r_cross_s = vec2_crossprod( r, s ); //it's a scalar, representing z.\n\tif(r_cross_s === 0)\n\t{\n\t\tconsole.log(\"parallel?\",r,s)\n\t\treturn 0;\n\t}\n\t\n\tvar r_over_r_cross_s = r.clone();\n\tvar s_over_r_cross_s = s.clone();\n\t\n\tvar p_to_q = q.clone();\n\tp_to_q.sub(p);\n\t\n\tvar u = vec2_crossprod(p_to_q,r_over_r_cross_s);\n\tvar t = vec2_crossprod(p_to_q,s_over_r_cross_s);\n\t\n\tu /= r_cross_s;\n\tt /= r_cross_s;\n\t\n//\tif( 0 <= u && u <= 1 \n//\t && 0 <= t && t <= 1 ){\n//\t\t//answer is inside both line segments\n//\t}\n\n\tvar answer = p.clone();\n\tanswer.addScaledVector(r, t);\n\treturn answer;\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function intersectBezier3Line(ax1, ay1, ax2, ay2, ax3, ay3, ax4, ay4, bx1, by1, bx2, by2) {\n var c3, c2, c1, c0;\n var cl, n;\n var isV = bx1 === bx2;\n var isH = by1 === by2;\n var result = [];\n var minbx = Math.min(bx1, bx2);\n var minby = Math.min(by1, by2);\n var maxbx = Math.max(bx1, bx2);\n var maxby = Math.max(by1, by2);\n\n var dot = function dot(a, b) {\n return a.x * b.x + a.y * b.y;\n };\n\n var lerp = function lerp(a, b, t) {\n return {\n x: a.x - (a.x - b.x) * t,\n y: a.y - (a.y - b.y) * t,\n t: t\n };\n };\n\n c3 = {\n x: -ax1 + 3 * ax2 - 3 * ax3 + ax4,\n y: -ay1 + 3 * ay2 - 3 * ay3 + ay4\n };\n c2 = {\n x: 3 * ax1 - 6 * ax2 + 3 * ax3,\n y: 3 * ay1 - 6 * ay2 + 3 * ay3\n };\n c1 = {\n x: -3 * ax1 + 3 * ax2,\n y: -3 * ay1 + 3 * ay2\n };\n c0 = {\n x: ax1,\n y: ay1\n };\n n = {\n x: by1 - by2,\n y: bx2 - bx1\n };\n cl = bx1 * by2 - bx2 * by1;\n var coefs = [cl + dot(n, c0), dot(n, c1), dot(n, c2), dot(n, c3)];\n var roots = getRoots(coefs);\n\n for (var i = 0; i < roots.length; i++) {\n var t = roots[i];\n\n if (0 <= t && t <= 1) {\n var p5 = lerp({\n x: ax1,\n y: ay1\n }, {\n x: ax2,\n y: ay2\n }, t);\n var p6 = lerp({\n x: ax2,\n y: ay2\n }, {\n x: ax3,\n y: ay3\n }, t);\n var p7 = lerp({\n x: ax3,\n y: ay3\n }, {\n x: ax4,\n y: ay4\n }, t);\n var p8 = lerp(p5, p6, t);\n var p9 = lerp(p6, p7, t);\n var p10 = lerp(p8, p9, t);\n\n if (bx1 === bx2) {\n if (minby <= p10.y && p10.y <= maxby) {\n result.push(p10);\n }\n } else if (by1 === by2) {\n if (minbx <= p10.x && p10.x <= maxbx) {\n result.push(p10);\n }\n } else if (p10.x >= minbx && p10.y >= minby && p10.x <= maxbx && p10.y <= maxby) {\n result.push(p10);\n }\n }\n }\n\n if (isH || isV) {\n result.forEach(function (item) {\n if (isV) {\n if (item.x < minbx) {\n item.x = minbx;\n } else if (item.x > maxbx) {\n item.x = maxbx;\n }\n } else {\n if (item.y < minby) {\n item.y = minby;\n } else if (item.y > maxby) {\n item.y = maxby;\n }\n }\n });\n }\n\n return result;\n}", "function checkIntersection(line, polygonPoint, polygonNextPoint) {\n var point1 = { x: line.x1, y: line.y1 };\n var point2 = { x: line.x2, y: line.y2 };\n var point3 = { x: polygonPoint.x, y: polygonPoint.y };\n var point4 = { x: polygonNextPoint.x, y: polygonNextPoint.y };\n\n\n var deltaValue0 = (point4.y - point3.y) * (point2.x - point1.x) - (point4.x - point3.x) * (point2.y - point1.y);\n\n // if delta0 is 0 then the 2 segments are parallel, so interesction can occour\n if (deltaValue0 === 0) {\n return false;\n }\n\n var deltaValue1 = (point4.x - point3.x) * (point1.y - point3.y) - (point4.y - point3.y) * (point1.x - point3.x);\n\n var deltaValue2 = (point2.x - point1.x) * (point1.y - point3.y) - (point2.y - point1.y) * (point1.x - point3.x);\n\n var varDeltaA = deltaValue1 / deltaValue0;\n var varDeltaB = deltaValue2 / deltaValue0;\n\n if ((varDeltaA >= 0 && varDeltaA <= 1) && (varDeltaB >= 0 && varDeltaB <= 1)) {\n var intersectionX = point1.x + varDeltaA * (point2.x - point1.x);\n var intersectionY = point1.y + varDeltaA * (point2.y - point1.y);\n\n return { x: intersectionX, y: intersectionY };\n }\n\n return false;\n}", "intersectionCheck(p3, p4) {\n let p0_x = this.p1.position[0];\n let p0_y = this.p1.position[2];\n let p1_x = this.p2.position[0];\n let p1_y = this.p2.position[2];\n let p2_x = p3.position[0];\n let p2_y = p3.position[2];\n let p3_x = p4.position[0];\n let p3_y = p4.position[2];\n let s1_x = p1_x - p0_x;\n let s1_y = p1_y - p0_y;\n let s2_x = p3_x - p2_x;\n let s2_y = p3_y - p2_y;\n let s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y);\n let t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);\n if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {\n let x_result = p0_x + (t * s1_x);\n let y_Result = p0_y + (t * s1_y);\n return new Point(vec3.fromValues(x_result, 0, y_Result));\n }\n return null;\n }", "function getCurvature(p1, p2, p3) {\n let x1 = p1.x, y1 = p1.y;\n let x2 = p2.x, y2 = p2.y;\n let x3 = p3.x, y3 = p3.y;\n if (x1 === x2) x1 += 0.0001;\n let k1 = 0.5 * (Math.pow(x1, 2) + Math.pow(y1, 2) - Math.pow(x2, 2) - Math.pow(y2, 2)) / (x1 - x2);\n let k2 = (y1 - y2) / (x1 - x2);\n let b = 0.5 * (Math.pow(x2, 2) - 2 * x2 * k1 + Math.pow(y2, 2) - Math.pow(x3, 2) + 2 * x3 * k1 - Math.pow(y3, 2)) / (x3 * k2 - y3 + y2 - x2 * k2);\n let a = k1 - k2 * b;\n let r = Math.sqrt(Math.pow(x1 - a, 2) + Math.pow(y1 - b, 2));\n let c = 1 / r;\n if (isNaN(c)) {\n return 0.0;\n }\n return c;\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function findIntersection(d) {\n var a1 = d[0].vector.x;\n var a2 = d[1].vector.x;\n var b1 = d[0].vector.y;\n var b2 = d[1].vector.y;\n var c1 = innerProduct(d[0].base, d[0].vector);\n var c2 = innerProduct(d[1].base, d[1].vector);\n var invDet = 1 / (a1 * b2 - b1 * a2);\n if (isZero(invDet)) {\n // no solution: parallel lines\n return null;\n }\n var x = invDet * (b2 * c1 - b1 * c2);\n var y = invDet * (-a2 * c1 + a1 * c2);\n return {x: x, y: y};\n }", "function _segseg (out, p1, p2, p3, p4) {\n let x1 = p1[0]\n let y1 = p1[1]\n let x2 = p2[0]\n let y2 = p2[1]\n let x3 = p3[0]\n let y3 = p3[1]\n let x4 = p4[0]\n let y4 = p4[1]\n\n let a1, a2, b1, b2, c1, c2 // Coefficients of line eqns.\n let r1, r2, r3, r4 // 'Sign' values\n let denom, offset // Intermediate values\n let x, y // Intermediate return values\n\n // Compute a1, b1, c1, where line joining points 1 and 2\n // is \"a1 x + b1 y + c1 = 0\".\n a1 = y2 - y1\n b1 = x1 - x2\n c1 = x2 * y1 - x1 * y2\n\n // Compute r3 and r4.\n r3 = a1 * x3 + b1 * y3 + c1\n r4 = a1 * x4 + b1 * y4 + c1\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ( r3 !== 0 && r4 !== 0 && ((r3 >= 0 && r4 >= 0) || (r3 < 0 && r4 < 0)))\n return DONT_INTERSECT\n\n // Compute a2, b2, c2\n a2 = y4 - y3\n b2 = x3 - x4\n c2 = x4 * y3 - x3 * y4\n\n // Compute r1 and r2\n r1 = a2 * x1 + b2 * y1 + c2\n r2 = a2 * x2 + b2 * y2 + c2\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if (r1 !== 0 && r2 !== 0 && ((r1 >= 0 && r2 >= 0) || (r1 < 0 && r2 < 0)))\n return DONT_INTERSECT\n\n // Line segments intersect: compute intersection point.\n denom = a1 * b2 - a2 * b1\n\n if (denom === 0)\n return COLINEAR\n\n offset = denom < 0 ? - denom / 2 : denom / 2\n\n x = b1 * c2 - b2 * c1\n y = a2 * c1 - a1 * c2\n\n out[0] = ( x < 0 ? x : x ) / denom\n out[1] = ( y < 0 ? y : y ) / denom\n \n return DO_INTERSECT\n}", "function ISECT(state)\n{\n var stack = state.stack;\n var pa0i = stack.pop();\n var pa1i = stack.pop();\n var pb0i = stack.pop();\n var pb1i = stack.pop();\n var pi = stack.pop();\n var z0 = state.z0;\n var z1 = state.z1;\n var pa0 = z0[pa0i];\n var pa1 = z0[pa1i];\n var pb0 = z1[pb0i];\n var pb1 = z1[pb1i];\n var p = state.z2[pi];\n\n if (DEBUG) console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n var x1 = pa0.x;\n var y1 = pa0.y;\n var x2 = pa1.x;\n var y2 = pa1.y;\n var x3 = pb0.x;\n var y3 = pb0.y;\n var x4 = pb1.x;\n var y4 = pb1.y;\n\n var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n var f1 = x1 * y2 - y1 * x2;\n var f2 = x3 * y4 - y3 * x4;\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;\n}", "function findCrossIntersection(ax, ay, bx, by, cx, cy, dx, dy, eps) {\n if (!segmentHit(ax, ay, bx, by, cx, cy, dx, dy)) return null;\n var den = determinant2D(bx - ax, by - ay, dx - cx, dy - cy);\n var m = orient2D(cx, cy, dx, dy, ax, ay) / den;\n var p = [ax + m * (bx - ax), ay + m * (by - ay)];\n if (Math.abs(den) < 1e-18) {\n // assume that collinear and near-collinear segment intersections have been\n // accounted for already.\n // TODO: is this a valid assumption?\n return null;\n }\n\n // Snap p to a vertex if very close to one\n // This avoids tiny segments caused by T-intersection overshoots and prevents\n // pathfinder errors related to f-p rounding.\n // (NOTE: this may no longer be needed, since T-intersections are now detected\n // first)\n if (eps > 0) {\n snapIntersectionPoint(p, ax, ay, bx, by, cx, cy, dx, dy, eps);\n }\n // Clamp point to x range and y range of both segments\n // (This may occur due to fp rounding, if one segment is vertical or horizontal)\n clampIntersectionPoint(p, ax, ay, bx, by, cx, cy, dx, dy);\n return p;\n }", "function getCubicInterpolator(pointsFrom, pointsTo) {\n\n for (var i = 2; i < pointsFrom.length - 1; i += 3) {\n pointsFrom[i - 1].isCubicControl = true;\n pointsFrom[i].isCubicControl = true;\n }\n for (i = 2; i < pointsTo.length - 1; i += 3) {\n pointsTo[i - 1].isCubicControl = true;\n pointsTo[i].isCubicControl = true;\n }\n\n // Replace interpolated points sequence with straight segment\n // TODO: Continue unfinished transition of ending points.\n pointsFrom = pointsFrom.filter(d => !d.isInterpolated);\n var d, p;\n for (i = pointsFrom.length - 2; i >= 0; i--) {\n p = pointsFrom[i + 1];\n d = pointsFrom[i];\n if (!d.isCubicControl && !p.isCubicControl) {\n pointsFrom.splice(\n i + 1,\n 0,\n getBezierPoint(1 / 3, p, d),\n getBezierPoint(2 / 3, p, d)\n );\n pointsFrom[i + 1].isCubicControl = true;\n pointsFrom[i + 2].isCubicControl = true;\n }\n }\n\n // NOTE: Suppose data is already sorted by X.\n // var anchorsFrom = pointsFrom.filter(d => !d.isCubicControl);\n // var anchorsTo = pointsTo.filter(d => !d.isCubicControl);\n var anchorsFrom = pointsFrom.filter((d, i) => i % 3 === 0);\n var anchorsTo = pointsTo.filter((d, i) => i % 3 === 0);\n var idsFrom = anchorsFrom.map(d => d.id);\n var idsTo = anchorsTo.map(d => d.id);\n var indicesFrom = idsFrom.reduce((memo, id) => ((memo[id] = pointsFrom.findIndex(d => d.id === id), memo)), {});\n var indicesTo = idsTo.reduce((memo, id) => ((memo[id] = pointsTo.findIndex(d => d.id === id), memo)), {});\n var remainingIds = idsFrom\n .filter(id => idsTo.indexOf(id) >= 0);\n\n //\n // Determine start and end scales difference to apply\n // to initial target position of newly added points\n // (or end position of deleted points)\n\n var stableFrom = anchorsFrom.filter(d => !d.positionIsBeingChanged);\n var stableTo = anchorsTo.filter(d => !d.positionIsBeingChanged);\n var toEndScale = getScaleDiffFn(stableFrom, stableTo);\n var toStartScale = getScaleDiffFn(stableTo, stableFrom);\n\n var interpolators = [];\n remainingIds.forEach((id, i) => {\n\n var indexFrom = indicesFrom[id];\n var indexTo = indicesTo[id];\n\n if (\n i === 0 &&\n (indexFrom > 0 || indexTo > 0)\n ) {\n interpolators.push(getEndingInterpolator({\n polylineFrom: pointsFrom.slice(0, indexFrom + 1),\n polylineTo: pointsTo.slice(0, indexTo + 1),\n toOppositeScale: indexTo === 0 ? toEndScale : toStartScale,\n isCubic: true\n }));\n }\n\n if (i > 0) {\n var prevIndexFrom = indicesFrom[remainingIds[i - 1]];\n var prevIndexTo = indicesTo[remainingIds[i - 1]];\n if (indexFrom - prevIndexFrom > 3 || indexTo - prevIndexTo > 3) {\n interpolators.push(getInnerInterpolator({\n polylineFrom: pointsFrom.slice(prevIndexFrom, indexFrom + 1),\n polylineTo: pointsTo.slice(prevIndexTo, indexTo + 1),\n isCubic: true\n }));\n } else {\n interpolators.push(getControlsBetweenRemainingInterpolator({\n polylineFrom: pointsFrom.slice(prevIndexFrom, indexFrom + 1),\n polylineTo: pointsTo.slice(prevIndexTo, indexTo + 1)\n }));\n }\n }\n\n interpolators.push(getRemainingPointInterpolator({\n pointFrom: pointsFrom[indexFrom],\n pointTo: pointsTo[indexTo]\n }));\n\n if (\n i === remainingIds.length - 1 &&\n (pointsFrom.length - indexFrom - 1 > 0 ||\n pointsTo.length - indexTo - 1 > 0)\n ) {\n interpolators.push(getEndingInterpolator({\n polylineFrom: pointsFrom.slice(indexFrom),\n polylineTo: pointsTo.slice(indexTo),\n toOppositeScale: pointsTo.length - indexTo === 1 ? toEndScale : toStartScale,\n isCubic: true\n }));\n }\n });\n\n if (interpolators.length === 0 && (\n pointsTo.length > 0 && remainingIds.length === 0 ||\n pointsFrom.length > 0 && remainingIds.length === 0\n )) {\n interpolators.push(getNonRemainingPathInterpolator({\n polylineFrom: pointsFrom.slice(0),\n polylineTo: pointsTo.slice(0),\n isCubic: true\n }));\n }\n\n return (t) => {\n var intermediate = [];\n interpolators.forEach(ipl => {\n var points = ipl(t);\n push(intermediate, points);\n });\n return intermediate;\n };\n}", "function intersectsLine(a,b,c,d,p,q,r,s) {\n var det, gamma, lambda;\n det = (c - a) * (s - q) - (r - p) * (d - b);\n if (det === 0) {\n return false;\n } else {\n lambda = ((s - q) * (r - a) + (p - r) * (s - b)) / det;\n gamma = ((b - d) * (r - a) + (c - a) * (s - b)) / det;\n\n if((0 < lambda && lambda < 1) && (0 < gamma && gamma < 1)) {\n \n // let dir = new THREE.Vector2(c-a, d-b);\n // // dir.normalize();\n\n // let px = a + lambda * dir.x; \n // let py = b + gamma * dir.y;\n \n let dir1 = new THREE.Vector2(c-a, d-b);\n // dir1.normalize();\n let dir2 = new THREE.Vector2(r-p, s-q);\n // dir2.normalize();\n\n let px = (a + lambda * dir1.x); // + (p + gamma * dir2.x); \n let py = (b + lambda * dir1.y); // + (q + gamma * dir2.y); \n \n\n\n return { px: px, py: py };\n }\n\n return false;\n }\n}", "function getControlPoints(x0,y0,x1,y1,x2,y2,t){\n // x0,y0,x1,y1 are the coordinates of the end (knot) pts of this segment\n // x2,y2 is the next knot -- not connected here but needed to calculate p2\n // p1 is the control point calculated here, from x1 back toward x0.\n // p2 is the next control point, calculated here and returned to become the\n // next segment's p1.\n // t is the 'tension' which controls how far the control points spread.\n\n // Scaling factors: distances from this knot to the previous and following knots.\n var d01=Math.sqrt(Math.pow(x1-x0,2)+Math.pow(y1-y0,2));\n var d12=Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));\n\n var fa=t*d01/(d01+d12);\n var fb=t-fa;\n\n var p1x=x1+fa*(x0-x2);\n var p1y=y1+fa*(y0-y2);\n\n var p2x=x1-fb*(x0-x2);\n var p2y=y1-fb*(y0-y2);\n\n return [p1x,p1y,p2x,p2y]\n }", "function inferCubicControlPoint(p0, p2, p3) {\n // Extend p1 away from p0 by 50%. This is the equivalent quadratic point that\n // would give the same slope as catmull rom at p0.\n var p2e0 = -0.5 * p3[0] + 1.5 * p2[0];\n var p2e1 = -0.5 * p3[1] + 1.5 * p2[1];\n\n return [\n (2 * p2e0 + p0[0]) / 3,\n (2 * p2e1 + p0[1]) / 3,\n ];\n}", "static interpolate_poly_segment(pts, i, prop) {\n const pt1 = pts[i%pts.length];\n const pt2 = pts[(i + 1)%pts.length];\n return [\n pt1[0]*(1.0 - prop) + pt2[0]*prop,\n pt1[1]*(1.0 - prop) + pt2[1]*prop\n ];\n }", "function intersectLine(p1,p2,q1,q2){\n// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n// p7 and p473.\nvar a1,a2,b1,b2,c1,c2;var r1,r2,r3,r4;var denom,offset,num;var x,y;\n// Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n// b1 y + c1 = 0.\na1=p2.y-p1.y;b1=p1.x-p2.x;c1=p2.x*p1.y-p1.x*p2.y;\n// Compute r3 and r4.\nr3=a1*q1.x+b1*q1.y+c1;r4=a1*q2.x+b1*q2.y+c1;\n// Check signs of r3 and r4. If both point 3 and point 4 lie on\n// same side of line 1, the line segments do not intersect.\nif(r3!==0&&r4!==0&&sameSign(r3,r4)){return}\n// Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\na2=q2.y-q1.y;b2=q1.x-q2.x;c2=q2.x*q1.y-q1.x*q2.y;\n// Compute r1 and r2\nr1=a2*p1.x+b2*p1.y+c2;r2=a2*p2.x+b2*p2.y+c2;\n// Check signs of r1 and r2. If both point 1 and point 2 lie\n// on same side of second line segment, the line segments do\n// not intersect.\nif(r1!==0&&r2!==0&&sameSign(r1,r2)){return}\n// Line segments intersect: compute intersection point.\ndenom=a1*b2-a2*b1;if(denom===0){return}offset=Math.abs(denom/2);\n// The denom/2 is to get rounding instead of truncating. It\n// is added or subtracted to the numerator, depending upon the\n// sign of the numerator.\nnum=b1*c2-b2*c1;x=num<0?(num-offset)/denom:(num+offset)/denom;num=a2*c1-a1*c2;y=num<0?(num-offset)/denom:(num+offset)/denom;return{x:x,y:y}}", "function line_intersect(v1, v2, p1, p2) {\n\n\t// Ax + By = C\n\tvar Va = v2.y - v1.y,\n\t\tVb = v1.x - v2.x,\n\t\tVc = Va * v1.x + Vb * v1.y,\n\n\t\tPa = p2.y - p1.y,\n\t\tPb = p1.x - p2.x,\n\t\tPc = Pa * p1.x + Pb * p1.y,\n\n\t\tdet = (Va * Pb - Pa * Vb);\n\n\t// parallel lines\n\tif (det == 0) {\n\t\treturn null;\n\t}\n\n\tvar x = (Pb * Vc - Vb * Pc) / det,\n\t\ty = (Va * Pc - Pa * Vc) / det,\n\t\tvdistsq = ((v2.x - v1.x)*(v2.x - v1.x) + (v2.y - v1.y)*(v2.y - v1.y) ),\n\t\tvdotprod = (x - v1.x) * (v2.x - v1.x) + (y - v1.y) * (v2.y - v1.y),\n\t\tpdistsq = ((p2.x - p1.x)*(p2.x - p1.x) + (p2.y - p1.y)*(p2.y - p1.y) ),\n\t\tpdotprod = (x - p1.x) * (p2.x - p1.x) + (y - p1.y) * (p2.y - p1.y);\n\n\t// intersection point is out of bounds\n\tif (vdotprod < 0 || vdotprod > vdistsq || pdotprod < 0 || pdotprod > pdistsq) {\n\t\treturn null;\n\t}\n\n\tvar circle = new Path.Circle(new Point(x, y), 10);\n\tcircle.fillColor = 'green';\n\n\treturn [x, y];\n}", "function ISECT(state)\n{\n const stack = state.stack;\n const pa0i = stack.pop();\n const pa1i = stack.pop();\n const pb0i = stack.pop();\n const pb1i = stack.pop();\n const pi = stack.pop();\n const z0 = state.z0;\n const z1 = state.z1;\n const pa0 = z0[pa0i];\n const pa1 = z0[pa1i];\n const pb0 = z1[pb0i];\n const pb1 = z1[pb1i];\n const p = state.z2[pi];\n\n if (exports.DEBUG) console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n const x1 = pa0.x;\n const y1 = pa0.y;\n const x2 = pa1.x;\n const y2 = pa1.y;\n const x3 = pb0.x;\n const y3 = pb0.y;\n const x4 = pb1.x;\n const y4 = pb1.y;\n\n const div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n const f1 = x1 * y2 - y1 * x2;\n const f2 = x3 * y4 - y3 * x4;\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;\n}", "function LineIntersect(p1, p2, q1, q2) {\n var i = { x: 0, y: 0 };\n var a1 = p2.y - p1.y;\n var b1 = p1.x - p2.x;\n var c1 = a1 * p1.x + b1 * p1.y;\n var a2 = q2.y - q1.y;\n var b2 = q1.x - q2.x;\n var c2 = a2 * q1.x + b2 * q1.y;\n var det = a1 * b2 - a2 * b1;\n if (!FloatEquals(det, 0)) {\n // lines are not parallel\n i.x = (b2 * c1 - b1 * c2) / det;\n i.y = (a1 * c2 - a2 * c1) / det;\n }\n return i;\n }", "function segment_circle_intersection(A, B, C) {\n const CA = vec_sub(C, A), BA = vec_sub(B, A);\n let u = (CA.x * BA.x + CA.y * BA.y) / (BA.x * BA.x + BA.y * BA.y);\n if (u < 0.0) { u = 0.0; }\n if (u > 1.0) { u = 1.0; }\n\n const E = vec_interpolate(A, B, u);\n const d = vec_distance(C, E);\n return { u: u, d: d, E: E, intersects: d <= C.r };\n}", "function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n var t1 = 1 - t;\n var t13 = Math.pow(t1, 3);\n var t12 = Math.pow(t1, 2);\n var t2 = t * t;\n var t3 = t2 * t;\n var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;\n var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;\n var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);\n var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);\n var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);\n var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);\n var ax = t1 * p1x + t * c1x;\n var ay = t1 * p1y + t * c1y;\n var cx = t1 * c2x + t * p2x;\n var cy = t1 * c2y + t * p2y;\n var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI;\n\n if (mx > nx || my < ny) {\n alpha += 180;\n }\n\n return {\n x: x,\n y: y,\n m: { x: mx, y: my },\n n: { x: nx, y: ny },\n start: { x: ax, y: ay },\n end: { x: cx, y: cy },\n alpha: alpha\n };\n }", "function interpolateCubicEnding({t, polyline, decreasing, rightToLeft}) {\n\n var reverse = Boolean(decreasing) !== Boolean(rightToLeft);\n\n var result = (function getLinePiece(t, line) {\n var pointsCount = (line.length - 1) / 3 + 1;\n var q = 0;\n if (t > 0) {\n var distance = [0];\n var totalDistance = 0;\n for (\n var i = 1, x1, y1, x0, y0, cx0, cy0, cx1, cy1, d;\n i < pointsCount;\n i++\n ) {\n x0 = line[i * 3 - 3].x;\n y0 = line[i * 3 - 3].y;\n cx0 = line[i * 3 - 2].x;\n cy0 = line[i * 3 - 2].y;\n cx1 = line[i * 3 - 1].x;\n cy1 = line[i * 3 - 1].y;\n x1 = line[i * 3].x;\n y1 = line[i * 3].y;\n d = (getDistance(x0, y0, cx0, cy0) +\n getDistance(cx0, cy0, cx1, cy1) +\n getDistance(cx1, cy1, x1, y1) +\n getDistance(x1, y1, x0, y0)\n ) / 2;\n totalDistance += d;\n distance.push(totalDistance);\n }\n var passedDistance = t * totalDistance;\n for (i = 1; i < distance.length; i++) {\n if (passedDistance <= distance[i]) {\n q = Math.min(1, (i - 1 +\n (passedDistance - distance[i - 1]) /\n (distance[i] - distance[i - 1])) /\n (pointsCount - 1)\n );\n break;\n }\n }\n }\n\n var existingCount = Math.floor((pointsCount - 1) * q) + 1;\n var tempCount = pointsCount - existingCount;\n var tempStartIdIndex = existingCount * 3;\n var result = line.slice(0, (existingCount - 1) * 3 + 1);\n if (q < 1) {\n var qi = (q * (pointsCount - 1)) % 1;\n var spl = splitCubicSegment(\n qi,\n line.slice((existingCount - 1) * 3, existingCount * 3 + 1)\n );\n var newPiece = spl.slice(1, 4);\n newPiece.forEach(p => p.isInterpolated = true);\n newPiece[2].id = line[tempStartIdIndex].id;\n push(result, newPiece);\n utils.range(1, tempCount).forEach((i) => {\n push(result, [\n {x: newPiece[2].x, y: newPiece[2].y, isCubicControl: true, isInterpolated: true},\n {x: newPiece[2].x, y: newPiece[2].y, isCubicControl: true, isInterpolated: true},\n Object.assign(\n {}, newPiece[2],\n {\n id: line[tempStartIdIndex + i * 3].id,\n isInterpolated: true\n }\n )\n ]);\n });\n }\n return result;\n })(\n (decreasing ? 1 - t : t),\n (reverse ? polyline.slice(0).reverse() : polyline)\n );\n if (reverse) {\n result.reverse();\n }\n\n return result;\n}", "function ISECT(state) {\n var stack = state.stack;\n var pa0i = stack.pop();\n var pa1i = stack.pop();\n var pb0i = stack.pop();\n var pb1i = stack.pop();\n var pi = stack.pop();\n var z0 = state.z0;\n var z1 = state.z1;\n var pa0 = z0[pa0i];\n var pa1 = z0[pa1i];\n var pb0 = z1[pb0i];\n var pb1 = z1[pb1i];\n var p = state.z2[pi];\n\n if (exports.DEBUG) {\n console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);\n }\n\n // math from\n // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line\n\n var x1 = pa0.x;\n var y1 = pa0.y;\n var x2 = pa1.x;\n var y2 = pa1.y;\n var x3 = pb0.x;\n var y3 = pb0.y;\n var x4 = pb1.x;\n var y4 = pb1.y;\n\n var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n var f1 = x1 * y2 - y1 * x2;\n var f2 = x3 * y4 - y3 * x4;\n\n p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;\n p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;\n }", "function getIntersection(x1, y1, x2, y2, x3, y3, x4, y4){\n var denom = ((x2 - x1)*(y4 - y3)-(y2 - y1)*(x4 - x3));\n var r;\n var s;\n var x;\n var y;\n var b = false;\n\n //If lines not collinear or parallel\n if(denom != 0){\n //Intersection in ray \"local\" coordinates\n r = (((y1 - y3) * (x4 - x3)) - (x1 - x3) * (y4 - y3)) / denom;\n\n //Intersection in segment \"local\" coordinates\n s = (((y1 - y3) * (x2 - x1)) - (x1 - x3) * (y2 - y1)) / denom;\n\n //The algorithm gives the intersection of two infinite lines, determine if it lies on the side that the ray is defined on\n if (r >= 0)\n {\n //If point along the line segment\n if (s >= 0 && s <= 1)\n {\n b = true;\n //Get point coordinates (offset by r local units from start of ray)\n x = x1 + r * (x2 - x1);\n y = y1 + r * (y2 - y1);\n }\n }\n }\n var p = [b,x,y];\n return p;\n}", "function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {\n\n var t1 = 1 - t, t13 = Math.pow(t1, 3), t12 = Math.pow(t1, 2), t2 = t * t,\n t3 = t2 * t, x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x +\n t3 * p2x, y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y +\n t3 * p2y, mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x),\n my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y),\n nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x),\n ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y),\n ax = t1 * p1x + t * c1x, ay = t1 * p1y + t * c1y,\n cx = t1 * c2x + t * p2x, cy = t1 * c2y + t * p2y,\n alpha = (90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI);\n\n if (mx > nx || my < ny) { alpha += 180; }\n\n return { x: x, y: y, m: { x: mx, y: my }, n: { x: nx, y: ny },\n start: { x: ax, y: ay }, end: { x: cx, y: cy }, alpha: alpha\n };\n}", "function find_intersection(m, s) {\n // find the 1d intersections on the number line in x an y dimensions\n var x = find_1d_intersection({ \"l\" : m.tl.x, \"r\" : m.br.x }, { \"l\": s.tl.x, \"r\": s.br.x });\n var y = find_1d_intersection({ \"l\" : m.tl.y, \"r\" : m.br.y }, { \"l\": s.tl.y, \"r\": s.br.y });\n\n // return an object that knows its corners \n // tl - top left, br - bottom right, etc.\n return {\n \"tl\": { \"x\" : x.l, \"y\" : y.l },\n \"tr\": { \"x\" : x.r, \"y\" : y.l },\n \"bl\": { \"x\" : x.l, \"y\" : y.r },\n \"br\": { \"x\" : x.r, \"y\" : y.r },\n };\n}", "curvatureInfluence(point, i, allPoints) {\n const curvature = this.averageMCurvature(this.getPointsToMeasure(i, allPoints)) * this.segCurveMultiplier;\n const curveDirection = curvature < 0 ? 1 : -1;\n\n let nextPoint = allPoints[i + 1];\n\n if (!nextPoint && this.wrapEnd) {\n // If wrapped, the next point at the end is the start\n nextPoint = allPoints[0];\n }\n\n const tangent = nextPoint.sub(point);\n const biangle = tangent.angle() + 1.5708 * curveDirection;\n const bitangent = uvFromAngle(biangle).setMag(Math.abs(curvature));\n\n const a = tangent.normalize();\n const b = bitangent.normalize();\n let mVector = a.mix(b, this.mixTangentRatio);\n\n // Noise to add interesting extra flows\n if (this.noiseFn) {\n const t = this.noiseFn(point.x, point.y);\n\n if (this.noiseMode === 'mix' && Math.abs(t) > this.noiseStrengthAffect) {\n // Mix the strength of the noise\n const n = uvFromAngle(t);\n mVector = mVector.mix(n, this.mixNoiseRatio);\n } else if (this.noiseMode === 'flowInTo') {\n // \"Flow\" into lower areas, zero out high areas\n if (t < 0) {\n const n = uvFromAngle(t);\n mVector = mVector.mix(n, this.mixNoiseRatio);\n } else {\n // TODO scale down based on noise, not zero\n mVector = new Vector(0, 0);\n }\n } else if (this.noiseMode === 'scaleMag') {\n const nscale = mapRange(0, this.noiseStrengthAffect, 5, 1, 3, Math.abs(t));\n mVector = mVector.setMag(nscale);\n }\n }\n\n // Increase the strength\n if (this.mixMagnitude) {\n mVector = mVector.setMag(this.mixMagnitude);\n }\n\n // Limit the length\n if (this.influenceLimit > 0) {\n mVector = mVector.limit(this.influenceLimit);\n }\n\n return mVector;\n }", "doLineSegmentsIntersect (Ax, Ay, Bx, By, Cx, Cy, Dx, Dy) {\n const Sx = Bx - Ax\n const Sy = By - Ay\n const Tx = Dx - Cx\n const Ty = Dy - Cy\n const u = (-Sy * (Ax - Cx) + Sx * (Ay - Cy)) / (-Tx * Sy + Sx * Ty)\n const v = (Tx * (Ay - Cy) - Ty * (Ax - Cx)) / (-Tx * Sy + Sx * Ty)\n return u >= 0 && u <= 1 && v >= 0 && v <= 1\n }", "function circleLineIntersection(cc, r, p1, p2) {\n var x1 = p1[0],\n y1 = p1[1],\n x2 = p2[0],\n y2 = p2[1],\n xc = cc[0],\n yc = cc[1],\n a = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1),\n b = 2 * ((x2 - x1) * (x1 - xc) + (y2 - y1) * (y1 - yc)),\n c =\n xc * xc + yc * yc + x1 * x1 + y1 * y1 - 2 * (xc * x1 + yc * y1) - r * r,\n d = b * b - 4 * a * c,\n u1 = 0,\n u2 = 0,\n x = 0,\n y = 0;\n if (a === 0) {\n return [0, [0, 0]];\n } else if (d < 0) {\n return [0, [0, 0]];\n }\n u1 = (-b + sqrt(d)) / (2 * a);\n u2 = (-b - sqrt(d)) / (2 * a);\n if (0 <= u1 && u1 <= 1) {\n x = x1 + u1 * (x2 - x1);\n y = y1 + u1 * (y2 - y1);\n return [1, [x, y]];\n } else if (0 <= u2 && u2 <= 1) {\n x = x1 + u2 * (x2 - x1);\n y = y1 + u2 * (y2 - y1);\n return [1, [x, y]];\n } else {\n return [0, [0, 0]];\n }\n }", "function _default(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n,\n p0 = segment[0],\n p1 = segment[n],\n x;\n\n if ((0, _pointEqual.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n\n stream.lineEnd();\n return;\n } // handle degenerate cases by moving the point\n\n\n p1[0] += 2 * _math.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n\n while (current.v) if ((current = current.n) === start) return;\n\n points = current.z;\n stream.lineStart();\n\n do {\n current.v = current.o.v = true;\n\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n\n current = current.p;\n }\n\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n\n stream.lineEnd();\n }\n}", "function inter(ray,segment){\n ray.a = ray.origin;\n ray.b = ray.dir;\n segment.a = segment.origin;\n segment.b = segment.dir; \n\n\tvar r_px = ray.a.x;\n\tvar r_py = ray.a.y;\n\tvar r_dx = ray.b.x-ray.a.x;\n\tvar r_dy = ray.b.y-ray.a.y;\n\tvar s_px = segment.a.x;\n\tvar s_py = segment.a.y;\n\tvar s_dx = segment.b.x-segment.a.x;\n\tvar s_dy = segment.b.y-segment.a.y;\n\tvar r_mag = Math.sqrt(r_dx*r_dx+r_dy*r_dy);\n\tvar s_mag = Math.sqrt(s_dx*s_dx+s_dy*s_dy);\n\n\tif(r_dx/r_mag==s_dx/s_mag && r_dy/r_mag==s_dy/s_mag)\n\t\treturn null;\n\n\tvar T2 = (r_dx*(s_py-r_py) + r_dy*(r_px-s_px))/(s_dx*r_dy - s_dy*r_dx);\n\tvar T1 = (s_px+s_dx*T2-r_px)/r_dx;\n\n\tif( (T1<0) || (T2<0 || T2>1) ) \n return null;\n\n\treturn {\n p : new Vec2(r_px+r_dx*T1, r_py+r_dy*T1),\n\t\tparam: T1,\n m : segment\n\t};\n}", "function intersect(p1, q1, p2, q2)\n{\n let res = false;\n // Find the four orientations needed for general and \n // special cases \n let o1 = orientation(p1, q1, p2);\n let o2 = orientation(p1, q1, q2);\n let o3 = orientation(p2, q2, p1);\n let o4 = orientation(p2, q2, q1);\n\n // General case \n if (o1 != o2 && o3 != o4)\n res = true;\n\n // Special Cases \n // p2 and q2 both lies on segment p1q1 \n if ((o1 == 0 && onSegment(p1, p2, q1)) && (o2 == 0 && onSegment(p1, q2, q1))) {\n let disP2 = ((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2) ** 0.5;\n let disQ2 = ((p1.x - q2.x) ** 2 + (p1.y - q2.y) ** 2) ** 0.5;\n return disP2 < disQ2 ? p2 : q2;\n }\n\n if (res) {\n let denominator = ((q2.y - p2.y) * (q1.x - p1.x) - (q2.x - p2.x) * (q1.y - p1.y));\n let ua = ((q2.x - p2.x) * (p1.y - p2.y) - (q2.y - p2.y) * (p1.x - p2.x)) / denominator;\n let x = p1.x + ua * (q1.x - p1.x);\n let y = p1.y + ua * (q1.y - p1.y);\n return {x, y}\n }\n\n return res; // Doesn't fall in any of the above cases \n}", "function findIntersectionPoint(line1, line2) { //http://stackoverflow.com/a/565282/6283767\n\tconst p = line1[0];\n\tconst q = line2[0];\n\tconst r = line1[1].subtract(line1[0]);\n\tconst s = line2[1].subtract(line2[0]);\n\tconst t = q.subtract(p).crossProduct(s) / (r.crossProduct(s));\n\tconst u = q.subtract(p).crossProduct(r) / (r.crossProduct(s));\n\tif (line1[0] === line2[0] || line1[1] === line2[0] || line1[0] === line2[1] || line1[1] === line2[1]) { //They're touching each other on the edge\n\t\treturn new Point(0, 0);\n\t} else if (r.crossProduct(s) === 0 && (q.subtract(p).crossProduct(r) === 0)) { //Collinear\n\t\treturn new Point(0, 0);\n\t} else if (r.crossProduct(s) === 0 && (q.subtract(p).crossProduct(r) !== 0)) { //Parallel lines\n\t\treturn new Point(0, 0);\n\t} else if (r.crossProduct(s) !== 0 && ((0 <= t && t <= 1) && (0 <= u && u <= 1))) {\n\t\tconst newP = p.add(r.scale(t));\n\t\treturn newP;\n\t} else {\n\t\treturn new Point(0, 0);\n\t}\n}", "function closestPointS_2Segments(A0,A1,B0,B1){\n\tvar u = A1.clone().sub(A0),\n\t\tv = B1.clone().sub(B0),\n\t\tw = A0.clone().sub(B0),\n\t\ta = Vec3.dot(u,u), // always >= 0\n\t\tb = Vec3.dot(u,v),\n\t\tc = Vec3.dot(v,v), // always >= 0\n\t\td = Vec3.dot(u,w),\n\t\te = Vec3.dot(v,w),\n\t\tD = a*c - b*b, // always >= 0\n \tsc, sN, sD = D, // sc = sN / sD, default sD = D >= 0\n \ttc, tN, tD = D; // tc = tN / tD, default tD = D >= 0\n\n \t// compute the line parameters of the two closest points\n if(D < 0.000001){ // the lines are almost parallel\n sN = 0.0; // force using point P0 on segment S1\n sD = 1.0; // to prevent possible division by 0.0 later\n tN = e;\n tD = c;\n }else{ // get the closest points on the infinite lines\n sN = (b*e - c*d);\n tN = (a*e - b*d);\n if(sN < 0.0){ // sc < 0 => the s=0 edge is visible\n sN = 0.0;\n tN = e;\n tD = c;\n }else if (sN > sD){ // sc > 1 => the s=1 edge is visible\n sN = sD;\n tN = e + b;\n tD = c;\n }\n }\n\n if (tN < 0.0){ // tc < 0 => the t=0 edge is visible\n tN = 0.0;\n // recompute sc for this edge\n if (-d < 0.0)\t\tsN = 0.0;\n else if (-d > a)\tsN = sD;\n else{\n sN = -d;\n sD = a;\n }\n }else if(tN > tD){ // tc > 1 => the t=1 edge is visible\n tN = tD;\n // recompute sc for this edge\n if((-d + b) < 0.0)\t\tsN = 0;\n else if ((-d + b) > a)\tsN = sD;\n else{\n sN = (-d + b);\n sD = a;\n }\n }\n\n // finally do the division to get sc and tc\n sc = (Math.abs(sN) < 0.000001 ? 0.0 : sN / sD);\n tc = (Math.abs(tN) < 0.000001 ? 0.0 : tN / tD);\n\n // get the difference of the two closest points\n //Vector dP = w + (sc * u) - (tc * v); // = S1(sc) - S2(tc)\n\n\treturn [ u.scale(sc).add(A0), v.scale(tc).add(B0) ];\n}", "function getintersection2d(la,lb,lc,ld,i0) {\n\tvar e = lb.x - la.x;\n\tvar f = lc.x - ld.x;\n\tvar g = lc.x - la.x;\n\tvar h = lb.y - la.y;\n\tvar j = lc.y - ld.y;\n\tvar k = lc.y - la.y;\n\tvar det = e*j - f*h;\n\tif (det == 0)\n\t\treturn false;\n\tdet = 1/det;\n\tvar t0 = (g*j - f*k)*det;\n\tvar t1 = -(g*h - e*k)*det;\n\tif (t0>=0 && t0<=1 && t1>=0 && t1<=1) {\n\t\tif (i0) {\n\t\t\ti0.x = la.x + (lb.x - la.x)*t0;\n\t\t\ti0.y = la.y + (lb.y - la.y)*t0;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}", "function getintersection2d(la,lb,lc,ld,i0) {\n\tvar e = lb.x - la.x;\n\tvar f = lc.x - ld.x;\n\tvar g = lc.x - la.x;\n\tvar h = lb.y - la.y;\n\tvar j = lc.y - ld.y;\n\tvar k = lc.y - la.y;\n\tvar det = e*j - f*h;\n\tif (det == 0)\n\t\treturn false;\n\tdet = 1/det;\n\tvar t0 = (g*j - f*k)*det;\n\tvar t1 = -(g*h - e*k)*det;\n\tif (t0>=0 && t0<=1 && t1>=0 && t1<=1) {\n\t\tif (i0) {\n\t\t\ti0.x = la.x + (lb.x - la.x)*t0;\n\t\t\ti0.y = la.y + (lb.y - la.y)*t0;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}", "function ifIsectAddToOutput(ring0, edge0, ring1, edge1) {\n var start0 = coord[ring0][edge0];\n var end0 = coord[ring0][edge0+1];\n var start1 = coord[ring1][edge1];\n var end1 = coord[ring1][edge1+1];\n\n var isect = intersect(start0, end0, start1, end1);\n\n if (isect == null) return; // discard parallels and coincidence\n frac0, frac1;\n if (end0[0] != start0[0]) {\n var frac0 = (isect[0]-start0[0])/(end0[0]-start0[0]);\n } else {\n var frac0 = (isect[1]-start0[1])/(end0[1]-start0[1]);\n };\n if (end1[0] != start1[0]) {\n var frac1 = (isect[0]-start1[0])/(end1[0]-start1[0]);\n } else {\n var frac1 = (isect[1]-start1[1])/(end1[1]-start1[1]);\n };\n if (frac0 >= 1 || frac0 <= 0 || frac1 >= 1 || frac1 <= 0) return; // require segment intersection\n\n var key = isect;\n var unique = !seen[key];\n if (unique) {\n seen[key] = true;\n }\n\n if (filterFn) {\n output.push(filterFn(isect, ring0, edge0, start0, end0, frac0, ring1, edge1, start1, end1, frac1, unique));\n } else {\n output.push(isect);\n }\n }", "function CheckIntSegCircle(a0, a1, b0, b1, r, p)\n{\n // Calculate 'a' path relative to 'b'\n var a0_rel = vec2.subtract(vec2.create(), a0, b0);\n var a1_rel = vec2.subtract(vec2.create(), a1, b1);\n\n // Based on MathWorld Circle-Line Intersection Article\n // http://mathworld.wolfram.com/Circle-LineIntersection.html\n\n // Line-circle intersection variables\n var dx = a1_rel[0] - a0_rel[0];\n var dy = a1_rel[1] - a0_rel[1];\n var dr = Math.sqrt(dx*dx + dy*dy);\n var d_mat = mat2.fromValues(a0_rel[0], a0_rel[1], a1_rel[0], a1_rel[1]);\n var d_det = mat2.determinant(d_mat);\n var discriminant = r*r * dr*dr - d_det*d_det;\n var discr_sqrt;\n var x_num1, x_num2, y_num1, y_num2;\n var p1 = vec2.create();\n var p2 = vec2.create();\n var dx1, dx2, dy1, dy2;\n var t;\n\n // Check discriminant\n if (discriminant < 0.0)\n {\n // No intersection\n p = null;\n return false;\n }\n else\n {\n // Calculate equation parts\n discr_sqrt = Math.sqrt(discriminant);\n x_num1 = d_det * dy;\n if (dy < 0)\n {\n x_num2 = dx * discr_sqrt;\n }\n else\n {\n x_num2 = -dx * discr_sqrt;\n }\n y_num1 = -d_det * dx;\n y_num2 = Math.abs(dy) * discr_sqrt;\n\n // TODO: Check if collision is within segment length (below)\n\n // Final solution(s)\n if (discriminant == 0.0)\n {\n // Tangent case - one solution\n p[0] = x_num1 / (dr*dr);\n p[1] = y_num1 / (dr*dr);\n\n // Back-calculate absolute position\n // Determine \"tiem of intersection\"\n t = vec2.len(vec2.subtract(vec2.create(), p, a0_rel)) /\n vec2.len(vec2.subtract(vec2.create(), a1_rel, a0, rel));\n\n // Check if contact is within time step\n if (t >= 0 && t <= 1)\n {\n // Calculate absolute position\n vec2.add(p, a0,\n vec2.scale(vec2.create(),\n vec2.subtract(vec2.create(), a1, a0),\n t));\n\n return true;\n }\n else\n {\n p = null;\n return false;\n }\n }\n else\n {\n // Non-tangent - two solutions\n p1[0] = (x_num1 + x_num2) / (dr*dr);\n p1[1] = (y_num1 + y_num2) / (dr*dr);\n p2[0] = (x_num1 - x_num2) / (dr*dr);\n p2[1] = (y_num1 - y_num2) / (dr*dr);\n\n // Determine first-occuring solution\n dx1 = p1[0] - a0_rel[0];\n dx2 = p2[0] - a0_rel[0];\n dy1 = p1[1] - a0_rel[1];\n dy2 = p2[1] - a0_rel[1];\n\n // TODO: do t calculations first and use to check for first-occurring\n // TODO: re-use length calculations for efficiency\n\n if ((dx1*dx1 + dy1*dy1) <= (dx2*dx2 + dy2*dy2))\n {\n // First-occuring solution is '1'\n // Calculate \"t\"\n t = Math.sqrt(dx1*dx1 + dy1*dy1) / Math.sqrt(dx*dx + dy*dy);\n\n // Check if contact is within time step\n if (t >= 0 && t <= 1)\n {\n // Calculate absolute position\n vec2.add(p, a0,\n vec2.scale(vec2.create(),\n vec2.subtract(vec2.create(), a1, a0),\n t));\n\n return true;\n }\n else\n {\n p = null;\n return false;\n }\n }\n else\n {\n // First-occuring solution is '2'\n // Calculate \"t\"\n t = Math.sqrt(dx2*dx2 + dy2*dy2) / Math.sqrt(dx*dx + dy*dy);\n\n // Check if contact is within time step\n if (t >= 0 && t <= 1)\n {\n // Calculate absolute position\n vec2.add(p, a0,\n vec2.scale(vec2.create(),\n vec2.subtract(vec2.create(), a1, a0),\n t));\n\n return true;\n }\n else\n {\n p = null;\n return false;\n }\n }\n }\n }\n}", "function intersectLineCircle( x1, y1, x2, y2, cx, cy, r) {\n \"use strict\";\n var sqR = r*r;\n //Check if segment extremes are inside the circle\n var oneInside = (cx-x1)*(cx-x1)+(cy-y1)*(cy-y1) < sqR;\n var twoInside = (cx-x2)*(cx-x2)+(cy-y2)*(cy-y2) < sqR;\n\n //If segment is inside the circle there is no intersection\n if (oneInside && twoInside) return null;\n\n //Get a normalized vector (sx, sy) in the direction of the segment and its magnitude (sLength)\n var dx = x2-x1;\n var dy = y2-y1; \n var sLength = Math.sqrt(dx*dx + dy*dy);\n var sx = dx/sLength;\n var sy = dy/sLength;\n\n //Calculate the length of the projected line (pLength) connecting the origin\n // of the segment (x1, y1) to the center of the circle (cx, cy) using dot product\n var pLength = (cx-x1)*sx + (cy-y1)*sy;\n\n //Check if closest point in the segment is one of the segment extremes and if there is intersection in that case\n if ((pLength < 0 && !oneInside) || (pLength > sLength && !twoInside)) return null;\n\n //Else, closest point is between both extremes\n //If distance from this point to center is bigger than radius there is no intersection\n var x = x1 + sx * pLength;\n var y = y1 + sy * pLength;\n var d = sqR - ((x-cx)*(x-cx) + (y-cy)*(y-cy));\n if (d < 0) return null;\n\n //Calculate distance from this point to intersection points (applying Pythagoras theorem)\n d = Math.sqrt(d);\n //Calculate intersection points\n var result = [];\n if (oneInside) {\n result.push(createVector(x+sx*d, y+sy*d));\n return result;\n }\n\n if (twoInside) {\n result.push(createVector(x-sx*d, y-sy*d));\n return result;\n }\n\n result.push(createVector(x+sx*d, y+sy*d));\n result.push(createVector(x-sx*d, y-sy*d));\n\n return result;\n\n}", "function lineSegmentsIntersect (x1, y1, x2, y2, x3, y3, x4, y4) {\n var x=((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n var y=((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4));\n if (isNaN(x)||isNaN(y)) {\n return false;\n } else {\n if (x1>=x2) {\n if (!(x2<=x&&x<=x1)) {return false;}\n } else {\n if (!(x1<=x&&x<=x2)) {return false;}\n }\n if (y1>=y2) {\n if (!(y2<=y&&y<=y1)) {return false;}\n } else {\n if (!(y1<=y&&y<=y2)) {return false;}\n }\n if (x3>=x4) {\n if (!(x4<=x&&x<=x3)) {return false;}\n } else {\n if (!(x3<=x&&x<=x4)) {return false;}\n }\n if (y3>=y4) {\n if (!(y4<=y&&y<=y3)) {return false;}\n } else {\n if (!(y3<=y&&y<=y4)) {return false;}\n }\n }\n return true;\n}", "function segment(line, intersect1, intersect2) {\n this.line = line;\n this.intersect1 = intersect1;\n this.intersect2 = intersect2;\n }", "function getLeftRightIntersections(params) {\n var vertices = params.vertices;\n var matrix = params.matrix;\n var PForward = params.PForward;\n var PMiddle = params.PMiddle;\n var leftIntersection;\n var rightIntersection;\n var p0 = new THREE.Vector3();\n var p1 = new THREE.Vector3();\n var P = PForward;\n var EPSILON = 0.0000001;\n for (var i = 0; i < vertices.length - 1; i++) {\n var v0 = vertices[i];\n var v1 = vertices[i + 1];\n p0.set(v0.x, v0.y, v0.z).applyMatrix4(matrix);\n p1.set(v1.x, v1.y, v1.z).applyMatrix4(matrix);\n var denominador = P.B * p1.y + P.A * p1.x - P.B * p0.y - P.A * p0.x;\n if (Math.abs(denominador) < EPSILON) {\n continue;\n }\n var u = -(P.B * p0.y + P.A * p0.x + P.D) / denominador;\n var pIntersect = {\n x: (1 - u) * p0.x + u * p1.x,\n y: (1 - u) * p0.y + u * p1.y,\n z: (1 - u) * p0.z + u * p1.z\n };\n if (u >= 0 && u <= 1) {\n var ev = P.A * pIntersect.x + P.B * pIntersect.y + P.D;\n var evSide = PMiddle.A * pIntersect.x + PMiddle.B * pIntersect.y + PMiddle.D;\n if (evSide > 0) {\n rightIntersection = pIntersect;\n } else {\n leftIntersection = pIntersect;\n }\n }\n /*\n PB p0y + PA p0x + PD\n [u = - ---------------------------------]\n PB p1y + PA p1x - PB p0y - PA p0x\n */\n }\n return {\n left: leftIntersection,\n right: rightIntersection\n };\n }", "intersection(start, end, sideStart, sideEnd) {\n let line = end.clone().subtract(start)\n let side = sideEnd.clone().subtract(sideStart)\n let lineCrossSidePerp = line.x * side.y - line.y * side.x\n\n // if line Cross side === 0, it means the lines are parallel so have infinite intersection points\n if (lineCrossSidePerp === 0) {\n return null\n }\n\n const diff = sideStart.clone().subtract(start)\n let t = (diff.x * side.y - diff.y * side.x) / lineCrossSidePerp\n if (t < 0 || t >= 1) {\n return null\n }\n\n const u = (diff.x * line.y - diff.y * line.x) / lineCrossSidePerp\n if (u < 0 || u >= 1) {\n return null\n }\n\n return start.clone().add(line.clone().multiply(new Victor(t, t)))\n }", "function interpolygonTwoLines(P1, m1, P2, m2) {\n var x1 = P1[0];\n var y1 = P1[1];\n var x2 = P2[0];\n var y2 = P2[1];\n var x3, y3;\n if (Math.abs(m2) == \"Infinity\") {\n x3 = x2;\n y3 = m1*(x3 - x1) + y1;\n }\n else if (Math.abs(m1) == \"Infinity\") {\n x3 = x1;\n y3 = m2*(x3 - x2) + y2;\n }\n else {\n x3 = (m1*x1 - m2*x2 + y2 -y1) / (m1 - m2);\n y3 = m1*(x3 - x1) + y1; \n }\n interpolygonPoint = [x3, y3];\n return interpolygonPoint;\n}", "function F(e,t,n){// computes for inPt the corresponding point inPt' on a new contour\n// shifted by 1 unit (length of normalized vector) to the left\n// if we walk along contour clockwise, this new contour is outside the old one\n//\n// inPt' is the intersection of the two lines parallel to the two\n// adjacent edges of inPt at a distance of 1 unit on the left side.\nvar i,r,o,a=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=a*a+s*s,h=a*c-s*l;// resulting translation vector for inPt\n// good reading for geometry algorithms (here: line-line intersection)\n// http://geomalgorithms.com/a05-_intersect-1.html\nif(Math.abs(h)>Number.EPSILON){// not collinear\n// length of vectors for normalizing\nvar d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+a/d,g=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(a*c-s*l),v=(// vector from inPt to intersection point\ni=f+a*g-e.x)*i+(r=m+s*g-e.y)*r;if(v<=2)return new _t(i,r);o=Math.sqrt(v/2)}else{// handle special case of collinear edges\nvar y=!1;// assumes: opposite\na>Number.EPSILON?l>Number.EPSILON&&(y=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(// console.log(\"Warning: lines are a straight sequence\");\ni=-s,r=a,o=Math.sqrt(u)):(// console.log(\"Warning: lines are a straight spike\");\ni=a,r=s,o=Math.sqrt(u/2))}return new _t(i/o,r/o)}", "drawCatmullRom(points, f) {\n // invent a virtual first and last point\n const f0 = points[0],\n f1 = points[1],\n fn = f0.reflect(f1),\n l1 = points[points.length - 2],\n l0 = points[points.length - 1],\n ln = l0.reflect(l1),\n cpoints = [fn, ...points, ln];\n\n // four point sliding window over the segment\n for (let i = 0, e = cpoints.length - 3; i < e; i++) {\n let [c1, c2, c3, c4] = cpoints.slice(i, i + 4);\n let p2 = {\n x: c2.x + (c3.x - c1.x) / (6 * f),\n y: c2.y + (c3.y - c1.y) / (6 * f),\n };\n let p3 = {\n x: c3.x - (c4.x - c2.x) / (6 * f),\n y: c3.y - (c4.y - c2.y) / (6 * f),\n };\n this.ctx.bezierCurveTo(p2.x, p2.y, p3.x, p3.y, c3.x, c3.y);\n }\n }", "function raySegmentIntersection(pi, vi, pj, vj) {\n const intersection = segmentSegmentIntersection(pj, vj, pi, vi);\n if (intersection === null) return interval.empty();\n const { t, s } = intersection;\n // t is time in ray, s parameter on the segment\n if (t <= 0 || s < 0 || s > 1) {\n return interval.empty();\n }\n return interval(t, Number.POSITIVE_INFINITY);\n}", "function Spline( points ) {\n\n\tthis.points = points;\n\n\tvar c = [], v3 = { x: 0, y: 0, z: 0 },\n\tpoint, intPoint, weight, w2, w3,\n\tpa, pb, pc, pd;\n\n\tthis.initFromArray = function ( a ) {\n\n\t\tthis.points = [];\n\n\t\tfor ( var i = 0; i < a.length; i ++ ) {\n\n\t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\n\n\t\t}\n\n\t};\n\n\tthis.getPoint = function ( k ) {\n\n\t\tpoint = ( this.points.length - 1 ) * k;\n\t\tintPoint = Math.floor( point );\n\t\tweight = point - intPoint;\n\n\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\n\t\tc[ 1 ] = intPoint;\n\t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\n\t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\n\n\t\tpa = this.points[ c[ 0 ] ];\n\t\tpb = this.points[ c[ 1 ] ];\n\t\tpc = this.points[ c[ 2 ] ];\n\t\tpd = this.points[ c[ 3 ] ];\n\n\t\tw2 = weight * weight;\n\t\tw3 = weight * w2;\n\n\t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\n\t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\n\t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\n\n\t\treturn v3;\n\n\t};\n\n\tthis.getControlPointsArray = function () {\n\n\t\tvar i, p, l = this.points.length,\n\t\t\tcoords = [];\n\n\t\tfor ( i = 0; i < l; i ++ ) {\n\n\t\t\tp = this.points[ i ];\n\t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\n\n\t\t}\n\n\t\treturn coords;\n\n\t};\n\n\t// approximate length by summing linear segments\n\n\tthis.getLength = function ( nSubDivisions ) {\n\n\t\tvar i, index, nSamples, position,\n\t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\n\t\t\toldPosition = new Vector3(),\n\t\t\ttmpVec = new Vector3(),\n\t\t\tchunkLengths = [],\n\t\t\ttotalLength = 0;\n\n\t\t// first point has 0 length\n\n\t\tchunkLengths[ 0 ] = 0;\n\n\t\tif ( ! nSubDivisions ) nSubDivisions = 100;\n\n\t\tnSamples = this.points.length * nSubDivisions;\n\n\t\toldPosition.copy( this.points[ 0 ] );\n\n\t\tfor ( i = 1; i < nSamples; i ++ ) {\n\n\t\t\tindex = i / nSamples;\n\n\t\t\tposition = this.getPoint( index );\n\t\t\ttmpVec.copy( position );\n\n\t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\n\n\t\t\toldPosition.copy( position );\n\n\t\t\tpoint = ( this.points.length - 1 ) * index;\n\t\t\tintPoint = Math.floor( point );\n\n\t\t\tif ( intPoint !== oldIntPoint ) {\n\n\t\t\t\tchunkLengths[ intPoint ] = totalLength;\n\t\t\t\toldIntPoint = intPoint;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// last point ends with total length\n\n\t\tchunkLengths[ chunkLengths.length ] = totalLength;\n\n\t\treturn { chunks: chunkLengths, total: totalLength };\n\n\t};\n\n\tthis.reparametrizeByArcLength = function ( samplingCoef ) {\n\n\t\tvar i, j,\n\t\t\tindex, indexCurrent, indexNext,\n\t\t\trealDistance,\n\t\t\tsampling, position,\n\t\t\tnewpoints = [],\n\t\t\ttmpVec = new Vector3(),\n\t\t\tsl = this.getLength();\n\n\t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\n\n\t\tfor ( i = 1; i < this.points.length; i ++ ) {\n\n\t\t\t//tmpVec.copy( this.points[ i - 1 ] );\n\t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\n\n\t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\n\n\t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\n\n\t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\n\t\t\tindexNext = i / ( this.points.length - 1 );\n\n\t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\n\n\t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\n\n\t\t\t\tposition = this.getPoint( index );\n\t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\n\n\t\t\t}\n\n\t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\n\n\t\t}\n\n\t\tthis.points = newpoints;\n\n\t};\n\n\t// Catmull-Rom\n\n\tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\n\n\t\tvar v0 = ( p2 - p0 ) * 0.5,\n\t\t\tv1 = ( p3 - p1 ) * 0.5;\n\n\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n\t}\n\n}", "function Spline( points ) {\n\n\tthis.points = points;\n\n\tvar c = [], v3 = { x: 0, y: 0, z: 0 },\n\tpoint, intPoint, weight, w2, w3,\n\tpa, pb, pc, pd;\n\n\tthis.initFromArray = function ( a ) {\n\n\t\tthis.points = [];\n\n\t\tfor ( var i = 0; i < a.length; i ++ ) {\n\n\t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\n\n\t\t}\n\n\t};\n\n\tthis.getPoint = function ( k ) {\n\n\t\tpoint = ( this.points.length - 1 ) * k;\n\t\tintPoint = Math.floor( point );\n\t\tweight = point - intPoint;\n\n\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\n\t\tc[ 1 ] = intPoint;\n\t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\n\t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\n\n\t\tpa = this.points[ c[ 0 ] ];\n\t\tpb = this.points[ c[ 1 ] ];\n\t\tpc = this.points[ c[ 2 ] ];\n\t\tpd = this.points[ c[ 3 ] ];\n\n\t\tw2 = weight * weight;\n\t\tw3 = weight * w2;\n\n\t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\n\t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\n\t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\n\n\t\treturn v3;\n\n\t};\n\n\tthis.getControlPointsArray = function () {\n\n\t\tvar i, p, l = this.points.length,\n\t\t\tcoords = [];\n\n\t\tfor ( i = 0; i < l; i ++ ) {\n\n\t\t\tp = this.points[ i ];\n\t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\n\n\t\t}\n\n\t\treturn coords;\n\n\t};\n\n\t// approximate length by summing linear segments\n\n\tthis.getLength = function ( nSubDivisions ) {\n\n\t\tvar i, index, nSamples, position,\n\t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\n\t\t\toldPosition = new Vector3(),\n\t\t\ttmpVec = new Vector3(),\n\t\t\tchunkLengths = [],\n\t\t\ttotalLength = 0;\n\n\t\t// first point has 0 length\n\n\t\tchunkLengths[ 0 ] = 0;\n\n\t\tif ( ! nSubDivisions ) nSubDivisions = 100;\n\n\t\tnSamples = this.points.length * nSubDivisions;\n\n\t\toldPosition.copy( this.points[ 0 ] );\n\n\t\tfor ( i = 1; i < nSamples; i ++ ) {\n\n\t\t\tindex = i / nSamples;\n\n\t\t\tposition = this.getPoint( index );\n\t\t\ttmpVec.copy( position );\n\n\t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\n\n\t\t\toldPosition.copy( position );\n\n\t\t\tpoint = ( this.points.length - 1 ) * index;\n\t\t\tintPoint = Math.floor( point );\n\n\t\t\tif ( intPoint !== oldIntPoint ) {\n\n\t\t\t\tchunkLengths[ intPoint ] = totalLength;\n\t\t\t\toldIntPoint = intPoint;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// last point ends with total length\n\n\t\tchunkLengths[ chunkLengths.length ] = totalLength;\n\n\t\treturn { chunks: chunkLengths, total: totalLength };\n\n\t};\n\n\tthis.reparametrizeByArcLength = function ( samplingCoef ) {\n\n\t\tvar i, j,\n\t\t\tindex, indexCurrent, indexNext,\n\t\t\trealDistance,\n\t\t\tsampling, position,\n\t\t\tnewpoints = [],\n\t\t\ttmpVec = new Vector3(),\n\t\t\tsl = this.getLength();\n\n\t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\n\n\t\tfor ( i = 1; i < this.points.length; i ++ ) {\n\n\t\t\t//tmpVec.copy( this.points[ i - 1 ] );\n\t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\n\n\t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\n\n\t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\n\n\t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\n\t\t\tindexNext = i / ( this.points.length - 1 );\n\n\t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\n\n\t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\n\n\t\t\t\tposition = this.getPoint( index );\n\t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\n\n\t\t\t}\n\n\t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\n\n\t\t}\n\n\t\tthis.points = newpoints;\n\n\t};\n\n\t// Catmull-Rom\n\n\tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\n\n\t\tvar v0 = ( p2 - p0 ) * 0.5,\n\t\t\tv1 = ( p3 - p1 ) * 0.5;\n\n\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n\t}\n\n}", "function Spline( points ) {\n\n\tthis.points = points;\n\n\tvar c = [], v3 = { x: 0, y: 0, z: 0 },\n\tpoint, intPoint, weight, w2, w3,\n\tpa, pb, pc, pd;\n\n\tthis.initFromArray = function ( a ) {\n\n\t\tthis.points = [];\n\n\t\tfor ( var i = 0; i < a.length; i ++ ) {\n\n\t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\n\n\t\t}\n\n\t};\n\n\tthis.getPoint = function ( k ) {\n\n\t\tpoint = ( this.points.length - 1 ) * k;\n\t\tintPoint = Math.floor( point );\n\t\tweight = point - intPoint;\n\n\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\n\t\tc[ 1 ] = intPoint;\n\t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\n\t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\n\n\t\tpa = this.points[ c[ 0 ] ];\n\t\tpb = this.points[ c[ 1 ] ];\n\t\tpc = this.points[ c[ 2 ] ];\n\t\tpd = this.points[ c[ 3 ] ];\n\n\t\tw2 = weight * weight;\n\t\tw3 = weight * w2;\n\n\t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\n\t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\n\t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\n\n\t\treturn v3;\n\n\t};\n\n\tthis.getControlPointsArray = function () {\n\n\t\tvar i, p, l = this.points.length,\n\t\t\tcoords = [];\n\n\t\tfor ( i = 0; i < l; i ++ ) {\n\n\t\t\tp = this.points[ i ];\n\t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\n\n\t\t}\n\n\t\treturn coords;\n\n\t};\n\n\t// approximate length by summing linear segments\n\n\tthis.getLength = function ( nSubDivisions ) {\n\n\t\tvar i, index, nSamples, position,\n\t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\n\t\t\toldPosition = new Vector3(),\n\t\t\ttmpVec = new Vector3(),\n\t\t\tchunkLengths = [],\n\t\t\ttotalLength = 0;\n\n\t\t// first point has 0 length\n\n\t\tchunkLengths[ 0 ] = 0;\n\n\t\tif ( ! nSubDivisions ) nSubDivisions = 100;\n\n\t\tnSamples = this.points.length * nSubDivisions;\n\n\t\toldPosition.copy( this.points[ 0 ] );\n\n\t\tfor ( i = 1; i < nSamples; i ++ ) {\n\n\t\t\tindex = i / nSamples;\n\n\t\t\tposition = this.getPoint( index );\n\t\t\ttmpVec.copy( position );\n\n\t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\n\n\t\t\toldPosition.copy( position );\n\n\t\t\tpoint = ( this.points.length - 1 ) * index;\n\t\t\tintPoint = Math.floor( point );\n\n\t\t\tif ( intPoint !== oldIntPoint ) {\n\n\t\t\t\tchunkLengths[ intPoint ] = totalLength;\n\t\t\t\toldIntPoint = intPoint;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// last point ends with total length\n\n\t\tchunkLengths[ chunkLengths.length ] = totalLength;\n\n\t\treturn { chunks: chunkLengths, total: totalLength };\n\n\t};\n\n\tthis.reparametrizeByArcLength = function ( samplingCoef ) {\n\n\t\tvar i, j,\n\t\t\tindex, indexCurrent, indexNext,\n\t\t\trealDistance,\n\t\t\tsampling, position,\n\t\t\tnewpoints = [],\n\t\t\ttmpVec = new Vector3(),\n\t\t\tsl = this.getLength();\n\n\t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\n\n\t\tfor ( i = 1; i < this.points.length; i ++ ) {\n\n\t\t\t//tmpVec.copy( this.points[ i - 1 ] );\n\t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\n\n\t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\n\n\t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\n\n\t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\n\t\t\tindexNext = i / ( this.points.length - 1 );\n\n\t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\n\n\t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\n\n\t\t\t\tposition = this.getPoint( index );\n\t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\n\n\t\t\t}\n\n\t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\n\n\t\t}\n\n\t\tthis.points = newpoints;\n\n\t};\n\n\t// Catmull-Rom\n\n\tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\n\n\t\tvar v0 = ( p2 - p0 ) * 0.5,\n\t\t\tv1 = ( p3 - p1 ) * 0.5;\n\n\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n\t}\n\n}", "function intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2 , r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = (p2.x * p1.y) - (p1.x * p2.y);\n\n // Compute r3 and r4.\n r3 = ((a1 * q1.x) + (b1 * q1.y) + c1);\n r4 = ((a1 * q2.x) + (b1 * q2.y) + c1);\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = (q2.x * q1.y) - (q1.x * q2.y);\n\n // Compute r1 and r2\n r1 = (a2 * p1.x) + (b2 * p1.yy) + c2;\n r2 = (a2 * p2.x) + (b2 * p2.y) + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return /*DONT_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = (a1 * b2) - (a2 * b1);\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = (b1 * c2) - (b2 * c1);\n x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n num = (a2 * c1) - (a1 * c2);\n y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n return { x: x, y: y };\n}", "function intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2 , r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = (p2.x * p1.y) - (p1.x * p2.y);\n\n // Compute r3 and r4.\n r3 = ((a1 * q1.x) + (b1 * q1.y) + c1);\n r4 = ((a1 * q2.x) + (b1 * q2.y) + c1);\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = (q2.x * q1.y) - (q1.x * q2.y);\n\n // Compute r1 and r2\n r1 = (a2 * p1.x) + (b2 * p1.y) + c2;\n r2 = (a2 * p2.x) + (b2 * p2.y) + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return /*DONT_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = (a1 * b2) - (a2 * b1);\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = (b1 * c2) - (b2 * c1);\n x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n num = (a2 * c1) - (a1 * c2);\n y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n return { x: x, y: y };\n}", "function intersection(line1, line2, point) {\n this.line1 = line1;\n this.line2 = line2;\n this.point = point;\n this.segments = [];\n }", "function onSegment (pi, pj, pk) {\n return Math.min(pi[0], pj[0]) <= pk[0] &&\n pk[0] <= Math.max(pi[0], pj[0]) &&\n Math.min(pi[1], pj[1]) <= pk[1] &&\n pk[1] <= Math.max(pi[1], pj[1]);\n}", "function calculate_line(mp, point) {\n var a = mp[0] - point[0];\n var b = mp[1] - point[1];\n var omegaFirst = tanh(a/b);\n \n var aPrime1 = 30*Math.sin(omegaFirst);\n var bPrime1 = 30*Math.cos(omegaFirst);\n \n var omegaSecond = tanh(a/b);\n \n var aPrime2 = 30*Math.sin(omegaSecond);\n var bPrime2 = 30*Math.cos(omegaSecond);\n \n var start=[];\n var end = [];\n \n if (a>0 && b>0){\n start = [mp[0]-aPrime1, mp[1]-bPrime1];\n end = [point[0]+aPrime2, point[1]+bPrime2];\n }\n else if(a<0 && b>0) {\n start = [mp[0]-aPrime1, mp[1]-bPrime1];\n end = [point[0]+aPrime2, point[1]+bPrime2];\n }\n else if(a>0 && b<0) {\n start = [mp[0]+aPrime1, mp[1]+bPrime1];\n end = [point[0]-aPrime2, point[1]-bPrime2];\n }\n else {\n // a<0 && b<0\n start = [mp[0]+aPrime1, mp[1]+bPrime1];\n end = [point[0]-aPrime2, point[1]-bPrime2];\n }\n \n return [start,end];\n}", "function intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, offset, num;\n var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.\n\n r3 = a1 * q1.x + b1 * q1.y + c1;\n r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n\n if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {\n return;\n } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n\n\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2\n\n r1 = a2 * p1.x + b2 * p1.y + c2;\n r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n\n if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {\n return;\n } // Line segments intersect: compute intersection point.\n\n\n denom = a1 * b2 - a2 * b1;\n\n if (denom === 0) {\n return;\n }\n\n offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n\n num = b1 * c2 - b2 * c1;\n x = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n num = a2 * c1 - a1 * c2;\n y = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n return {\n x: x,\n y: y\n };\n}", "function stepAlgorithm() {\n if (algorithmFinished) return;\n copyToTrace();\n if (d3.selectAll(\"line.lower\").size() == 0) {\n algorithmFinished = true;\n trace(\"Region is unbounded in the direction of the objective function\");\n return;\n } else if (d3.selectAll(\"line.lower\").size() == 1) {\n svg.selectAll(\"circle.pair\").remove();\n svg.select(\"line.median\").remove();\n trace(\"Lower envelope has only 1 line. Find minimum point on lower envelope.\");\n var lowerLine = d3.select(\"line.lower\").datum();\n var lowerLineInverse = {x : -lowerLine.vector.x, y : -lowerLine.vector.y};\n var upperLines = d3.selectAll(\"line.upper\").data();\n // check steeper and shallower lines\n if (crossProductNorm (lowerLineInverse, getObj()) > 0) {\n var steeper = upperLines.filter(function (l) {return crossProductNorm (l.vector, lowerLineInverse) >= 0;});\n var shallower = upperLines.filter(function (l) {return crossProductNorm (l.vector, lowerLineInverse) < 0;});\n } else {\n var steeper = upperLines.filter(function (l) {return crossProductNorm (l.vector, lowerLineInverse) <= 0;});\n var shallower = upperLines.filter(function (l) {return crossProductNorm (l.vector, lowerLineInverse) > 0;});\n }\n var shallowLineLow = null;\n var steepLineHigh = null;\n shallower.forEach(function(l) {\n if (shallowLineLow === null) {\n shallowLineLow = l;\n } else {\n if (innerProduct (findIntersection ([l,lowerLine]), getObj()) >\n innerProduct (findIntersection ([shallowLineLow, lowerLine]), getObj())) {\n shallowLineLow = l;\n }\n }\n });\n steeper.forEach(function(l) {\n if (steepLineHigh === null) {\n steepLineHigh = l;\n } else {\n if (innerProduct (findIntersection ([l,lowerLine]), getObj()) <\n innerProduct (findIntersection ([steepLineHigh, lowerLine]), getObj())) {\n steepLineHigh = l;\n }\n }\n });\n if (steepLineHigh === null) {\n trace(\"Unbounded feasible region in direction of objective. Infinite solution.\");\n algorithmFinished = true;\n } else if (shallowLineLow === null) {\n showSolution([findIntersection([lowerLine, steepLineHigh])]);\n } else if (innerProduct (findIntersection([lowerLine, steepLineHigh]), getObj()) <\n innerProduct (findIntersection([lowerLine, shallowLineLow]), getObj())) {\n trace(\"No solution. Feasible region does not exist.\");\n algorithmFinished = true;\n } else {\n showSolution([findIntersection([lowerLine, steepLineHigh])]);\n }\n return;\n }\n \n // do stuff for each step of the algorithm\n switch (algorithmStep) {\n case 0:\n svg.selectAll(\"circle.pair\").remove();\n svg.select(\"line.median\").remove();\n for (var i = 0; i < dataset.length; i++) {\n dataset[i].black = false;\n }\n update();\n upperPairs = [];\n lowerPairs = [];\n trace(\"Pairing lines (intersections in black) and eliminating parallel pairs\");\n var u = false;\n // tweak any line perpendicular to objective\n for (var i = 0; i < dataset.length; i++) {\n if (isZero(innerProduct(dataset[i].vector, getObj()))) {\n dataset[i].vector.y += getObj().y / 10000;\n u = true;\n }\n }\n if (u == true) {\n update();\n }\n var lowerSet = new Array();\n d3.selectAll(\".lower\").each(function (d, i) {d.r = Math.random(); lowerSet.push(d)});\n lowerSet.sort(function (a,b) {return a.r - b.r;});\n while (lowerSet.length > 1) {\n lowerPairs.push([lowerSet[0], lowerSet[1]]);\n lowerSet.splice(0,2);\n }\n var upperSet = new Array();\n d3.selectAll(\".upper\").each(function (d, i) {d.r = Math.random(); upperSet.push(d)});\n upperSet.sort(function (a,b) {return a.r - b.r;});\n while (upperSet.length > 1) {\n upperPairs.push([upperSet[0], upperSet[1]]);\n upperSet.splice(0,2);\n }\n for (var i = lowerPairs.length - 1; i >= 0; i--) {\n var l1 = lowerPairs[i][0];\n var l2 = lowerPairs[i][1];\n // if lines are parallel, remove the lower one\n if (isZero(crossProduct(l1.vector,l2.vector))) {\n if (innerProduct (l1.base, getObj()) > innerProduct(l2.base, getObj())) {\n l1.active = false;\n } else {\n l2.active = false;\n }\n update();\n lowerPairs.splice(i);\n trace(\"Parallel lines paired: removing redundant one\");\n }\n }\n for (var i = upperPairs.length - 1; i >= 0; i--) {\n var l1 = upperPairs[i][0];\n var l2 = upperPairs[i][1];\n // if lines are parallel, remove the upper one\n if (isZero(crossProduct(l1.vector,l2.vector))) {\n if (innerProduct (l1, getObj()) > innerProduct(l2, getObj())) {\n l2.active = false;\n } else {\n l1.active = false;\n }\n update();\n upperPairs.splice(i);\n trace(\"Parallel lines paired: removing redundant one\");\n }\n }\n var allPairs = lowerPairs.concat(upperPairs);\n svg.selectAll(\"circle.pair\")\n .data(allPairs)\n .enter()\n .append(\"circle\")\n .classed(\"pair\", true)\n .attr(\"r\", 100)\n .attr(\"cx\", function (d) {return transformXWithScale(findIntersection(d).x);})\n .attr(\"cy\", function (d) {return transformYWithScale(findIntersection(d).y);})\n .transition().attr(\"r\", 5);\n algorithmStep = 1;\n break;\n case 1:\n var perp = getPerp();\n var data = svg.selectAll(\"circle.pair\").data();\n if (data.length > 0) {\n // there is some pairing\n data.sort(function (d1, d2) {return innerProduct (findIntersection(d1), perp) - innerProduct (findIntersection(d2), perp);});\n var median = findIntersection(data[Math.floor(data.length / 2)]);\n var medianLine = [{vector : perp, base : {x: median.x, y: median.y}}];\n svg.selectAll(\"line.median\").data(medianLine).enter().append(\"line\").classed(\"median\", true)\n .attr(\"x1\", getX1).attr(\"x2\", getX2).attr(\"y1\", getY1).attr(\"y2\", getY2).style(\"opacity\", 0).transition().style(\"opacity\", 1);\n algorithmStep = 2;\n } else {\n // no pairings find solution\n trace(\"No pairs remaining. Find direct solution\");\n return;\n }\n trace(\"Finding median\");\n break;\n case 2:\n var upperLines = svg.selectAll(\"line.upper\").data();\n var lowerLines = svg.selectAll(\"line.lower\").data();\n var median = svg.select(\"line.median\").datum();\n var lowerInt1 = null;\n var lowerInt2 = null;\n var upperInt = null;\n upperLines.forEach(function(l) {\n if (upperInt === null) {\n upperInt = l;\n } else if (innerProduct(findIntersection([median, l]),getObj()) >\n innerProduct(findIntersection([median, upperInt]),getObj())) {\n upperInt = l;\n }\n });\n lowerLines.forEach(function(l) {\n if (lowerInt1 === null) {\n lowerInt1 = l;\n } else if (lowerInt2 === null) {\n if (innerProduct(findIntersection([median,l]),getObj()) <\n innerProduct(findIntersection([median, lowerInt1]),getObj())) {\n lowerInt2 = lowerInt1;\n lowerInt1 = l;\n } else {\n lowerInt2 = l;\n }\n } else if (innerProduct(findIntersection([median, l]),getObj()) <\n innerProduct(findIntersection([median, lowerInt1]),getObj())) {\n lowerInt2 = lowerInt1;\n lowerInt1 = l;\n } else if (innerProduct(findIntersection([median, l]),getObj()) <\n innerProduct(findIntersection([median, lowerInt2]),getObj())) {\n lowerInt2 = l;\n }\n });\n // if lower line is flat and upper line is above, done\n if (isZero(innerProduct(median.vector,lowerInt1.vector))) {\n trace(\"Lower envelope is flat. Check feasibility.\");\n if (innerProduct(findIntersection([median, upperInt]), getObj()) <\n innerProduct(findIntersection([median, lowerInt1]), getObj())) {\n showSolution([findIntersection([lowerInt1, median])]);\n } else {\n trace(\"Intersection of half-planes does not produce a feasible region. No solution.\");\n algorithmFinished = true;\n }\n return;\n }\n // if top two lower lines intersect median line at the same place\n // and they slant to different sides, this is potential solution\n // if it's below the upper envelope, it is, otherwise, no solution.\n if (isZero(innerProductNorm(findIntersection([median,lowerInt1]), getObj()) -\n innerProductNorm(findIntersection([median,lowerInt2]), getObj())) &&\n crossProduct(lowerInt1.vector, getObj()) * crossProduct(lowerInt2.vector, getObj()) < 0) {\n trace(\"Median crosses cusp of lower envelope. Check feasibility.\");\n if (innerProduct(findIntersection([median, upperInt]), getObj()) <\n innerProduct(findIntersection([median, lowerInt1]), getObj())) {\n showSolution([findIntersection([lowerInt1, median])]);\n } else {\n trace(\"Intersection of half-planes does not produce a feasible region. No solution.\");\n algorithmFinished = true;\n }\n return;\n }\n trace(\"Find upper lower line and lower upper lines (in bold).\");\n algorithmStep = 3;\n upperInt.most = true;\n lowerInt1.most = true;\n update();\n if (innerProduct(findIntersection([median, upperInt]), getObj()) <\n innerProduct(findIntersection([median, lowerInt1]), getObj())) {\n // there is a space, trim away from direction of lower line perpendicular\n towardPerp = innerProduct(lowerInt1.vector,getPerp()) < 0;\n } else {\n if (isZero(crossProductNorm(upperInt.vector,lowerInt1.vector))) {\n trace(\"Upper envelope below lower envelope, and envelopes are parallel.\");\n trace(\"Intersection of half-planes does not produce a feasible region. No solution.\");\n algorithmFinished = true;\n return;\n }\n // find sum of normalized perpendiculars. It points in the direction opposite the one to prune\n var sum = { x : upperInt.vector.x / norm(upperInt.vector) + lowerInt1.vector.x / norm(lowerInt1.vector),\n y : upperInt.vector.y / norm(upperInt.vector) + lowerInt1.vector.y / norm(lowerInt1.vector) };\n towardPerp = innerProduct(sum, getPerp()) < 0;\n }\n break;\n case 3:\n // clear topmost line highlight\n svg.selectAll(\"line.most\").data().forEach(function (d) {d.most = false});\n update();\n trace(\"Trim data on side of median farther from solution (\" + (towardPerp ? \"left\" : \"right\") + \" turn from objective). (Lines to be deleted in black)\");\n var pairs = svg.selectAll(\"circle.pair\").data().sort(function (d1, d2) {return innerProduct (findIntersection(d1), getPerp()) - innerProduct (findIntersection(d2), getPerp());});\n var median = svg.select(\"line.median\").datum().base;\n if (towardPerp) {\n var trim = pairs.filter(function (p) {return innerProduct(findIntersection(p),getPerp()) >= innerProduct(median,getPerp()) - epsilon;});\n } else {\n var trim = pairs.filter(function (p) {return innerProduct(findIntersection(p),getPerp()) <= innerProduct(median,getPerp()) + epsilon;});\n }\n trim.forEach(function(p) {\n var l1 = p[0];\n var l2 = p[1];\n if (towardPerp) {\n if (innerProductNorm(l1.vector,getPerp()) < innerProductNorm(l2.vector,getPerp())) {\n l1.active = false;\n l1.black = true;\n } else {\n l2.active = false;\n l2.black = true;\n }\n } else {\n if (innerProductNorm(l1.vector,getPerp()) < innerProductNorm(l2.vector,getPerp())) {\n l2.active = false;\n l2.black = true;\n } else {\n l1.active = false;\n l1.black = true;\n }\n }\n });\n // highlight lines to be deleted in black.\n svg.selectAll(\"line.lower\").filter(function (d,i) {return !d.active}).classed(\"lower\", false).style(\"stroke\", \"black\");\n svg.selectAll(\"line.upper\").filter(function (d,i) {return !d.active}).classed(\"upper\", false).style(\"stroke\", \"black\");\n algorithmStep = 0;\n break;\n case 4:\n svg.selectAll(\"line.inactive\").data().forEach(function (d) {d.active = true});\n update();\n algorithmFinished = true;\n break;\n }\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [], clip = [], i, n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n for ((i = 0, n = clip.length); i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n // Find first unvisited intersection.\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for ((i = 0, n = points.length); i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function PolylineOffsetIntersection(v1, v2, v3, distanceOffset) {\n\n\tlet bisectorVector = BisectorVector(\n\t\tv1,\n\t\tv2,\n\t\tv3\n\t\t);\n\n\tlet angle = radiansBetweenThreePoints(\n\t\tv1,\n\t\tv2,\n\t\tv3\n\t\t) / 2;\n\n\n\tlet distanceBisector = v2.distanceTo(bisectorVector);\n\tlet distanceIntersection = distanceOffset / Math.sin(angle);\n\tlet scaleFactor = distanceIntersection / distanceBisector;\n\n\n\tlet intersection = ScaledVector3FromStartPoint(bisectorVector, v2, scaleFactor);\n\n\treturn intersection ;\n}", "function labelRectangleIntersection(lk, li, vi, pi) {\n let min = 0;\n let max = Number.POSITIVE_INFINITY;\n if (vi.y !== 0) {\n const firstIntersection = (lk.height / 2 + li.height / 2 - li.offsetY + (lk.top + lk.bottom) / 2 - pi.y) / vi.y;\n const secondIntersection = (-lk.height / 2 - li.height / 2 - li.offsetY + (lk.top + lk.bottom) / 2 - pi.y) / vi.y;\n // Multiplying by a negative sign reverses an inequality\n if (vi.y > 0) {\n max = Math.min(max, firstIntersection);\n min = Math.max(min, secondIntersection);\n } else {\n min = Math.max(min, firstIntersection);\n max = Math.min(max, secondIntersection);\n }\n } else {\n // vector is vertical and they will never intersect\n if (li.offsetY + pi.y - (lk.top + lk.bottom) / 2 > lk.height / 2 + li.height / 2) return interval.empty();\n if (li.offsetY + pi.y - (lk.top + lk.bottom) / 2 < -lk.height / 2 - li.height / 2) return interval.empty();\n }\n if (vi.x !== 0) {\n const thirdIntersection = (lk.width / 2 + li.width / 2 + (lk.right + lk.left) / 2 - pi.x - li.offsetX) / vi.x;\n const fourthIntersection = (-lk.width / 2 - li.width / 2 + (lk.right + lk.left) / 2 - pi.x - li.offsetX) / vi.x;\n if (vi.x > 0) {\n max = Math.min(max, thirdIntersection);\n min = Math.max(min, fourthIntersection);\n } else {\n min = Math.max(min, thirdIntersection);\n max = Math.min(max, fourthIntersection);\n }\n } else {\n if (pi.x + li.offsetX - (lk.right + lk.left) / 2 > lk.width / 2 + li.width / 2) return interval.empty();\n if (pi.x + li.offsetX - (lk.right + lk.left) / 2 < -lk.width / 2 - li.width / 2) return interval.empty();\n }\n\n // Only interested in positive values\n return interval(min, max);\n}", "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 }", "static get_nearest_point_on_segment(ref_x, ref_y, eq, kp1, kp2) {\n // For convenience\n const a = eq[\"a\"];\n const b = eq[\"b\"];\n const c = eq[\"c\"];\n \n // Where is that point on the line, exactly?\n var nrx = (b*(b*ref_x - a*ref_y) - a*c)/(a*a + b*b);\n var nry = (a*(a*ref_y - b*ref_x) - b*c)/(a*a + b*b);\n \n // Where along the segment is that point?\n var xprop = 0.0;\n if (kp2[0] != kp1[0]) {\n xprop = (nrx - kp1[0])/(kp2[0] - kp1[0]);\n }\n var yprop = 0.0;\n if (kp2[1] != kp1[1]) {\n yprop = (nry - kp1[1])/(kp2[1] - kp1[1]);\n }\n\n // If the point is at an end of the segment, just return null\n if ((xprop < 0) || (xprop > 1) || (yprop < 0) || (yprop > 1)) {\n return null; \n }\n\n // Distance from point to line\n var dst = Math.abs(a*ref_x + b*ref_y + c)/Math.sqrt(a*a + b*b);\n \n // Proportion of the length of segment from p1 to the nearest point\n const seg_length = Math.sqrt((kp2[0] - kp1[0])*(kp2[0] - kp1[0]) + (kp2[1] - kp1[1])*(kp2[1] - kp1[1]));\n const kprop = Math.sqrt((nrx - kp1[0])*(nrx - kp1[0]) + (nry - kp1[1])*(nry - kp1[1]))/seg_length;\n\n // return object with info about the point\n return {\n \"dst\": dst,\n \"prop\": kprop\n };\n }", "function subdivide(complex) {\n var positions = complex.positions\n var cells = complex.cells\n\n var newCells = []\n var newPositions = []\n var midpoints = {}\n var f = [0, 1, 2]\n var l = 0\n\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i]\n var c0 = cell[0]\n var c1 = cell[1]\n var c2 = cell[2]\n var v0 = positions[c0]\n var v1 = positions[c1]\n var v2 = positions[c2]\n\n var a = getMidpoint(v0, v1)\n var b = getMidpoint(v1, v2)\n var c = getMidpoint(v2, v0)\n\n var ai = newPositions.indexOf(a)\n if (ai === -1) ai = l++, newPositions.push(a)\n var bi = newPositions.indexOf(b)\n if (bi === -1) bi = l++, newPositions.push(b)\n var ci = newPositions.indexOf(c)\n if (ci === -1) ci = l++, newPositions.push(c)\n\n var v0i = newPositions.indexOf(v0)\n if (v0i === -1) v0i = l++, newPositions.push(v0)\n var v1i = newPositions.indexOf(v1)\n if (v1i === -1) v1i = l++, newPositions.push(v1)\n var v2i = newPositions.indexOf(v2)\n if (v2i === -1) v2i = l++, newPositions.push(v2)\n\n newCells.push([v0i, ai, ci])\n newCells.push([v1i, bi, ai])\n newCells.push([v2i, ci, bi])\n newCells.push([ai, bi, ci])\n }\n\n return {\n cells: newCells\n , positions: newPositions\n }\n\n // reuse midpoint vertices between iterations.\n // Otherwise, there'll be duplicate vertices in the final\n // mesh, resulting in sharp edges.\n function getMidpoint(a, b) {\n var point = midpoint(a, b)\n var pointKey = pointToKey(point)\n var cachedPoint = midpoints[pointKey]\n if (cachedPoint) {\n return cachedPoint\n } else {\n return midpoints[pointKey] = point\n }\n }\n\n function pointToKey(point) {\n return point[0].toPrecision(6) + ','\n + point[1].toPrecision(6) + ','\n + point[2].toPrecision(6)\n }\n\n function midpoint(a, b) {\n return [\n (a[0] + b[0]) / 2\n , (a[1] + b[1]) / 2\n , (a[2] + b[2]) / 2\n ]\n }\n}", "function findPolygonPointsCorrectPosition(line) {\n var lengthOfCathetusFirstTriangle = Math.sqrt(line.getLength() * line.getLength() - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius());\n var lengthOfCathetusSecondTriangle = Math.sqrt(line.getLength() * line.getLength() - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius());\n var ya, yb, xa, xb, ya2, yb2, xa2, xb2;\n var center = {\n x: line.getPoints().firstPoint.getPosition().x - svgOffset.left,\n y: line.getPoints().firstPoint.getPosition().y - svgOffset.top\n };\n var point = {\n x: line.getPoints().secondPoint.getPosition().x - svgOffset.left,\n y: line.getPoints().secondPoint.getPosition().y - svgOffset.top\n };\n var result = {\n xa: null,\n xb: null,\n ya: null,\n yb: null,\n xa2: null,\n xb2: null,\n ya2: null,\n yb2: null\n };\n var e = center.x - point.x;\n var c = center.y - point.y;\n var q = (lengthOfCathetusFirstTriangle * lengthOfCathetusFirstTriangle - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius() + center.y * center.y - point.y * point.y + center.x * center.x - point.x * point.x) / 2;\n var A = c * c + e * e;\n var B = (center.x * e * c - c * q - center.y * e * e) * 2;\n var C = center.x * center.x * e * e - 2 * center.x * e * q + q * q + center.y * center.y * e * e - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius() * e * e;\n var e2 = point.x - center.x;\n var c2 = point.y - center.y;\n var q2 = (lengthOfCathetusSecondTriangle * lengthOfCathetusSecondTriangle - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius() + point.y * point.y - center.y * center.y + point.x * point.x - center.x * center.x) / 2;\n var A2 = c2 * c2 + e2 * e2;\n var B2 = (point.x * e2 * c2 - c2 * q2 - point.y * e2 * e2) * 2;\n var C2 = point.x * point.x * e2 * e2 - 2 * point.x * e2 * q2 + q2 * q2 + point.y * point.y * e2 * e2 - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius() * e2 * e2;\n\n result.ya = (Math.sqrt(B * B - 4 * A * C) - B) / (2 * A);\n result.yb = (-Math.sqrt(B * B - 4 * A * C) - B) / (2 * A);\n result.xa = (q - result.ya * c) / e;\n result.xb = (q - result.yb * c) / e;\n result.ya2 = (Math.sqrt(B2 * B2 - 4 * A2 * C2) - B2) / (2 * A2);\n result.yb2 = (-Math.sqrt(B2 * B2 - 4 * A2 * C2) - B2) / (2 * A2);\n result.xa2 = (q2 - result.ya2 * c2) / e2;\n result.xb2 = (q2 - result.yb2 * c2) / e2;\n\n return result;\n}", "function clipLine(stream){var point0,// previous point\nc0,// code for previous point\nv0,// visibility of previous point\nv00,// visibility of first point\nclean;// no intersections\nreturn{lineStart:function(){v00=v0=false;clean=1},point:function(lambda,phi){var point1=[lambda,phi],point2,v=visible(lambda,phi),c=smallRadius?v?0:code(lambda,phi):v?code(lambda+(lambda<0?pi:-pi),phi):0;if(!point0&&(v00=v0=v))stream.lineStart();\n// Handle degeneracies.\n// TODO ignore if not clipping polygons.\nif(v!==v0){point2=intersect(point0,point1);if(!point2||pointEqual(point0,point2)||pointEqual(point1,point2)){point1[0]+=epsilon;point1[1]+=epsilon;v=visible(point1[0],point1[1])}}if(v!==v0){clean=0;if(v){\n// outside going in\nstream.lineStart();point2=intersect(point1,point0);stream.point(point2[0],point2[1])}else{\n// inside going out\npoint2=intersect(point0,point1);stream.point(point2[0],point2[1]);stream.lineEnd()}point0=point2}else if(notHemisphere&&point0&&smallRadius^v){var t;\n// If the codes for two points are different, or are both zero,\n// and there this segment intersects with the small circle.\nif(!(c&c0)&&(t=intersect(point1,point0,true))){clean=0;if(smallRadius){stream.lineStart();stream.point(t[0][0],t[0][1]);stream.point(t[1][0],t[1][1]);stream.lineEnd()}else{stream.point(t[1][0],t[1][1]);stream.lineEnd();stream.lineStart();stream.point(t[0][0],t[0][1])}}}if(v&&(!point0||!pointEqual(point0,point1))){stream.point(point1[0],point1[1])}point0=point1,v0=v,c0=c},lineEnd:function(){if(v0)stream.lineEnd();point0=null},\n// Rejoin first and last segments if there were intersections and the first\n// and last points were visible.\nclean:function(){return clean|(v00&&v0)<<1}}}", "function bezier_intersect_t(r) {\n //var X = 0.5 + Math.sin((PI/6) - (2/3) * Math.atan(1/Math.sqrt(r)));\n return 0.5 + Math.sin((PI / 6) - (2 / 3) * Math.atan(1 / Math.sqrt(r)));\n var t = 0.5 + ((1 + r) / (2 * X)) + (X / (2 * (1 + r)));\n return t;\n}", "resolveSegmentSegment(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n const result = [];\n const isHorizontal1 = ax2 - ax1 > ay2 - ay1;\n const isHorizontal2 = bx2 - bx1 > by2 - by1;\n\n if (isHorizontal1 && isHorizontal2 &&\n by1 === ay1 &&\n ((ax1 <= bx2 && ax1 >= bx1) || (ax2 <= bx2 && ax2 >= bx1) || (bx1 <= ax2 && bx1 >= ax1) || (bx2 <= ax2 && bx2 >= ax1))) {\n\n if (bx1 < ax1) result.push(bx1, by1, ax1, by1);\n if (bx2 > ax2) result.push(ax2, by2, bx2, by2);\n\n } else if (!isHorizontal1 && isHorizontal2 &&\n by1 >= ay1 && by1 < ay2 &&\n ((ax1 <= bx2 && ax1 >= bx1) || (ax2 <= bx2 && ax2 >= bx1) || (bx1 <= ax2 && bx1 >= ax1) || (bx2 <= ax2 && bx2 >= ax1))) {\n\n if (bx1 < ax1) result.push(bx1, by1, ax1, by1);\n if (bx2 > ax2) result.push(ax2 + 1, by2, bx2, by2);\n\n } else if (!isHorizontal1 && !isHorizontal2 &&\n ax1 === bx2 &&\n ((by1 <= ay2 && by1 >= ay1) || (by2 <= ay2 && by2 >= ay1) || (ay1 <= by2 && ay1 >= by1) || (ay2 <= by2 && ay2 >= by1))) {\n\n if (by1 < ay1) result.push(bx1, by1, bx1, ay1);\n if (by2 > ay2) result.push(bx2, ay2, bx2, by2);\n\n } else if (isHorizontal1 && !isHorizontal2 &&\n bx1 >= ax1 && bx1 < ax2 &&\n ((ay2 <= by2 && ay2 >= by1) || (ay1 <= by2 && ay1 >= by1) || (by2 <= ay2 && by2 >= ay1) || (by1 <= ay2 && by1 >= ay1))) {\n\n if (by1 < ay1) result.push(bx1, by1, bx1, ay1);\n if (by2 > ay2) result.push(bx2, ay2 + 1, bx2, by2);\n\n } else { // segments do not intersect\n result.push(bx1, by1, bx2, by2);\n }\n\n return result;\n }", "function lineintersect(s1, e1, s2, e2) { \n // Solve the equation \n // [(e1-s1) -(e2-s2)]*[a1 a2]^T = s2-s1\n // for [a1 a2]. Both a1 and a2 should be in the range [0,1] for segments to\n // intersect. The matrix on the lhs will be singular if the lines are\n // collinear.\n const a = e1[0] - s1[0], c = e1[1] - s1[1]\n const b = -(e2[0] - s2[0]), d = -(e2[1] - s2[1])\n const e = s2[0] - s1[0], f = s2[1] - s1[1]\n const det = a*d - b*c\n if (det == 0) return null\n const a1 = ( d*e - b*f)/det\n const a2 = (-c*e + a*f)/det\n if (a1 < 0 || a1 > 1 || a2 < 0 || a2 > 1) return null\n return [s1[0]+a1*a, s1[1]+a1*c]\n}", "function intersect(a,b,two){var pa=cartesian(a),pb=cartesian(b);\n// We have two planes, n1.p = d1 and n2.p = d2.\n// Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).\nvar n1=[1,0,0],// normal\nn2=cartesianCross(pa,pb),n2n2=cartesianDot(n2,n2),n1n2=n2[0],// cartesianDot(n1, n2),\ndeterminant=n2n2-n1n2*n1n2;\n// Two polar points.\nif(!determinant)return!two&&a;var c1=cr*n2n2/determinant,c2=-cr*n1n2/determinant,n1xn2=cartesianCross(n1,n2),A=cartesianScale(n1,c1),B=cartesianScale(n2,c2);cartesianAddInPlace(A,B);\n// Solve |p(t)|^2 = 1.\nvar u=n1xn2,w=cartesianDot(A,u),uu=cartesianDot(u,u),t2=w*w-uu*(cartesianDot(A,A)-1);if(t2<0)return;var t=sqrt(t2),q=cartesianScale(u,(-w-t)/uu);cartesianAddInPlace(q,A);q=spherical(q);if(!two)return q;\n// Two intersection points.\nvar lambda0=a[0],lambda1=b[0],phi0=a[1],phi1=b[1],z;if(lambda1<lambda0)z=lambda0,lambda0=lambda1,lambda1=z;var delta=lambda1-lambda0,polar=abs(delta-pi)<epsilon,meridian=polar||delta<epsilon;if(!polar&&phi1<phi0)z=phi0,phi0=phi1,phi1=z;\n// Check that the first point is between a and b.\nif(meridian?polar?phi0+phi1>0^q[1]<(abs(q[0]-lambda0)<epsilon?phi0:phi1):phi0<=q[1]&&q[1]<=phi1:delta>pi^(lambda0<=q[0]&&q[0]<=lambda1)){var q1=cartesianScale(u,(-w+t)/uu);cartesianAddInPlace(q1,A);return[q,spherical(q1)]}}", "function intersect(x1,y1,x2,y2,x3,y3,x4,y4){\r\n s1x = x2 - x1;\r\n s1y = y2 - y1;\r\n\r\n s2x = x4 - x3;\r\n s2y = y4 - y3;\r\n\r\n s1 = ((-s1y * (x1 - x3)) + (s1x * (y1 - y3))) / ((-s2x * s1y) + (s1x * s2y))\r\n s2 = (( s2x * (y1 - y3)) - (s2y * (x1 - x3))) / ((-s2x * s1y) + (s1x * s2y))\r\n\r\n if ((s1 >= 0)*(s1 <= 1)*(s2 >= 0)*(s2 <= 1))\r\n {\r\n return [(x1 + (s2*s1x)),(y1 + (s2*s1y))];\r\n }\r\n else \r\n {\r\n return null;;\r\n }\r\n}", "static SegmentIntersectsSegment( a1, a2, b1, b2)\n\t{\n\t var b = a2.getVecSub(a1);\n\t var d = b2.getVecSub(b1);\n\t var bDotDPerp = b.x * d.y - b.y * d.x;\n\t\n\t // if b dot d == 0, it means the lines are parallel so have infinite intersection points\n\t if (bDotDPerp == 0)\n\t return null;\n\t\n\t var c = b1.getVecSub(a1);\n\t var t = (c.x * d.y - c.y * d.x) / bDotDPerp;\n\t if (t < 0 || t > 1)\n\t return null;\n\t\n\t var u = (c.x * b.y - c.y * b.x) / bDotDPerp;\n\t if (u < 0 || u > 1)\n\t return null;\n\t\n\t return a1.getVecAdd( b.getScalarMult(t) ) ;\n\t}", "function subdivide(p1,p2){\n let pts=[p1];\n for (let i=1,step=(p2.d-p1.d)/segments;i<segments;i++){\n pts[i] = ptWithLength(p1.d + step*i);\n }\n pts.push(p2);\n if (polyArea(pts)<=threshold) return [p1,p2];\n else {\n let result = [];\n for (let j=1;j<pts.length;++j){\n let mids = subdivide(pts[j-1], pts[j]);\n mids.pop(); // We'll get the last point as the start of the next pair\n result = result.concat(mids)\n }\n result.push(p2);\n return result;\n }\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function getIntersectionPointsByConstants(linearConstants1, linearConstants2) {\n var a1 = linearConstants1[0],\n b1 = linearConstants1[1],\n c1 = linearConstants1[2];\n var a2 = linearConstants2[0],\n b2 = linearConstants2[1],\n c2 = linearConstants2[2];\n var isZeroA = a1 === 0 && a2 === 0;\n var isZeroB = b1 === 0 && b2 === 0;\n\n if (isZeroA && isZeroB) {\n return [];\n } else if (isZeroA) {\n // b1 * y + c1 = 0\n // b2 * y + c2 = 0\n var y1 = -c1 / b1;\n var y2 = -c2 / b2;\n\n if (y1 !== y2) {\n return [];\n } else {\n return [[-Infinity, y1], [Infinity, y1]];\n }\n } else if (isZeroB) {\n // a1 * x + c1 = 0\n // a2 * x + c2 = 0\n var x1 = -c1 / a1;\n var x2 = -c2 / a2;\n\n if (x1 !== x2) {\n return [];\n } else {\n return [[x1, -Infinity], [x1, Infinity]];\n }\n } else if (a1 === 0) {\n // b1 * y + c1 = 0\n // y = - c1 / b1;\n // a2 * x + b2 * y + c2 = 0\n var y = -c1 / b1;\n var x = -(b2 * y + c2) / a2;\n return [[x, y]];\n } else if (a2 === 0) {\n // b2 * y + c2 = 0\n // y = - c2 / b2;\n // a1 * x + b1 * y + c1 = 0\n var y = -c2 / b2;\n var x = -(b1 * y + c1) / a1;\n return [[x, y]];\n } else if (b1 === 0) {\n // a1 * x + c1 = 0\n // x = - c1 / a1;\n // a2 * x + b2 * y + c2 = 0\n var x = -c1 / a1;\n var y = -(a2 * x + c2) / b2;\n return [[x, y]];\n } else if (b2 === 0) {\n // a2 * x + c2 = 0\n // x = - c2 / a2;\n // a1 * x + b1 * y + c1 = 0\n var x = -c2 / a2;\n var y = -(a1 * x + c1) / b1;\n return [[x, y]];\n } else {\n // a1 * x + b1 * y + c1 = 0\n // a2 * x + b2 * y + c2 = 0\n // b2 * a1 * x + b2 * b1 * y + b2 * c1 = 0\n // b1 * a2 * x + b1 * b2 * y + b1 * c2 = 0\n // (b2 * a1 - b1 * a2) * x = (b1 * c2 - b2 * c1)\n var x = (b1 * c2 - b2 * c1) / (b2 * a1 - b1 * a2);\n var y = -(a1 * x + c1) / b1;\n return [[x, y]];\n }\n }", "function checkLineIntersection(line1StartX, line1StartY, line1EndX, line1EndY, line2StartX, line2StartY, line2EndX, line2EndY) {\n // if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point\n var denominator, a, b, numerator1, numerator2, result = {\n x: null,\n y: null,\n };\n denominator = ((line2EndY - line2StartY) * (line1EndX - line1StartX)) - ((line2EndX - line2StartX) * (line1EndY - line1StartY));\n // console.log('Denominator: ' + denominator);\n if (denominator < 0.0000001 && denominator > -0.0000001) {\n // console.log( 'no intersection ');\n return result;\n }\n // console.log( 'intersection' );\n a = line1StartY - line2StartY;\n b = line1StartX - line2StartX;\n numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);\n numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);\n a = numerator1 / denominator;\n b = numerator2 / denominator;\n\n // if we cast these lines infinitely in both directions, they intersect here:\n result.x = line1StartX + (a * (line1EndX - line1StartX));\n result.y = line1StartY + (a * (line1EndY - line1StartY));\n/*\n // it is worth noting that this should be the same as:\n x = line2StartX + (b * (line2EndX - line2StartX));\n y = line2StartX + (b * (line2EndY - line2StartY));\n */\n\n return result;\n}", "function getLinearEdgeIntersections(pt1, pt2) {\n var out = [];\n var ptCount = 0;\n for (var i = 0; i < 4; i++) {\n var edge = edges[i];\n var ptInt = segmentsIntersect(pt1[0], pt1[1], pt2[0], pt2[1], edge[0], edge[1], edge[2], edge[3]);\n if (ptInt && (!ptCount || Math.abs(ptInt.x - out[0][0]) > 1 || Math.abs(ptInt.y - out[0][1]) > 1)) {\n ptInt = [ptInt.x, ptInt.y];\n // if we have 2 intersections, make sure the closest one to pt1 comes first\n if (ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt);else out.push(ptInt);\n ptCount++;\n }\n }\n return out;\n }", "function getCutPoint(x, y, i, j, xx, yy) {\n if (j < i || j > i + 1) {\n error(\"Out-of-sequence arc ids:\", i, j);\n }\n\n // Removed out-of-range check: small out-of-range intersection points are now allowed.\n // (Such points may occur due to fp rounding, when intersections occur along\n // vertical or horizontal segments)\n // if (geom.outsideRange(x, ix, jx) || geom.outsideRange(y, iy, jy)) {\n // return null;\n // }\n\n // Removed endpoint check: intersecting arcs need to be cut both at vertices\n // and between vertices, so pathfinding functions will work correctly.\n // if (x == ix && y == iy || x == jx && y == jy) {\n // return null;\n // }\n return {x: x, y: y, i: i};\n }", "function segmentsIntersect(e1, e2, precisionDistance)\n{\n var denom = e2.dy * e1.dx - e2.dx * e1.dy;\n var numera = e2.dx * (e1.v1.y - e2.v1.y) - e2.dy * (e1.v1.x - e2.v1.x);\n var numerb = e1.dx * (e1.v1.y - e2.v1.y) - e1.dy * (e1.v1.x - e2.v1.x);\n\n /* Are the lines coincident? */\n if (ABS(numera) < EPS && ABS(numerb) < EPS && ABS(denom) < EPS) {\n return null;\n }\n\n /* Are the lines parallel */\n if (ABS(denom) < EPS) {\n /* check for overlap */\n return parallelLinesOverlap(e1, e2, precisionDistance);\n }\n\n /* Is the intersection along the segments */\n var mua = numera / denom;\n var da = mua * e1.length;\n if (da < -precisionDistance || da > e1.length + precisionDistance) {\n return null;\n }\n\n var mub = numerb / denom;\n var db = mub * e2.length;\n if (db < -precisionDistance || db > e2.length + precisionDistance) {\n return null;\n }\n\n var x = e1.v1.x + mua * e1.dx;\n var y = e1.v1.y + mua * e1.dy;\n\n return {\n status: ONE_INTERSECTION,\n e1: [x, y],\n e2: [x, y] };\n\n}", "ptInScaledTriangle(p, t0, t1, t2, scale) {\n\t\t// Find centroid of full-size triangle\n let centroid = {\n \tx: (t0.x + t1.x + t2.x) / 3,\n y: (t0.y + t1.y + t2.y) / 3\n };\n \n // Construct new corners, scaling the triangles points in toward the centroid\n let p0 = this.scalePoint(t0, centroid, scale);\n let p1 = this.scalePoint(t1, centroid, scale);\n let p2 = this.scalePoint(t2, centroid, scale);\n\t\t\n var A = 0.5 * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\n var sign = A < 0 ? -1 : 1;\n var s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\n var t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\n \n return s > 0 && t > 0 && (s + t) < 2 * A * sign;\n }", "function getIntersectingSegment(polyline) {\n\n return null;\n}", "function _lineIntersect(A,B,E,F,infinite){\n\t\tvar a1, a2, b1, b2, c1, c2, x, y;\n\t\t\n\t\ta1= B.y-A.y;\n\t\tb1= A.x-B.x;\n\t\tc1= B.x*A.y - A.x*B.y;\n\t\ta2= F.y-E.y;\n\t\tb2= E.x-F.x;\n\t\tc2= F.x*E.y - E.x*F.y;\n\t\t\n\t\tvar denom=a1*b2 - a2*b1;\n\t\t\n\t\tx = (b1*c2 - b2*c1)/denom,\n\t\ty = (a2*c1 - a1*c2)/denom\n\t\t\n\t\tif(!isFinite(x) || !isFinite(y)){\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\t// lines are colinear\n\t\t/*var crossABE = (E.y - A.y) * (B.x - A.x) - (E.x - A.x) * (B.y - A.y);\n\t\tvar crossABF = (F.y - A.y) * (B.x - A.x) - (F.x - A.x) * (B.y - A.y);\n\t\tif(_almostEqual(crossABE,0) && _almostEqual(crossABF,0)){\n\t\t\treturn null;\n\t\t}*/\n\t\t\n\t\tif(!infinite){\n\t\t\t// coincident points do not count as intersecting\n\t\t\tif (Math.abs(A.x-B.x) > TOL && (( A.x < B.x ) ? x < A.x || x > B.x : x > A.x || x < B.x )) return null;\n\t\t\tif (Math.abs(A.y-B.y) > TOL && (( A.y < B.y ) ? y < A.y || y > B.y : y > A.y || y < B.y )) return null;\n\n\t\t\tif (Math.abs(E.x-F.x) > TOL && (( E.x < F.x ) ? x < E.x || x > F.x : x > E.x || x < F.x )) return null;\n\t\t\tif (Math.abs(E.y-F.y) > TOL && (( E.y < F.y ) ? y < E.y || y > F.y : y > E.y || y < F.y )) return null;\n\t\t}\n\t\t\n\t\treturn {x: x, y: y};\n\t}", "function intersectLineLine(x1, y1, x2, y2, x3, y3, x4, y4) {\n \"use strict\";\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, num;\n var x, y;\n x = 0;\n y = 0;\n\n var result = null;\n\n a1 = y2 - y1;\n\n b1 = x1 - x2;\n c1 = (x2 * y1) - (x1 * y2);\n\n r3 = ((a1 * x3) + (b1 * y3) + c1);\n r4 = ((a1 * x4) + (b1 * y4) + c1);\n\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return result;\n }\n\n a2 = y4 - y3;\n b2 = x3 - x4;\n c2 = (x4 * y3) - (x3 * y4);\n\n r1 = (a2 * x1) + (b2 * y1) + c2;\n r2 = (a2 * x2) + (b2 * y2) + c2;\n\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return result;\n }\n\n denom = (a1 * b2) - (a2 * b1);\n\n if (denom === 0) {\n return result;\n }\n\n num = (b1 * c2) - (b2 * c1);\n x = (num) / denom;\n\n num = (a2 * c1) - (a1 * c2);\n y = (num) / denom;\n\n result = createVector(x, y);\n\n return result;\n}", "_getIntersection(refPoint, secondPoint) {\n // direction vector to add\n let direction = secondPoint.clone().sub(refPoint);\n\n // copy our corner refpoint\n let intersection = refPoint.clone();\n // iterate till we reach near plane\n while(intersection.z > -1) {\n intersection.add(direction);\n }\n\n return intersection;\n }", "function findSegmentIndex(t, parameterSubdivision)\n{\n var x = t;\n var index = 0;\n var rawX = t;\n\n for(var i = 0; i < parameterSubdivision.length; i++)\n {\n if(x - parameterSubdivision[i] < 0)\n {\n index = i + 1;\n x = THREE.Math.clamp(x / parameterSubdivision[i], 0, 1);\n break;\n }\n else\n {\n x -= parameterSubdivision[i];\n rawX -= parameterSubdivision[i];\n }\n }\n\n return [index, x, rawX];\n}", "function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {\n var key = join.call(arguments);\n if (segmentCache[key]) {\n return segmentCache[key];\n }\n\n var th = rotateX * (Math.PI/180);\n var sin_th = Math.sin(th);\n var cos_th = Math.cos(th);\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;\n var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;\n var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);\n if (pl > 1) {\n pl = Math.sqrt(pl);\n rx *= pl;\n ry *= pl;\n }\n\n var a00 = cos_th / rx;\n var a01 = sin_th / rx;\n var a10 = (-sin_th) / ry;\n var a11 = (cos_th) / ry;\n var x0 = a00 * ox + a01 * oy;\n var y0 = a10 * ox + a11 * oy;\n var x1 = a00 * x + a01 * y;\n var y1 = a10 * x + a11 * y;\n\n var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);\n var sfactor_sq = 1 / d - 0.25;\n if (sfactor_sq < 0) sfactor_sq = 0;\n var sfactor = Math.sqrt(sfactor_sq);\n if (sweep == large) sfactor = -sfactor;\n var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);\n var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);\n\n var th0 = Math.atan2(y0-yc, x0-xc);\n var th1 = Math.atan2(y1-yc, x1-xc);\n\n var th_arc = th1-th0;\n if (th_arc < 0 && sweep === 1) {\n th_arc += 2 * Math.PI;\n } else if (th_arc > 0 && sweep === 0) {\n th_arc -= 2 * Math.PI;\n }\n\n var segs = Math.ceil(Math.abs(th_arc / (Math.PI * 0.5 + 0.001)));\n var result = [];\n for (var i=0; i<segs; ++i) {\n var th2 = th0 + i * th_arc / segs;\n var th3 = th0 + (i+1) * th_arc / segs;\n result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];\n }\n\n return (segmentCache[key] = result);\n }", "function Spline( points ) {\n\n\t \tthis.points = points;\n\n\t \tvar c = [], v3 = { x: 0, y: 0, z: 0 },\n\t \tpoint, intPoint, weight, w2, w3,\n\t \tpa, pb, pc, pd;\n\n\t \tthis.initFromArray = function ( a ) {\n\n\t \t\tthis.points = [];\n\n\t \t\tfor ( var i = 0; i < a.length; i ++ ) {\n\n\t \t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\n\n\t \t\t}\n\n\t \t};\n\n\t \tthis.getPoint = function ( k ) {\n\n\t \t\tpoint = ( this.points.length - 1 ) * k;\n\t \t\tintPoint = Math.floor( point );\n\t \t\tweight = point - intPoint;\n\n\t \t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\n\t \t\tc[ 1 ] = intPoint;\n\t \t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\n\t \t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\n\n\t \t\tpa = this.points[ c[ 0 ] ];\n\t \t\tpb = this.points[ c[ 1 ] ];\n\t \t\tpc = this.points[ c[ 2 ] ];\n\t \t\tpd = this.points[ c[ 3 ] ];\n\n\t \t\tw2 = weight * weight;\n\t \t\tw3 = weight * w2;\n\n\t \t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\n\t \t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\n\t \t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\n\n\t \t\treturn v3;\n\n\t \t};\n\n\t \tthis.getControlPointsArray = function () {\n\n\t \t\tvar i, p, l = this.points.length,\n\t \t\t\tcoords = [];\n\n\t \t\tfor ( i = 0; i < l; i ++ ) {\n\n\t \t\t\tp = this.points[ i ];\n\t \t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\n\n\t \t\t}\n\n\t \t\treturn coords;\n\n\t \t};\n\n\t \t// approximate length by summing linear segments\n\n\t \tthis.getLength = function ( nSubDivisions ) {\n\n\t \t\tvar i, index, nSamples, position,\n\t \t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\n\t \t\t\toldPosition = new Vector3(),\n\t \t\t\ttmpVec = new Vector3(),\n\t \t\t\tchunkLengths = [],\n\t \t\t\ttotalLength = 0;\n\n\t \t\t// first point has 0 length\n\n\t \t\tchunkLengths[ 0 ] = 0;\n\n\t \t\tif ( ! nSubDivisions ) nSubDivisions = 100;\n\n\t \t\tnSamples = this.points.length * nSubDivisions;\n\n\t \t\toldPosition.copy( this.points[ 0 ] );\n\n\t \t\tfor ( i = 1; i < nSamples; i ++ ) {\n\n\t \t\t\tindex = i / nSamples;\n\n\t \t\t\tposition = this.getPoint( index );\n\t \t\t\ttmpVec.copy( position );\n\n\t \t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\n\n\t \t\t\toldPosition.copy( position );\n\n\t \t\t\tpoint = ( this.points.length - 1 ) * index;\n\t \t\t\tintPoint = Math.floor( point );\n\n\t \t\t\tif ( intPoint !== oldIntPoint ) {\n\n\t \t\t\t\tchunkLengths[ intPoint ] = totalLength;\n\t \t\t\t\toldIntPoint = intPoint;\n\n\t \t\t\t}\n\n\t \t\t}\n\n\t \t\t// last point ends with total length\n\n\t \t\tchunkLengths[ chunkLengths.length ] = totalLength;\n\n\t \t\treturn { chunks: chunkLengths, total: totalLength };\n\n\t \t};\n\n\t \tthis.reparametrizeByArcLength = function ( samplingCoef ) {\n\n\t \t\tvar i, j,\n\t \t\t\tindex, indexCurrent, indexNext,\n\t \t\t\trealDistance,\n\t \t\t\tsampling, position,\n\t \t\t\tnewpoints = [],\n\t \t\t\ttmpVec = new Vector3(),\n\t \t\t\tsl = this.getLength();\n\n\t \t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\n\n\t \t\tfor ( i = 1; i < this.points.length; i ++ ) {\n\n\t \t\t\t//tmpVec.copy( this.points[ i - 1 ] );\n\t \t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\n\n\t \t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\n\n\t \t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\n\n\t \t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\n\t \t\t\tindexNext = i / ( this.points.length - 1 );\n\n\t \t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\n\n\t \t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\n\n\t \t\t\t\tposition = this.getPoint( index );\n\t \t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\n\n\t \t\t\t}\n\n\t \t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\n\n\t \t\t}\n\n\t \t\tthis.points = newpoints;\n\n\t \t};\n\n\t \t// Catmull-Rom\n\n\t \tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\n\n\t \t\tvar v0 = ( p2 - p0 ) * 0.5,\n\t \t\t\tv1 = ( p3 - p1 ) * 0.5;\n\n\t \t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n\t \t}\n\n\t }", "function lineIntersect(a,b,c,d){\n // http://paulbourke.net/geometry/lineline2d/\n var f = ((d.y - c.y)*(b.x - a.x) - (d.x - c.x)*(b.y - a.y)); \n if(f == 0){\n return null;\n }\n f = 1 / f;\n var fab = ((d.x - c.x)*(a.y - c.y) - (d.y - c.y)*(a.x - c.x)) * f ;\n if(fab < 0 || fab > 1){\n return null;\n }\n var fcd = ((b.x - a.x)*(a.y - c.y) - (b.y - a.y)*(a.x - c.x)) * f ;\n if(fcd < 0 || fcd > 1){\n return null;\n }\n return new V2(a.x + fab * (b.x-a.x), a.y + fab * (b.y - a.y) );\n }", "function isProjectedPointOnSegment(c, a, b) {\n var ab = b.subtract(a);\n var ac = c.subtract(a);\n var t = ac.dot(ab) / ab.dot(ab);\n return t >= 0 && t <= 1;\n}" ]
[ "0.6423302", "0.6368426", "0.62815225", "0.6260365", "0.6254019", "0.6101914", "0.6070711", "0.59512794", "0.59469426", "0.59067935", "0.583224", "0.5796831", "0.5796831", "0.57700837", "0.57184213", "0.56974655", "0.56851524", "0.5668007", "0.5667565", "0.55917317", "0.55894864", "0.5589344", "0.5555721", "0.55260473", "0.55204743", "0.55161065", "0.55155456", "0.5511266", "0.551023", "0.5489068", "0.54594404", "0.54519975", "0.5448312", "0.54402924", "0.54379684", "0.5396996", "0.5394163", "0.539361", "0.53870577", "0.53816277", "0.53740466", "0.53645", "0.5361379", "0.5360402", "0.5360273", "0.5347543", "0.53428674", "0.53428674", "0.53150326", "0.5311102", "0.5290312", "0.52897584", "0.5289178", "0.5288387", "0.52879024", "0.5280396", "0.5275705", "0.5274702", "0.52695143", "0.5258625", "0.5258625", "0.5258625", "0.5255654", "0.52489734", "0.5238737", "0.5234965", "0.5234206", "0.5226613", "0.52264464", "0.5225954", "0.52191114", "0.52185524", "0.521349", "0.5203219", "0.5193503", "0.51922005", "0.51795006", "0.5178316", "0.51774704", "0.51728165", "0.51676804", "0.51665884", "0.516483", "0.5155674", "0.5154567", "0.5135806", "0.5123046", "0.51192373", "0.51089936", "0.5093831", "0.5092006", "0.50819784", "0.5080314", "0.50724536", "0.5072013", "0.507114", "0.50699055", "0.50670856", "0.5063053", "0.5056565" ]
0.6872056
0
the longitudinal distance between points i and k
function dx(i, k){ var latlng = new google.maps.LatLng(pointarray[i].LatLng.lat(), pointarray[k].LatLng.lng()); var sign = (pointarray[k].LatLng.lng() > pointarray[i].LatLng.lng()) ? 1 : -1; return sign * google.maps.geometry.spherical.computeDistanceBetween(pointarray[i].LatLng, latlng); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dy(i, k){\n\tvar latlng = new google.maps.LatLng(pointarray[k].LatLng.lat(), pointarray[i].LatLng.lng());\n\tvar sign = (pointarray[k].LatLng.lat() > pointarray[i].LatLng.lat()) ? 1 : -1;\n\treturn sign * google.maps.geometry.spherical.computeDistanceBetween(latlng, pointarray[i].LatLng);\n}", "function kmeansDistance(p, q) {\n return geolib.getDistance(\n { lat: p[0], lng: p[1] },\n { lat: q[0], lat: q[1] }\n );\n }", "getCluster(data, value, k) {\n var result = 0;\n var d = -1;\n for (var i = 0; i < k; i++) {\n\n var distance = Math.abs(data[i].centroid - value);\n if (d == -1) {\n d = distance;\n } else if (d > distance) {\n d = distance;\n result = i;\n }\n }\n return result;\n }", "diff(k, vector) {\n let dVector = NVector.canonical(k, this.inputDim).prod(this.h);\n return this.value(vector.cSum(dVector).get(k) - vector.get(k)).cProd(1 / this.h);\n }", "function geo_dist(prob, k) {\n if (0 < prob <= 1) {\n return Math.pow(1 - prob, k - 1) * prob;\n } else throw \"prob must be between 0 and 1\";\n}", "function MetToKil(distance) {\n return new Distance(distance.length / 1000);\n}", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371;\n var dLat = deg2rad(lat2 - lat1);\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n return d;\n }", "_getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\r\n var R = 6371; // Radius of the earth in km\r\n var dLat = this._deg2rad(lat2-lat1);\r\n var dLon = this._deg2rad(lon2-lon1); \r\n var a = \r\n Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.cos(this._deg2rad(lat1)) * Math.cos(this._deg2rad(lat2)) * \r\n Math.sin(dLon/2) * Math.sin(dLon/2)\r\n ; \r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \r\n var d = R * c; // Distance in km\r\n return d;\r\n }", "function getIntersection (i, k) {\n\tvar det = dx(i,i + 1) * dy(k,k + 1) - dx(k, k +1 ) * dy(i, i + 1);\n\tvar s = dx(i,k) * dy (k,k + 1) - dx(k,k + 1) * dy(i, k); s = s / det;\n\tvar t = dy(i,k) * dx (i,i + 1) - dy(i,i + 1) * dx(i, k); t = t / det;\n\treturn s;\n}", "function longLatDistance (lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad(); \n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //sys.puts(d.toString() + \"km from here\");\n return d;\n}", "function pairsTooLong(k, arr) {\n // declare count to track number of pairs\n let count = 0\n // loop to get through values, omitting last value (no comparison)\n for (let i = 0; i < arr.length - 1; i ++) {\n // loop to compare, j determined by value of i\n for (let j = i + 1; j < arr.length; j ++) {\n let diff = Math.abs(arr[i] - arr[j])\n\n if (diff == k) {\n count = count + 1\n }\n }\n }\n // return count\n // (or)\n console.log('Final count: ', count)\n}", "function getDistanceFromLatLonInKm(lat1, lon1, cosLat1, lat2, lon2, cosLat2) {\n\n var dLat = (lat2 - lat1) * (Math.PI / 180);\n var dLon = (lon2 - lon1) * (Math.PI / 180);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n cosLat1 * cosLat2 *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return R * c;\n}", "GetDistanceToPoint() {}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n\t\t\t\t var R = 6371; // Radius of the earth in km\n\t\t\t\t var dLat = deg2rad(lat2-lat1); // deg2rad below\n\t\t\t\t var dLon = deg2rad(lon2-lon1); \n\t\t\t\t var a = \n\t\t\t\t Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\t\t\t Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n\t\t\t\t Math.sin(dLon/2) * Math.sin(dLon/2)\n\t\t\t\t ; \n\t\t\t\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\t\t\t\t var d = R * c; // Distance in km\n\t\t\t\t return d;\n\t\t\t\t}", "function distance(p1, p2) { return length_v2(diff_v2(p1, p2)); }", "function getKNearestNeighbor(k, mouseCoords) {\n if (points.length == 0) {\n return {\"cluster\":0, \"radius\":INITIAL_RADIUS};\n }\n\n var Distances = new Array();\n for(var i = 0; i < points.length; i++) {\n points[i][\"cluster\"] = points[i][\"class\"];\n var dist = euklideanDist(points[i], mouseCoords);\n Distances.push({\"dist\":dist, \"class\":points[i][\"class\"]});\n } \n\n numberSort = function (a,b) {\n return a[\"dist\"] - b[\"dist\"];\n };\n\n Distances.sort(numberSort);\n if (Distances.length < k) {\n /* initialise array to count */\n var classCount = new Array(maxKnearestNeighborClasses);\n for(var i=0;i<maxKnearestNeighborClasses;i++) {\n classCount[i] = 0;\n }\n \n /* count classes */\n for(var i = 0; i < Distances.length; i++) {\n classCount[Distances[i][\"class\"]]++;\n }\n\n /* find maximum */\n maxClass = 0;\n maxClassCount = 0;\n for(var i =0; i <maxKnearestNeighborClasses;i++) {\n if(maxClassCount < classCount[i]) {\n maxClassCount = classCount[i];\n maxClass = i;\n }\n }\n return {\"cluster\":maxClass, \"radius\":Distances.slice(-1)[0][\"dist\"]};\n } else {\n /* initialise array to count */\n var classCount = new Array(maxKnearestNeighborClasses);\n for(var i=0;i<maxKnearestNeighborClasses;i++) {\n classCount[i] = 0;\n }\n\n\n for(var i = 0; i < k; i++) {\n classCount[Distances[i][\"class\"]]++;\n }\n\n /* find maximum */\n maxClass = 0;\n maxClassCount = 0;\n for(var i =0; i <maxKnearestNeighborClasses;i++) {\n if(maxClassCount < classCount[i]) {\n maxClassCount = classCount[i];\n maxClass = i;\n }\n }\n return {\"cluster\":maxClass, \n \"radius\":Distances[k-1][\"dist\"]};\n }\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c* 0.6213712; // Distance in Miles\n return d;\n}", "function classicDistorsion(k) {\n var n_samples = 44100,\n curve = new Float32Array(n_samples),\n deg = Math.PI / 180, i = 0, x;\n\n for (; i < n_samples; ++i) {\n x = i * 2 / n_samples - 1;\n curve[i] = (3 + k) * x * 57 * deg / (Math.PI + k * Math.abs(x));\n }\n return curve;\n }", "function closest(points, k) {\n var arr = []\n for(var i =0 ; i<points.length ; i++) {\n var obj = {}\n var x = points[i][0]\n var y = points[i][1]\n\n var distance = Math.sqrt(x*x + y*y)\n\n obj['coordinates'] = points[i]\n obj['distance'] = distance\n\n arr.push(obj)\n }\n\n var sortedArr = arr.sort((a,b) => {\n return a.distance - b.distance\n })\n\n var arrResult = []\n\n for(var i =0 ; i < k ; i ++) {\n arrResult.push(sortedArr[i]['coordinates'])\n }\n\n return arrResult\n\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function _delaunay_distance(v1, v2) {\n\treturn Math.sqrt(Math.pow(v2.x - v1.x, 2) + Math.pow(v2.y - v1.y, 2));\n}", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n return d;\n }", "function dist2(r,c) {\n\t\tvar d = 0;\n\t\t\tfor(var k=0;k<nv;k++)\n\t\t\t\td += (r[graph.ivalues[k]]-c[k])*(r[graph.ivalues[k]]-c[k]);\n\t\treturn d;\n\t}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in km\n return d;\n}", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n return d;\n }", "function KilToMet(distance) {\n return new Distance(distance.length * 1000);\n}", "function calcDistance(points) {\n var sum = 0;\n var prev = 0;\n for (var i = 0; i < points.length; i++) {\n var d = distances[prev][points[i]];\n prev = points[i];\n sum += d;\n }\n //points.unshift(0);\n return sum;\n}", "function sol(nums, k) {\n // sum : index\n const map = {};\n map[0] = -1;\n let sum = 0;\n let maxLen = 0;\n for (let i = 0; i < nums.length; i++) {\n sum += nums[i];\n if (map[`${sum - k}`]) {\n maxLen = Math.max(maxLen, i - map[`${sum - k}`]);\n }\n if (!map[sum]) map[sum] = i;\n }\n\n return maxLen;\n}", "getDistanceFromLatLonInKm(lat1, lon1) {\n const R = 6371; // Radius of the earth in km\n const dLat = this.deg2rad(this.latitude - lat1);\n const dLon = this.deg2rad(this.longitude - lon1);\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(this.latitude)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n const d = R * c; // Distance in km\n this.distance = d.toFixed();\n }", "function distance(p1, p2){\n\tvar result = 0;\n\tfor(var i = 0; i < 3; i++){\n\t\tresult += Math.pow( p1[i] - p2[i], 2);\n\t}\n\treturn result;\n}", "function distance(key) {\n return Math.abs(data[key].x - point.x) + Math.abs(data[key].y - point.y);\n }", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) *\n Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n return d;\n }", "function geoDistanceKm(p1,p2) {\n var R = 6371; // km\n var x1 = p2.lat()-p1.lat();\n var dLat = x1.toRad();\n var x2 = p2.lng()-p1.lng();\n var dLon = x2.toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(p1.lat().toRad()) * Math.cos(p2.lat().toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n return R * c;\n }", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n return d;\n }", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n\n lat1 = parseFloat(lat1);\n lon1 = parseFloat(lon1);\n lat2 = parseFloat(lat2);\n lon2 = parseFloat(lon2);\n\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n\n return d;\n }", "function getDistorsionValue() {\n var pos = logToPos(k);\n return parseFloat(pos).toFixed(1);\n }", "function longitud(vector) {\n return Math.sqrt(Math.pow(vector.x, 2) + Math.pow(vector.y, 2))\n}", "function geoDistanceKm(p1,p2) {\n var R = 6371; // km\n var x1 = p2.lat()-p1.lat();\n var dLat = x1.toRad();\n var x2 = p2.lng()-p1.lng();\n var dLon = x2.toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(p1.lat().toRad()) * Math.cos(p2.lat().toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n return R * c;\n}", "function distanceMeter(km)\n {\n var meters=km*1000;\n return meters;\n\n }", "function distance(i1, i2) {\n return Math.abs(i1 - i2);\n }", "ln (k = 0) {\n\t\t\treturn Complex.C (Math.log (this.r), this.arg + 2 * Math.PI * k);\n\t\t}", "function calcDistance(points) {\n\tlet sum = 0;\n\n\tfor (let i = 0; i < points.length - 1; i++) {\n\t\tlet d = dist(points[i].x, points[i].y, points[i + 1].x, points[i + 1].y);\n\t\tsum += d;\n\t}\n\n\treturn sum;\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n \n function deg2rad(deg) {\n return deg * (Math.PI/180)\n }\n\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function distEuclid(dataItem, centroid, dataMeta) {\n // The distance should be normalized between different dimensions,\n // otherwise they may provide different weight in the final distance.\n // The greater weight offers more effect in the cluster determination.\n\n var powerSum = 0;\n var dimensions = dataMeta.dimensions;\n var extents = dataMeta.rawExtents;\n //subtract the corresponding elements in the vectors\n for (var i = 0; i < dimensions.length; i++) {\n var span = extents[i].span;\n // If span is 0, do not count.\n if (span) {\n var dimIdx = dimensions[i];\n var dist = (dataItem[dimIdx] - centroid[i]) / span;\n powerSum += mathPow(dist, 2);\n }\n }\n\n return powerSum;\n }", "function knn(features, labels, predictionPoint, k) {\n // tf.moments() => gives { mean, variance }\n // Standard Deviation = sqrt(variance)\n const { mean, variance } = tf.moments(features, 0);\n const standardDeviation = variance.pow(0.5);\n const scale = point => standardize(point, mean, standardDeviation);\n\n return (\n scale(features)\n .sub(scale(predictionPoint))\n .pow(2)\n .sum(1)\n .pow(0.5)\n .expandDims(1)\n .concat(labels, 1)\n .unstack()\n .sort((a, b) => (a.get(0) > b.get(0) ? 1 : -1))\n .slice(0, k)\n .reduce((acc, pair) => acc + pair.get(1), 0) / k\n );\n}", "function allLengthsOptimal(k, shorter, longer) {\n let lengths = new Set();\n for(let nShorter = 0; nShorter <= k; nShorter++) {\n let nLonger = k - nShorter;\n let length = (shorter * nShorter) + (longer * nLonger);\n lengths.add(length)\n }\n return lengths\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n function deg2rad(deg) {\n return deg * (Math.PI/180)\n }\n\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var distKm = R * c; // Distance in km\n\n return distKm;\n }", "function $PP_CloudDistance(pts1, pts2) // revised for $P+\r\n{\r\n\tvar matched = new Array(pts1.length); // pts1.length == pts2.length\r\n\tfor (var k = 0; k < pts1.length; k++)\r\n\t\tmatched[k] = false;\r\n\tvar sum = 0;\r\n\tfor (var i = 0; i < pts1.length; i++)\r\n\t{\r\n\t\tvar index = -1;\r\n\t\tvar min = +Infinity;\r\n\t\tfor (var j = 0; j < pts1.length; j++)\r\n\t\t{\r\n\t\t\tvar d = $PP_DistanceWithAngle(pts1[i], pts2[j]);\r\n\t\t\tif (d < min) {\r\n\t\t\t\tmin = d;\r\n\t\t\t\tindex = j;\r\n\t\t\t}\r\n\t\t}\r\n\t\tmatched[index] = true;\r\n\t\tsum += min;\r\n\t}\r\n\tfor (var j = 0; j < matched.length; j++)\r\n\t{\r\n\t\tif (!matched[j]) {\r\n\t\t\tvar min = +Infinity;\r\n\t\t\tfor (var i = 0; i < pts1.length; i++) {\r\n\t\t\t\tvar d = $PP_DistanceWithAngle(pts1[i], pts2[j]);\r\n\t\t\t\tif (d < min)\r\n\t\t\t\t\tmin = d;\r\n\t\t\t}\r\n\t\t\tsum += min;\r\n\t\t}\r\n\t}\r\n\treturn sum;\r\n}", "function calculateDistances(cluster) {\n var startLocation = cluster.properties.startLocation;\n cluster.features.forEach(function(isoline) {\n var points = _(isoline.geometry.coordinates).flatten().flatten().value();\n isoline.properties.distances = getDistances(startLocation, points);\n });\n}", "getDistanceByLatLon(taxi_lat, taxi_lon, point_lat, point_lon) {\r\n\t\t\treturn (6371 * Math.acos(\r\n\t\t\t\t\t\tMath.cos(point_lat * Math.PI /180) *\r\n\t\t\t\t\t\tMath.cos(taxi_lat * Math.PI /180) *\r\n\t\t\t\t\t\tMath.cos((taxi_lon * Math.PI /180) - (point_lon * Math.PI /180)) +\r\n\t\t\t\t\t\tMath.sin(point_lat * Math.PI / 180) *\r\n\t\t\t\t\t\tMath.sin(taxi_lat * Math.PI / 180)) \r\n\t\t\t\t\t) ;\r\n\t\t}", "function getDistance(c1 ,c2){\n \n let x1 = c1.x ;\n let y1 = c1.y ;\n let x2 = c2.x ;\n let y2 = c2.y ;\n let x = x2-x1;\n let y = y2-y1;\n return (Math.sqrt(Math.pow(x,2)+Math.pow(y,2)));\n\n }", "function calculateDistanceKM(lat1, lon1, lat2, lon2) {\n var R = 6371;\n var dLat = (lat2-lat1).toRad();\n console.log(\"dLAT = \"+dLat);\n \n if (typeof(Number.prototype.toRad) === \"undefined\") {\n Number.prototype.toRad = function() {\n return this * Math.PI / 180;\n }\n }\n \n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos((lat1* Math.PI / 180).toRad()) * Math.cos((lat2* Math.PI / 180).toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n \n return d;\n}", "function k_closest_stars(sequence, k){\n\n}", "function maxLength3(a, k) {\n let answer = 0\n for (i = 0; i < a.length; i++) {\n let total = 0\n let l = 0\n for (let curInd = i; curInd < a.length; curInd++) {\n total = total + a[curInd]\n if (total <= k) {\n l = curInd - i + 1\n } else break\n }\n if (l > answer) answer = l\n }\n return answer\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 distance (point1, point2) {\n Math.sqrt(Math.pow(point1[0] - point1[1], 2) + Math.pow(point2[0] - point2[1], 2))\n}", "function geo_distnot(prob, k) {\n if (0 < prob <= 1) {\n return Math.pow(1 - prob, k) * prob;\n } else throw \"prob must be between 0 and 1\";\n}", "function _distance(point1, point2) {\n return Math.sqrt((point1[0] - point2[0]) * (point1[0] - point2[0]) + (point1[1] - point2[1]) * (point1[1] - point2[1]) + (point1[2] - point2[2]) * (point1[2] - point2[2]));\n}", "function pairs(k, arr) {\n let count = 0\n for (let i=0; i< arr.length-1; i++) {\n for (let j=i+1; j<arr.length; j++) {\n if ((arr[i] - arr[j]) == k || (arr[j] - arr[i]) == k) {\n count++\n }\n }\n }\n return count\n}", "function meridianDist(lat) {\n\t\t\tvar c1 = MajorAxis * (1 - Ecc / 4 - 3 * E4 / 64 - 5 * E6 / 256);\n\t\t\tvar c2 = -MajorAxis * (3 * Ecc / 8 + 3 * E4 / 32 + 45 * E6 / 1024);\n\t\t\tvar c3 = MajorAxis * (15 * E4 / 256 + 45 * E6 / 1024);\n\t\t\tvar c4 = -MajorAxis * 35 * E6 / 3072;\n\t\t\t\n\t\t\treturn(c1 * lat + c2 * Math.sin(lat * 2) + c3 * Math.sin(lat * 4) + c4 * Math.sin(lat * 6));\n\t\t}", "function levDist(s, t) {\n var d = []; //2d matrix\n\n // Step 1\n var n = s.length;\n var m = t.length;\n\n if (n == 0) return m;\n if (m == 0) return n;\n\n //Create an array of arrays in javascript (a descending loop is quicker)\n for (var i = n; i >= 0; i--) d[i] = [];\n\n // Step 2\n for (var i = n; i >= 0; i--) d[i][0] = i;\n for (var j = m; j >= 0; j--) d[0][j] = j;\n\n // Step 3\n for (var i = 1; i <= n; i++) {\n var s_i = s.charAt(i - 1);\n\n // Step 4\n for (var j = 1; j <= m; j++) {\n\n //Check the jagged ld total so far\n if (i == j && d[i][j] > 4) return n;\n\n var t_j = t.charAt(j - 1);\n var cost = (s_i == t_j) ? 0 : 1; // Step 5\n\n //Calculate the minimum\n var mi = d[i - 1][j] + 1;\n var b = d[i][j - 1] + 1;\n var c = d[i - 1][j - 1] + cost;\n\n if (b < mi) mi = b;\n if (c < mi) mi = c;\n\n d[i][j] = mi; // Step 6\n\n //Damerau transposition\n if (i > 1 && j > 1 && s_i == t.charAt(j - 2) && s.charAt(i - 2) == t_j) {\n d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);\n }\n }\n }\n // Step 7\n return d[n][m];\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 knn(features, labels, predictionPoint, k){\n const {mean,variance}=tf.moments(features,0);\n const scaledPrediction=predictionPoint.sub(mean).div(variance.pow(.5));\n return features\n .sub(mean)\n .div(variance.pow(.5))\n .sub(scaledPrediction)\n .pow(2)\n .sum(1)\n .pow(0.5)\n .expandDims(1)\n .concat(labels, 1)\n .unstack()\n .sort((tensorA, tensorB) => tensorA.arraySync() > tensorB.arraySync() ? 1 : -1)\n .slice(0, k)\n .reduce((acc, pair) => acc + pair.arraySync()[1], 0) / k;\n}", "function sellers_levenshtein (pattern, txt, k) {\n if (pattern === txt) return 0;\n\n let smallest_distance = k + 1;\n let prev_diag_value;\n let col = [0];\n let j;\n let i = pattern.length;\n\n while (i--) col[i] = i;\n\n for (j = 1; j <= txt.length; j++) {\n prev_diag_value = 0;\n\n for (i = 1; i <= pattern.length; i++) {\n [prev_diag_value, col[i]] = [col[i], prev_diag_value];\n\n if (pattern[i-1] === txt[j-1]) continue;\n else col[i] = 1 + Math.min(col[i], col[i-1], prev_diag_value);\n }\n\n if (col[i-1] === 0) return col[i-1];\n if (col[i-1] < smallest_distance) smallest_distance = col[i-1];\n }\n\n if (smallest_distance <= k) return smallest_distance;\n else return -1;\n}", "function dist(c1, c2){\r\n return ((c2.x - c1.x) ** 2 + (c2.y - c1.y) ** 2) ** 0.5;\r\n}", "function len (p1, p2) {\n return Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y))\n }", "function distanceInKmBetweenCoords(lat1, lon1, lat2, lon2) {\n var earthRadiusKm = 6371;\n\n var dLat = degreesToRadians(lat2-lat1);\n var dLon = degreesToRadians(lon2-lon1);\n\n lat1 = degreesToRadians(lat1);\n lat2 = degreesToRadians(lat2);\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n return earthRadiusKm * c;\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); \n }", "function getMinDiff(arr, k) {\n console.log(\"Input Array: \", arr);\n console.log(\"K: \", k);\n var n = arr.length;\n arr = arr.sort((a, b) => a - b);\n var ans = arr[n - 1] - arr[0]; // get initial max diff\n\n var tempmin = arr[0]; // get temp min\n var tempmax = arr[n - 1]; // get temp max\n for (var i = 1; i < n; i++) {\n if (arr[i] - k < 0) {\n continue;\n }\n\n tempmin = Math.min(arr[0] + k, arr[i] - k);\n tempmax = Math.max(arr[n - 1] - k, arr[i - 1] + k)\n\n ans = Math.min(ans, tempmax - tempmin);\n }\n console.log(\"Output: \", ans);\n return ans;\n}", "function maxLength2(a, k) {\n let answer = 0\n for (i = 0; i < a.length; i++) {\n let total = 0\n let l = 0\n let curInd = i\n while (total <= k && curInd < a.length) {\n l++\n total = total + a[curInd]\n console.log(total + \"total\" + l)\n curInd++\n }\n if (curInd)\n if ( l - 1 > answer) answer = l - 1\n }\n return answer\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n \n d = ConvertKmToMile(d);\n console.log(d);\n return d;\n}", "function distanciaPuntos(lat1,lon1,lat2,lon2)\n{\n\tvar R = 6371e3;//Radio de la tierra\n\tvar Ang1 = lat1 * Math.PI/180;\n\tvar Ang2 = lat2 * Math.PI/180;\n\tvar A1 = (lat2-lat1) * Math.PI/180;\n\tvar A2 = (lon2-lon1) * Math.PI/180;\n\n\tvar a = Math.sin(A1/2) * Math.sin(A1/2) +\n\t\t\t Math.cos(Ang1) * Math.cos(Ang2) *\n\t\t\t Math.sin(A2/2) * Math.sin(A2/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n\treturn ((R * c)/1000).toFixed(2)+\" Km\";\n}", "function distance(lat1, lon1, lat2, lon2) {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var radlon1 = Math.PI * lon1/180;\n var radlon2 = Math.PI * lon2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n\n unit = \"K\";\n if (unit==\"K\") { dist = dist * 1.609344; }\n if (unit==\"N\") { dist = dist * 0.8684; }\n return dist;\n}", "function getNIdx (mp, points, stepsize) {\n var i, dist, nIdx;\n var min = Infinity;\n\n for (i=0; i < 8; i+=stepsize) {\n dist = vec2.dist(mp, points[i]);\n if (dist < min) {\n min = dist;\n nIdx = i;\n }\n }\n return nIdx;\n}", "function dist(p1, p2)\n{\n return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);\n}", "function distance(p1, p2) {\r\n\treturn Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2));\r\n}", "calculer_distance() {}", "get distance() {}", "function getDistanceBetweenTwoLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = degTorad(lat2 - lat1); \n var dLon = degTorad(lon2 - lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(degTorad(lat1)) * Math.cos(degTorad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "dist (pos1, pos2) {\n return Math.sqrt(\n Math.pow(pos1[0] - pos2[0], 2) + Math.pow(pos1[1] - pos2[1], 2)\n );\n }", "function singeK(dataIn, k){\n let data = copy(dataIn);\n\n let i;\n let centers = [];\n let IDvec = [];\n let oldCenters = [];\n let ktest = k;\n let nrUnique = 0;\n while(nrUnique < ktest){\n centers = []\n oldCenters = []\n for(i = 0; i < ktest; i++){\n centers.push(randomize(data)) //initiate centers\n oldCenters.push(randomize(data)) //initiate old centers\n }\n \n IDvec = [];\n for(i = 0; i < data.length; i++){\n IDvec.push(clusterID(centers, data[i]));\n }\n nrUnique = IDvec.filter( onlyUnique ).length;\n }\n\n let iteration = 0;\n let clusterMatrix;\n let randval;\n nrUnique = 0;\n while(convergenceTest(oldCenters, centers, iteration) === false){\n iteration = iteration + 1;\n while(nrUnique < ktest){\n for(i = 0; i < centers.length; i++){\n oldCenters[i] = centers[i];\n clusterMatrix = clusterData(i, IDvec, data);\n if(clusterMatrix = []){\n randval = Math.floor(Math.random()*data.length);\n IDvec[randval] = i;\n clusterMatrix = clusterData(i, IDvec, data);\n };\n centers[i] = findCenter(clusterMatrix); /////////////////////\n }\n IDvec = [];\n for(i = 0; i < data.length; i++){\n IDvec.push(clusterID(centers, data[i]));\n }\n nrUnique = IDvec.filter( onlyUnique ).length;\n }\n\n }\n return [IDvec, centers]\n}", "getLength() {\n var x1 = this.point1.getX();\n var y1 = this.point1.getY();\n var x2 = this.point2.getX();\n var y2 = this.point2.getY();\n return Math.hypot(x1 - x2, y1 - y2);\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}", "dist (pos1, pos2) {\n\t return Math.sqrt(\n\t Math.pow(pos1[0] - pos2[0], 2) + Math.pow(pos1[1] - pos2[1], 2)\n\t );\n\t }", "function getDistance(user1, user2, keys) {\n return keys.reduce((sum, key) => sum + Math.abs(user1[key] - user2[key]), 0);\n}", "function kthPairSum (arr, k){\n\tif(arr.length <= 2) return arr;\n\tconst result = [];\n\n\t// two pointers\n\tlet sP = arr[1] > arr[0] ? 0 : 1;\n\tlet lP = arr[1] > arr[0] ? 1 : 0;\n\n\tresult.push([sP, lP]);\n\n\t// start from idx 2 \n\tfor(let i=2; i<arr.length; i++){\n\t\tlet next = arr[i];\n\t\tif (next > arr[sP]){\n\t\t\tif(next > arr[lP]){\n\t\t\t\tsP = lP;\n\t\t\t\tlP = i;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsP = i;\n\t\t\t}\n\t\t\tresult.push([sP, lP])\n\t\t}\n\t}\n\n\t// return the kth biggest - from right to left of the result array return k\n\n\treturn result[result.length - k];\n}", "function cantorPairing(k1, k2) {\n\treturn ((((k1+k2) * (k1+k2+1)) / 2) + k2);\n}", "distance (a, b) {\n return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n }", "function get_distances_per_lat_long(lat, long){\n return [111.32*10**3, 40075 *10**3 * Math.cos( lat ) / 360];\n }", "function getDistance(a, b) {\n 'use strict';\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) +\n (a[1] - b[1]) * (a[1] - b[1]));\n}", "function computeDistance(p1, p2) {\n var R = 6371000; // m\n var d = Math.acos(Math.sin(p1.latitude) * Math.sin(p2.latitude) +\n Math.cos(p1.latitude) * Math.cos(p2.latitude) *\n Math.cos(p2.longitude - p1.longitude)) * R;\n return d;\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function distance(p1, p2)\n{\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function f(n, k){\r\n let dp = new Array(n + 1)\r\n for (let i=0; i<n+1; i++)\r\n dp[i] = new Array(k + 1).fill(0)\r\n \r\n dp[0][0] = 1\r\n \r\n \r\n for (let i=1; i<=n; i++)\r\n for (let j=1; j<=Math.min(i, k); j++) {\r\n dp[i][j] = dp[i - j][j] + dp[i - 1][j - 1]\r\n console.log(dp); \r\n } \r\n return dp[n][k]\r\n}", "distance(p) {\n return Math.sqrt(this.squaredDistance(p));\n }", "function havDistance(lat1, lat2, dLng) {\n return hav(lat1 - lat2) + hav(dLng) * Math.cos(lat1) * Math.cos(lat2);\n}", "static distance(p1, p2) {\n const dx = (p1.x - p2.x);\n const dy = (p1.y - p2.y);\n return Math.sqrt(dx * dx + dy * dy);\n }" ]
[ "0.67786604", "0.62765473", "0.6053718", "0.59932667", "0.5943284", "0.57277036", "0.57270545", "0.57172847", "0.56388736", "0.5634655", "0.56286424", "0.56047046", "0.5599009", "0.5593887", "0.5580052", "0.55335015", "0.55155176", "0.54399455", "0.5432419", "0.54315674", "0.5409407", "0.54090595", "0.54045385", "0.53932387", "0.5378595", "0.53746146", "0.53739285", "0.5356243", "0.5350999", "0.5348745", "0.53434813", "0.53407156", "0.53287476", "0.5324837", "0.5322448", "0.5320643", "0.53168607", "0.5306794", "0.5305897", "0.5279538", "0.5276535", "0.5276307", "0.5272563", "0.5261069", "0.5249412", "0.5241983", "0.5223964", "0.52227455", "0.52026236", "0.51995087", "0.5186645", "0.51853544", "0.5183184", "0.51722544", "0.51696837", "0.5166818", "0.5160251", "0.5146441", "0.51405543", "0.5139628", "0.51289517", "0.512535", "0.51199436", "0.5115857", "0.5109307", "0.5108571", "0.51039803", "0.5097723", "0.50951916", "0.50880265", "0.5085591", "0.5085421", "0.50841975", "0.5081175", "0.50804234", "0.5080222", "0.5076718", "0.50755996", "0.5075115", "0.50716954", "0.5065925", "0.5061161", "0.5054322", "0.50414896", "0.504112", "0.50388795", "0.50380814", "0.5037001", "0.50332373", "0.5018679", "0.5017384", "0.50167745", "0.50167745", "0.50167745", "0.50167745", "0.501202", "0.5010891", "0.50067836", "0.5003519", "0.50014615" ]
0.6682368
1
the lateral distance between points i and k
function dy(i, k){ var latlng = new google.maps.LatLng(pointarray[k].LatLng.lat(), pointarray[i].LatLng.lng()); var sign = (pointarray[k].LatLng.lat() > pointarray[i].LatLng.lat()) ? 1 : -1; return sign * google.maps.geometry.spherical.computeDistanceBetween(latlng, pointarray[i].LatLng); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dx(i, k){\n\tvar latlng = new google.maps.LatLng(pointarray[i].LatLng.lat(), pointarray[k].LatLng.lng());\n\tvar sign = (pointarray[k].LatLng.lng() > pointarray[i].LatLng.lng()) ? 1 : -1;\n\treturn sign * google.maps.geometry.spherical.computeDistanceBetween(pointarray[i].LatLng, latlng);\n}", "function calcDistance(points) {\n var sum = 0;\n var prev = 0;\n for (var i = 0; i < points.length; i++) {\n var d = distances[prev][points[i]];\n prev = points[i];\n sum += d;\n }\n //points.unshift(0);\n return sum;\n}", "function kmeansDistance(p, q) {\n return geolib.getDistance(\n { lat: p[0], lng: p[1] },\n { lat: q[0], lat: q[1] }\n );\n }", "diff(k, vector) {\n let dVector = NVector.canonical(k, this.inputDim).prod(this.h);\n return this.value(vector.cSum(dVector).get(k) - vector.get(k)).cProd(1 / this.h);\n }", "function dist2(r,c) {\n\t\tvar d = 0;\n\t\t\tfor(var k=0;k<nv;k++)\n\t\t\t\td += (r[graph.ivalues[k]]-c[k])*(r[graph.ivalues[k]]-c[k]);\n\t\treturn d;\n\t}", "function geo_dist(prob, k) {\n if (0 < prob <= 1) {\n return Math.pow(1 - prob, k - 1) * prob;\n } else throw \"prob must be between 0 and 1\";\n}", "function getIntersection (i, k) {\n\tvar det = dx(i,i + 1) * dy(k,k + 1) - dx(k, k +1 ) * dy(i, i + 1);\n\tvar s = dx(i,k) * dy (k,k + 1) - dx(k,k + 1) * dy(i, k); s = s / det;\n\tvar t = dy(i,k) * dx (i,i + 1) - dy(i,i + 1) * dx(i, k); t = t / det;\n\treturn s;\n}", "function closest(points, k) {\n var arr = []\n for(var i =0 ; i<points.length ; i++) {\n var obj = {}\n var x = points[i][0]\n var y = points[i][1]\n\n var distance = Math.sqrt(x*x + y*y)\n\n obj['coordinates'] = points[i]\n obj['distance'] = distance\n\n arr.push(obj)\n }\n\n var sortedArr = arr.sort((a,b) => {\n return a.distance - b.distance\n })\n\n var arrResult = []\n\n for(var i =0 ; i < k ; i ++) {\n arrResult.push(sortedArr[i]['coordinates'])\n }\n\n return arrResult\n\n}", "function calcDistance(points) {\n\tlet sum = 0;\n\n\tfor (let i = 0; i < points.length - 1; i++) {\n\t\tlet d = dist(points[i].x, points[i].y, points[i + 1].x, points[i + 1].y);\n\t\tsum += d;\n\t}\n\n\treturn sum;\n}", "GetDistanceToPoint() {}", "getCluster(data, value, k) {\n var result = 0;\n var d = -1;\n for (var i = 0; i < k; i++) {\n\n var distance = Math.abs(data[i].centroid - value);\n if (d == -1) {\n d = distance;\n } else if (d > distance) {\n d = distance;\n result = i;\n }\n }\n return result;\n }", "function distance(p1, p2){\n\tvar result = 0;\n\tfor(var i = 0; i < 3; i++){\n\t\tresult += Math.pow( p1[i] - p2[i], 2);\n\t}\n\treturn result;\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}", "function classicDistorsion(k) {\n var n_samples = 44100,\n curve = new Float32Array(n_samples),\n deg = Math.PI / 180, i = 0, x;\n\n for (; i < n_samples; ++i) {\n x = i * 2 / n_samples - 1;\n curve[i] = (3 + k) * x * 57 * deg / (Math.PI + k * Math.abs(x));\n }\n return curve;\n }", "function distance(key) {\n return Math.abs(data[key].x - point.x) + Math.abs(data[key].y - point.y);\n }", "function k_closest_stars(sequence, k){\n\n}", "function getKNearestNeighbor(k, mouseCoords) {\n if (points.length == 0) {\n return {\"cluster\":0, \"radius\":INITIAL_RADIUS};\n }\n\n var Distances = new Array();\n for(var i = 0; i < points.length; i++) {\n points[i][\"cluster\"] = points[i][\"class\"];\n var dist = euklideanDist(points[i], mouseCoords);\n Distances.push({\"dist\":dist, \"class\":points[i][\"class\"]});\n } \n\n numberSort = function (a,b) {\n return a[\"dist\"] - b[\"dist\"];\n };\n\n Distances.sort(numberSort);\n if (Distances.length < k) {\n /* initialise array to count */\n var classCount = new Array(maxKnearestNeighborClasses);\n for(var i=0;i<maxKnearestNeighborClasses;i++) {\n classCount[i] = 0;\n }\n \n /* count classes */\n for(var i = 0; i < Distances.length; i++) {\n classCount[Distances[i][\"class\"]]++;\n }\n\n /* find maximum */\n maxClass = 0;\n maxClassCount = 0;\n for(var i =0; i <maxKnearestNeighborClasses;i++) {\n if(maxClassCount < classCount[i]) {\n maxClassCount = classCount[i];\n maxClass = i;\n }\n }\n return {\"cluster\":maxClass, \"radius\":Distances.slice(-1)[0][\"dist\"]};\n } else {\n /* initialise array to count */\n var classCount = new Array(maxKnearestNeighborClasses);\n for(var i=0;i<maxKnearestNeighborClasses;i++) {\n classCount[i] = 0;\n }\n\n\n for(var i = 0; i < k; i++) {\n classCount[Distances[i][\"class\"]]++;\n }\n\n /* find maximum */\n maxClass = 0;\n maxClassCount = 0;\n for(var i =0; i <maxKnearestNeighborClasses;i++) {\n if(maxClassCount < classCount[i]) {\n maxClassCount = classCount[i];\n maxClass = i;\n }\n }\n return {\"cluster\":maxClass, \n \"radius\":Distances[k-1][\"dist\"]};\n }\n}", "function distance(p1, p2) { return length_v2(diff_v2(p1, p2)); }", "function eachStrokeLen(sketch, points) {\r\n var sum = 0;\r\n for (var i = 1; i < points.length; i++) {\r\n var id1 = points[i - 1];\r\n var id2 = points[i];\r\n // console.log(id1);\r\n // console.log(sketch.pointsObj[id1]);\r\n var dis = distance(sketch.pointsObj[id1], sketch.pointsObj[id2]);\r\n sum += dis;\r\n }\r\n // console.log(\"each stroke length is \" + sum);\r\n return sum;\r\n}", "function dist(p1, p2)\n{\n return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);\n}", "function weightDistance (pt1,pt2) {\n const xCost = 1\n const yCost = 1\n const zCost = 1\n\n return parseFloat(Math.sqrt(xCost*Math.pow((pt1.x - pt2.x),2)+\n yCost*Math.pow((pt1.y - pt2.y),2)+\n zCost*Math.pow((pt1.z - pt2.z),2)))\n}", "distance(vertices) {\n let d = 0\n for(let i=0; i<vertices.length; i++) {\n if (i > 0) d = d + distance(vertices[i], vertices[i-1])\n }\n\n return d\n }", "function $PP_CloudDistance(pts1, pts2) // revised for $P+\r\n{\r\n\tvar matched = new Array(pts1.length); // pts1.length == pts2.length\r\n\tfor (var k = 0; k < pts1.length; k++)\r\n\t\tmatched[k] = false;\r\n\tvar sum = 0;\r\n\tfor (var i = 0; i < pts1.length; i++)\r\n\t{\r\n\t\tvar index = -1;\r\n\t\tvar min = +Infinity;\r\n\t\tfor (var j = 0; j < pts1.length; j++)\r\n\t\t{\r\n\t\t\tvar d = $PP_DistanceWithAngle(pts1[i], pts2[j]);\r\n\t\t\tif (d < min) {\r\n\t\t\t\tmin = d;\r\n\t\t\t\tindex = j;\r\n\t\t\t}\r\n\t\t}\r\n\t\tmatched[index] = true;\r\n\t\tsum += min;\r\n\t}\r\n\tfor (var j = 0; j < matched.length; j++)\r\n\t{\r\n\t\tif (!matched[j]) {\r\n\t\t\tvar min = +Infinity;\r\n\t\t\tfor (var i = 0; i < pts1.length; i++) {\r\n\t\t\t\tvar d = $PP_DistanceWithAngle(pts1[i], pts2[j]);\r\n\t\t\t\tif (d < min)\r\n\t\t\t\t\tmin = d;\r\n\t\t\t}\r\n\t\t\tsum += min;\r\n\t\t}\r\n\t}\r\n\treturn sum;\r\n}", "function CloudDistance(pointsCloud1, pointsCloud2, npt) {\n let matched = new Array(npt);\n let sum = 0;\n //Initialize the Flag array to False which indicates\n // that any point from gesture1 has been matched with a point from gesture2\n for (let i = 0; i < npt; i++)\n matched[i] = false;\n // match gesture points from pointsCloud1 with points from pointsCloud2; 1-to-many matchings allowed, more flexible\n for (let i = 0; i < npt; i++) {\n let mininmumDistance = Infinity;\n let index = -1;\n for (let j = 0; j < npt; j++) {\n let distance = EuclideanDistance(pointsCloud1[i], pointsCloud2[j]);\n if (distance < mininmumDistance) {\n mininmumDistance = distance;\n index = j;\n }\n }\n matched[index] = true;\n //No weights assigned to points for the distance calculation\n sum += mininmumDistance;\n }\n // match remaining gesture points pointsCloud2 with points from pointsCloud1; 1-to-many matchings allowed\n for (let j = 0; j < matched.length; j++) {\n if (!matched[j]) {\n let minimumDistance = Infinity;\n for (let i = 0; i < npt; i++) {\n let distance = EuclideanDistance(pointsCloud1[i], pointsCloud2[j]);\n if (distance < minimumDistance)\n minimumDistance = distance;\n }\n sum += minimumDistance;\n }\n }\n return sum;\n}", "function kthPairSum (arr, k){\n\tif(arr.length <= 2) return arr;\n\tconst result = [];\n\n\t// two pointers\n\tlet sP = arr[1] > arr[0] ? 0 : 1;\n\tlet lP = arr[1] > arr[0] ? 1 : 0;\n\n\tresult.push([sP, lP]);\n\n\t// start from idx 2 \n\tfor(let i=2; i<arr.length; i++){\n\t\tlet next = arr[i];\n\t\tif (next > arr[sP]){\n\t\t\tif(next > arr[lP]){\n\t\t\t\tsP = lP;\n\t\t\t\tlP = i;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsP = i;\n\t\t\t}\n\t\t\tresult.push([sP, lP])\n\t\t}\n\t}\n\n\t// return the kth biggest - from right to left of the result array return k\n\n\treturn result[result.length - k];\n}", "function f(n, k){\r\n let dp = new Array(n + 1)\r\n for (let i=0; i<n+1; i++)\r\n dp[i] = new Array(k + 1).fill(0)\r\n \r\n dp[0][0] = 1\r\n \r\n \r\n for (let i=1; i<=n; i++)\r\n for (let j=1; j<=Math.min(i, k); j++) {\r\n dp[i][j] = dp[i - j][j] + dp[i - 1][j - 1]\r\n console.log(dp); \r\n } \r\n return dp[n][k]\r\n}", "function findConsqSums(arr, k) {\n\n}", "function _delaunay_distance(v1, v2) {\n\treturn Math.sqrt(Math.pow(v2.x - v1.x, 2) + Math.pow(v2.y - v1.y, 2));\n}", "function cantorPairing(k1, k2) {\n\treturn ((((k1+k2) * (k1+k2+1)) / 2) + k2);\n}", "distanceToPoint (p0) {\n const dd = (this.a * p0.x + this.b * p0.y + this.c * p0.z + this.d) /\n Math.sqrt(this.a * this.a + this.b * this.b + this.c * this.c)\n return dd\n }", "function pairs(k, arr) {\n let count = 0\n for (let i=0; i< arr.length-1; i++) {\n for (let j=i+1; j<arr.length; j++) {\n if ((arr[i] - arr[j]) == k || (arr[j] - arr[i]) == k) {\n count++\n }\n }\n }\n return count\n}", "function distance(i1, i2) {\n return Math.abs(i1 - i2);\n }", "calculer_distance() {}", "function pairsTooLong(k, arr) {\n // declare count to track number of pairs\n let count = 0\n // loop to get through values, omitting last value (no comparison)\n for (let i = 0; i < arr.length - 1; i ++) {\n // loop to compare, j determined by value of i\n for (let j = i + 1; j < arr.length; j ++) {\n let diff = Math.abs(arr[i] - arr[j])\n\n if (diff == k) {\n count = count + 1\n }\n }\n }\n // return count\n // (or)\n console.log('Final count: ', count)\n}", "function dist(c1, c2){\r\n return ((c2.x - c1.x) ** 2 + (c2.y - c1.y) ** 2) ** 0.5;\r\n}", "get distance() {}", "function distance3(p1,p2){\n return Math.sqrt(((p1[0]-p2[0])*(p1[0]-p2[0]))+((p1[1]-p2[1])*(p1[1]-p2[1]))+((p1[2]-p2[2])*(p1[2]-p2[2])))\n}", "function pairSum(numbers, k) {\n\n}", "function getNeighbours(trainingSet, testInstance, k)\n{\n var distances = []\n var list_testInstance = listify(testInstance);\n // console.log(list_testInstance);\n // console.log(\"here\")\n\n for (partner of trainingSet)\n {\n var name = partner.firstName\n list_trainingSet = listify(partner);\n // console.log(list_trainingSet);\n dist = euclideanDistance(list_testInstance, list_trainingSet);\n distances.push([name, dist])\n }\n // console.log('// ----------------------------------------------------')\n \n// sort distances by order of magnitude\nvar distancesSorted = distances.sort(function (a, b)\n{\n return a[1] - b[1];\n});\n// console.log(distancesSorted)\n//console.log('// ----------------------------------------------------')\nvar neighbours = []\nvar counter = 0\n// return top k neighbours\nwhile (counter < k)\n{\n if (counter >= distancesSorted.length) break\n if (!Object.is(distancesSorted[counter], undefined)) \n { \n var element = distancesSorted[counter];\n var obj = {id: String, match: Number, rank: Number}\n obj = {id:element[0],match: element[1], rank: counter + 1};\n neighbours.push(obj);\n \n }\n counter++;\n}\nreturn neighbours;\n}", "function knn(features, labels, predictionPoint, k) {\n // tf.moments() => gives { mean, variance }\n // Standard Deviation = sqrt(variance)\n const { mean, variance } = tf.moments(features, 0);\n const standardDeviation = variance.pow(0.5);\n const scale = point => standardize(point, mean, standardDeviation);\n\n return (\n scale(features)\n .sub(scale(predictionPoint))\n .pow(2)\n .sum(1)\n .pow(0.5)\n .expandDims(1)\n .concat(labels, 1)\n .unstack()\n .sort((a, b) => (a.get(0) > b.get(0) ? 1 : -1))\n .slice(0, k)\n .reduce((acc, pair) => acc + pair.get(1), 0) / k\n );\n}", "function knn(features, labels, predictionPoint, k){\n const {mean,variance}=tf.moments(features,0);\n const scaledPrediction=predictionPoint.sub(mean).div(variance.pow(.5));\n return features\n .sub(mean)\n .div(variance.pow(.5))\n .sub(scaledPrediction)\n .pow(2)\n .sum(1)\n .pow(0.5)\n .expandDims(1)\n .concat(labels, 1)\n .unstack()\n .sort((tensorA, tensorB) => tensorA.arraySync() > tensorB.arraySync() ? 1 : -1)\n .slice(0, k)\n .reduce((acc, pair) => acc + pair.arraySync()[1], 0) / k;\n}", "function distance(p1, p2)\n{\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "getDistancia(x, xi, xf, y, yi, yf) {\n\n let dist;\n\n if (xf === xi) {\n let yu = yf;\n let yd = yi;\n\n if (y >= yu) {\n dist = Math.abs(Math.sqrt((xi - x) * (xi - x) + (yu - y) * (yu - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if (y <= yd) {\n dist = Math.abs(Math.sqrt((xi - x) * (xi - x) + (yd - y) * (yd - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if ((y > yd) && (y < yu)) {\n dist = Math.abs(xi - x);\n dist = dist * DEGREE_TO_METER\n return dist;\n }\n }\n\n if (yf === yi) {\n\n let xr;\n let xl;\n if (xf > xi) {\n xr = xf;\n xl = xi;\n } else {\n xr = xi;\n xl = xf;\n }\n if (x >= xr) {\n dist = Math.abs(Math.sqrt((x - xr) * (x - xr) + (yi - y) * (yi - y)));\n dist = dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if (x <= xl) {\n dist = Math.abs(Math.sqrt((x - xl) * (x - xl) + (yi - y) * (yi - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if ((x > xl) && (x < xr)) {\n dist = Math.abs(yi - y);\n dist = dist;\n return dist = Math.abs((yi - y) * DEGREE_TO_METER);\n }\n }\n\n let xr = xf;\n let yr = yf;\n let xl = xi;\n let yl = yi;\n\n let M = (yf - yi) / (xf - xi);\n let b = yi - M * xi;\n let bp = y + (1 / M) * x;\n let xs = (bp - b) / (M + 1 / M);\n let ys = b + M * xs;\n\n if (xs > xr) {\n dist = Math.abs(Math.sqrt((xr - x) * (xr - x) + (yr - y) * (yr - y)));\n } else {\n if (xs < xl) {\n dist = Math.abs(Math.sqrt((xl - x) * (xl - x) + (yl - y) * (yl - y)));\n } else {\n dist = Math.abs(Math.sqrt((xs - x) * (xs - x) + (ys - y) * (ys - y)));\n }\n }\n return dist = Math.abs(dist * DEGREE_TO_METER);\n }", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); \n }", "function computeControlPoints(K) {\n var i, m,\n p1 = new Array(),\n p2 = new Array(),\n n = K.length - 1,\n /*rhs vector*/\n a = new Array(),\n b = new Array(),\n c = new Array(),\n r = new Array();\n /*left most segment*/\n a[0] = 0;\n b[0] = 2;\n c[0] = 1;\n r[0] = K[0] + 2 * K[1];\n /*internal segments*/\n for (i = 1; i < n - 1; i++) {\n a[i] = 1;\n b[i] = 4;\n c[i] = 1;\n r[i] = 4 * K[i] + 2 * K[i + 1];\n }\n\n /*right segment*/\n a[n - 1] = 2;\n b[n - 1] = 7;\n c[n - 1] = 0;\n r[n - 1] = 8 * K[n - 1] + K[n];\n /*solves Ax=b with the Thomas algorithm (from Wikipedia)*/\n for (i = 1; i < n; i++) {\n m = a[i] / b[i - 1];\n b[i] = b[i] - m * c[i - 1];\n r[i] = r[i] - m * r[i - 1];\n }\n\n p1[n - 1] = r[n - 1] / b[n - 1];\n for (i = n - 2; i >= 0; --i) {\n p1[i] = (r[i] - c[i] * p1[i + 1]) / b[i];\n }\n\n /*we have p1, now compute p2*/\n for (i = 0; i < n - 1; i++) {\n p2[i] = 2 * K[i + 1] - p1[i + 1];\n }\n p2[n - 1] = 0.5 * (K[n] + p1[n - 1]);\n return {p1: p1, p2: p2};\n }", "function dist(a, b){return norm(sum(a, scalar(-1, b)));}", "function geo_distnot(prob, k) {\n if (0 < prob <= 1) {\n return Math.pow(1 - prob, k) * prob;\n } else throw \"prob must be between 0 and 1\";\n}", "function distance (point1, point2) {\n Math.sqrt(Math.pow(point1[0] - point1[1], 2) + Math.pow(point2[0] - point2[1], 2))\n}", "function getInitialKPoints(data, k){\n let kPoints = [];\n let kPointIndexes =[];\n \n //Get k number of random indexes to fetch k-points from\n while (kPointIndexes.length < k) {\n //Get random int\n let randInt = getRandomInt(data.length-1)\n //Check that the k-point isn't already in the array of k-points\n if (!kPointIndexes.includes(randInt)) {\n kPointIndexes.push(randInt);\n } \n }\n //Get the k-points from the data\n kPointIndexes.forEach(index => {\n kPoints.push(data[index]);\n });\n return kPoints;\n }", "function distance(p1, p2) {\r\n\treturn Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2));\r\n}", "function del_k(a, k) {\n if (k == 0) {\n k++\n }\n let j = 0\n let b = []\n while (j + 1 < a.length) {\n if (j % k == 0) {\n b = b.concat([(a[j] + a[j + 1]) / 2])\n } else {\n b = b.concat([a[j], a[j + 1]])\n }\n j += 2\n }\n return b\n}", "function findPairsWithGivenDifference(arr, k) {\n const output = [];\n const hashtable = {};\n\n for (let i = 0; i < arr.length; i++) {\n const x = arr[i];\n const y = x - k;\n hashtable[y] = x;\n }\n\n for (let i = 0; i < arr.length; i++) {\n const x = arr[i];\n if (hashtable[x] !== undefined) {\n output.push([hashtable[x], x]);\n }\n }\n return output;\n}", "function getDistance(user1, user2, keys) {\n return keys.reduce((sum, key) => sum + Math.abs(user1[key] - user2[key]), 0);\n}", "function distance(pointA,pointB){\r\n // return Math.abs(pointA-pointB)\r\n return _.chain(pointA)\r\n .zip(pointB)\r\n .map(([a,b])=>(a-b)**2)\r\n .sum()\r\n .value()**0.5\r\n}", "function kMeans3D(data, k = 3, maxSteps = 20) {\n // 1. PICK K CENTROIDS\n let c = data.slice(0, k)\n // console.log(c)\n\n let step = 0\n while(step < maxSteps) {\n let cHash = {}\n\n // 2&3.FOR EACT DATA, CALCULATE ITS SQUARE DISTANCE WITH EACH CP & FIND THE CLOEST CP\n for(let i = 0; i < data.length; i++) {\n let centroidIdx = c.reduce((cIndex, curr, idx) => {\n if((Math.pow(data[i][0] - curr[0], 2) + \n Math.pow(data[i][1] - curr[1], 2) + \n Math.pow(data[i][2] - curr[2], 2)) <= \n (Math.pow(data[i][0] - c[cIndex][0], 2) + \n Math.pow(data[i][1] - c[cIndex][1], 2) + \n Math.pow(data[i][2] - c[cIndex][2], 2))) {\n return idx\n }\n return cIndex\n }, 0)\n\n let centroid = c[centroidIdx]\n console.log('data: ', data[i], '; ', 'cp: ', centroid)\n\n // 4.ADD DATA TO CLOSEST CP KEY IN HASH\n // CREATE HASH\n if(!cHash[centroidIdx]) {\n cHash[centroidIdx] = []\n }\n // ADD TO HASH\n cHash[centroidIdx].push(data[i])\n }\n\n console.log('cHash: ', cHash)\n\n // 5. FOR EACH CP GROUP, FIND NEW CP AND UPDATE\n let prevC = c.slice()\n\n for(let key in cHash) {\n if(cHash[key].length <= 1) continue\n\n let sum = cHash[key].reduce((acc, curr) => {\n return [acc[0]+curr[0], acc[1]+curr[1], acc[2]+curr[2]]\n }, [0, 0, 0])\n\n let newCentroid = sum.map(indieSum => indieSum/cHash[key].length)\n c[key] = newCentroid\n }\n\n console.log('new c: ', c)\n console.log('prev c: ', prevC)\n\n // BREAK LOOP IF CPS ARE CONSISTENT\n let b = true\n for(let i = 0; i < c.length; i++) {\n if(Math.pow(c[i][0]-prevC[i][0], 2) + Math.pow(c[i][1]-prevC[i][1], 2) + Math.pow(c[i][2]-prevC[i][2], 2) > 0.01) {\n b = false\n }\n }\n console.log(b)\n\n if(b) break\n\n step++\n }\n\n console.log(c)\n return c\n}", "function getDistance(c1 ,c2){\n \n let x1 = c1.x ;\n let y1 = c1.y ;\n let x2 = c2.x ;\n let y2 = c2.y ;\n let x = x2-x1;\n let y = y2-y1;\n return (Math.sqrt(Math.pow(x,2)+Math.pow(y,2)));\n\n }", "function _distance(point1, point2) {\n return Math.sqrt((point1[0] - point2[0]) * (point1[0] - point2[0]) + (point1[1] - point2[1]) * (point1[1] - point2[1]) + (point1[2] - point2[2]) * (point1[2] - point2[2]));\n}", "static distance(p1, p2) {\n const dx = (p1.x - p2.x);\n const dy = (p1.y - p2.y);\n return Math.sqrt(dx * dx + dy * dy);\n }", "function pointDistance (x,y,z) {\nreturn Math.sqrt(Math.pow(x,2)+Math.pow(y,2)+Math.pow(z,2));\n}", "function calculateDistances(cluster) {\n var startLocation = cluster.properties.startLocation;\n cluster.features.forEach(function(isoline) {\n var points = _(isoline.geometry.coordinates).flatten().flatten().value();\n isoline.properties.distances = getDistances(startLocation, points);\n });\n}", "function MetToKil(distance) {\n return new Distance(distance.length / 1000);\n}", "function TotalDistancia(points, order) {\n let sum = 0;\n for (let i = 0; i < order.length - 1; i++) {\n let cityAIndex = order[i];\n let cityA = points[cityAIndex];\n let cityBIndex = order[i + 1];\n let cityB = points[cityBIndex];\n let d = dist(cityA.x, cityA.y, cityB.x, cityB.y);\n sum += d;\n }\n return sum;\n}", "function geoDistanceKm(p1,p2) {\n var R = 6371; // km\n var x1 = p2.lat()-p1.lat();\n var dLat = x1.toRad();\n var x2 = p2.lng()-p1.lng();\n var dLon = x2.toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(p1.lat().toRad()) * Math.cos(p2.lat().toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n return R * c;\n }", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function computeControlPointsBigWThomas(K, W) {\n const n = K.length - 1;\n\n /*rhs vector*/\n const a = [];\n const b = [];\n const c = [];\n const d = [];\n const r = [];\n\n /*left most segment*/\n a[0] = 0; // outside the matrix\n b[0] = 2;\n c[0] = -1;\n d[0] = 0;\n r[0] = K[0] + 0;// add curvature at K0\n\n /*internal segments*/\n for (let i = 1; i < n; i++) {\n a[2 * i - 1] = 1 * W[i] * W[i];\n b[2 * i - 1] = -2 * W[i] * W[i];\n c[2 * i - 1] = 2 * W[i - 1] * W[i - 1];\n d[2 * i - 1] = -1 * W[i - 1] * W[i - 1];\n r[2 * i - 1] = K[i] * ((-W[i] * W[i] + W[i - 1] * W[i - 1]));\n\n a[2 * i] = W[i];\n b[2 * i] = W[i - 1];\n c[2 * i] = 0;\n d[2 * i] = 0; // note: d[2n-2] is already outside the matrix\n r[2 * i] = (W[i - 1] + W[i]) * K[i];\n }\n\n /*right segment*/\n a[2 * n - 1] = -1;\n b[2 * n - 1] = 2;\n r[2 * n - 1] = K[n];// curvature at last point\n\n // the following array elements are not in the original matrix, so they should not be used:\n c[2 * n - 1] = 0; // outside the matrix\n d[2 * n - 2] = 0; // outside the matrix\n d[2 * n - 1] = 0; // outside the matrix\n\n /*solves Ax=b with the Thomas algorithm (from Wikipedia)*/\n const p = Thomas4(r, a, b, c, d);\n\n /*re-arrange the array*/\n const p1 = [];\n const p2 = [];\n for (let i = 0; i < n; i++) {\n p1[i] = p[2 * i];\n p2[i] = p[2 * i + 1];\n }\n\n return {p1, p2};\n}", "function distance(p1, p2) {\n\treturn Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getInitialKPoints(data, k){\n let kPoints = [];\n let kPointIndexes =[];\n\n //Get k number of random indexes to fetch k-points from\n while (kPointIndexes.length < k) {\n //Get random int\n let randInt = getRandomInt(data.length-1)\n //Check that the k-point isn't already in the array of k-points\n if (!kPointIndexes.includes(randInt)) {\n kPointIndexes.push(randInt);\n } \n }\n //Get the k-points from the data\n kPointIndexes.forEach(index => {\n kPoints.push(data[index]);\n });\n return kPoints;\n}", "function distEuclid(dataItem, centroid, dataMeta) {\n // The distance should be normalized between different dimensions,\n // otherwise they may provide different weight in the final distance.\n // The greater weight offers more effect in the cluster determination.\n\n var powerSum = 0;\n var dimensions = dataMeta.dimensions;\n var extents = dataMeta.rawExtents;\n //subtract the corresponding elements in the vectors\n for (var i = 0; i < dimensions.length; i++) {\n var span = extents[i].span;\n // If span is 0, do not count.\n if (span) {\n var dimIdx = dimensions[i];\n var dist = (dataItem[dimIdx] - centroid[i]) / span;\n powerSum += mathPow(dist, 2);\n }\n }\n\n return powerSum;\n }", "distance (a, b) {\n return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n }", "function sol(nums, k) {\n // sum : index\n const map = {};\n map[0] = -1;\n let sum = 0;\n let maxLen = 0;\n for (let i = 0; i < nums.length; i++) {\n sum += nums[i];\n if (map[`${sum - k}`]) {\n maxLen = Math.max(maxLen, i - map[`${sum - k}`]);\n }\n if (!map[sum]) map[sum] = i;\n }\n\n return maxLen;\n}", "function geoDistanceKm(p1,p2) {\n var R = 6371; // km\n var x1 = p2.lat()-p1.lat();\n var dLat = x1.toRad();\n var x2 = p2.lng()-p1.lng();\n var dLon = x2.toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(p1.lat().toRad()) * Math.cos(p2.lat().toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n return R * c;\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 addDistances(fromPoint, toPoints, key='distance') {\n let distanceFn = cityBlocksFrom(fromPoint);\n toPoints.forEach((p) => p[key] = distanceFn(p));\n return toPoints;\n}", "function f6(points) {\n\tp1 = points[0];\n\tp2 = points[points.length - 1];\n\treturn (p2.X - p1.X) / Distance(p1, p2);\n}", "function distance(pt1, pt2) { \n\n return Math.sqrt(Math.pow((pt1.x - pt2.x), 2) + Math.pow((pt1.y - pt2.y), 2));\n}", "function dist(p1, p2) {\n return Math.sqrt(Math.pow(p1[0] - p2[0], 2)\n + Math.pow(p1[1] - p2[1], 2));\n}", "function distance(p1, p2) {\n\t return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));\n\t}", "dist (pos1, pos2) {\n return Math.sqrt(\n Math.pow(pos1[0] - pos2[0], 2) + Math.pow(pos1[1] - pos2[1], 2)\n );\n }", "function sellers_levenshtein (pattern, txt, k) {\n if (pattern === txt) return 0;\n\n let smallest_distance = k + 1;\n let prev_diag_value;\n let col = [0];\n let j;\n let i = pattern.length;\n\n while (i--) col[i] = i;\n\n for (j = 1; j <= txt.length; j++) {\n prev_diag_value = 0;\n\n for (i = 1; i <= pattern.length; i++) {\n [prev_diag_value, col[i]] = [col[i], prev_diag_value];\n\n if (pattern[i-1] === txt[j-1]) continue;\n else col[i] = 1 + Math.min(col[i], col[i-1], prev_diag_value);\n }\n\n if (col[i-1] === 0) return col[i-1];\n if (col[i-1] < smallest_distance) smallest_distance = col[i-1];\n }\n\n if (smallest_distance <= k) return smallest_distance;\n else return -1;\n}", "function delta(f,c,costo,k){\n if(!enTablero(f,c)) return\n if(costo > distancias[f][c]) return;\n distancias[f][c] = costo;\n\n if(f === target[0] && c === target[1]) return;\n\n if( k>K ) return;\n\n delta(f-1,c, tablero[f][c]=='U' ? costo : costo+1, k +1 );\n delta(f+1,c, tablero[f][c]=='D' ? costo : costo+1, k +1 );\n delta(f,c+1, tablero[f][c]=='R' ? costo : costo+1, k +1 );\n delta(f,c-1, tablero[f][c]=='L' ? costo : costo+1, k +1 );\n }", "distance(p) {\n return Math.sqrt(this.squaredDistance(p));\n }", "static pointDistance(p1, p2) {\n return Math.sqrt((p2.x-p1.x)*(p2.x-p1.x) + (p2.y-p1.y)*(p2.y-p1.y));\n }", "function distance(p1, p2) {\n\t\treturn Math.sqrt(Math.pow(p2.y - p1.y, 2) + Math.pow(p2.x - p1.x, 2));\n\t}", "function getDistorsionValue() {\n var pos = logToPos(k);\n return parseFloat(pos).toFixed(1);\n }", "get planeDistance() {}", "function distance(point1, point2){\n return Math.sqrt(Math.pow(point1[0]-point2[0], 2) + Math.pow(point1[1]-point2[1], 2));\n}", "function calcDistance(p1, p2) {\n\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 628).toFixed(3);\n }", "function getDist(p1, p2) {\n return Math.sqrt(\n Math.pow(p2[0] - p1[0], 2) +\n Math.pow(p2[1] - p1[1], 2)\n );\n}", "function distance(p1, p2) {\n return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));\n }", "overpressureToDistance(overPressurekPa)\n{\n const a1 = -0.214362789151;\n const b1 = 1.35034249993;\n const c01 = 2.78076916577;\n const c11 = -1.6958988741;\n const c21 = -0.154159376846;\n const c31 = 0.514060730593;\n const c41 = 0.0988554365274;\n const c51 = -0.293912623038;\n const c61 = -0.0268112345019;\n const c71 = 0.109097496421;\n const c81 = 0.001628467556311;\n const c91 = -0.0214631030242;\n const c101 = 0.0001456723382;\n const c111 = 0.00167847752266;\n \n //Tolerancia del cálculo\n const tolerance = 0.001;\n\n //Valor de inicio del calculo de dsitancia x a la de sobrepresion overPressureTNT;\n let xTNT = 0;\n \n //Presion inicial para el cálculo este numero es el maximo reportado por EPA en kPA\n var pres = 33000;\n \n //Calculo de Masa equivalente de TNT\n let masaEQTNT = (this.fe*this.hCombKJKG*this.mass)/DHCTNT;\n \n //Calculo de la distancia por iteracion\n for (xTNT = 1; pres > overPressurekPa; xTNT = xTNT + tolerance)\n {\n //Distancia Escalada (m/kg^1/3)\n const z = xTNT/Math.pow(masaEQTNT, 1.0/3.0);\n \n let ablog = a1+b1*Math.log10(z);\n let c = c01+c11*ablog+c21*Math.pow(ablog, 2)+c31*Math.pow(ablog, 3)+c41*Math.pow(ablog, 4)+c51*Math.pow(ablog, 5)+c61*Math.pow(ablog, 6)+c71*Math.pow(ablog, 7)+c81*Math.pow(ablog, 8)+c91*Math.pow(ablog, 9)+c101*Math.pow(ablog, 10)+c111*Math.pow(ablog, 11);\n pres = Math.pow(10, c);\n }\n return xTNT;\n\n}", "function getDistance(point1, point2) {\n return Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2);\n}", "function len (p1, p2) {\n return Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y))\n }", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371;\n var dLat = deg2rad(lat2 - lat1);\n var dLon = deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n return d;\n }", "function calculateDistanceIn3D(arr){\n let firstObject = { X: arr[0], Y: arr[1], Z: arr[2] };\n let secondObject = { X: arr[3], Y: arr[4], Z: arr[5] };\n\n return Math.pow(\n Math.pow(secondObject.X - firstObject.X, 2) +\n Math.pow(secondObject.Y - firstObject.Y, 2) +\n Math.pow(secondObject.Z - firstObject.Z, 2), 1/2);\n}", "function distBetweenPoints(a,b){\r\n return Math.sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));\r\n}", "function getKnn(data, options = {}) {\n // for now, predictPoints got 3 values,\n const { predictPoints, k } = options;\n\n return _.chain(data)\n .map(row => {\n const features = _.initial(row);\n const label = _.last(row);\n\n return [\n getDistance(features, predictPoints),\n label,\n ]\n })\n .sortBy(row => row[0])\n .slice(0, k)\n .countBy(row => row[1])\n .toPairs()\n .sortBy(row => row[1])\n .last()\n .first()\n .parseInt()\n .value()\n}", "function calculateNumerator(start, end , nodes){\r\n var start = nodes.find(x => x.id === start);\r\n var end = nodes.find(x => x.id === end);\r\n var curr_path = [];\r\n // The following three arrays are mapped using index\r\n var paths = [];\r\n var forwardLoopgains = [];\r\n var delta_k = [];\r\n let numer = new Expression(0);\r\n\r\n // Step 1 - handle forward paths (this is P_k in the equation)\r\n findForwardPaths(start, end, nodes, paths, curr_path); // paths variable is now filled in \r\n var forwardLoopgains = getForwardPathsLoopgains(paths);\r\n\r\n // Step 2 - handle loops that do not touch kth forward path (this is delta_k)\r\n paths.forEach(p => { \r\n const subgraph = subtractNodes(nodes, p);\r\n const allLoops = findAllLoops(subgraph);\r\n const nonTouchingLoops = findNonTouching(allLoops);\r\n const d_k = calculateDenominator(allLoops, nonTouchingLoops);\r\n delta_k.push(d_k);\r\n\r\n });\r\n\r\n // Find the sum of P_k * delta_k\r\n if (forwardLoopgains. length == delta_k.length){ // Sanity check\r\n for (let i=0; i<forwardLoopgains.length; i++){\r\n let ex = forwardLoopgains[i];\r\n ex = ex.multiply(delta_k[i]);\r\n numer = numer.add(ex);\r\n }\r\n return numer;\r\n }\r\n else{\r\n console.log(\"The number of P-K and delta_k do no match\")\r\n return undefined\r\n }\r\n}" ]
[ "0.702653", "0.6447083", "0.63794065", "0.62759477", "0.6182576", "0.6167447", "0.61447847", "0.60284674", "0.5956133", "0.59430903", "0.5916947", "0.5865775", "0.5865561", "0.5706482", "0.57038635", "0.5680996", "0.5658824", "0.56480646", "0.56450343", "0.56025165", "0.5599435", "0.5581135", "0.55638564", "0.5560411", "0.5553019", "0.5553013", "0.5533848", "0.5526956", "0.55194646", "0.55176115", "0.5497218", "0.5489056", "0.54853874", "0.5478072", "0.5467856", "0.5458605", "0.54404706", "0.5438339", "0.5426276", "0.5395792", "0.53855425", "0.53746176", "0.5373648", "0.5359325", "0.53521377", "0.53518695", "0.53499365", "0.53434", "0.53414625", "0.5340563", "0.5307392", "0.52995324", "0.5293323", "0.5283912", "0.52838516", "0.5278117", "0.52723026", "0.5266449", "0.5261325", "0.52580714", "0.52566946", "0.52478844", "0.5232348", "0.5230157", "0.5230157", "0.5230157", "0.5230157", "0.52164584", "0.52065635", "0.5197833", "0.5192192", "0.5190434", "0.51896405", "0.51811266", "0.51788116", "0.5178175", "0.5175169", "0.5170417", "0.5170113", "0.5169089", "0.5166644", "0.51607454", "0.5158141", "0.5156717", "0.5150052", "0.5146097", "0.5142522", "0.5141585", "0.51387155", "0.51349163", "0.51222473", "0.5106853", "0.51057947", "0.51056576", "0.51026106", "0.5101829", "0.5101734", "0.5100986", "0.5098505", "0.5093507" ]
0.7116098
0
get the value from selected radio buttons
function getRadioValue(){ let redioValue; radioInputs.forEach((radioInput) => { if(radioInput.checked){ radioValue = radioInput.value ; } }); return radioValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSelectedValue() {\n for(var i = 0; i < radioButtons.length; i++) {\n if(radioButtons[i].checked) {\n //Store the value of the selected rb in the selectedValue var\n selectedValue = radioButtons[i].value;\n\n // return selectedValue;\n }\n }\n}", "function getRadioButtonValue (radio)\r\n{ for (var i = 0; i < radio.length; i++)\r\n { if (radio[i].checked) { break }\r\n }\r\n return radio[i].value\r\n}", "function getSelectedRadio(){\n\t\t\n\t\tvar radioButtons = document.forms[0].priority;\n\t\tfor(var i=0; i<radioButtons.length; i++){\n\t\t\t\n\t\t\tif(radioButtons[i].checked){\n\t\t\t\tpriorityValue = radioButtons[i].value;\n\t\t\t}\n\t\t}\n\t}", "function getSelectedRadio(){\n var radios = document.forms[0].sex;\n for (var i = 0; i<radios.length; i++) {\n if(radios[i].checked){ \n sexValue = radios[i].value;\n }\n }\n }", "function getRadioResult() {\n for (let i = 0; i < radioButtons.length; i++) {\n if (radioButtons[i].checked) {\n return radioButtons[i].value;\n }\n }\n}", "function getRadioValue( radio){\n for(var i=0; i<radio.length; i++){\n if(radio[i].checked){\n return radio[i].value;\n }\n }\n}", "function getSelectedRadioValue(frmObj) {\n for (var i = 0; i < frmObj.elements.length; i++) {\n var elm = frmObj.elements[i];\n\n if (elm.checked) {\n return elm.value;\n }\n }\n return \"\";\n}", "function getSelectedRadio(){\n var radios = document.forms[0].priority;\n for (i=0, j=radios.length;i<j;i++){\n if (radios[i].checked){\n priorityValue =radios[i].value;\n }\n }\n }", "function getSelectedRadio(){\n\t\tvar radios = document.forms[0].sex;\n\t\tfor(var i=0; i<radios.length; i++){\n\t\t\tif(radios[i].checked){\n\t\t\t\tsexValue = radios[i].value;\n\t\t\t}\t\t\t\t\t\t\n\t\t}\n\t}", "function getSelectedRadio() {\n\t\tvar radios = document.forms[0].status;\n\t\tfor(var i=0; i<radios.length; i++) {\n\t\t\tif(radios[i].checked) {\n\t\t\t\tcrateValue = radios[i].value;\n\t\t\t}\n\t\t}\n\t} // End Selected Radio Button Function", "function ui_getSelectedRadioValue(str_name){\n\tvar _radios = ui_getObjsByName(str_name);\n\tfor (var i=0; i<_radios.length; i++){\n\t\tif (_radios[i].checked){\n\t\t\treturn _radios[i].value;\n\t\t}\n\t}\n}", "function radioButtonValue(button) {\n\tfor (var i = 0; i < button.length; i++) {\n\t\tif (button[i].checked) {\n\t\t\treturn button[i].value;\n\t\t}\n\t}\n\treturn \"\";\n}", "function getSelectedRadio(radio)\r\n{\t\r\n\tvar obj = radio;\r\n\tvar val = \"\";\r\n\tfor(var i=0; i < obj.length; ++i) {\r\n\t\tif(obj[i].checked == true) {\r\n\t\t\tval = obj[i].value;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn(val);\r\n}", "function getSelectedRadio(radio)\r\n{\t\r\n\tvar obj = radio;\r\n\tvar val = \"\";\r\n\tfor(var i=0; i < obj.length; ++i) {\r\n\t\tif(obj[i].checked == true) {\r\n\t\t\tval = obj[i].value;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn(val);\r\n}", "function getRadioButtonValue(radio)\r\n{\r\n if (radio.length == undefined && radio.checked)\r\n return radio.value;\r\n\r\n for (var i = 0; i < radio.length; i++)\r\n {\r\n if (radio[i].checked)\r\n return radio[i].value;\r\n\r\n }\r\n return \"\";\r\n}", "function getRadioValue() {\n let radioValue;\n radioInputs.forEach((radioInput) => {\n if(radioInput.checked) {\n radioValue = radioInput.value;\n \n }\n });\n return radioValue;\n}", "function getRadioValue(radio)\n{\n for ( var i=0;i< radio.length;i++ )\n {\n if ( radio[i].checked )\n {\n return radio[i].value;\n }\n }\n}", "function getRadioButtonValue(objRadio)\r\n\t{\r\n\t\tvar strValue;\r\n\t\tfor(var i =0; i < objRadio.length; i++)\r\n\t\t{ \r\n\t\t\t //checking for If selected\r\n\t\t\tif(objRadio[i].checked)\r\n\t\t\t{\r\n\t\t\t\tstrValue = objRadio[i].value ;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn strValue;\r\n\t}", "function getRadioInfo() {\n var decision = null;\n //for(var i = 0; i < $('input[type=radio]:checked'); i += 1) {\n if($('input[type=radio]:checked')) {\n decision = $(('input[type=radio]:checked')).val();\n // }\n }\n return decision;\n }", "function getCheckedRadioButton(buttons){\n for(button of buttons){\n if(button.checked){\n return button.value\n }\n }\n}", "function getSelectedRadioValue(buttonGroup) {\r\n var i = getSelectedRadio(buttonGroup);\r\n if (i == -1) {\r\n return \"\";\r\n } else {\r\n if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)\r\n return buttonGroup[i].value;\r\n } else { // The button group is just the one button, and it is checked\r\n return buttonGroup.value;\r\n }\r\n }\r\n}", "function interestedIn() {\n var radios = document.getElementsByClassName(\"form-check-input\");\n for(let radio of radios) {\n if(radio.checked) {\n return document.getElementById(radio.id).value;\n }\n }\n }", "function getSelectedRadio (){\n\t\tvar radio = document.forms[0].add\n\t\tfor (var i=0; i<radio.length; i++){\n\t\t\tif (radio[i].checked){\n\t\t\t\taddValue = radio[i].value\n\t\t\t}\n\t\t}\n\t}", "function getValueFromRadioButton(name) {\n\treturn [...document.getElementsByName('type')]\n\t\t.reduce((rez, btn) => (btn.checked ? btn.value : rez), null)\n}", "function getSelectedRadio(){\n\t\tvar radio = document.forms[0].mech;\n\t\tfor(var i=0; i<radio.lenth; i++){\n\t\t\tif(radio[i].checked){\n\t\t\t\tmechValue = radio[i].value;\n\t\t\t}\n\t\t}\n\t}", "function getSelectedRadioValue(radioName) {\r\n return document.querySelector('input[name=\"' + radioName + '\"]:checked').value;\r\n}", "function getSelectedRadio(){\n\t\tvar radios = document.forms[0].favorites;\n\t\tfor(var i=0; i<radios.length; i++){\n\t\t\tif(radios[i].checked){\n\t\t\t\tfavoritevalue = radios[i].value;\n\t\t\t}\n\t\t}\n\t}", "getCurrentSelectedRadioButton() {\n var radioButtonControllers = this.reportContainer.querySelectorAll(\"input[type=radio]\");\n for (var i = 0, len = radioButtonControllers.length; i < len; i += 1) {\n if (radioButtonControllers[i].checked) {\n return radioButtonControllers[i];\n }\n }\n return null;\n }", "function getSelectedRadio(){\n\t\tvar radio = document.forms[0].group;\n\t\tfor(var i=0; i<radio.length; i++){\n\t\t\tif(radio[i].checked){\n\t\t\t\tgroupValue = radio[i].value;\n\t\t\t};\n\t\t};\n\t}", "function getSelectedRadioButton(name){\r\n let selectedChoice;\r\n let btnSelectedRadioChoice = document.getElementsByName(name);\r\n for (let i=0; i<btnSelectedRadioChoice.length; i++){\r\n if (btnSelectedRadioChoice[i].checked){\r\n selectedChoice = btnSelectedRadioChoice[i].value;\r\n }\r\n }\r\n return selectedChoice;\r\n}", "function getSelectedRadios(){\n \t\t\tvar radios = document.forms(0).yesorno;\n \t\t\tfor(var i=0; i<radio.length; i++){\n \t\t\t\tif(radios[i].checked){\n \t\t\t\tyesornoValue = radios[i].value;\n \t\t\t}\n \t\t}\t\n \t}", "function getRadioValue() {\n var element = document.getElementsByName('sizes');\n for (i = 0; i < element.length; i++) {\n if (element[i].checked)\n return element[i].value;\n }\n}", "function getRadioButtonValue(name){\n\tvar result = null;\n\tvar objRadio = document.getElementsByName(name);\n\tif (objRadio) {\n\t\tfor (var i = 0; i < objRadio.length; i++) {\n\t\t\tvar optRadio = objRadio[i];\n\t\t\tif (optRadio.checked) {\n\t\t\t\tresult = optRadio.value;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n}", "function getSelectedRadio(){\r\n\t\tvar radios = document.forms[0].illStyle;\r\n\t\tfor(var i=0; i<radios.length; i++){\r\n\t\t\tif(radios[i].checked){\r\n\t\t\t\tstyleValue = radios[i].value;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function getSelectedRadio() {\n\t\tvar radios = document.forms[0].timeofday;\n\t\tfor (var i=0, j=radios.length; i<j; i++) {\n\t\t\tif (radios[i].checked) {\n\t\t\t\ttimeValue = radios[i].value;\n\t\t\t}\n\t\t}\n\t}", "function getSelectedRadio(){\n\t\tvar radios =document.forms[0].deviceValue;\n\tfor(var i=0; i<radios.length; i++){\n\t\tif(radios[i].checked){\n\t\t\tdeviceValue = radios[i].value;\n\t\t}\n\t}\n}", "function getUserAnswer() {\n var radios = document.getElementsByName(\"question\" + currentQuestion + \"Choices\");\n for (var i=0, len=radios.length; i<len; i++) { \n if ( radios[i].checked ) {\n return radios[i].value;\n }\n }\n return null\n }", "function getSelectedRadio () {\n\t \tvar radio = document.forms[0].time;\n\t \tfor(var i=0; i<radio.length; i++){\n\t\t \tif(radio[i].checked){\n\t\t \t\ttimeValue = radio[i].value;\n\t\t \t}\n\t \t}\n \t}", "function NumRecButtons_getValue()\r\n{\r\n var retVal = \"all\";\r\n \r\n if (this.radioObj[0].checked == true)\r\n retVal = this.textFieldObj.value;\r\n \r\n return retVal;\r\n}", "function getRadioButtonValue(name) {\n var radios = document.getElementsByName(name);\n for (var i = 0, length = radios.length; i < length; i++) {\n if (radios[i].checked) {\n return radios[i].value;\n }\n }\n return null;\n}", "function getValueFromRadio(radioName){\n var radios = document.getElementsByName(radioName);\n for (var i = 0; i < radios.length; i++) {\n if (radios[i].checked) {\n return radios[i].value;\n }\n }\n }", "function GetRadioButtonListCheckedValue(ctl)\r\n{\r\n\tvar oRadio=document.getElementById(ctl);\r\n\tvar oRadioButtons=oRadio.getElementsByTagName(\"input\");\r\n\tfor(var i=0;i<oRadioButtons.length;i++)\r\n\t{\r\n\t\tif(oRadioButtons[i].type==\"radio\" && oRadioButtons[i].checked)\r\n\t\t{\r\n\t\t\treturn oRadioButtons[i].value;\r\n\t\t}\r\n\t}\t\r\n\treturn \"\";\r\n}", "function getSelectedRadioButtonValue(radiobuttonGroup) {\n if(radiobuttonGroup==null) {\n alert('Radio button group is null.');\n return null;\n }\n \n var selectedValue = null;\n if(radiobuttonGroup.length==null) {\n // radio button group contains only one element ...\n if(radiobuttonGroup.checked) {\n selectedValue = radiobuttonGroup.value;\n }\n \t \n } else {\n // radio button group contains more than one element ...\n for(i=0; i<radiobuttonGroup.length; i++) {\n if(radiobuttonGroup[i].checked == true) {\n selectedValue = radiobuttonGroup[i].value;\n break;\n }\n } // for loop\n }\n return selectedValue;\n}", "function getRadioValue(formname,radioname){\n var theRadioButtons = document[formname][radioname];\n for (i=0;i<theRadioButtons.length;i++){\n if (theRadioButtons[i].checked){\n return theRadioButtons[i].value;\n }\n }\n}", "function getRadioVal(form, name) {\n var val;\n // get list of radio buttons with specified name\n var radios = form.elements[name];\n\n // loop through list of radio buttons\n for (var i = 0, len = radios.length; i < len; i++) {\n if (radios[i].checked) { // radio checked?\n val = radios[i].value; // if so, hold its value in val\n break; // and break out of for loop\n }\n }\n return val; // return value of checked radio or undefined if none checked\n }", "function GetItemRadioButton(){\n var val1 = document.getElementById(\"radio1\").checked;\n var val2 = document.getElementById(\"radio2\").checked;\n var val3 = document.getElementById(\"radio3\").checked;\n var val4 = document.getElementById(\"radio4\").checked;\n var val5 = document.getElementById(\"radio5\").checked;\n var returnval;\n if(val1 === true){\n returnval = \"1\";\n }\n else if(val2 === true){\n returnval = \"2\";\n }\n else if(val3 === true){\n returnval = \"3\";\n }\n else if(val4 === true){\n returnval = \"4\";\n }\n else if(val5 === true){\n returnval = \"5\";\n }else{\n returnval = \"N/A\";\n }\n return returnval;\n}", "function getRadioVal(form, name) {\n var val;\n // get list of radio bubbles\n var radios = form.elements[name];\n \n // loop through list of selections\n for (var i=0, len=radios.length; i<len; i++) {\n // Check if the bubble is checked\n if ( radios[i].checked ) { \n // Set value and break if true\n val = radios[i].value;\n break;\n }\n }\n // Return the value\n return val;\n}", "function getAnswersFromRadioButtons(){\n\t\t\n\t\tvar answer = parseInt($(\"#quiz input[type='radio']:checked\").val());\n\t\tif(!isNaN(answer)){ return answer;}else{return -1;}\n\t\t\n\t}", "function getRadioValue(form, name) {\n\n //iegut formas elementus\n var radios = form.elements[name];\n\n //cikls kas parbauda kurs elements ir izvelets\n for (var i = 0; i < radios.length; i++) {\n //parbaude vai elements ir izvelets\n if (radios[i].checked) {\n var value = radios[i].value;\n break;\n };\n \n };\n //atgriez elementa vertibu\n return value;\n}", "function getRatingValue() {\n if(document.getElementById(\"rating-5\").checked) {\n return document.getElementById(\"rating-5\").value;\n }\n else if(document.getElementById(\"rating-4\").checked) {\n return document.getElementById(\"rating-4\").value;\n }\n else if(document.getElementById(\"rating-3\").checked) {\n return document.getElementById(\"rating-3\").value;\n }\n else if(document.getElementById(\"rating-2\").checked) {\n return document.getElementById(\"rating-2\").value;\n }\n else if(document.getElementById(\"rating-1\").checked) {\n return document.getElementById(\"rating-1\").value;\n }\n}", "function getRadioCheckedValue(formNum, radio_name)\n{\n var oRadio = document.forms[formNum].elements[radio_name];\n for(var i = 0; i < oRadio.length; i++)\n {\n if(oRadio[i].checked)\n {\n return oRadio[i].value;\n }\n }\n return '';\n}", "function getRadioCheckedValue(formNum, radio_name)\n{\n var oRadio = document.forms[formNum].elements[radio_name];\n for(var i = 0; i < oRadio.length; i++)\n {\n if(oRadio[i].checked)\n {\n return oRadio[i].value;\n }\n }\n return '';\n}", "function getRadioCheckedValue(formNum, radio_name)\n{\n var oRadio = document.forms[formNum].elements[radio_name];\n for(var i = 0; i < oRadio.length; i++)\n {\n if(oRadio[i].checked)\n {\n return oRadio[i].value;\n }\n }\n return '';\n}", "function getRadioValor(name) {\n var rads = document.getElementsByName(name);\n for (var i = 0; i < rads.length; i++) {\n if (rads[i].checked) {\n return rads[i].value;\n }\n }\n return null;\n }", "function getCheckedRadio(op) {\n var radioButtons = document.getElementsByName(op);\n for (var x = 0; x < radioButtons.length; x ++) {\n if (radioButtons[x].checked) {\n var score = radioButtons[x].dataset.score;\n }\n }\n return score;\n }", "function tiendaGetCheckedValue(radioObj) {\r\n\tif (!radioObj) {\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\tvar radioLength = radioObj.length;\r\n\tif (radioLength == undefined) {\r\n\t\tif (radioObj.checked)\r\n\t\t\treturn radioObj.value;\r\n\t\telse\r\n\t\t\treturn \"\";\r\n\t}\r\n\r\n\tfor (var i = 0; i < radioLength; i++) {\r\n\t\tif (radioObj[i].checked) {\r\n\t\t\treturn radioObj[i].value;\r\n\t\t}\r\n\t}\r\n\treturn \"\";\r\n}", "function getRadioVal(form, name) {\n var val;\n // get list of radio buttons with specified name\n var radios = form.elements[name];\n\n // loop through list of radio buttons\n for (var i = 0, len = radios.length; i < len; i++) {\n if (radios[i].checked) {\n // radio checked?\n val = radios[i].value; // if so, hold its value in val\n break; // and break out of for loop\n }\n }\n return val; // return value of checked radio or undefined if none checked\n}", "function getSelectedRadio() {\n\t\tradios = document.forms[0].os;\n\t\tfor(var i=0; i<radios.length; i++) {\n\t\t\tif (radios[i].checked) {\n\t\t\t\tsystemOS = radios[i].value;\n\t\t\t}\n\t\t}\n\t}", "function __getRadioValue($domName) {\r\n var domRadios = __getObjs($domName);\r\n for (var i=0; i<domRadios.length; i++) {\r\n if (domRadios[i].checked) {\r\n return domRadios[i].value;\r\n }\r\n }\r\n return null;\r\n}", "function getGender() {\n var radios = document.getElementsByName('gender');\n for (var radio of radios) {\n if (radio.checked) {\n return radio.value;\n }\n }\n return alert('Gender not selcted !');\n}", "function getCheckedValue(radioObj) {\r\n if(!radioObj)\r\n return \"\";\r\n var radioLength = radioObj.length;\r\n if(radioLength == undefined)\r\n if(radioObj.checked)\r\n return radioObj.value;\r\n else\r\n return \"\";\r\n for(var i = 0; i < radioLength; i++) {\r\n if(radioObj[i].checked) {\r\n return radioObj[i].value;\r\n }\r\n }\r\n return \"\";\r\n}", "function obtemAtributoSelecionado() {\n var radioAtributo = document.getElementsByName('atributo')\n for (var i = 0; i < radioAtributo.length; i++) {\n if (radioAtributo[i].checked) {\n return radioAtributo[i].value\n }\n }\n}", "function getCheckedValue(radioObj) {\r\n\tif (!radioObj)\r\n\t\treturn \"\";\r\n\tradioLength = radioObj.length;\r\n\tif (radioLength == undefined)\r\n\t\tif (radioObj.checked)\r\n\t\t\treturn radioObj.value;\r\n\t\telse\r\n\t\t\treturn \"\";\r\n\tfor ( var i = 0; i < radioLength; i++) {\r\n\t\tif (radioObj[i].checked) {\r\n\t\t\treturn radioObj[i].value;\r\n\t\t}\r\n\t}\r\n\treturn \"\";\r\n}", "function genderValue() {\n\t\n\t// Link radio button\n var radiobtn = document.getElementsByName('gender');\n\n\t// Checks which radio button has been selected and returns value\n if (radiobtn[0].checked) {\n return radiobtn[0].value;\n } else {\n return radiobtn[1].value;\n }\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n}", "function valButton(btn) {\n\t\t\tvar cnt = -1;\n\t\t\tfor (var i=btn.length-1; i > -1; i--) {\n\t\t\t\tif (btn[i].checked) {cnt = i; i = -1;}\n\t\t\t}\n\t\t\tif (cnt > -1) return btn[cnt].value;\n\t\t\telse return null;\n\t\t}", "function getCheckedValue(radioObj) {\n if (!radioObj)\n return \"\";\n var radioLength = radioObj.length;\n if (radioLength === undefined)\n if (radioObj.checked)\n return radioObj.value;\n else\n return \"\";\n for (var i = 0; i < radioLength; i++) {\n if (radioObj[i].checked) {\n return radioObj[i].value;\n }\n }\n return \"\";\n}", "function getCheckedValue(radioObj) {\n if (!radioObj)\n return \"\";\n var radioLength = radioObj.length;\n if (radioLength === undefined)\n if (radioObj.checked)\n return radioObj.value;\n else\n return \"\";\n for (var i = 0; i < radioLength; i++) {\n if (radioObj[i].checked) {\n return radioObj[i].value;\n }\n }\n return \"\";\n}", "function getFrontValue() {\n const englishRadio = document.getElementById('english');\n const kanaRadio = document.getElementById('kana');\n const kanjiRadio = document.getElementById('kanji');\n\n if (englishRadio.checked) return 'english';\n if (kanaRadio.checked) return 'kana';\n if (kanjiRadio.checked) return 'kanji';\n\n return 'random';\n}", "function RadioButton(id)\r\n{\r\n\t var radios = document.getElementsByName(\"JourneyType\");\r\n\t //var found = 1;\r\n\t for (var i = 0; i < radios.length; i++) \r\n\t\t{ \r\n\t if (radios[i].checked)\r\n\t\t\t{\r\n\t //alert(radios[i].value);\r\n\t found = 0;\r\n\t return radios[i].value;\r\n\t }\r\n\t }\r\n\r\n}", "function getSelectedGenre(){\n for(radio of document.querySelectorAll('.genre input[type=\"radio\"]')){\n if(radio.checked) return radio.value;\n }\n \n return undefined; //probably won't happen... hopefuly\n}", "function get_input() {\n var ele = document.getElementsByTagName('input');\n for (i = 0; i < ele.length; i++) {\n if (ele[i].type == \"radio\") {\n if (ele[i].checked) {\n return ele[i].value;\n }\n }\n }\n}", "function getAccountTypeRadioValue() {\n\n if(document.getElementById('typeStudent').checked){\n return 'student';\n }\n else if (document.getElementById('typeCounselor').checked){\n\n return 'guidance';\n }\n\n}", "function getCheckedRadioValue(name) {\r\n var elements = document.getElementsByName(name);\r\n\r\n for (var i = 0, len = elements.length; i < len; ++i) {\r\n if (elements[i].checked) {\r\n return elements[i].value;\r\n }\r\n }\r\n}", "function getRadio() {\n var radButton = document.forms[0].coverstyle;\n for (var i=0; i<radButton.length; i++) {\n if (radButton[i].checked) {\n styleValue = radButton[i].value;\n };\n };\n }", "function getInput(){\n const clicked = document.querySelectorAll('.answer');\n \n for(var x = 0; x < clicked.length; x++){\n if(clicked[x].checked){\n return clicked[x].value;\n }\n }\n }", "function getProductAmountFromSelectedRadioButton()\n {\n return $('input[name=price]:checked').val();//nanCheck(val)\n }", "function getChosenAnswer() {\n for (let i = 0, length = radios.length; i < length; i++) {\n if (radios[i].checked) {\n console.log(\"888888\", radios[i].value);\n return (answerChosen = radios[i].value);\n }\n }\n }", "function getRadio() {\n var radio = document.forms[0].location;\n for(var i=0; i<radio.length; i++){\n if(radio[i].checked){\n locationValue = radio[i].value;\n }\n }\n }", "function getCheckedValue(radioObj) {\n\t\tif(!radioObj)\n\t\t\treturn \"\";\n\t\tvar radioLength = radioObj.length;\n\t\tif(radioLength == undefined)\n\t\t\tif(radioObj.checked)\n\t\t\t\treturn radioObj.value;\n\t\t\telse\n\t\t\t\treturn \"\";\n\t\tfor(var i = 0; i < radioLength; i++) {\n\t\t\tif(radioObj[i].checked) {\n\t\t\t\treturn radioObj[i].value;\n\t\t\t}\n\t\t}\n\t\treturn \"\";\n\t}", "function RetrieveRadioButtonValue(groupName) {\n // debugger;\n var value = \"\";\n var radioButtonGrouping = document.getElementsByName(groupName);\n if (radioButtonGrouping && radioButtonGrouping.length > 0) {\n // We need to search for which radio button was selected\n // by looking at the checked value https://www.w3schools.com/jsref/prop_radio_checked.asp\n for (let idx = 0; idx < radioButtonGrouping.length; idx++) {\n if (radioButtonGrouping[idx]\n && radioButtonGrouping[idx].value !== undefined\n && radioButtonGrouping[idx].checked !== undefined) {\n if (radioButtonGrouping[idx].checked) {\n value = radioButtonGrouping[idx].value;\n break; // No use looking at the next checkboxes because only one can be checked\n }\n }\n }\n }\n else {\n console.log(\"Could not find radio button group named '\" + groupName + \"'\");\n }\n return value;\n}", "function getRadioValue(radioInput)\n{\n let chosenRadio = \"\";\n for (let i = 0; i < radioInput.length; i++)\n {\n if(radioInput[i].checked)\n {\n chosenRadio = radioInput[i].value;\n //only one radio can be checked, so we stop the loop once we've found the checked one\n break;\n }\n }\n if(!chosenRadio)\n {\n chosenRadio = \"none\";\n }\n return chosenRadio;\n}", "function radioButtonsAccessor(arg) {\n if (typeof arg == \"undefined\")\n return $(this).children(\"input\").filter(\":checked\").val();\n else {\n return $(this).children(\"input\").val([arg, arg]);\n }\n }", "function RadioButton_GetData()\n{\n\t//create an array for the result and return it with our value\n\treturn new Array(this.InterpreterObject.Properties[__NEMESIS_PROPERTY_CHECKED]);\n}", "function getSelectedRadio(buttonGroup) {\r\n if (buttonGroup[0]) { // if the button group is an array (one button is not an array)\r\n for (var i = 0; i < buttonGroup.length; i++) {\r\n if (buttonGroup[i].checked) {\r\n return i;\r\n }\r\n }\r\n } else {\r\n if (buttonGroup.checked) {\r\n return 0;\r\n } // if the one button is checked, return zero\r\n }\r\n // if we get to this point, no radio button is selected\r\n return -1;\r\n}", "function getRadioGroupValue(radioGroupName) {\n var radioElements = document.getElementsByName(radioGroupName);\n\n for(var i= 0; i<radioElements.length; i++ ) {\n if(radioElements[i].checked){\n return radioElements[i].value;\n }\n }\n}", "function GetItemRadioButton2(){\n var val1 = document.getElementById(\"exampleRadios1\").checked;\n var val2 = document.getElementById(\"exampleRadios2\").checked;\n var val3 = document.getElementById(\"exampleRadios3\").checked;\n var val4 = document.getElementById(\"exampleRadios4\").checked;\n var val5 = document.getElementById(\"exampleRadios5\").checked;\n var returnval;\n if(val1 === true){\n returnval = \"1\";\n }\n else if(val2 === true){\n returnval = \"2\";\n }\n else if(val3 === true){\n returnval = \"3\";\n }\n else if(val4 === true){\n returnval = \"4\";\n }\n else if(val5 === true){\n returnval = \"5\";\n }else{\n returnval = \"N/A\";\n }\n Validation(returnval);\n return returnval;\n}", "function GetItemRadioButton3(){\n var val1 = document.getElementById(\"exampleRadios1\").checked;\n var val2 = document.getElementById(\"exampleRadios2\").checked;\n var val3 = document.getElementById(\"exampleRadios3\").checked;\n var val4 = document.getElementById(\"exampleRadios4\").checked;\n var returnval;\n if(val1 === true){\n returnval = \"1\";\n }\n else if(val2 === true){\n returnval = \"2\";\n }\n else if(val3 === true){\n returnval = \"3\";\n }\n else if(val4 === true){\n returnval = \"4\";\n }else{\n returnval = \"N/A\";\n }\n Validation(returnval);\n return returnval;\n}", "function aquireRadioValue(radioId) {\r\n var returnValue = 0;\r\n if (document.getElementById(radioId).checked) {\r\n returnValue = document.getElementById(radioId).value;\r\n }\r\n return returnValue;\r\n}", "function citruscartGetCheckedValue(radioObj) {\r\n\tif (!radioObj) {\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\tvar radioLength = radioObj.length;\r\n\tif (radioLength == undefined) {\r\n\t\tif (radioObj.checked)\r\n\t\t\treturn radioObj.value;\r\n\t\telse\r\n\t\t\treturn \"\";\r\n\t}\r\n\r\n\tfor (var i = 0; i < radioLength; i++) {\r\n\t\tif (radioObj[i].checked) {\r\n\t\t\treturn radioObj[i].value;\r\n\t\t}\r\n\t}\r\n\treturn \"\";\r\n}", "function whatIsChecked() {\n let radioElements = document.getElementsByClassName(\"businessEntity\");\n\n for (let i = 0; i < radioElements.length; i++) {\n if (radioElements[i].checked) {\n return radioValue = radioElements[i].value;\n }\n }\n\n}", "function checkingValuesOfRadioBtns() {\n for (var i = 0; i < 10; i++) {\n var radioValues = $(\"input[name=quest_\" + i + \"]:checked\").data(\n \"reference\"\n );\n valuesFromRadio.push(radioValues);\n }\n console.log(\"the values are:\" + valuesFromRadio);\n }", "function whatsSelected() {\n //Find out which radio button is selected\n var radios = document.getElementsByName(\"selected\");\n for (var i = 0; i < radios.length; i++) {\n if (radios[i].checked) {\n //console.log(i + \" is selected!\")\n return i;\n }\n }\n}", "function selected() {\n let answer = undefined;\n answerElements.forEach((answerElement) => {\n if (answerElement.checked) {\n answer = answerElement.id\n }\n\n });\n return answer;\n}", "function radioButtonCheck(){\n\tvar element = document.getElementsByName(\"choice\");\n\tfor(let i=0;i<element.length;i++){\n\t\tif(element[i].checked){\n\t\t\treturn element[i].id;\n\t\t}\n\t}\n}", "function getSelectedOption(){\n\treturn $('input[name=search-type]:checked').val();\n}", "function GetCheckedRadioButtonFromName(name) {\n //Gets all of the radiobuttons.\n var radioButtons = document.getElementsByName(\"ctl00$MainContent$\" + name);\n //Loops through all of the radiobuttons.\n for (var radioButton of radioButtons) {\n //Finds out which radioButton is checked.\n if (radioButton.checked) {\n //Return the value of the radio button that is checked.\n return radioButton;\n }\n }\n\n}", "function radioSave(){\n var cNames = [];\n $('input:radio').each(function(){\n if(!!this.name && this.name.length>0){\n cNames.push(this.name);\n }\n });\n var v={};\n for(const cName of [...new Set(cNames)]){\n v[cName] = $(\"input[name='\"+cName+\"']:checked\").val();\n }\n return v;\n}", "function skill(){\r\n let skillLevel = document.getElementsByName(\"skill\");\r\n for(var i = 0; i < skillLevel.length; i++) {\r\n if(skillLevel[i].checked){\r\n return skillLevel[i].value;\r\n }\r\n }\r\n }", "function 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 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}" ]
[ "0.8111806", "0.79798925", "0.78177446", "0.78147954", "0.7809307", "0.7805381", "0.7796166", "0.77905595", "0.77691585", "0.77616173", "0.77355486", "0.7708302", "0.7684945", "0.7684945", "0.7667638", "0.76627886", "0.76585346", "0.7574681", "0.7519006", "0.75168407", "0.7510902", "0.7495304", "0.74618196", "0.7446872", "0.73987913", "0.73762035", "0.7368762", "0.7358177", "0.73399764", "0.7331221", "0.73260796", "0.73113394", "0.7300553", "0.72959906", "0.72871286", "0.7264369", "0.72547185", "0.7238098", "0.7225633", "0.7221993", "0.72156906", "0.72156227", "0.7172571", "0.7170583", "0.71367526", "0.71207786", "0.71115696", "0.7110838", "0.70661193", "0.70533514", "0.7049807", "0.7049807", "0.7049807", "0.7047803", "0.70271754", "0.70152485", "0.6999429", "0.6979336", "0.6977566", "0.69773", "0.69683933", "0.69458383", "0.6937109", "0.69094086", "0.6896516", "0.6889309", "0.68802017", "0.68614554", "0.685962", "0.6831334", "0.6812386", "0.6804579", "0.68045515", "0.6787092", "0.67765105", "0.6775207", "0.67650443", "0.6764035", "0.67467135", "0.6713614", "0.67089784", "0.6694862", "0.66798186", "0.6660879", "0.6658285", "0.66474664", "0.66323656", "0.6630615", "0.66187406", "0.6563104", "0.65570265", "0.65261585", "0.65253043", "0.65033966", "0.6492099", "0.6459168", "0.64536405", "0.644715", "0.64438593", "0.64358604" ]
0.7687428
12
from that deside the amount of questions
function selectQuestionAmount(e){ e.preventDefault(); questionAmount = getRadioValue(); //alert(questionAmount); console.log("Question amount value=",questionAmount); if(questionAmount){ showCountDown(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numberOfQuestions () {\n return quiz.questions.length\n}", "function numberOfQuestions () {\n return quiz.questions.length\n}", "function numberOfQuestions () {\n return quiz.questions.length\n}", "function getTotalQuestions() {\n var totalQuestions = questions.length;\n return totalQuestions;\n}", "function numberOfAnswers () {\n return quiz.questions[quiz.currentQuestion].choices.length\n}", "function numberOfAnswers () {\n return quiz.questions[quiz.currentQuestion].choices.length\n}", "function countQuestions(length) {\n \n if (index > length) {\n index = length;\n } else if (index < 1) {\n index = 1;\n }\n $(\"#questionCounter\").html(\"Question: \" + (index) + \"/\" + length);\n}", "function numberOfAnswers () {\n return quiz.questions[quiz.currentQuestion].options.length\n}", "function remainingQuestions () {\n const questionsLeft = triviaQuestions.length - (currentQuestion + 1);\n const totalQuestions = triviaQuestions.length;\n return `Remaining Questions: ${questionsLeft}/${totalQuestions}`\n}", "function scoreCount() {\n for (var i = 0; i < data.length; i++) {\n\n // If user selected an answer\n if (data[i].checked) {\n\n // check if what the user select is equal to the array answers\n\n if (answers.indexOf(data[i].value) !== -1) {\n correct++;\n } else {\n incorrect++;\n }\n }\n }\n //check how many questions were blank\n //subtracting the if/else values from above from TOTAL Q's\n \n var totalAnswered = correct + incorrect;\n console.log(totalAnswered);\n if (totalAnswered !== totalQuizQuestions) {\n unanswered = totalQuizQuestions - totalAnswered;\n }\n\n $('#correct').html(\" \" + correct);\n $('#incorrect').html(\" \" + incorrect);\n $(\"#unanswered\").html(\" \" + unanswered);\n }", "function questionCounter() {\n if (counter < 4) {\n counter++;\n startTrivia();\n timer = 10;\n timeHolder();\n } else {\n finishTrivia();\n }\n }", "function questionCounter() {\n if(STORE.currentQuestion <= 4) {\n renderQuiz(STORE.currentQuestion);\n console.log(\"We just passed \" + STORE.currentQuestion + \"to renderQuiz\")\n STORE.currentQuestion++;\n } else {\n showResultsAndRetake();\n }\n\n}", "function getNumberOfQuestions() {\n //QuerySelectorAll has better browser support in exchange for being slightly slower than gEBCN.\n var totalQuestions = document.querySelectorAll('.question').length;\n\n return totalQuestions;\n}", "function setmaxNumberOfQuestions() { \n maxNumberOfQuestions = 60;\n}", "function countQuestion() {\n questionCounter--;\n console.log(questionCounter);\n}", "function removeAllQuestion(){\n\t\t$scope.newExam.questions = [];\n\t\t$scope.newExam.numberQuestion = 0;\n\t}", "function getQuestionStats() {\n return questions;\n }", "function nextQ(){\n\tquestionCount++;\n}", "total_questions() {\n var total_questions = 0;\n for (var i = 0; i < this.state.quiz_log.length; i++) {\n total_questions = total_questions + this.state.quiz_log[i][1];\n }\n return (total_questions)\n }", "function queCounter(index){\n const bottomQuesCounter = document.querySelector(\".total-questions\");\n let totalquesCountTag = '<span>'+ index + ' of ' + randomQuestions.length +' Questions</span>';\n bottomQuesCounter.innerHTML = totalquesCountTag;\n}", "static countAnswered(items = [TestAnswer.structure]){\n const filtered = items.filter((answer = {}) => (\n (!answer.userAnswer ) || \n ( answer.label === EXAM_LABELS.SKIPPPED)\n ));\n return filtered.length;\n }", "function totalCorrectAnswers() {\n alert('You answered ' + count + ' questions correctly');\n}", "total_incorrect_questions() {\n var total_incorrect_questions = 0;\n for (var i = 0; i < this.state.quiz_log.length; i++) {\n total_incorrect_questions = total_incorrect_questions + this.state.quiz_log[i][2];\n }\n return (total_incorrect_questions)\n }", "function scoreCount() {\n for (var i = 0; i < userSelection.length; i++) {\n // If user selected an answer\n if (userSelection[i].checked) {\n // check if what the user select is equal to the array answers\n\n if (answers.indexOf(userSelection[i].value) !== -1) {\n correctAnswer++;\n } else {\n incorrectAnswer++;\n }\n }\n }\n //check how many questions were blank by subtracting the if/else values from above from the total number of questions.\n\n var totalAnswered = correctAnswer + incorrectAnswer;\n\n if (totalAnswered !== totalQuestions) {\n blank = totalQuestions - totalAnswered;\n }\n\n $(\"#correct\").html(\" \" + correctAnswer);\n $(\"#incorrect\").html(\" \" + incorrectAnswer);\n $(\"#blank\").html(\" \" + blank);\n } //end scoreCount", "function countResult () {\n\t\t//display how many questions the user ansswered\n\t\t$(\".question\").text(\"Total \" + allQuestions + \" questions\").append('<br>');\n\t\t//display wrong answer counter\n\t\t$(\".answers\").append(wrongCounter + \" wrong\").append('<br>');\n\t\t//display right answer counter\n\t\t$(\".answers\").append(rightCounter + \" right\").append('<br>');\n\t\t//display time out counter\n\t\t$(\".answers\").append(dontAnswerCounter + \" no answer\");\t\t\n\t}", "function scoreCount() {\n for (var i = 0; i < data.length; i++) {\n \n // If user selected an answer\n if (data[i].checked) {\n \n // check if what the user select is equal to the array answers\n \n if (answers.indexOf(data[i].value) !== -1) {\n correctAnswer++;\n } else {\n incorrectAnswer++;\n }\n }\n }\n\n //check how many questions were blank by subtracting the if/else values from above from the total number of questions.\n\n var totalAnswered = correctAnswer + incorrectAnswer;\n console.log(totalAnswered);\n if (totalAnswered !== totalQuiz) {\n blank = totalQuiz - totalAnswered;\n }\n\n $('#correct').html(\" \" + correctAnswer);\n $('#incorrect').html(\" \" + incorrectAnswer);\n $(\"#blank\").html(\" \" + blank);\n\n } //end scoreCount", "function findQuestionNumber(questions) {\n let count = 0;\n let questionLines = [];\n questions.forEach((question) => {\n if (question !== '') {\n questionLines.push(question);\n } else {\n count += findUniques(createQuestionString(questionLines));\n questionLines = [];\n }\n });\n\n return count;\n}", "function nextQuestion(){\n if ((count > 0) && (count < randomQuestions.length)){\n subseqQuesText.textContent = randomQuestions[count];\n count += 1;\n }\n // reset count \n else {\n count = 0;\n subseqQuesText.textContent = randomQuestions[count];\n count += 1;\n }\n}", "function scoreQ6() {\n console.log(\"q6 answer: \" + q6)\n console.log(\"q6 length: \" + q6.length);\n return q6.length;\n\n}", "function counterCheck() {\r\n if (radioCount >= 5) {\r\n radioCount = 1;\r\n questionCount++;\r\n count++;\r\n } else {\r\n radioCount++;\r\n count++;\r\n }\r\n}", "function populate() {\n// alert(\"function populate started\");\n// this function gives each of the answers 0 points so if someone doesn't answer a question\n// the whole thing will continue to work\n for(var i=0; i<3; i++) { Quest[i]=0; }\n}", "function afficherQuestion(num)\n{\n for(var i=1;i<=nbQuestions;i++)\n {\n hide(i);\n }\n show(num);\n}", "function resetWholeQuestion(){\n\t\tresetQuestion();\n\t\tresetChoices();\t\n\t}", "function populate() {\n// alert(\"function populate started\"); \n// this function gives each of the answers 0 points so if someone doesn't answer a question\n// the whole thing will continue to work \n for(var i=0; i<3; i++) { Quest[i]=0; } \n}", "function quizQuestions() {\n var cAnswers = 0;\n var unanswered = 0;\n for (var q = 0; q < questionsArray.length; q++) {\n var chosenValue = $('input[name=\"question' + q +'\"]:checked').val();\n if (chosenValue === undefined) {\n unanswered++;\n } else cAnswers += (chosenValue == questionsArray[q].correctAnswer) ? 1 : 0;\n\n }\n return [cAnswers, unanswered];\n}", "function quesCounter(count) {\n const disp_ques_count = quiz_box.querySelector(\".total-questions\");\n let ques_count_tag =\n \"<span><p>\" +\n count +\n \"</p>of<p>\" +\n quiz_content.length +\n \"</p>Questions</span>\";\n\n disp_ques_count.innerHTML = ques_count_tag;\n}", "function scoreKeeper()\n {\n for (var i = 0; i < quizQuestions.length; i++)\n {\n var checked = $(\"input[name='options\"+i+1+\"']:checked\").val();\n if (checked === undefined)\n {\n noResponse++;\n }\n else if (checked == quizQuestions[i].correctChoice)\n {\n correctAnswerCount++;\n }\n else\n {\n wrongAnswerCount++;\n };\n };\n }", "function questions(number) {\n if (number < quiz.length) {\n $(\"#question\").html(quiz[number].question);\n var choicesArr = quiz[number].choices;\n $(\"#choices\").removeClass(\"textStyle\");\n $(\"#choices\").text(\"\");\n for (var i = 0; i < choicesArr.length; i++) {\n var buttonChoices = $(\"<button>\");\n buttonChoices.attr(\"data-ans\", i);\n buttonChoices.html(choicesArr[i]);\n $(\"#choices\").append(buttonChoices);\n $(\"#choices\").append(\"<br>\");\n } \n } else { \n result();\n }\n }", "function newQuestion() {\n scoreText.textContent = `Score: ${score}`\n questionNumber++\n if (questionNumber >= 25) {\n numOfQuestions.textContent = `Question 25 of 25`\n } else {\n numOfQuestions.textContent = `Question ${questionNumber} of 25`\n }\n question.setAttribute(`class`, `d-none`)\n question = document.getElementById(questionNumber);\n question.removeAttribute(`class`, `d-none`);\n answerchoices = question.querySelectorAll('p');\n }", "function tally() {\n tallied = Math.floor((100 / quizLength) * score);\n if(tallied >= 80){\n commendation = commendationObj.good;\n } else if (tallied >= 66.66){\n commendation = commendationObj.ok;\n } else {\n commendation = commendationObj.bad;\n }\n }", "function setQuestions(){\n for(i = 0; i < quizLength; i++){\n var randomNum = Math.floor(Math.random() * quiz.length);\n if(questionsArray.indexOf(randomNum) != -1){\n i--;\n } else {\n questionsArray.push(randomNum);\n }\n }\n }", "function populate() { \n// alert(\"function populate started\"); \n// this function gives each of the answers 0 points so if someone doesn't answer a question \n// the whole thing will continue to work \n for(var i=0; i<5; i++) { Quest[i]=0; } \n}", "function resetQuestionIndex() {\n questionIndex = 0;\n}", "function backQuestion() {\r\n if (qstNum == 0) {\r\n return;\r\n } else {\r\n qstNum--;\r\n //answers.length--;\r\n //console.log(answers.length);\r\n question();\r\n console.log(\"backQuestion\" + answers.length);\r\n }\r\n}", "function deleteQuestion() {\n var questionDiv = $(this).closest(\".question-group\");\n questionDiv.remove();\n\n questionCounter--;\n\n var counter = 2;\n $(\".question-number\").each(function() {\n $(this).text(counter);\n counter++;\n });\n}", "function scoreAnswers(){}", "function displayQuestion(event) {\n document.getElementById(\"question\").innerHTML = questions[count1%3].question;\n document.getElementById(\"answer\").innerHTML = \"\";\n ++count1;\n //adjusting the display of the answer \n count2=count1-1;\n}", "function getQuestions() {\n if (currentQuestionIndex === 6) {\n clearInterval(timerInterval);\n endGame();\n } else {\n showQuestion(shuffleQuestions[currentQuestionIndex]);\n showAnswers(shuffleQuestions[currentQuestionIndex]);\n }\n}", "function showQuestionCounter(questionNumber) {\n return \"Question \" + (questionNumber) + \" of \" + questionAnswersOptions.length;\n}", "function keepingScore() {\n\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n\n // Q1\n if (userAnswer1 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q2\n if (userAnswer2 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer2 == questions[1].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q3\n if (userAnswer3 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer3 == questions[2].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q4\n if (userAnswer4 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer4 == questions[3].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q5\n if (userAnswer5 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer5 == questions[4].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q6\n if (userAnswer6 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer6 == questions[5].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n }\n\n // Q7\n if (userAnswer7 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer7 == questions[6].answer) {\n\n correctAnswers++;\n }\n else {\n\n wrongAnswers++;\n } \n\n}", "function deductFromScore () {\n score -= questionInfo[correspondingQuestion].points\n document.querySelector('#score').innerHTML = `Score: ${score}`\n numberOfWrongAnswers++\n}", "function newQues() {\n // if the question counter < 16 only 15 question allowed\n if (count < 16) {\n clearInterval(intervalId2);\n var random = Math.floor(Math.random() * objArray.length);\n // console.log(objArray[random].question);\n // clearing weird stuff from the text\n var q = (objArray[random].question).replace(/&quot;/g, '\"');\n q = (q).replace(/&#039;/g, \"'\");\n q = (q).replace(/&laquo;/g, \"<<\");\n q = (q).replace(/&raquo;/g, \">>\");\n q = (q).replace(/&hellip;/g, \"...\");\n\n // question information \"category\" \"difficulty\" \"number\"\n $(\".question\").text(q);\n $(\"#category\").text(objArray[random].category);\n $(\"#difficulty\").text(objArray[random].difficulty);\n $(\"#qNum\").text(count);\n $(\"#ofq\").text(count);\n console.log(\"count\"+count);\n count++;\n $(\".answerPanel\").empty();\n $(\"#cor\").text(correct);\n $(\"#incor\").text(incorrect);\n // put the answers in an array\n var newArr = objArray[random].incorrect_answers;\n newArr.push(objArray[random].correct_answer);\n correctAnswer = objArray[random].correct_answer;\n // shuffle the answers\n newArr.sort();\n // display answers\n for (let i = 0; i < 4; i++) {\n var newh = $(\"<h4>\");\n newh.addClass(\"answer\");\n newh.attr(\"data-answer\", newArr[i]);\n newh.text(newArr[i])\n $(\".answerPanel\").append(newh);\n }\n }\n // exeeded the 15 question end game and display info\n else{\n $(\".question\").text(\"All done\");\n var newDiv = $(\"<div>\");\n var p = $(\"<h3>\");\n var p2 = $(\"<h3>\");\n p.text(\"Correct answers: \"+correct);\n p2.text(\"Incorrect answers: \"+incorrect);\n newDiv.append(p,p2);\n var b =$(\"<button type='button' class='btn btn-outline-success rest'>\");\n var d = $(\"<div class='spinner-grow text-warning spin' role='status'>\");\n var s = $(\"<span class='sr-only'>\")\n s.text(\"Loading...\"); \n var h =$(\"<h3>\")\n h.text(\"Restart\");\n d.append(s);\n b.append(d,h);\n $(\".answerPanel\").empty();\n $(\".answerPanel\").append(newDiv,b);\n clearInterval(intervalId);\n clearInterval(intervalId2);\n }\n }", "function populateQuestions() {\n const twentyQuestionsArray = getAllQuestionsAndAnswers();\n return buildQuestions(twentyQuestionsArray, 10);\n}", "function keepingScore() {\n\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n var userAnswer8 = $(\"input[name='answer8']:checked\").val();\n var userAnswer9 = $(\"input[name='answer9']:checked\").val();\n var userAnswer10 = $(\"input[name='answer10']:checked\").val();\n \n \n // Question 1\n if (userAnswer1 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 2\n if (userAnswer2 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer2 == questions[1].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 3\n if (userAnswer3 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer3 == questions[2].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 4\n if (userAnswer4 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer4 == questions[3].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 5\n if (userAnswer5 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer5 == questions[4].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 6\n if (userAnswer6 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer6 == questions[5].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 7\n if (userAnswer7 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer7 == questions[6].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 8\n if (userAnswer8 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer8 == questions[7].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 9\n if (userAnswer9 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer9 == questions[8].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n // Question 10\n if (userAnswer10 === undefined) {\n\n unanswered++;\n }\n else if (userAnswer10 == questions[9].answer) {\n\n correctAnswers++;\n }\n else {\n\n incorrectAnswers++;\n }\n\n \n}", "function setAvailableQuestions(){\r\nconst totalQuestion = quiz.length;\r\nfor(let i=0; i=totalQuestion; i++){\r\n availableQuestions.push(quiz[i])\r\n}\r\n}", "function loadPreviousQuestion() {\r\n //Decrement quentions index\r\n currentQuestion--;\r\n //remove last array value;\r\n score.pop();\r\n //Generate the question\r\n generateQuestions(currentQuestion);\r\n}", "function onDeleteQuestion(e) {\r\n \tvar part = this.part,\r\n\t\t\tquestions = e.sender.dataSource.data();\r\n \tpart.set('questionCount', questions.length - 1); // Event fires before item is removed from DataSource\r\n }", "function runQuestions() {\n if (questionCounter < 6) {\n choicesEl.innerHTML = \"\";\n renderQuestion(quizQuestions[questionCounter]);\n createButton(quizQuestions[questionCounter]);\n createListeners();\n } else {\n endQuiz();\n }\n}", "constructor(questions) {\n this._questionCollection = questions;\n ////console.log(this._questionCollection);\n // this._isRandomized = behaviourConfig.isRandomized;\n this._currentQuestion = -1;\n this._questionBank = [];\n this._currentPool = [];\n }", "function previousQuestion() {\n mainQuestion--;\n score.pop()\n createQuestions(mainQuestion);\n}", "function quiz() {\r\n let questionNumber = 0;\r\n let score = 0;\r\n let totalQuestions = 0;\r\n\r\n const STORE = getDataArray();\r\n\r\n totalQuestions = STORE.length;\r\n\r\n initQuiz(STORE, questionNumber, totalQuestions);\r\n\r\n processQuestions(STORE, questionNumber, totalQuestions, score);\r\n}", "prepareLevel() {\n super.prepareLevel()\n monika.support.pause()\n\n this.answersExpected = 0\n var total = this.queue.length\n for ( let ii = 0; ii < total; ii += 1 ) {\n let cue = this.queue[ii]\n this.addToAnswerCount(cue)\n }\n \n this.answered = {\n consonants: 0\n , names: 0\n , numbers: 0\n }\n \n return this\n }", "function resetQuiz(){\n questionCounter = 0;\n score = 0;\n}", "function getNumOfQuestions(){ // gets the max # of questions from DB GENERALQUESTIONGET .PHP FILE. do AJAX request here\r\n\tvar numberOfQuestions = questionList.length;\r\n\treturn numberOfQuestions;\r\n}", "function setQuestion(qCount, rand) {\n\n let ques = quesObject[rand];\n \n question.textContent = (qCount+1) + \". \" + ques.question;\n option1.textContent = ques.option1;\n option2.textContent = ques.option2;\n option3.textContent = ques.option3;\n option4.textContent = ques.option4;\n\n}", "function scoreKeep(){\n var userAnswer1 = $(\"input[name='answer1']:checked\").val();\n var userAnswer2 = $(\"input[name='answer2']:checked\").val();\n var userAnswer3 = $(\"input[name='answer3']:checked\").val();\n var userAnswer4 = $(\"input[name='answer4']:checked\").val();\n var userAnswer5 = $(\"input[name='answer5']:checked\").val();\n var userAnswer6 = $(\"input[name='answer6']:checked\").val();\n var userAnswer7 = $(\"input[name='answer7']:checked\").val();\n\n //now keep score for all questions and answers\n if (userAnswer1 === undefined) {\n\n unanswered++;\n } else if (userAnswer1 == questions[0].answer) {\n\n correctAnswers++;\n } else {\n\n incorrectAnswers++;\n }\n if(userAnswer2 === undefined) {\n unanswered++;\n } else if (userAnswer2 == questions[1].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer3 === undefined) {\n unanswered++;\n } else if (userAnswer3 == questions[2].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer4 === undefined) {\n unanswered++;\n } else if (userAnswer4 == questions[3].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer5 === undefined) {\n unanswered++;\n } else if (userAnswer5 == questions[4].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer6 === undefined) {\n unanswered++;\n } else if (userAnswer6 == questions[5].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n if(userAnswer7 === undefined) {\n unanswered++;\n } else if (userAnswer7 == questions[6].answer){\n correctAnswers++;\n } else {\n incorrectAnswers++;\n }\n}", "function unansweredNoti() {\n clearDivs();\n $('#timer').html(\"<p>Pick</p>\");\n unanswered++; // number of unaswered goes up\n showAnswers();\n stopCounting();\n setTimeout(playGame, 5000);\n }", "function loadPreviousQuestion() {\n //Decrement quentions index\n currentQuestion--;\n //remove last array value;\n score.pop();\n //Generate the question\n generateQuestions(currentQuestion);\n}", "function loadPreviousQuestion() {\n //Decrement quentions index\n currentQuestion--;\n //remove last array value;\n score.pop();\n //Generate the question\n generateQuestions(currentQuestion);\n}", "get foilCount() {\n return Math.floor(this.itemCount * 0.10); // 10% of questions will have a foil response\n }", "function setAvailableQuestions(){\n const totalQuestion = quiz.length;\n for(let i=0; i<totalQuestion; i++ ){\n availableQuestions.push(quiz[i])\n }\n\n\n }", "function reset() {\n timer.answerTime = 30;\n totalQuestions = 0;\n counter = 0;\n correctAns = 0;\n wrongAns = 0;\n unanswered = totalQuestions - correctAns - wrongAns;\n $(\"#result\").empty();\n $(\"#response\").empty();\n questions();\n}", "function startQuiz() {\n questionCounter = 0;\n score = 0;\n availableQuestions = [...questions];\n newQuestion();\n}", "function questionChooser() {\n var remainingQuestions = [];\n for (i = 0; i < triviaContent.length; i++) {\n if (triviaContent[i].status === \"unused\") {\n remainingQuestions.push(i);\n }\n }\n if (questionsCompleted < 8) {\n var randomQuestion =\n remainingQuestions[\n Math.floor(Math.random() * remainingQuestions.length)\n ];\n currentQuestion = randomQuestion;\n triviaContent[randomQuestion].status = \"used\";\n var questionh3 = $(\"<h3>\").text(triviaContent[randomQuestion].question);\n questionh3.attr({ id: \"question\", class: \"animated flipInX\" });\n $(\"#question-section\").append(questionh3);\n printTimer();\n } else {\n endScreen();\n }\n }", "function calcDistictAnswers(answers, question) {\n\n //Check if answers contains more than one submission and question is defined\n if (answers.length < 1 || question == undefined) {\n console.log(\"Error in calculating disctinct answers: No answers provided or question missing\")\n return;\n }\n\n //Prepare return object\n var result = new Array();\n\n if (question.questionType == \"multi-choice\") {\n //All submissions must have same amount of options\n var optionsLength = question.questionOptions.length;\n\n //Get correct answer\n var solution = new Array();\n for (var i = 0; i < optionsLength; i++) {\n if (question.questionType == \"multi-choice\") {\n solution.push(question.questionOptions[i].correct);\n } else {\n solution.push(question.questionOptions[i].text);\n }\n };\n console.log(solution);\n\n //Iterate over answers\n for (var i = 0; i < answers.length; i++) {\n //Check if answer has the correct amount of options\n if (answers[i].submission.length != optionsLength) {\n console.log(\"Error in calculating disctinct options: Multiple choice options differ in length. This can't be as every answer has to have the same length.\")\n }\n\n //Remember id answer is not part of results yet\n var newAnswer = true\n\n //Check if answer was seen before. If yes increase quantity, if no add to results.\n\n for (var j = 0; j < result.length; j++) {\n //Check if answer alreday exists in results and if yes increase quantity\n if (arrayEqual(result[j].submission, answers[i].submission)) {\n result[j].quantity++;\n newAnswer = false;\n break;\n }\n };\n //If still new anser add to reluts\n if (newAnswer) {\n\n //Check if new answer is correct\n var correct = arrayEqual(answers[i].submission, solution);\n\n //text for each dataset\n var optionText = \"\";\n //text that contains all selected answer option texts\n\n var selected = new Array();\n for (var k = 0; k < answers[i].submission.length; k++) {\n if (answers[i].submission[k] == true) {\n selected.push(question.questionOptions[k].text.trim());\n optionText = optionText + String.fromCharCode(65 + k) + \" \";\n }\n };\n\n if (question.questionType == \"multi-choice\") {\n optionText = optionText + \"- \" + selected.join(\", \");\n\n } else {\n console.log(\"Qswefrgth\");\n optionText = selected.join(\", \");\n }\n\n //push new answer to results\n result.push({\n submission : answers[i].submission,\n text : optionText,\n correct : correct,\n quantity : 1 //How often option was selected\n });\n }\n\n };\n }\n //Text questions\n else if (question.questionType = \"text-input\") {\n for (var i = 0; i < answers.length; i++) {\n //Test if answer is new, if no increase quantity in results\n var isNewAnswer = true;\n for (var j = 0; j < result.length; j++) {\n if (arrayEqual(result[j].submission, answers[i].submission)) {\n isNewAnswer = false;\n result[j].quantity++;\n }\n };\n\n //If new answer push to results\n if (isNewAnswer) {\n var newAnswer = {\n submission : answers[i].submission,\n text : answers[i].submission.join(),\n correct : false,\n quantity : 1 //How often option was selected\n }\n if (answers[i].correctness == 100) {\n newAnswer.correct = true;\n }\n result.push(newAnswer)\n }\n };\n }\n //Else (missing or unknown question type) log error\n //else{\n // console.log(\"Error in calculating disctinct options: question type is unknown or mission: \");\n // console.log(question.questionType)\n //}\n\n return result;\n}", "function setAvailableQuestions() {\r\n const totalQuestion = quiz.length;\r\n\r\n for (let i = 0; i < totalQuestion; i++) {\r\n availableQuestions.push(quiz[i])\r\n }\r\n\r\n\r\n}", "function eens(){ \r\n\tanswers[count] = 'pro';\r\n\tcount++\r\n\tupdateItems();\r\n}", "function Quiz(questions) {\n this.score = 0;\n this.questions = questions;\n this.questionIndex = 0;\n}", "function Quiz(questions) {\n this.score = 0;\n this.questions = questions;\n this.questionIndex = 0;\n}", "function questionPrep() {\n counter++;\n if (counter < question.length) {\n buttonArea.innerHTML=\"\";\n renderQuestion ();\n } else {\n endQuiz();\n };\n}", "function setAvailableQuestions() {\n const totalQuestion = quiz.length;\n for (let i = 0; i < totalQuestion; i++) {\n availableQuestions.push(quiz[i]);\n }\n}", "function takeQuestions() {\n\t\tlet questions=[]\n\t\tinputList=questionsContent.childNodes\n\t\tfor (i=0;i<inputList.length;i++) {\n\t\t\tquestions.push([inputList[i].querySelector('.question').value,inputList[i].querySelector('.anserw').value])\n\t\t}\n\t\tquestions.forEach(function(el) {\n\t\t\tif (el[0].length===0) {el[0]=' '}\n\t\t\tif (el[1].length===0) {el[1]=' '}\n\t\t})\n\t\treturn questions\n\t}", "function increaseQuestionIndex() {\n questionIndex++;\n}", "function generateQuestion(){\n if (questionNumber < STORE.length){\n return createQuestion(questionNumber);\n } else {\n $('.questionBox').hide();\n finalScore();\n $('.questionNumber').text(10);\n }\n}", "function deleteUsed (){\n\tif(Questions.length > 0) {\n\t\tQuestions.splice(Questions.indexOf(question),1);\n\t} else {\n\t\tdocument.getElementById('answerT').style.display=\"none\";\n\t\tdocument.getElementById('answerF').style.display=\"none\";\n\t\tdocument.getElementById('questions').style.display=\"none\";\n\t\tdocument.getElementById('looser').style.display=\"\";\n\t\tdocument.getElementById('reset').style.display=\"\";\n\t}\n}", "function handleQuestions() { \n while (shuffledQuestions.length <= 7) {\n const random = questions[Math.floor(Math.random() * questions.length)];\n if (!shuffledQuestions.includes(random)) {\n shuffledQuestions.push(random);\n }\n }\n }", "function checkAnswer() {\n \n var numOfQs = 0;\n \n var choices = [];\n var chosen = [];\n \n for (var i = 0; i < pos; i++ ) {\n numOfQs += qNum[i];\n }\n \n firstQ = numOfQs - qNum[pos - 1];\n //document.write(questions[pos].Correct);\n for (var j = firstQ; j < numOfQs; j++) {\n choices.push(document.getElementsByName(\"choices\" + j));\n for (var i=0; i < choices[j -firstQ].length; i++) {\n if (choices[j - firstQ][i].checked) {\n chosen.push(choices[j - firstQ][i].value);\n //document.write(\"if\");\n }\n }\n }\n \n //document.write(questions[pos].Correct);\n //document.write(choices.length);\n //document.write(\"Holass\");\n for (var i=0; i < chosen.length; i++) {\n\n if (chosen[i] == questions[pos].Correct) {\n score++;\n }\n }\n \n //document.write(\"Hola\");\n if (pos == test.length) {\n document.write(\"<h1>Te sacaste \" + score + \" de \" + numOfQs + \" preguntas</h1><br>\");\n document.write(qNum);\n } else {\n renderQuestion();\n }\n}", "function generateQuestion() {\n let questionNumber = STORE.questionNumber;\n if (questionNumber <= STORE.questions.length+1) {\n return STORE.questions[questionNumber - 2].question;\n }\n else\n finalScore();\n}", "function updateQuestion() {\n //1 - update the question text\n $('#question').text(myQuestions[currentQuestionNumber].questionText);\n //2 - display what are the choices for the current question\n //2.1 - first delete all exisiting choices before populating it with new ones\n $('.options').empty();\n //2.2 - get the total number of choices for the current question\n let totalChoices = myQuestions[currentQuestionNumber].questionChoices.length;\n console.log(totalChoices);\n //2.3 - loop through all the choices and append them to the choices container\n for (var i = 0; i < totalChoices; i++) {\n //2.3.1 - loop through the answer choices and create a dynamically generated row for eaach of them\n let buildEachChoice = \"<input class='answers' name='q1' type='radio' value=\" + i + \">\" + myQuestions[currentQuestionNumber].questionChoices[i] + \"<br>\";\n //2.3.2 - append that row to the choices container in html\n $('.options').append(buildEachChoice);\n }\n //3 - displays the number of the current question\n $('.footer').text(\"Question\" + (currentQuestionNumber + 1) + \"of\" + totalAmountOfQuestions);\n\n\n // display current score\n $('.right').text(\"Current Score: \" + totalNumberOfCorrectAnswers + \"/\" + totalAmountOfQuestions);\n\n}", "function setAvailableQuestions(){\n\tconst totalQuestion = quiz.length;\n\tfor(let i=0; i<totalQuestion; i++){\n\t\tavailableQuestions.push(quiz[i])\n\t}\n}", "getRandomQuestionNumber () {\n return Math.floor(Math.random() * this.state.allQuestions.length);\n }", "setUnanswered (state, questions) {\n // To intitially load the questions from the JSON file you made earlier\n state.unansweredQuestions = questions\n }", "function people_ask_questions(count = 4) {\n document.querySelectorAll(\".ifM9O a\");\n //*getting the values of the href in the people also ask section\n var start_count_questions = 0;\n let question_links = document.querySelectorAll(\".ifM9O a\");\n let temp = new Array();\n for (i = start_count; i < start_count + 4; i++) {\n temp.push(question_links[i]);\n }\n}", "function questionCorrectlyAnswered(questionName, questionIsRequired) {\n questions.answered.total++;\n questions.answered.log.push(questionName);\n\n if( questionIsRequired ) {\n questions.answered.required++;\n }\n }", "function count() {\n if (timeRemaining > 0) {\n timeRemaining--;\n $(\"#time-display\").text(\"Time Remaining: \" + timeRemaining + \" Seconds\");\n } else {\n unansweredNumber++;\n questionsCompleted++;\n clearInterval(intervalId);\n clearScreen();\n timesUpPrint();\n nextQuestion();\n }\n }", "getOptionsBreakdown() {\n const { includePhantoms, question: { options, answers } } = this.props;\n const breakdown = { length: answers.length };\n options.forEach((option) => {\n breakdown[option.id] = { count: 0, names: [] };\n });\n answers.forEach((answer) => {\n answer.selected_options.forEach((selectedOption) => {\n if (!includePhantoms && answer.phantom) { return; }\n breakdown[selectedOption].count += 1;\n breakdown[selectedOption].names.push(answer.course_user_name);\n });\n });\n return breakdown;\n }", "function gryffindor() {\n gryffindorScore += 1;\n questionCount += 1;\n if (questionCount >= 3) {\n updateResult();\n }\n}", "function questions() {\n return {\n 1: {\n ques: \"Archipiélago conocido como 'Las afortunadas'.\",\n ans: \"ISLAS CANARIAS\",\n showAns: \"I**AS **N*R*AS\"\n },\n 2: {\n ques: \"¿Cómo se llama el satélite de planeta Tierra?\",\n ans: \"LUNA\",\n showAns: \"L**A\"\n },\n 3: {\n ques: \"¿Cuál es la capital de Arizona?\",\n ans: \"PHOENIX\",\n showAns: \"P**E**X\"\n },\n 4: {\n ques: \"Personajes que han salido en todas las pelicula de Star Wars:\",\n ans: \"R2-D2 y C-3PO\",\n showAns: \"R*-D* y C-**O\"\n },\n 5: {\n ques: \"¿De qué color es el caballo blanco de Santiago?\",\n ans: \"BLANCO\",\n showAns: \"B**N*O\"\n },\n 6: {\n ques: \"¿Cómo se llama el mejor de amigo de John Snow?\",\n ans: \"SAMWELL TARLY\",\n showAns: \"S**W**L T*RL*\"\n },\n 7: {\n ques: \"¿En qué año se firmó la declaración de independencia de EEUU?\",\n ans: \"1776\",\n showAns: \"1**6\"\n }\n };\n}", "function timeQuestion() {\n //If is different is because the user have not responded all questions\n if (countQuestion != questionList.length) {\n countTime--;\n $(\"#time\").text(countTime);\n\n //If countTime is zero is because the time finished\n if (countTime == 1) {\n countLoose++;\n visibleAnswer(false, true);\n }\n }\n //The responded all question, and we have to stop timer\n else {\n clearInterval(time);\n }\n }", "function generateQuiz(){\n if(quizStarted == false){\n showQuestions(currentQuestion)\n timer()\n }\n//showquestions(){\n//clear the current question and possible answers\n//increase myquestion index\n//display new question and possible answers\n//}\n}", "function resetQuestions() {\n currentQuestionIndex++;\n if (currentQuestionIndex < availableQuestions.length) {\n \n while (choiceButtonsEl.firstChild){\n choiceButtonsEl.removeChild(choiceButtonsEl.firstChild);\n } \n\n getNewQuestion(); \n }\n else {\n getScore();\n showScore(score);\n clearInterval(timeInterval);\n }\n}" ]
[ "0.7181995", "0.7181995", "0.7181995", "0.70489967", "0.6776236", "0.6776236", "0.6768875", "0.6768064", "0.6578214", "0.65611786", "0.65390265", "0.6503893", "0.6412783", "0.63999283", "0.6396519", "0.6343734", "0.6315477", "0.6310545", "0.63101614", "0.6252874", "0.6245445", "0.62276036", "0.6204746", "0.61988866", "0.616833", "0.61672837", "0.6152185", "0.6145668", "0.61349416", "0.61231506", "0.6116363", "0.61081797", "0.6108067", "0.60879314", "0.6083717", "0.6067565", "0.6065385", "0.6063766", "0.6052194", "0.6048132", "0.60282344", "0.6024225", "0.597913", "0.5969518", "0.59672195", "0.59658474", "0.59546304", "0.59348845", "0.59315354", "0.59282714", "0.59262407", "0.59148514", "0.5909402", "0.5895356", "0.58940744", "0.58880156", "0.58860886", "0.5884244", "0.58835155", "0.5882999", "0.5878924", "0.5876044", "0.5871943", "0.58705443", "0.58467484", "0.58379537", "0.5836287", "0.5833781", "0.5833781", "0.5830957", "0.5825347", "0.5801409", "0.5799919", "0.579914", "0.5790549", "0.5783628", "0.57813656", "0.57786995", "0.57786995", "0.5770966", "0.5770459", "0.5770046", "0.5767209", "0.5762822", "0.5751516", "0.5749371", "0.5745279", "0.57446617", "0.5723617", "0.57235366", "0.5723496", "0.57231027", "0.5722566", "0.57222027", "0.5717266", "0.5714483", "0.5713878", "0.57115585", "0.5710655", "0.57083", "0.5707171" ]
0.0
-1
display 123 and Go
function countDownStart(){ countdown.textContent = "3"; setTimeout(() => { countdown.textContent = "2"; },1000); setTimeout(() => { countdown.textContent = "1"; },2000); setTimeout(() => { countdown.textContent = "Go!"; },3000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayHelper (num) {\n if (num < 10) {\n return '0' + num.toString()\n } else {\n return num.toString()\n }\n }", "function takeANumber(katzDeliLine, people){\n return 'Welcome, '+ people +'. You are number '+ katzDeliLine + ' in line.'\n\n}", "function displayPlayer(name, number) {\n console.log(`this is the best player in the world ${name} and his number is ${number}`)\n}", "function displayDigit(digit) {\r\n const displayMainText = displayMain.textContent;\r\n if(regexOperators.test(displayMainText[displayMainText.length-1])) {\r\n displayChain.textContent += displayMainText;\r\n displayMain.textContent = digit;\r\n } \r\n else {\r\n displayMain.textContent += digit;\r\n }\r\n \r\n}", "function view(counter){\nreturn (`\\nCount: ${counter}\\nAdd(+)/Substract(-)/\"q\" to quit\\n`);\n}", "function numberToString(num) {\n\t\tvar result=\"\"\n\t\tresult+=num;\n\t\treturn result;\n\t //your code is here\n\t}", "function mostrarDosDigitos(k) {\n if (k < 10) {\n return \"0\" + k;\n } else {\n return k;\n }\n}", "function numberToString(test) {\r\n return `${test}`; \r\n }", "function displayNumber(n){\n if (resultado.textContent == '0' & n=='0') {\n\n }else if (cantDigitos < 8 & first == 0) {\n resultado.innerHTML = '';\n resultado.textContent = resultado.textContent + n;\n first = 1;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 1) {\n resultado.textContent = resultado.textContent + n;\n cantDigitos = cantDigitos + 1;\n }else if (cantDigitos < 8 & first == 2 ){\n resultado.textContent = resultado.textContent + n;\n puntoPermitido = 0;\n first = 1 ;\n }\n}", "function printDigit(e) {\n let obj = e.target;\n \n if (result.value === '0') {\n result.value = obj.textContent;\n } else {\n result.value += obj.textContent;\n }\n}", "function threeChar(number) {\n if (number === 1) {\n console.log(\"I\");\n }\n else if (number === 2) {\n console.log(\"II\");\n }\n\n else if (number === 3) {\n console.log(\"III\");\n }\n}", "function displayOpperator(char) {\n opperator = char;\n firstNumber = tempNumber;\n displayNum += char + \" \";\n tempNumber = ''; \n subDisplay.textContent = firstNumber + \" \" + opperator;\n display.textContent = tempNumber;\n}", "function digitsWithWords(stringMe) {\r\n switch (stringMe) {\r\n case \"one\":\r\n console.log(\"1\");\r\n break;\r\n case \"two\":\r\n console.log(\"2\");\r\n break;\r\n case \"three\":\r\n console.log(\"3\");\r\n break;\r\n case \"four\":\r\n console.log(\"4\");\r\n break;\r\n case \"five\":\r\n console.log(\"5\");\r\n break;\r\n case \"six\":\r\n console.log(\"6\");\r\n break;\r\n case \"seven\":\r\n console.log(\"7\");\r\n break;\r\n case \"eight\":\r\n console.log(\"8\");\r\n break;\r\n case \"nine\":\r\n console.log(\"9\");\r\n break;\r\n default:\r\n console.log(\"0\");\r\n break;\r\n }\r\n}", "function subChar(number) {\n if (number === 4) {\n console.log(\"IV\");\n }\n else if (number === 5) {\n console.log(\"V\");\n }\n\n else if (number === 6) {\n console.log(\"VI\");\n }\n\n \n}", "function negrita(val) {\n return '<b>' + val + '</b>';\n }", "function printOneNum(){\r\n\tconsole.log(1);\r\n}", "function printsResult(num) {\n console.log('Result ' + num);\n}", "printResult(value) {\n if (value === \"\") {\n // if value is a string print it\n document.getElementById(\"result\").innerText = value;\n return;\n } else {\n // if value in not a string, first convert in to string and then print it\n document.getElementById(\"result\").innerText = this.numToStr(value);\n }\n }", "getDisplayNumber(number) {\n return number;\n }", "function listInteger() {\n\tfor (var i = 1; i < 11; i++) {\n\t\tdocument.write(i+\"&nbsp\"); // &nbsp la ki tu khoang trang.\n\t}\n}", "function printOutput(num)\n{\n\tdocument.getElementById(\"output-value\").innerText=num;\n}", "function onClick() {\n\t\tconsole.log('123');\n\t}", "function printDigit(e) {\n let obj=e.target;\n\n if (result.value==='0') {\n result.value=obj.textContent;\n } else {\n result.value +=obj.textContent;\n }\n}", "function printFruit(i){\n console.log(`I want to eat a ${i}`);\n}", "function printDisplay(num) {\n if (num == \"\") {\n document.getElementById(\"display\").innerText = num;\n } else {\n document.getElementById(\"display\").innerText = getFormattedNumber(num);\n }\n}", "function printNumber() {\n\n //Attribution du symbol du bouton cliqué (chiffre) à la variable nb\n let nb = this.getAttribute(\"data-symbol\");\n\n //Affiche le chiffre cliqué dans l'écran (screen)\n screen.textContent += nb;\n\n //On enlève tous les espaces du string (screen) et on met cela dans la variable screenContent\n let screenContent = screen.textContent.replace(/\\s/g, \"\");\n \n //On affiche le résultat de l'équation dans screenResult avec un arrondit à 2 chiffres après la virgule\n screenResult.textContent = `= ${Math.round(eval(screenContent)*100)/100}`;\n\n //On enlève la classe \"result\" au screenResult\n screenResult.classList.remove(\"result\");\n}", "function printInt(path, _opts, _print) {\n const { body } = path.getValue();\n\n // If the number is a base 10 number, is sufficiently large, and is not\n // already formatted with underscores, then add them in in between the\n // numbers every three characters starting from the right.\n if (!body.startsWith(\"0\") && body.length >= 5 && !body.includes(\"_\")) {\n return ` ${body}`\n .slice((body.length + 2) % 3)\n .match(/.{3}/g)\n .join(\"_\")\n .trim();\n }\n\n return body;\n}", "function printOutput(num){\r\n\tdocument.getElementById(\"output_value\").innerText=num;\r\n}", "function showCadrsNum() {\n\n\n}", "function showUm(){\n console.log(1);\n }", "function numToString(arg){\n return '' + arg + ''\n}", "function print() {\r\n return \"Lara Mahfouz\";\r\n }", "function numDisplay (name, value) {\n var str = \"The \" + name + \" statement equals \" + value + \".<br>\";\n numEle.innerHTML += str;\n}", "function display_time(n){\n return n > 9 ? \"\" + n: \"0\" + n;\n}", "function echo(strg, num){\n for (var i = 0; i < num; i++ ){\n console.log(strg);\n }\n}", "function write(str, num) {\n let out = '<p>';\n if (num == 1) {\n out += '<b>';\n }\n out += str;\n if (num == 1) {\n out += '</b>';\n }\n out += '</p>';\n\n document.write(out);\n}", "function takeANumber(katzDeli, tourist) {\n katzDeli.push(`${tourist}`);\n return (`Welcome, ${tourist}. You are number ${katzDeli.length} in line.`);\n}", "function number_method(){\n var number = 3;\n document.getElementById(\"number_method\").innerHTML=number.toString();\n}", "function numberToString(num) {\n\t //your code is here\n\t var result=\"\";\n\t result=result+num;\n\t return result;\n\t}", "function echo (stringInput, num){\n for(var i = 0; i < num; i++){\n console.log(stringInput + \", \" + (i+1));\n }\n}", "function printNumber(num) {\n console.log(num);\n}", "function print(value){ // => the word value here is a parameter/placeholder/passenger\r\n console.log(value);\r\n }", "function tuna(stuff) {\n return stuff + \"2\"\n}", "function presionarNumero(valor) {\n var result = obtenerResultado();\n if (result == \"01010010\") {\n mostrarResultado(\"Rolling (<>)\");\n } else {\n mostrarResultado(result + valor);\n }\n}", "function printNum(val) {\n\n let out = document.querySelector('#result');\n let current = out.innerHTML;\n\n // When our screen is empty, the next operation is that we add clicked number/operation\n if (out.innerHTML == '0') {\n if (val != 'C' && val != 'DEL') {\n out.innerHTML = '';\n out.innerHTML += val;\n } \n } else {\n if (val == 'DEL') {\n\n // slice method allows us to remove the last part of the string\n out.innerHTML = current.slice(0, -1);\n if (out.innerHTML.length <= 1) {\n out.innerHTML = '0';\n }\n }\n\n // We add the value to our screen unless we want to perform an operation\n if (val != 'C' && val != 'DEL' && val != '=') {\n out.innerHTML += val;\n }\n\n if (val == 'C') {\n out.innerHTML = '0';\n }\n\n // Now we need to calculate our expression\n // For that we will use eval math function\n if (val == '=') {\n let result = out.innerHTML;\n out.innerHTML = eval(result);\n }\n }\n}", "function printInteger(n) {\n var out = '[' + n + ']';\n return out;\n}", "function printInteger(n) {\n var out = '[' + n + ']';\n return out;\n}", "function printInteger(n) {\n var out = '[' + n + ']';\n return out;\n}", "function printInteger(n) {\n var out = '[' + n + ']';\n return out;\n}", "function passByValue(myInt) {\n return --myInt + ' this is one fewer than you sent';\n}", "function mostrar(num){\r\n\t\tif(resultado.textContent.length < 8){\r\n\t\t\tif(resultado.innerHTML ==\"0\"){\r\n\t\t\t\tresultado.textContent = num;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tresultado.textContent = \"0\";\r\n\t\t}\r\n\t}", "function takeANumber(katzDeliLine,name){\n katzDeliLine.push(name);\n return `Welcome, ${name}. You are number ${katzDeliLine.indexOf(name) + 1} in line.`\n}", "function hiddenCardNumber(argument) {\n\treturn argument.slice(0, 7) + ' **** ' + argument.slice(-4);\n}", "function p(num) {\n\treturn \".\"+s_[num];\n}", "function repitechar(cantidad, carac) {\r\n\tvar caracter = carac;\r\n\tvar numero = parseInt(cantidad);\r\n\tvar cadena = '';\r\n\tfor ( var r = 0; r < numero; r++) {\r\n\t\tcadena += caracter;\r\n\t}\r\n\treturn cadena;\r\n}", "function display(num) {\r\n outputScreen.value += num;\r\n}", "function takeANumber (katzDeliLine, name) {\n katzDeliLine.push(name);\n var deliLength = katzDeliLine.length\n return (`Welcome, ${name}. You are number ${deliLength} in line.`);\n}", "function printEnglishNameOfLastDigit(digit) {\r\n digit = digit.toString();\r\n let arrDigit = digit.split('');\r\n let lastNumber = arrDigit.pop();\r\n let result = '';\r\n switch (lastNumber) {\r\n case '0':\r\n result = 'zero';\r\n break;\r\n case '1':\r\n result = 'one';\r\n break;\r\n case '2':\r\n result = 'two';\r\n break;\r\n case '3':\r\n result = 'three';\r\n break;\r\n case '4':\r\n result = 'four';\r\n break;\r\n case '5':\r\n result = 'five';\r\n break;\r\n case '6':\r\n result = 'six';\r\n break;\r\n case '7':\r\n result = 'seven';\r\n break;\r\n case '8':\r\n result = 'eight';\r\n break;\r\n case '9':\r\n result = 'nine';\r\n break;\r\n }\r\n console.log(result);\r\n}", "function echo(str,num){\n for(var i = 0; i < num; i++){\n console.log(str);\n }\n}", "function write(that) {\nscreenH.innerHTML = that;\n\n if (that.length <= 10) {\n screenH.innerHTML = that;\n }\n else {\n let mostrar = Number(that).toExponential(10);\n screenH.innerHTML = mostrar;\n }\n}", "function writeNumber (stringNumber) {\n if (result.innerText === \"0\") {\n result.innerText = stringNumber; \n } else {\n result.innerText += stringNumber;\n }\n nextIsOperator = true;\n}", "function takeIn(numStr) {\n activeString += numStr.toString();\n displayActive();\n }", "function printNum(number1) {\n var dicePosition1 = document.getElementById('dicePosition1');\n dicePosition1.innerHTML = number1;\n}", "function e() {\n return \"4\" + h(3)\n }", "function printOutput(num) {\r\n if (num == \"\") {\r\n document.querySelector(\".output-value\").innerHTML = num;\r\n } else {\r\n document.querySelector(\".output-value\").innerHTML = getFormattedNumber(num);\r\n }\r\n}", "function kelilingPersegi(){\n var kotak = parseInt(prompt('Masukan sisi persegi : '))\n var keliling = hitungKelilingSegiEmpat(kotak)\n document.write('Keliling Persegi adalah : ' + keliling)\n}", "function AddDigit(dig) \n\t{\n\t\tif (Current.length > MAXLENGTH)\n\t\t{\n \t\t \tCurrent = \"Aargh! Too long\"; //limit length\n \t} else\n \t{ \n \t\tif ( (eval(Current) == 0) && (Current.indexOf(\".\") == -1) ) \n \t\t{ \n \t\t\tCurrent = dig;\n \t} else\n \t{ \n \t\tCurrent = Current + dig;\n \t};\n \t};\n \t\tdocument.Calculator.Display.value = Current;\n \t}", "function addNumber(event){ \n let str = event.target.id;\n number = str.charAt(3);\n let text =document.getElementById(\"txt\");\n text.value=text.value+number; \n \n}", "function myString (num) {\nreturn num.toString();\n}", "function enter1(arg) {\n return \"Hello, %\" + arg + \"%!\";\n}", "function printNumber(num) {\n var i = 0;\n while (num[i] === '0') {\n i += 1;\n }\n\n console.log(num.substring(i));\n}", "function printZeroPaddedWithLabel(number, label) {\n let numberString = String(number);\n while (numberString.length < 3) {\n numberString = \"0\" + numberString;\n }\n console.log(`${numberString} ${label}`)\n}", "function numberEntered(num){\n console.log(\"The number you entered was:\",num,\" Is this correct?\");\n}", "function printZeroPaddedWithLabel(number, label) {\n let numberString = String(number);\n while (numberString.length < 3) {\n numberString = \"0\" + numberString;\n }\n console.log(`${numberString} ${label}`);\n}", "function NumberHandler()\n{\n\tvar output = getOutput();\n\tif(output != NaN)\n\t{ \n\t\toutput = output + this.id;\n\t\tprintOutput(output);\n\t}\n}", "function takeANumber(katzDeliLine,name){\n return \"Welcome, \" + name + \". You are number \" +katzDeliLine.push(name) + \" in line.\"\n}", "function AddDigit(dig){\n\tif (Current.indexOf(\"!\") == -1){\n\t\tif ((eval(Current) == 0) && (Current.indexOf(\".\") == -1)) \n\t\t\tCurrent = dig;\n\t\telse\n\t\t\tCurrent = Current + dig;\n\t\tCurrent = Current.toLowerCase(); //FORCE LOWER CASE\n\t} \n\telse\n\t\tCurrent = \"Hint! Press 'AC'\"; //Help out, if error present.\n\tif (Current.indexOf(\"e0\") != -1){\n\t\tvar epos = Current.indexOf(\"e\");\n\t\tCurrent = Current.substring(0, epos + 1) + Current.substring(epos + 2);\n\t}\n\tif (Current.length > MAXLENGTH)\n\t\tCurrent = \"Aargh! Too long\"; //don't allow over MAXLENGTH digits before \".\" ???\n\tdocument.getElementById(\"applications\").getElementsByTagName(\"input\")[0].value = Current;\n}", "function callChallengeBanner(num){\n let hashTag= \"\"\n num=num+1\n hashTag= hashTag +'#########'\n console.log(hashTag + \" \" + \"challenge\" + num + \" \" + hashTag)\n}", "function outputOnScreen(output){\n //string interpolation\n // let numb = 2\n // console.log('I have ' + numb + 'cats');\n // console.log(`I have ${numb} cats`)\n document.getElementById(\"result\").innerHTML = `The EU tariff will be ${output}`;\n}", "function printOutput(num) {\n if(num===\"\") {\n document.getElementById(\"output-value\").innerText\n } else {\n document.getElementById(\"output-value\").innerText = getFormattedNumber(num);\n }\n}", "function numString(total, num) {\n return total + num.toString();\n}", "function takeANumber(katzDeliLine, name) {\n katzDeliLine.push(name)\n var position = katzDeliLine.length\n return `Welcome, ${name}. You are number ${position} in line.`\n}", "function str(i) {\n if(i<10) {\n return \"0\"+String(i);\n }\n return String(i)\n }", "function showLetters(name){\n\tconsole.log(\"My name has \" + name.length + \" letters\");\n}", "function print_(x) { WScript.Echo(x+''); }", "function keyText(id, isMaj){\n var str;\n switch(id){\n case \"1\":\n str = \"C\";\n break;\n case \"2\":\n str = \"C#/Db\";\n break;\n case \"3\":\n str = \"D\";\n break;\n case \"4\":\n str = \"D#/Eb\";\n break;\n case \"5\":\n str = \"E\";\n break;\n case \"6\":\n str = \"F\";\n break;\n case \"7\":\n str = \"F#/Gb\";\n break;\n case \"8\":\n str = \"G\";\n break;\n case \"9\":\n str = \"G#/Ab\";\n break;\n case \"10\":\n str = \"A\";\n break;\n case \"11\":\n str = \"A#/Bb\";\n break;\n case \"12\":\n str = \"B\";\n break;\n default:\n str = \"C\";\n break;\n }\n if(isMaj)\n str += \" Major\";\n else\n str += \" Minor\";\n document.getElementById(\"keytext\").innerHTML = \"Key: \"+str;\n}", "function printf(naaam) {\n console.log(naaam)\n}", "function keyNum (val) {\n if (newCalc === false) {\n newCalc = true;\n display.innerHTML = '';\n return display.innerHTML += val;\n } else {\n return display.innerHTML += val;\n };\n }", "function setTextId(num) {\n text = num;\n multiphrase = '';\n lastused_phrase = '';\n}", "function numEnt(x){\r\n\tconsole.log(\"Number Entered: \" + x);\r\n}", "function printPlay(a, b, c, res){\n\n var line = \"\";\n line += setEmote(a) + setEmote(b) + setEmote(c);\n console.log(line.padStart(8));\n if (res === 3) {\n coins += 10;\n console.log(\"You won 10 coins! Amazing!\");\n } else if (res === 2) {\n coins += 1;\n console.log(\"You've recovered your coin!\");\n } else {\n\n console.log(\"Oh no! You lost...\");\n }\n \n}", "function GiveACharacter(str, num) {\n if (num >=0) {\n return str[num];\n }\n}", "function printInteger(n) {\n const out = `[${n}]`;\n return out;\n}", "charPrint (c) {\n if (!c) {\n c = 'X';\n }\n let i = this.width;\n while (i > 0) {\n console.log(c.repeat(this.width));\n i--;\n }\n }", "function one(input){\r\n console.log(\"\\nYour input is \" + input);\r\n}", "function testaSegundo(a){\n if(sc < 10){\n var a = \"0\";\n return a + sc;\n }else{\n return sc;\n }\n }", "function v(num) {\r\n\tif (output.value == '0') {\r\n\t\toutput.value = num;\r\n\t} else {\r\n\t\toutput.value = output.value + num;\r\n\t}\r\n}", "function number(num1,num2){\n var res =num1+num2;\n document.write(\"The sum of\"+\" \"+num1+\" \"+\"and\"+\" \"+num2+\" \"+\"=\"+\" \"+res);\n}", "function it(t, n) {\n return t + \" \" + n + (1 === t ? \"\" : \"s\");\n}", "function printNumber()\n{\n console.log();\n console.log(\"Number of sweet: \" + sweetCount);\n console.log(\"Number of salty: \" + saltyCount);\n console.log(\"Number of sweet'nSalty: \" + sweetSaltyCount);\n}", "function oneCharNumberToTwoChar(n){\n return n > 9 ? \"\" + n: \"0\" + n;\n}" ]
[ "0.6328718", "0.60593873", "0.5880683", "0.5852765", "0.58036596", "0.57587314", "0.57530093", "0.57446986", "0.57367396", "0.5729991", "0.5727309", "0.569266", "0.56899035", "0.56603974", "0.5646761", "0.56391466", "0.56357706", "0.56338966", "0.56225425", "0.5617587", "0.56090695", "0.5598857", "0.5592967", "0.5588933", "0.5582936", "0.55827", "0.55708754", "0.5555611", "0.55493504", "0.5548504", "0.5544899", "0.554447", "0.5525015", "0.55218786", "0.5521832", "0.5521549", "0.5519542", "0.55163825", "0.55061543", "0.55008054", "0.54965496", "0.54947037", "0.547822", "0.5458486", "0.5458457", "0.5448245", "0.5448245", "0.5448245", "0.5448245", "0.544616", "0.54449385", "0.543933", "0.5437716", "0.5431104", "0.5419568", "0.5416134", "0.541185", "0.5411111", "0.54110414", "0.5409756", "0.53978574", "0.53969556", "0.5396517", "0.539044", "0.53876996", "0.53861076", "0.538411", "0.538298", "0.5376305", "0.5376074", "0.53720623", "0.5371849", "0.53690696", "0.53682494", "0.5367691", "0.53641516", "0.5355988", "0.5349935", "0.53493273", "0.53482497", "0.5343787", "0.5337154", "0.5328591", "0.5327996", "0.5324253", "0.53226626", "0.5320775", "0.5313108", "0.53108895", "0.5310579", "0.5307698", "0.5307158", "0.53041035", "0.53032386", "0.530284", "0.53026444", "0.5299624", "0.52950436", "0.52901846", "0.52851725", "0.52848464" ]
0.0
-1
random number upto max
function getRandomInt(max){ return Math.floor(Math.random() * Math.floor(max)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RandomNumber( max ){\n return (Math.floor( Math.random()*max));\n }", "function randomNum(max) {\n \n return (Math.floor( Math.random()*max));\n}", "function generatoreNumeri(max){\n return Math.ceil(Math.random() * max);\n}", "function getRandomNum(max) {\n return Math.floor(Math.random() * max);\n }", "function _randomNumber(max) { \n return Math.round(Math.random() * max);\n}", "function r(max){\n return Math.floor(Math.random()*max);\n}", "function getRandomNumber(max) {\r\n return Math.ceil(Math.random() * max);\r\n}", "function randomNumber (max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomNumber(max) {\n return Math.ceil(Math.random() * max)\n}", "function getRandomNumber(max) {\n return Math.floor(Math.random() * max);\n }", "function getRandomNumber(max) {\r\n return (Math.random() * max);\r\n}", "function getRandomNumber(max) {\n return Math.ceil(Math.random() * max);\n}", "function getRandomNum( max ) {\n var num = Math.floor( Math.random() * max );\n return num;\n }", "function getRandomNumber(max) {\n return Math.ceil(Math.random() * max);\n}", "function getRandomNumber(max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandomNumber(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomNumber (max) {\n return Math.floor(Math.random() * max) + 0\n}", "function getRandomInt(max) {return Math.floor(Math.random() * Math.floor(max));}", "function generate_random(max_number) {\n// generates x_number)a random number from o to max_number\n return Math.round(Math.random()*max_number);\n }", "function rand (max) {\n return Math.floor (Math.random()*max); \n}", "function getRandomNumber(max) {\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandomNumber(max) {\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandomNumber(max) {\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandom(max){\n\treturn Math.round(Math.random()*max);\n}", "function rand(max){\n return Math.floor(Math.random() * max);\n}", "function random(max){\n return Math.floor(Math.random() * max) ;\n}", "function randomNumber(max = 1) {\n return Math.floor(Math.random() * max)\n}", "function random(max){\r\n return Math.floor(Math.random() * (max));\r\n}", "function rng(max) {\n return Math.floor(Math.random() * max)\n}", "function rng(max) {\n return Math.floor(Math.random() * max)\n}", "function rand(maxNum) {\n return Math.floor(Math.random() * maxNum);\n}", "function random(max){\n return Math.floor( Math.random() * max + 1);\n}", "function getRandomNumber(max) {\n return Math.floor((Math.random() * 1000) + 1) % max;\n}", "function generateRandomNumberUpTo(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) \n{\n return num = Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * max)\n }", "function numeroRandom(max) {\nreturn Math.floor(Math.random() * 5) + 1;\n}", "function numeroRandom(max) { \n return Math.floor(Math.random() * max) + 1;\n}", "function getRandomInt(max){\n return Math.floor(Math.random()*max);\n}", "function getRandom (max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function genRanNum(max) {\n return Math.floor(Math.random() * max + 1)\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n }", "function getRandomInt(max) {\r\n return Math.floor(Math.random() * max);\r\n}", "function getRandomValue(max) {\r\n max = Math.floor(max);\r\n return Math.floor(Math.random() * max);\r\n}", "function getRando(max) {\n return Math.floor(Math.random() * max);\n}", "rand(max)\r\n {\r\n return Math.floor(Math.random() * max);\r\n }", "function getRandom(max){\n return Math.floor(Math.random() * Math.floor(max));\n\n}", "function rndInt(max) {\n return Math.floor(Math.random() * (max + 1));\n}", "function randomInt(max) {\r\n return Math.floor(Math.random() * max);\r\n}", "function random(max) {\n\n return Math.floor(Math.random() * max);\n}", "function randomInt(max) {\n\treturn Math.floor(Math.random()*max);\n}", "function generateRandomNumber(max) {\n let number = Math.floor(Math.random() * max) + 1;\n return number;\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * 10) +1;\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * 10) +1;\n}", "function rnd() {\n\treturn Math.round(Math.random() * rnd_max);\n}", "function getRandom(max) {\n return Math.floor(Math.random() * (max));\n}", "function getRandom(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandom(max) {\n return Math.floor(Math.random() * Math.floor(max))\n}", "function getRandomInteger(max){\n\t\treturn Math.floor(Math.random() * max + 1);\n\t}", "function randNumGen(max) { \n let randNum = Math.floor(Math.random() * max) + 1\n return randNum;\n}", "function randomInt(max){\r\n return Math.floor(Math.random() * Math.floor(max))+1;\r\n}", "function randomInt(max){\r\n return Math.floor(Math.random() * max) + 1;\r\n}", "function getRandomInt(max)\n{\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function randomUpTo(max)\n{\n return Math.floor(Math.random() * (max+1));\n}", "function randomUpTo(max)\n{\n return Math.floor(Math.random() * (max+1));\n}", "function randomUpTo(max)\n{\n return Math.floor(Math.random() * (max+1));\n}", "function getRandomMax(max){\n return Math.floor(Math.random()* Math.floor(max));\n}", "function rand10(max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function rand10(max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandom(max) {\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandom(max) {\n return Math.random() * max;\n}", "function getRandom(max) {\n return Math.floor(Math.random() * max) + 1;\n}", "function getRandomInt(max) {\r\n return Math.floor(Math.random() * Math.floor(max));\r\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * max);\n}", "function randomUpTo(max)\n{\n\treturn Math.floor(Math.random() * (max+1));\n}", "function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max)) + 1;\n }", "function getRandomNum(maxNum) {\n return Math.floor(Math.random() * 3);\n }", "_getRandomInt(max) {\n if (max === 0) {\n return 0;\n }\n return Math.floor(Math.random() * max);\n }", "getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }", "function getRandomInt(max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function getRandomInt(max){\n return Math.floor(Math.random() * Math.floor(max));\n}", "function randMax(max) {\n return Math.trunc(1E9 * Math.random()) % max;\n}", "function getRandomInt(max) {\r\n\treturn Math.floor(Math.random() * Math.floor(max));\r\n}", "function getRandomInt(max) {\r\n\treturn Math.floor(Math.random() * Math.floor(max));\r\n}" ]
[ "0.8994615", "0.88398767", "0.880315", "0.8762975", "0.87626743", "0.8744438", "0.87420714", "0.87004036", "0.8697208", "0.8695106", "0.8680173", "0.8665245", "0.8661347", "0.8656695", "0.8640513", "0.8638246", "0.8628963", "0.8619376", "0.86190116", "0.8611718", "0.86085486", "0.86076975", "0.86076975", "0.85809433", "0.8562764", "0.8559775", "0.8559291", "0.8555355", "0.8542678", "0.8542678", "0.85388184", "0.85138273", "0.85084414", "0.849402", "0.84718657", "0.8470095", "0.8468358", "0.8451375", "0.8443233", "0.8439818", "0.8438018", "0.84310305", "0.84263366", "0.84263366", "0.84263366", "0.8425018", "0.8423034", "0.84206045", "0.84204036", "0.8406281", "0.84009296", "0.83945245", "0.83926237", "0.8390666", "0.8387487", "0.83864623", "0.83864623", "0.83808625", "0.8372142", "0.83663905", "0.83606887", "0.83602774", "0.8359223", "0.8355024", "0.8350729", "0.834778", "0.8344847", "0.8344847", "0.8344847", "0.83442247", "0.83442247", "0.83442247", "0.8343558", "0.8340698", "0.8340698", "0.83332074", "0.83321995", "0.83304447", "0.8326363", "0.83249456", "0.83249456", "0.8320838", "0.8320838", "0.8320782", "0.8320782", "0.8320782", "0.8320782", "0.8320782", "0.8320782", "0.8317848", "0.8315175", "0.8312785", "0.8305661", "0.82988805", "0.82988805", "0.8298422", "0.8298422", "0.8297306", "0.8297303", "0.8297303" ]
0.8375434
58
random equestion create correct / incorrect
function createEquations(){ //ranodm choose how many correct equations. const correctEquations = getRandomInt(questionAmount); const wrongEquations =questionAmount - correctEquations; //loop create equestions for(let i=0;i<correctEquations;i++){ firstNumber = getRandomInt(9); secondNumber = getRandomInt(9); const equationValue = firstNumber * secondNumber; const equation = `${firstNumber} X ${secondNumber} = ${equationValue}`; equationObject ={value: equation, evaluated: 'true'}; equationsArray.push(equationObject); } //loop create wrong equation and push into array for(let i=0;i<wrongEquations;i++){ firstNumber = getRandomInt(9); secondNumber = getRandomInt(9); const equationValue = firstNumber * secondNumber; wrongFormat[0] = `${firstNumber} X ${secondNumber+1} = ${equationValue}`; wrongFormat[1] = `${firstNumber+1} X ${secondNumber} = ${equationValue}`; wrongFormat[2] = `${firstNumber} X ${secondNumber+1} = ${equationValue+2}`; const formatChoice = getRandomInt(3); const equation = wrongFormat[formatChoice]; equationObject ={value: equation, evaluated: 'false'}; equationsArray.push(equationObject); } shuffleArray(equationsArray); //console.log("Equestion = ",equationsArray); //equationsToDOM(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateQA(){\n var x = Math.round(Math.random()*14)+1;\n var y = Math.round(Math.random()*9)+1;\n answer = x * y;\n document.getElementById(\"question\").innerHTML = x + \"x\" + y;\n \n //for positioning the correct answer in the random box:\n var position = 1+Math.round(3*Math.random());\n document.getElementById(\"opt\" + position).innerHTML = answer;\n \n //for filled other options by wrong answers:\n var allanswers = [answer];\n for(var i = 1; i<5; i++){\n if(i !== position){\n var wronganswer;\n do{\n wronganswer = (Math.round(Math.random()*14)+1) * (Math.round(Math.random()*9)+1); //this will generates the wrong answer.\n }while(allanswers.indexOf(wronganswer) > -1);\n \n document.getElementById(\"opt\"+i).innerHTML = wronganswer;\n allanswers.push(wronganswer);\n }\n }\n}", "function generatenewQNA(){\n document.getElementById(\"question\").style.visibility = 'visible';\n //generate random question\n var x = Math.floor(Math.random()*11);\n var y = Math.floor(Math.random()*11);\n correctanswer = x*y;\n document.getElementById(\"firstnumber\").innerHTML = x;\n document.getElementById(\"secondnumber\").innerHTML = y; \n \n //fill in one answer box with the correct answer\n var correctansid = Math.floor(Math.random()*4+1);\n document.getElementById(\"ans\"+correctansid).innerHTML = correctanswer; \n \n //fill other boxes with wrong answers\n var answergroup = [correctanswer];\n for(i=1;i<5;i++){\n if(i !== correctansid){\n var wronganswer;\n do{\n wronganswer = Math.floor(Math.random()*101);\n }while(answergroup.indexOf(wronganswer)>-1);\n document.getElementById(\"ans\"+i).innerHTML = wronganswer;\n answergroup.push(wronganswer);\n } \n }\n }", "function generateQA(){\r\n\r\n var x =1+ Math.round(9*Math.random()); \r\n var y =1+ Math.round(9*Math.random()); \r\n correctAnswer = x*y;\r\n \r\n document.getElementById(\"question\").innerHTML = x +\"X\"+y;\r\n \r\n var correctPosition = 1 + Math.round(3*Math.random());\r\n \r\n document.getElementById(\"box\"+correctPosition).innerHTML=correctAnswer;//fill one box with the corect answer\r\n \r\n var answers = [correctAnswer];\r\n //fill other boxes with wrong answers\r\n \r\n for(i=1; i<5; i++){\r\n if(i != correctPosition){\r\n var wrongAnswer;\r\n \r\n do{ \r\n wrongAnswer =1+ Math.round(9*Math.random())*\r\n (1+ Math.round(9*Math.random()));//a wrong answer\r\n \r\n }while(answers.indexOf(wrongAnswer)>-1 )\r\n \r\n document.getElementById(\"box\"+i).innerHTML=wrongAnswer;\r\n answers.push(wrongAnswer);\r\n }\r\n }\r\n \r\n}", "function generateQA(){\n var x = 1 + Math.round(9*Math.random());\n var y = 1 + Math.round(9*Math.random());\n correctAnswer = x *y;\n $(\"#question\").html(x + \"x\" + y);\n console.log(correctAnswer);\n var correctPosition =1 + Math.round(3*Math.random());\n $(\"#box\" + correctPosition).html(correctAnswer);\n \n //fill other boxes with wrong answers\n var answrs = [correctAnswer];\n for(i = 1; i <5; i++){\n if(i!=correctPosition){\n var wrongAnswer;\n do{\n wrongAnswer=(1 + Math.round(9*Math.random()))*(1 + Math.round(9*Math.random()));\n }while(answrs.indexOf(wrongAnswer)>-1)\n \n $(\"#box\" + i).html(wrongAnswer);\n answrs.push(wrongAnswer);\n }\n }\n \n}", "function createAnswer() {\n\t\tanswer = String(words[Math.floor(Math.random() * words.length)]);\n\t\tconsole.log(answer)\n\t\t$(\".correctAnswer\").html(answer);\n\n\t}", "function generateQuestion() {\n\tvar q = \"If there were \" + estimateCount + \" \" + getEstAdj() + \" \" + getEstNoun() + \" in \" + getEstMin() + \", estimate how many you could expect to see in \" + estRandMins + \" \" + getMinutesSuffix(estRandMins) + \"?\";\n\tget('estBonusQuest').innerHTML = q;\n\tget('estBonusResQuest').innerHTML = q;\n}", "function generateQA() {\r\n var x = 1 + Math.round(9*Math.random());\r\n var y = 1 + Math.round(9*Math.random());\r\n correctAnswer = x*y;\r\n document.getElementById(\"question\").innerHTML = x + \"x\" + y;\r\n correctPosition = 1 + Math.round(3*Math.random());\r\n document.getElementById(\"variant\" + correctPosition).innerHTML = correctAnswer;//fill one box with the correct answer\r\n \r\n //fill other boxes with wrong answers\r\n var answers = [correctAnswer];\r\n\r\n for(i=1; i<5; i++) {\r\n if(i != correctPosition) {\r\n var wrongAnswer;\r\n do {\r\n wrongAnswer = (1 + Math.round(9*Math.random()))*(1 + Math.round(9*Math.random()));//a wrong answer\r\n }while(answers.indexOf(wrongAnswer)>-1)\r\n document.getElementById(\"variant\" + i).innerHTML = wrongAnswer;\r\n answers.push(wrongAnswer);\r\n }\r\n }\r\n}", "function generateRandomQ() {\r\n let randomQuestion = Math.floor(Math.random()*questionsArray.length) + 1;\r\n let questionToAsk = questionsArray[randomQuestion - 1];\r\n\r\n return questionToAsk;\r\n }", "function generateQA() {\r\n var x = randomNumber();\r\n var y = randomNumber();\r\n correctAns = x * y;\r\n document.getElementById('question').innerHTML = x + 'x' + y;\r\n var correctPosition = Math.round(Math.random() * 3) + 1;\r\n document.getElementById('box' + correctPosition).innerHTML = correctAns;\r\n\r\n //fill other with wrong answer\r\n\r\n var answers = [correctAns];\r\n for (let i = 1; i < 5; i++) {\r\n if (i !== correctPosition) {\r\n var wrongAns;\r\n do {\r\n wrongAns = randomNumber() * randomNumber();\r\n } while (answers.indexOf(wrongAns) > -1);\r\n document.getElementById('box' + i).innerHTML = wrongAns;\r\n answers.push(wrongAns);\r\n }\r\n\r\n }\r\n}", "function generateQA() {\n let x = 1 + Math.round(9 * Math.random());\n let y = 1 + Math.round(9 * Math.random());\n correctAnswer = x * y;\n\n document.getElementById('question').innerHTML = x + 'x' + y;\n let correctPosition = 1 + Math.round(3 * Math.random());\n document.getElementById('box' + correctPosition).innerHTML = correctAnswer; //fill one box with correct answer\n\n //fill other boxes with wrong answers\n\n let answers = [correctAnswer];\n\n for (i = 1; i < 5; i++) {\n if (i !== correctPosition) {\n let wrongAnswer;\n do {\n\n wrongAnswer = (1 + Math.round(9 * Math.random())) *\n (1 + Math.round(9 * Math.random())); // a wrong answer\n } while (answers.indexOf(wrongAnswer)>-1)\n\n document.getElementById('box' + i).innerHTML = wrongAnswer;\n answers.push(wrongAnswer);\n }\n\n }\n }", "function getQuestion() {\n indexFinder = Math.floor(Math.random() * questionArray.length);\n question.innerText = \"\";\n question.innerText = questionArray[indexFinder].q;\n currentCorrectAnswer = questionArray[indexFinder].correct;\n}", "function generateQA() {\n var x = 1 + Math.round(9 * Math.random());\n var y = 1 + Math.round(9 * Math.random());\n correctAnswer = x * y;\n document.getElementById(\"question\").innerHTML = x + \" x \" + y;\n var correctPosition = 1 + Math.round(3 * Math.random());\n document.getElementById(\"box\" + correctPosition).innerHTML = correctAnswer; // wypełnienie jednego pudełka odpowiednią odpowiedzią\n\n // wypełnienie pozostałych złymi odpowiedziami\n var answers = [correctAnswer];\n\n for (i = 1; i < 5; i++) {\n if (i != correctPosition) {\n var wrongAnswer;\n do {\n wrongAnswer = (1 + Math.round(9 * Math.random())) * (1 + Math.round(9 * Math.random())); // wrong answer\n }\n while (answers.indexOf(wrongAnswer) > -1)\n document.getElementById(\"box\" + i).innerHTML = wrongAnswer;\n answers.push(wrongAnswer);\n }\n }\n\n}", "function generateQA1(){\n var x = 1 + Math.round(9*Math.random());\n var y = 1 + Math.round(9*Math.random());\n //var z = 1 + Math.round(9*Math.random());\n correctAnswer = x*y;\n document.getElementById(\"Qshow\").innerHTML = x + \"x\" + y;\n var correctPostion = 1 + Math.round(3*Math.random());\n document.getElementById(\"box\"+correctPostion).innerHTML = correctAnswer; // Correct Answer\n var anwsers = [correctAnswer];\n for(i=1 ; i<5 ; i++){\n if(i != correctPostion){\n var wrongAnswer;\n do{\n wrongAnwser = (1 + Math.round(9 * Math.random())) *\n (1 + Math.round(9 * Math.random()));\n } while(anwsers.indexOf(wrongAnswer)>-1)\n document.getElementById(\"box\"+i).innerHTML = wrongAnwser;\n anwsers.push(wrongAnwser);\n }\n }\n}", "function generateQuestion() {\n number1 = Math.ceil(Math.random() * 10);\n number2 = Math.ceil(Math.random() * 10);\n correctAnswer = number1 * number2;\n document.getElementById(\"question\").innerHTML = number1 + \" X \" + number2;\n document.getElementById(\"choice1\").innerHTML = \"<p>\" + correctAnswer + \"</p>\";\n \n \n \n let positions = [];\n while(positions.length < 4) {\n random = Math.ceil(Math.random() * 4);\n if(positions.length === 0) {\n positions.push(random);\n } else if(positions.indexOf(random) === -1) {\n positions.push(random);\n }\n }\n \n \n answers = [];\n answers[positions[0] - 1] = correctAnswer;\n for (let i = 1; i <= 3; i++) {\n random = Math.ceil(Math.random() * 100);\n answers[positions[i] - 1] = random;\n }\n \n \n \n for (let i = 0; i < answers.length; i++) {\n document.getElementById(\"choice\" + (i +1)).innerHTML = answers[i];\n }\n \n \n choice1 = answers[0];\n choice2 = answers[1];\n choice3 = answers[2];\n choice4 = answers[3];\n \n}", "function createFirst() {\n var i = Math.floor(Math.random() * questions.length);\n answerOne = questions[i].answer;\n commentOne = questions[i].comment;\n var question = questions[i].content;\n questions.splice(i, 1);\n $(\"#question-one\").empty;\n $(\"#question-one\").text(question);\n $(\"#answer-one\").html(\"<input type='radio' name='answer' value='true'/>True <input type='radio' name='answer' value='false'/>False\");\n}", "function generateQuestion() {\n // Randomly select a question from the array\n currentQuestion = questions[Math.floor(Math.random() * questions.length)];\n\n // Update the question text in the HTML\n document.getElementById(\"question\").innerHTML =\n \"Spell the number \" +\n currentQuestion.number +\n \" in \" +\n currentQuestion.language +\n \":\";\n\n // Clear the answer input field\n document.getElementById(\"answer\").value = \"\";\n // Set the cursor to the answer input field\n document.getElementById(\"answer\").focus();\n}", "function generateQA(){\r\n var x = 1+ Math.round(9*Math.random());\r\n var y = 1+ Math.round(9*Math.random());\r\n correctAns = x*y;\r\n document.getElementById(\"qus\").innerHTML = x +\"*\"+ y;\r\n var position = 1+ Math.round(3*Math.random());\r\n document.getElementById(\"box\"+position).innerHTML = correctAns;\r\n \r\n var answers = [correctAns];\r\n for(i=1; i<5; i++){\r\n if(i != position){\r\n var wrongans;\r\n do{\r\n \r\n var wrongans = (1+ Math.round(9*Math.random()))*(1+ Math.round(9*Math.random()));\r\n\r\n \r\n }while(answers.indexOf(wrongans)>-1)\r\n document.getElementById(\"box\"+i).innerHTML = wrongans;\r\n answers.push(wrongans);\r\n \r\n }\r\n \r\n }\r\n \r\n}", "function makeQuestion() {\n var num1 = randomNumber();\n var num2 = randomNumber();\n var operatorString = randomOperator(Math.floor(Math.random() * 3))\n // creating a statement to randomise operator\n if (operatorString === \"+\") {\n correctAnswer = num1 + num2;\n } else if (operatorString === \"-\") {\n correctAnswer = num1 - num2;\n } else if (operatorString === \"x\") {\n correctAnswer = num1 * num2;\n }\n // Every single time you answer the question, new question should refresh\n document.getElementById('question').innerHTML = \" \";\n // question should appear on question box with randomised numbers and operator\n document.getElementById('question').append(`${num1} ${operatorString} ${num2}`);\n}", "function answerQuestion() {\n answers = [\"It is certain.\", \"Most likely.\", \"Without a doubt.\", \"Ask again later.\", \"Cannot predict now.\", \"Don't count on it.\", \"My sources say no.\", \"Outlook not so good.\"];\n i = getRandomIntInclusive(0, answers.length - 1);\n makeAnswerAppear(answers[i]);\n\n}", "function generateQA(){\n \n // Create variables for the multiplication of the numbers. Assign random value to them from 1 - 10.\n var x = 1+Math.round(9*Math.random());\n var y = 1+Math.round(9*Math.random());\n \n // Create a variable for the correct answer\n correctAnswer = x*y;\n \n /* Display the question in the Question Box */ \n document.getElementById(\"question\").innerHTML=x + \"*\" + y ;\n \n // Generate a random Box for the correct answer to be displayed.\n var correctPosition = Math.round(3*Math.random());\n \n document.getElementById(\"box\" + correctPosition).innerHTML=correctAnswer;\n \n var answers = [correctAnswer];\n \n // Fill other boxes with the wrong answers generated randomly\n for(i=1; i<5; i++){\n if(i != correctPosition){\n var wrongAnswer;\n do{\n wrongAnswer = (1+Math.round(9*Math.random())) * (1+Math.round(9*Math.random()));\n } while (answers.indexOf(wrongAnswer)>-1)\n document.getElementById(\"box\"+i).innerHTML = wrongAnswer;\n \n answers.push(wrongAnswer);\n }\n }\n}", "function generateNewQuestion() {\n\n var allAnswers = [];\n var correctAnswer = questionCollection[count].correct_answer;\n $(\"#answerList\").empty(); \n $(\"#suggestedAnswerByFriend\").empty();\n $(\"#suggestedAnswerByPublic\").empty();\n $(\"#suggestedAnswerByFifty\").empty();\n\n questionCollection[count].incorrect_answers.forEach(function (answer) {\n allAnswers.push(answer);\n });\n\n allAnswers.join();\n allAnswers.splice(Math.floor(Math.random() * 4), 0, correctAnswer);\n allAnswers.join();\n\n answerIndex = allAnswers.indexOf(correctAnswer);\n\n // question\n var countDisplay = count + 1;\n $(\"#questionField\").html(\"Question Number \" + countDisplay + \"<br>\" + questionCollection[count].question);\n\n // answers\n for (var i = 0; i < allAnswers.length; i++) { \n var li = document.createElement(\"li\");\n var text = document.createTextNode(decodeHtml(allAnswers[i]));\n li.appendChild(text);\n li.classList.add(\"answer\");\n li.id = i;\n document.getElementById(\"answerList\").appendChild(li);\n }\n }", "function randomQuestion() {\n return Math.floor(Math.random() * 2 + 1);\n}", "function pickRandomQuestion() {\n // console.log(currentQuestionIndex);\n document.getElementById(\"question-value\").innerHTML =\n questions[currentQuestionIndex].question;\n document.getElementById(\"choice-detail-a\").innerHTML =\n questions[currentQuestionIndex].content[0];\n document.getElementById(\"choice-detail-b\").innerHTML =\n questions[currentQuestionIndex].content[1];\n document.getElementById(\"choice-detail-c\").innerHTML =\n questions[currentQuestionIndex].content[2];\n document.getElementById(\"choice-detail-d\").innerHTML =\n questions[currentQuestionIndex].content[3];\n console.log(\"The correct answer index is: \" + correctAnswer);\n }", "function generateQuestion() {\n if (questionNumber < STORE.length) {\n return createThing(questionNumber);\n } else {\n $('.questionBox').hide();\n finalScore();\n $('.questionNumber').text(10);\n }\n}", "function assignAnswer() {\r\n\t\tcorrectAnswerNum = Math.floor((Math.random() * 4) + 1);\r\n\t\tvar tempLetterNum = Math.floor(Math.random() * itemArray.length);\r\n\t\tvar tempWordNum = Math.floor(Math.random() * 3);\r\n\t\tcorrectAnswerText = itemArray[tempLetterNum][tempWordNum].word;\r\n\t\tfor (var i = 1; i <= 4; i++) {\r\n\t\t\tif (i !== correctAnswerNum) {\r\n\t\t\t\tbadAnswerText = itemArray[Math.floor(Math.random() * itemArray.length)][Math.floor(Math.random() * 3)].word;\r\n\t\t\t\twhile (badAnswerText === correctAnswerText) // prevent duplicate of correct answer displaying\r\n\t\t\t\t\tbadAnswerText = itemArray[Math.floor(Math.random() * itemArray.length)][Math.floor(Math.random() * 3)].word;\r\n\t\t\t\t$('#answer' + i).html(badAnswerText);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$('#answer' + i).html(correctAnswerText);\r\n\t\t\t}\r\n\t\t}\r\n\t\t$('#quiz-pic').attr('src', itemArray[tempLetterNum][tempWordNum].image);\r\n\t\t$('#quiz-pic').attr('alt', itemArray[tempLetterNum][tempWordNum].word);\r\n\t}", "function generate(){\n var num1 = Math.round(Math.random()*10);\n var num2 = Math.round(Math.random()*10);\n correctanswer = num1 * num2; \n document.getElementById(\"question\").innerHTML=num1+\"x\"+num2;\n var correctposition = Math.round(Math.random()*3+1);\n document.getElementById(\"box\" + correctposition ).innerHTML = correctanswer;\n \n \n var answers = [correctanswer]\n \n for(var i = 1; i<5 ; i++ ){\n \n if(i!= correctposition) {\n var wronganswer;\n \n do{\n \n wronganswer= (1+Math.round(9*Math.random()))*(1+Math.round(9*Math.random())); //wrong answer\n \n }\n while(answers.indexOf(wronganswer)> -1)\n document.getElementById(\"box\" + i ).innerHTML = wronganswer;\n \n answers.push(wronganswer);\n \n \n } \n \n \n }\n \n \n \n \n \n \n \n\n \n \n \n \n \n\n}", "function generateQ() {\n\tvar num1, num2, question;\n\tnum1 = Math.floor((Math.random()*10));\n\tnum2 = Math.floor((Math.random()*10));\n\tcorrectAns = num1*num2;\n\tdocument.getElementById(\"question\").innerHTML = (\"How much is \" + num1 + \" times \" + num2 + \" ?\");\n\t\n\treturn correctAns;\t\n}", "function incorrect() {\n var bad = disapproval[Math.floor(Math.random() * disapproval.length)];\n $('#question').html(bad);\n }", "function placeCorrectAnswer() {\n correctAnswer = Math.floor(Math.random()*4)\n answersArray[correctAnswer] = questionsArray[categoryChoice][currentQuestion][1]\n}", "function createOnlineQuestionnaire() {\r\n //let robotNames = Object.keys(imgInfo);\r\n let i = Math.floor(Math.random() * imgInfo.length);\r\n changeRobot(imgInfo[i]);\r\n changeScalesOrder();\r\n }", "function formulateQuestion(){\n\ty = 0; //static variable to ensure only questions are asked\n\t\n\tgeneratedQuestion = alert(questions[answerIncrementor][y]); //generates question\n\t\n}", "function randomQuestion(){\n return questionOrder[i];\n}", "function newQuestion() {\n currentQuestionObject = questionsArray[Math.floor(Math.random()*questionsArray.length)]\n displayQuestion();\n return;\n}", "function generateQuestAns() {\r\n const fakeQuestAns = {\r\n question: faker.lorem.sentence(),\r\n answers: []\r\n };\r\n\r\n // Generate fake answer objects\r\n for (let i = 0; i < 5; i += 1) {\r\n const generatedAns = {\r\n display: faker.random.word(),\r\n matches: [],\r\n pts: Math.floor(Math.random()*100) + 1\r\n };\r\n \r\n // add 1-7 random words as matches\r\n for (let i = 0; i < Math.floor(Math.random()*7) + 1; i += 1) {\r\n generatedAns.matches.push(faker.random.word());\r\n }\r\n\r\n fakeQuestAns.answers.push(generatedAns);\r\n }\r\n return fakeQuestAns;\r\n}", "function\tgetQuestion(){\n\t//get a random number between zero and numQuestions - 1\n\tvar i = Math.floor((Math.random() * numQuestions) + 0);\t\n\t//find an unasked question\t\n\twhile (askedQuestions[i] === true && (askedQuestions.indexOf(false) !== -1) ){\n\t\tvar i = Math.floor((Math.random() * numQuestions) + 0);\t\t\n\t\t}//while\n\t\n\t\n\n\tif (askedQuestions.indexOf(false) !== -1){ \n\t\t\taskedQuestions[i] = true;\n\t\t\tq = trivia.question[i];\n\t\t\treturn q;\n\t\t} \n\t\telse {\n\t\t\tif (askedQuestions.indexOf(false) === -1 || trivia.qTimer === 6 ) {\n\t\t\t\ttrivia.gameOver = true;\n\t\t\t\ttrivia.timerDone();\n\t\t\t\tq = \"Game Over\";\n\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\treturn q; \n\t\t}\n\t\n} //function getQuestion", "generateCorrect() {\n return Math.floor(Math.random() * 100 + 1);\n }", "function loadNewQuestion() {\n message = questions[done].question;\n answerList = [questions[done].answer,\n questions[done].wrong_answer_1,\n questions[done].wrong_answer_2\n ];\n answerList = shuffle(answerList);\n}", "function setQuestion(array) {\n var i = random(0, array.length - 1);\n var q = array[i];\n return q;\n}", "function setQuestion(array) {\n var i = random(0, array.length - 1);\n var q = array[i];\n return q;\n}", "function generateEasyQuestion(){\n //Rename the button from \"Next Question\" to \"Submit\"\n var submitButton = document.getElementById(\"submit\");\n submitButton.innerHTML = \"Submit\";\n submitButton.onclick = checkAnswerForEasyLevel;\n\n //display a question if there is still an available question\n if (upToQuestion < easyLevel.length) {\n //get a number from the shuffled numbers inside the numbers array\n var random = randomNumber[upToQuestion];\n //use the generated random number to get a random question from the array containing the questions\n currentQuestionItem = easyLevel[random];\n console.log(\"Question item: \" + random);\n var question = currentQuestionItem.question;\n var answer = currentQuestionItem.answer;\n mathQuestionElement.textContent = question;\n\n\n //game won\n } else{\n createTransition(\"Congratulations! You won a barn! Are you ready to take another challenge?\", \"images/barn.png\", createMemoryGame);\n }\n //clear the user text field\n userAnswerTextbox.value = \"\";\n\n //display instructions\n mathAnswer.textContent = \"Compute the answer of the given math problem above.\";\n mathAnswer.id = \"qAInstructions\";\n}", "function generateQuestion(quiz, ip) {\n const number1 = genNum();\n const number2 = genNum();\n quiz.questions.push({\n ip,\n askTime: new Date(),\n number1,\n number2,\n answerCorrect: number1 * number2\n });\n}", "function setRandomQues(){\n randomQues = randomNumber(0, VocabSets.length-1);\n setScreen(\"questionScr\");\n setText(\"questionLbl\", VocabSets[randomQues].meera +\" はどういう意味ですか? \");\n //countriesSets.splice(randomQues, 1);\n randomAnswerBtns(randomQues);\n}", "function generateQuestion() {\n let questionNumber = STORE.questionNumber;\n if (questionNumber <= STORE.questions.length+1) {\n return STORE.questions[questionNumber - 2].question;\n }\n else\n finalScore();\n}", "function generateQuestion(){\n if (questionNumber < STORE.length){\n return createQuestion(questionNumber);\n } else {\n $('.questionBox').hide();\n finalScore();\n $('.questionNumber').text(10);\n }\n}", "function generateQuestion(quesNum, correct) {\n var question = questionBank[quesNum]\n $question.text(question.questionString)\n $(\"li\").remove();\n for (i = 0; i < question.answerChoices.length; i++) {\n $answers.append(\"<li data-index=\" + \"'\" + i + \"''>\" + question.answerChoices[i] + \"</li>\")\n }\n }", "function getNewQuestion() {\n if (availableQuestions.length === 0 || questionCounter >= MAX_QUESTIONS) {\n answered.style.display = \"block\";\n gameArea.style.display = \"none\";\n setTimeout(() => {\n return window.location.assign(\"index.html\");\n\n }, 5000);\n }\n questionCounter++;\n const questionIndex = Math.floor(Math.random() * availableQuestions.length);\n currentQuestion = availableQuestions[questionIndex];\n question.innerText = currentQuestion.question;\n\n choices.forEach(choice => {\n const number = choice.dataset.number;\n choice.innerText = currentQuestion['choice' + number];\n });\n availableQuestions.splice(questionIndex, 1);\n}", "function changeQuestion(){\n if(QUESTIONS.length === 0) return;\n var q = Math.floor(Math.random() * QUESTIONS.length);\n var a = QUESTIONS[q].answer;\n\n var redo = false;\n \n console.log(used_questions.length);\n console.log(QUESTIONS.length);\n if (used_questions.length == QUESTIONS.length) {\n used_questions = [];\n used_questions.push(a);\n redo = true;\n }\n \n while (!redo) {\n var con = true;\n for (var x = 0; x < used_questions.length; x++) {\n if (a == used_questions[x]) {\n q = Math.floor(Math.random() * QUESTIONS.length);\n a = QUESTIONS[q].answer;\n con = false;\n break;\n }\n }\n if (con) {\n used_questions.push(a);\n break;\n }\n }\n \n document.getElementById(\"draw_question\").innerHTML = QUESTIONS[q].question;\n \n for(var i = 0; i < MAX_ANSWERS; i++){\n var ans = QUESTIONS[Math.floor(Math.random() * QUESTIONS.length)].answer;\n while(ans === a){\n ans = QUESTIONS[Math.floor(Math.random() * QUESTIONS.length)].answer;\n }\n objects[i].elements[0].textContent = ans;\n objects[i].elements[0].dataset.correct = \"0\";\n }\n\n let el = objects[Math.floor(Math.random() * MAX_ANSWERS)].elements[0];\n el.textContent = a;\n el.dataset.correct = \"1\";\n}", "function generateHardQuestion(){\n //Rename the button from \"Next Question\" to \"Submit\"\n var submitButton = document.getElementById(\"submit\");\n submitButton.innerHTML = \"Submit\";\n submitButton.onclick = checkAnswerForHardLevel;\n\n\n //display a question if there is still an available question\n if (upToQuestion < hardLevel.length) {\n //get a number from the shuffled numbers inside the numbers array\n var random = randomNumber[ upToQuestion]\n currentQuestionItem = hardLevel[random];\n console.log(\"Question item: \" + random);\n var question = currentQuestionItem.question;\n var answer = currentQuestionItem.answer;\n mathQuestionElement.textContent = question;\n\n //game won\n } else {\n createTransition(\"Your farm family is surely growing! Accept this gift from us.\", \"images/pig.png\", createHardMemoryGame);\n }\n //clear the user text field\n userAnswerTextbox.value = \"\";\n\n //display instructions\n mathAnswer.textContent = \"Compute the answer of the given math problem above.\";\n mathAnswer.id = \"qAInstructions\";\n}", "function chooseCorrectAnswer() {\n correctAnswer = Math.floor(Math.random() * 3)\n setCorrect(correctAnswer)\n correctArray.push(database[randomArray[correctAnswer]].id)\n document.getElementById('mainImg').src = database[randomArray[correctAnswer]].images.lg\n \n console.log(`CorrectArray (Correct Answer ID): ${correctArray}`)\n console.log(`Correct Answer: ${correctAnswer}`)\n }", "function renderNewQuestion() {\n //questionBoxEl.setAttribute(\"style\", \"display:block\"); // I don't think I need this line\n count++;\n //pick a random question\n questionId = Math.floor(Math.random() * questionSet.length);\n //remove the question from the questionSet array\n question = questionSet.splice(questionId, 1)[0];\n\n //console.log(question); //this is an object\n\n questionEl.textContent = question.question;\n // how do I randomize the selection\n shuffle(question.choices);\n\n choiceA.textContent = question.choices[0];\n choiceB.textContent = question.choices[1];\n choiceC.textContent = question.choices[2];\n choiceD.textContent = question.choices[3];\n}", "function newQA() {\n //hide next level button\n nextLevelBtn.style.display = 'none'\n //show skip question button\n skipQuestionBtn.style.display = 'block'\n //add event listener to skipQbtn\n skipQuestionBtn.addEventListener('click', skipQuestion)\n //call function for answer box event listener\n addAnswerBtn()\n //2 random numbers\n let num1 = Math.floor(1 + Math.random() * 12)\n let num2 = Math.floor(1 + Math.random() * 12)\n //define the correct answer\n correctAnswer = num1 * num2\n //update innerHTML of Q box\n document.querySelector('.question-box').innerHTML = `${num1} x ${num2}`\n //define correct square of correct answer\n //assign the correct answer a random index\n let correctAnswerBox = (1 + Math.floor(Math.random() * 4))\n document.getElementById('box' + `${correctAnswerBox}`).innerHTML = correctAnswer\n console.log(correctAnswer)\n console.log(correctAnswerBox)\n\n //loop through the answer boxes and assign random index positions to wrong answers\n for (i = 1; i < 5; i++) {\n console.log('on loop: ', i)\n if (i !== correctAnswerBox) {\n //create an inccorect answer\n wrongAnswer = (1 + Math.floor(Math.random() * 12)) * (1 + Math.floor(Math.random() * 12))\n //if the random num does not equal the correct answer assign it to a wrong answer box\n if (wrongAnswer !== correctAnswer) {\n document.getElementById('box' + `${i}`).innerHTML = wrongAnswer\n }\n }\n }\n}", "function randomQuestionGenerator() {\n var randomQuestionIndex = getRandomInt(0, remainingQuestions.length - 1);\n var randomQuestionNum = remainingQuestions[randomQuestionIndex].number;\n currentQuestionIndex = randomQuestionIndex;\n $(\"#current-question-number\").html(randomQuestionNum);\n}", "function createEasyQAGame(){\n //clear the entire document\n document.body.innerHTML = \"\";\n\n upToQuestion = 0;\n //create a question\n mathQuestionElement = createParagraph(\"\", \"question\");\n\n var userAnswerDiv = createDiv();\n userAnswerDiv.id = \"userAnswerDiv\";\n\n //create an answer text box for the user\n var answer = createParagraph (\"Answer: \", \"answerInputlabel\");\n userAnswerTextbox = createTextInput();\n userAnswerDiv.appendChild(answer);\n userAnswerDiv.appendChild(userAnswerTextbox);\n\n //create an answer BUTTON\n buttonElement = createButton (\"Submit\");\n buttonElement.id = \"submit\";\n //add a click event handler to check the answerInputlabel\n buttonElement.onclick = checkAnswerForEasyLevel;\n userAnswerDiv.appendChild(buttonElement);\n\n\n mathAnswer = createParagraph(\"\", \"answer\");\n var answerDiv = createDiv();\n answerDiv.id = \"answerDiv\";\n answerDiv.appendChild(mathAnswer);\n\n var pigImage = createImage(\"images/pig2.png\");\n pigImage.classList.add(\"pig\");\n var pigDiv = createDiv();\n pigDiv.id = \"pigGame1\";\n pigDiv.appendChild(pigImage);\n\n var containerDiv = createDiv();\n containerDiv.classList.add(\"answerDisplay\");\n containerDiv.appendChild(answerDiv);\n containerDiv.appendChild(pigDiv);\n\n\n //This function shuffles elements\n function shuffle(o) {\n for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n };\n //shuffle numbers inside the numbers array\n randomNumber = shuffle(numbers);\n console.log(randomNumber);\n\n //generate easy level questions\n generateEasyQuestion();\n\n}", "function generate_wrong(name, question_answer) {\n let para = document.createElement(\"P\");\n let t = document.createTextNode(question_answer[name][2]);\n para.appendChild(t);\n para.style.color = \"#c73a26\";\n document.getElementById(name).appendChild(para);\n}", "function getNewQuestion(){\r\n //set question Number\r\n questionNumber.innerHTML= \"Question \" + (questionCounter + 1) + \" of \" + quiz.length;\r\n const questionIndex=availableQuesion[Math.floor(Math.random() * availableQuesion.length)]\r\n currentQuestion=questionIndex;\r\n questionText.innerHTML=currentQuestion.q\r\n \r\n //Get position of questionIndex from the avai;ableQuestion array\r\n const index1=availableQuesion.indexOf(questionIndex);\r\n //remove question Index\r\n availableQuesion.splice(index1,1)\r\n \r\n // set options\r\n //get the length of options\r\n const optionLen=currentQuestion.option.length\r\n //push option into availableOption Array \r\n for(let i=0; i<optionLen; i++)\r\n availableOption.push(i)\r\n\r\n //create Option in Html\r\n for(let i=0; i<optionLen; i++){\r\n //Random Options\r\n const optonIndex= availableOption[Math.floor(Math.random() * availableOption.length)]\r\n //positio of option index\r\n const index2= availableOption.indexOf(optonIndex);\r\n availableOption.splice(index2,1);\r\n \r\n const options= document.createElement(\"div\");\r\n options.innerHTML=currentQuestion.option[optonIndex]\r\n options.id=optonIndex;\r\n options.className=\"options\";\r\n optionContainer.appendChild(options)\r\n options.setAttribute(\"onclick\",\"getResult(this)\"); \r\n }\r\n\r\n questionCounter++\r\n \r\n}", "function questionN () {\n return Math.round(Math.random()*2)\n}", "function generate() {\n timer = 10;\n timer_el.innerHTML = `<h2>${timer}</h2>`;\n question.innerHTML = `${abc.results[rand].question}`;\n answerArray = [\n abc.results[rand].incorrect_answers[0],\n abc.results[rand].incorrect_answers[1],\n abc.results[rand].incorrect_answers[2],\n abc.results[rand].correct_answer,\n ];\n shuffle(answerArray);\n displayQuestions();\n score_el.innerHTML = `<h4>Score: ${score}</h4>`;\n timer_el.innerHTML = `<h2>10</h2>`;\n }", "function createHardQAGame(){\n //clear the entire document\n document.body.innerHTML = \"\";\n upToQuestion = 0;\n\n //create a question\n mathQuestionElement = createParagraph(\"\", \"questionH\");\n\n var userAnswerDiv = createDiv();\n userAnswerDiv.id = \"userAnswerDiv\";\n\n //create an answer text box for the user\n var answer = createParagraph (\"Answer: \", \"answerInputlabel\");\n userAnswerTextbox = createTextInput();\n userAnswerDiv.appendChild(answer);\n userAnswerDiv.appendChild(userAnswerTextbox);\n\n //create an answer BUTTON\n buttonElement = createButton (\"Submit\");\n buttonElement.id = \"submit\";\n //add a click event handler to check the answerInputlabel\n buttonElement.onclick = checkAnswerForHardLevel;\n userAnswerDiv.appendChild(buttonElement);\n\n\n mathAnswer = createParagraph(\"\", \"answer\");\n var answerDiv = createDiv();\n answerDiv.id = \"answerDiv\";\n answerDiv.appendChild( mathAnswer);\n\n var pigImage = createImage(\"images/pig2.png\");\n pigImage.classList.add(\"pig\");\n var pigDiv = createDiv();\n pigDiv.id = \"pigGame1\";\n pigDiv.appendChild(pigImage);\n\n var containerDiv = createDiv();\n containerDiv.classList.add(\"answerDisplayH\");\n containerDiv.appendChild(answerDiv);\n containerDiv.appendChild(pigDiv);\n\n\n //This function shuffles elements\n function shuffle(o) {\n for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n };\n //shuffle numbers inside the numbers array\n randomNumber = shuffle(numbers);\n console.log(randomNumber);\n\n //generate easy level questions\n generateHardQuestion();\n\n}", "function NewQuestion() {\n\thasChosen = false;\n\t// Retrieve innerHTML for option1 and option2\n\tlet option1 = document.getElementById(\"option1\").innerHTML;\n\tlet option2 = document.getElementById(\"option2\").innerHTML;\n\n\t// Get a new user value to retreive their question\n\tlet newChosenUser = Math.floor(Math.random() * questionArray.length);\n\n\t// If the new user value is the same as the current value, get a new value\n\twhile (newChosenUser === chosenUser) {\n\t\tnewChosenUser = Math.floor(Math.random() * questionArray.length);\n\t}\n\t// When the value is different, set the current value to the new one\n\tchosenUser = newChosenUser;\n\n\t// Set option1/option2 to the contents of the question from the array\n\toption1 = questionArray[chosenUser][1][1][0][0];\n\toption2 = questionArray[chosenUser][1][2][0][0];\n\t// Display the content to the user\n\tdocument.getElementById(\"option1\").innerHTML = option1;\n\tdocument.getElementById(\"option2\").innerHTML = option2;\n}", "function answer() {\r\n return Math.floor(Math.random() * 3) + 1;\r\n }", "function makeNewRetiredQuestion(question){\n\n}", "function buildQuestions(){\n var questions2 = questions;\n for (var i = 0; 4 < questions2.length; i++){\n questions2.splice(Math.floor(Math.random()*questions2.length), 1)\n }\n var questionHTML = ''\n for (var i = 0; i<questions2.length; i++) {\n questionHTML = questionHTML + formTemplate(questions2[i]);\n }\n $('#questions').append(questionHTML);\n \n }", "function generateQuiz(quiz_id, questions){\n\tQuizMod.startQuiz(quiz_id, questions);\n}", "function generateQuiz () {\n initializeQuiz(); \n startQuiz();\n submitAnswer();\n nextQuestion();\n restartQuiz();\n}", "function nextQuestion(){\n var n = Math.floor(Math.random() * q.length);\n q[n].display1();\n var ans = prompt('Please select the correct answer. (tap \\'exit\\' to exit)');\n \n if (ans !== 'exit'){\n q[n].checkAnswer(parseInt(ans),keepScore);\n nextQuestion();\n }\n }", "function createQuestions() {\n questions = [\n new TriviaQuestion(\"What is the name of bar the gang frequently visits?\",\n \"MacLaren's\",\n [\"MacLaren's\",\n \"MacLoughlin's\",\n \"MacLure's\",\n \"MacMaster's\"]\n ),\n new TriviaQuestion(\"What color and instrument does Ted steal for Robin?\",\n \"Blue French Horn\",\n [\"Blue French Horn\",\n \"Blue Trumpet\",\n \"Red French Horn\",\n \"Red Trumpet\"]\n ),\n new TriviaQuestion(\"Which acronym does Barney use to describe his job?\",\n \"P.L.E.A.S.E.\",\n [\"P.L.E.A.S.E.\",\n \"S.E.C.R.E.T.\",\n \"W.O.R.K.\",\n \"S.T.O.P.\"]\n ),\n new TriviaQuestion(\"What is the first Robin Sparkles song the gang listens to?\",\n \"Let's Go To The Mall\",\n [\"Let's Go To The Mall\",\n \"Sandcastles in the Sand\",\n \"The Beaver Song\",\n \"P.S. I Love You\"]\n ),\n new TriviaQuestion(\"What are the names of Ted's children?\",\n \"Luke and Penny\",\n [\"Luke and Penny\",\n \"Adam and Sara\",\n \"David and Jenna\",\n \"Jerry and Emily\"]\n ),\n new TriviaQuestion(\"If they owned a bar, what would Ted and Barney name it?\",\n \"Puzzles\",\n [\"Puzzles\",\n \"Clues\",\n \"Questions\",\n \"Kisses\"]\n ),\n new TriviaQuestion(\"What year is it when Ted is telling his children how he met their mother?\",\n \"2030\",\n [\"2030\",\n \"2015\",\n \"2020\",\n \"2025\"]\n ),\n new TriviaQuestion(\"At what occasion does Ted find a goat in his apartment?\",\n \"His 31th birthday\",\n [\"His 31th birthday\",\n \"His 30st birthday\",\n \"New Year's Day\",\n \"Halloween\"]\n ),\n new TriviaQuestion(\"Who narrates the show?\",\n \"Bob Saget\",\n [\"Bob Saget\",\n \"Jason Segel\",\n \"Josh Radnor\",\n \"Neil Patrick Harris\"]\n ),\n new TriviaQuestion(\"How many seasons are in the series?\",\n \"9\",\n [\"9\",\n \"7\",\n \"8\",\n \"10\"]\n ),\n new TriviaQuestion(\"Who is Robin's archenemy?\",\n \"Patrice\",\n [\"Patrice\",\n \"Clarisse\",\n \"Clara\",\n \"Paula\"]\n ),\n new TriviaQuestion(\"Which trio attended the same university together?\",\n \"Ted, Marshall, and Lily\",\n [\"Ted, Marshall, and Lily\",\n \"Marshall, Barney, and Ted\",\n \"Lily, Marshall, and Barney\",\n \"Robin, Lily, and Marshall\"]\n ),\n new TriviaQuestion(\"Which one of these is not one of Barney's catchphrases?\",\n \"Bottom's up!\",\n [\"Bottom's up!\",\n \"Legendary\",\n \"Have you met Ted?\",\n \"Suit up!\"]\n ),\n new TriviaQuestion(\"Which character got a tattoo of a butterfly on his/her lower back?\",\n \"Ted\",\n [\"Ted\",\n \"Barney\",\n \"Marshall\",\n \"Lily\"]\n ),\n new TriviaQuestion(\"Who is Linus?\",\n \"Lily's bartender\",\n [\"Lily's bartender\",\n \"One of Robin's exes\",\n \"Barney's half brother\",\n \"Ted's high school best friend\"]\n )\n ]\n }", "function questionGeneration(){\n\tquestionData = triviaTestData[testQuestionsArray[currentQuestionCount]];\n\tquestionChoicesTempArray = questionData[\"choices\"];\n\tchoiceOrderArray = uniqueRandomNumArrayGeneration(0,4, 4);\n\tquestionString = '\\\n\t\t\t\t\t<div class=\"timerAndQuestionClass\">\\\n\t\t\t\t\t\t<span id=\"timerSpan\">Time Remaining: ' + questionTimer + '</span>\\\n\t\t\t\t\t\t<span>' + questionData[\"question\"] + '</span>\\\n\t\t\t\t\t</div>\\\n\t\t\t\t\t<div class=\"choiceContainer centerClass\">\\\n\t\t\t\t\t\t<div id = \"testmanman\" class=\"choiceClass\" name=\"' + choiceOrderArray[0] + '\">\\\n\t\t\t\t\t\t\t<span class=\"hoverClass\">' + questionChoicesTempArray[choiceOrderArray[0]] + '</span>\\\n\t\t\t\t\t\t</div>\\\n\t\t\t\t\t\t<div class=\"choiceClass\" name=\"' + choiceOrderArray[1] + '\">\\\n\t\t\t\t\t\t\t<span class=\"hoverClass\">' + questionChoicesTempArray[choiceOrderArray[1]] + '</span>\\\n\t\t\t\t\t\t</div>\\\n\t\t\t\t\t\t<div class=\"choiceClass\" name=\"' + choiceOrderArray[2] + '\">\\\n\t\t\t\t\t\t\t<span class=\"hoverClass\">' + questionChoicesTempArray[choiceOrderArray[2]] + '</span>\\\n\t\t\t\t\t\t</div>\\\n\t\t\t\t\t\t<div class=\"choiceClass\" name=\"' + choiceOrderArray[3] + '\">\\\n\t\t\t\t\t\t\t<span class=\"hoverClass\">' + questionChoicesTempArray[choiceOrderArray[3]] + '</span>\\\n\t\t\t\t\t\t</div>\\\n\t\t\t\t\t</div>';\n\n\t$(\"#gameContentWrapper\").html(questionString);\n\t// gameClockTime.start;\n\tgameTimer(gameClockTime);\n}", "function correctMsgGenerator () {\n var $chosenCorrectMsg = $correctMessage[Math.floor(Math.random()*$correctMessage.length)];\n $('.correct-msg').html($chosenCorrectMsg);\n }", "function prepareNextQuestion() {\n // Obtain information about the current board\n var availableArray = [];\n // Note: foreach loop not working very well\n for (a=0; a<answers.length; a++) {\n if (answers[a].available == true) {\n availableArray.push(answers[a]);\n }\n }\n\n // Select one of the avaiable numbers\n var randAvailable = availableArray[getRandomInt(0, availableArray.length - 1)];\n // Toggle availibility off\n randAvailable.available = false;\n // Retrieve the answer\n return randAvailable.answer;\n}", "function getRandQuestionObj() {\n var rndNum = Math.floor(Math.random() * questions.length);\n return questions[rndNum];\n}", "function setQuestion() {\n selectionValid = false; // Flag to make sure question has not been asked yet\n while (selectionValid === false) {\n currentQuestion = Math.floor(Math.random() * 10); // randomly select starting question\n if (TriviaData[currentQuestion][2] === \"no\") {\n selectionValid = true;\n }\n }\n \n if (document.getElementById(\"TriviaQuestion\") !== null) {\n document.getElementById(\"TriviaQuestion\").innerHTML = TriviaData[currentQuestion][0];\n TriviaData[currentQuestion][2] = \"yes\";\n questionsAsked = questionsAsked + 1;\n }\n}", "function generateAnswer() {\n var answer;\n if (riddleNum === 0) {\n answer = \"Nothing\";\n } else if (riddleNum === 1) {\n answer = \"A wall\";\n } else if (riddleNum === 2) {\n answer = \"A lantern\";\n } else if (riddleNum === 3) {\n answer = \"A map\";\n } else if (riddleNum === 4) {\n answer = \"Sleep\";\n } else if (riddleNum === 5) {\n answer = \"A book\";\n } else if (riddleNum === 6) {\n answer = \"Shoes\";\n } else if (riddleNum === 7) {\n answer = \"The poison is in the ice\";\n } else if (riddleNum === 8) {\n answer = \"An hourglass\";\n } else if (riddleNum === 9) {\n answer = \"Alcohol\";\n } else {\n answer = \"Error 404\";\n }\n \n document.querySelector(\"#answer\").innerHTML = answer;\n \n }", "function nextQuestion() {\n resetState();\n generateQuestion (shuffleQuestions[currentQuestionIndex]);\n}", "function randomQuestion(questions, ele) {\n topic = questions[Math.floor(Math.random() * questions.length)];\n question = topic[Math.ceil(Math.random() * (topic.length - 1))];\n\n topicText[ele].innerText = `Topic: ${topic[0]}`;\n questionText[ele].innerText = `${question}`;\n\n console.log(questionText.innerText);\n}", "function doIt() {\n document.getElementById(\"qno\").innerText = parseInt(qno) + 1;\n let q = decodeURIComponent(data.results[qno].question);\n ques.innerText = q;\n let a = decodeURIComponent(data.results[qno].correct_answer);\n ar[qno][0] = q;\n ar[qno][1] = a;\n let b = data.results[qno].incorrect_answers;\n let arr = new Array(b.length + 1);\n //creating a random position for the correct answer and adding it to it\n let rn = Math.floor(Math.random() * (b.length + 1));\n arr[rn] = a;\n let c = 0;\n //adding the other option to the left off spaces\n for (let i = 0; i < b.length + 1; i++) {\n if (i != rn) {\n b[c] = decodeURIComponent(b[c]);\n arr[i] = b[c++];\n }\n }\n\n //creating the containers that store the option\n for (let i = 0; i < b.length + 1; i++) {\n let x = document.createElement(\"div\");\n x.classList.add(\"radio-container\");\n\n let y = document.createElement(\"input\");\n y.setAttribute(\"type\", \"radio\");\n y.setAttribute(\"name\", \"option\");\n y.setAttribute(\"id\", `radio${i}`);\n y.setAttribute(\"class\", \"radio\");\n\n let z = document.createElement(\"label\");\n z.setAttribute(\"for\", `radio${i}`);\n z.innerText = arr[i];\n\n //adding font awesome to correct and inncorrect option\n let w;\n if (i == rn) {\n w = document.createElement(\"i\");\n w.setAttribute(\"class\", \"fas fa-check\");\n } else {\n w = document.createElement(\"i\");\n w.setAttribute(\"class\", \"fas fa-times\");\n }\n\n x.appendChild(y);\n x.appendChild(z);\n x.appendChild(w);\n opc[0].appendChild(x);\n }\n\n //adding a pointer event none ensures that the question is attempted only once\n const radioSelect = document.getElementsByClassName(\"radio-container\");\n for (let i = 0; i < radioSelect.length; i++) {\n radioSelect[i].addEventListener(\"click\", () => {\n radioSelect[i].querySelector(\"input\").checked = true;\n ar[qno][2] = radioSelect[i].querySelector(\"label\").innerText;\n for (let j = 0; j < radioSelect.length; j++) {\n radioSelect[j].style.pointerEvents = \"none\";\n }\n });\n }\n\n // checking the answer and displaying the result accordingly\n for (let i = 0; i < b.length + 1; i++) {\n radioSelect[i].addEventListener(\"click\", () => {\n if (\n radioSelect[i].querySelector(\"input\").checked === true &&\n radioSelect[i].querySelector(\"label\").innerText === a\n ) {\n radioSelect[i].classList.add(\"correct\");\n document.getElementById(\"score\").innerText =\n parseInt(document.getElementById(\"score\").innerText) + 1;\n } else {\n radioSelect[i].classList.add(\"wrong\");\n radioSelect[rn].classList.add(\"correct\");\n }\n });\n }\n c = 0;\n }", "function newQuestion() {\n loadingWheel(true);\n if (totalQuestions.length == 0) {\n loadingWheel(true);\n game.classList.add(\"hide\");\n showScore.classList.remove(\"hide\");\n finalScore.innerHTML = (`Congratulations you scored ${score} / ${quant}`);\n loadingWheel(false);\n } else {\n questionCount++;\n questionCounter.innerText = (`Question:${questionCount}/${quant}`);\n let questionIndex = Math.floor(Math.random() * totalQuestions.length);\n currentQuestion = totalQuestions[questionIndex];\n question.innerHTML = currentQuestion.question;\n answers.forEach(answer => {\n let number = answer.dataset[\"answer\"];\n answer.innerHTML = currentQuestion[\"choice\" + number];\n });\n totalQuestions.splice(questionIndex, 1);\n questions.splice(questionIndex, 1);\n acceptingInput = true;\n }\n loadingWheel(false);\n answerFormat();\n}", "function questionGenerator() {\n questionChecker();\n \n if (gameStart) {\n showText(); \n theTimer(20);\n $(\"#image\").html(\" \")\n $(\"#button\").hide()\n $(\"#theResult\").hide()\n $(\"#question\").html(triviaQuestions[theQuestion].question);\n $(\"#answerOne\").html(triviaQuestions[theQuestion].answers[0]);\n $(\"#answerTwo\").html(triviaQuestions[theQuestion].answers[1]);\n $(\"#answerThree\").html(triviaQuestions[theQuestion].answers[2]);\n $(\"#answerFour\").html(triviaQuestions[theQuestion].answers[3]);\n }\n }", "function createMediumQAGame(){\n //clear the entire document\n document.body.innerHTML = \"\";\n upToQuestion = 0;\n\n //create a question\n mathQuestionElement = createParagraph(\"\", \"question\");\n\n var userAnswerDiv = createDiv();\n userAnswerDiv.id = \"userAnswerDiv\";\n\n //create an answer text box for the user\n var answer = createParagraph (\"Answer: \", \"answerInputlabel\");\n userAnswerTextbox = createTextInput();\n userAnswerDiv.appendChild(answer);\n userAnswerDiv.appendChild(userAnswerTextbox);\n\n //create an answer BUTTON\n buttonElement = createButton (\"Submit\");\n buttonElement.id = \"submit\";\n //add a click event handler to check the answerInputlabel\n buttonElement.onclick = checkAnswerForMediumLevel;\n userAnswerDiv.appendChild(buttonElement);\n\n\n mathAnswer = createParagraph(\"\", \"answer\");\n var answerDiv = createDiv();\n answerDiv.id = \"answerDiv\";\n answerDiv.appendChild(mathAnswer);\n\n var pigImage = createImage(\"images/pig2.png\");\n pigImage.classList.add(\"pig\");\n var pigDiv = createDiv();\n pigDiv.id = \"pigGame1\";\n pigDiv.appendChild(pigImage);\n\n var containerDiv = createDiv();\n containerDiv.classList.add(\"answerDisplay\");\n containerDiv.appendChild(answerDiv);\n containerDiv.appendChild(pigDiv);\n\n //This function shuffles elements\n function shuffle(o) {\n for (var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);\n return o;\n };\n //shuffle numbers inside the numbers array\n randomNumber = shuffle(numbers);\n console.log(randomNumber);\n\n //generate easy level questions\n generateMediumQuestion();\n}", "function generateMediumQuestion(){\n //Rename the button from \"Next Question\" to \"Submit\"\n var submitButton = document.getElementById(\"submit\");\n submitButton.innerHTML = \"Submit\";\n submitButton.onclick = checkAnswerForMediumLevel;\n\n //display a question if there is still an available question\n if (upToQuestion < mediumLevel.length) {\n //get a number from the shuffled numbers inside the numbers array\n var random = randomNumber[ upToQuestion]\n currentQuestionItem = mediumLevel[random];\n console.log(\"Question item: \" + random);\n var question = currentQuestionItem.question;\n var answer = currentQuestionItem.answer;\n mathQuestionElement.textContent = question;\n\n //game won\n } else {\n createTransition(\"Another challenge completed! Here's your reward.\", \"images/donkey.png\", createMediumMemoryGame);\n }\n //clear the user text field\n userAnswerTextbox.value = \"\";\n\n //display instructions\n mathAnswer.textContent = \"Compute the answer of the given math problem above.\";\n mathAnswer.id = \"qAInstructions\";\n}", "getRandomQuestionNumber () {\n return Math.floor(Math.random() * this.state.allQuestions.length);\n }", "function generateQuestions(numQuestions) {\n let id = 0;\n let questions = [];\n // Add one-time questions (at most half of all questions)\n let numOneTimeQuestions = Math.floor(1 + Math.random() * (oneTimeQuestionTemplate.length / 2));\n questions = questions.concat(pickRandomIn(oneTimeQuestionTemplate, numOneTimeQuestions));\n // Add other questions\n while (questions.length < numQuestions) { // until numQuestions is met\n let picks = pickRandomIn(questionTemplates, numQuestions - questions.length);\n questions = questions.concat(picks);\n }\n // shuffle and generate questions\n return _shuffle(questions).map(template => {\n template.generate(); // generate question from template\n // shuffle question choices\n template.question.choices = _shuffle(template.question.choices);\n return {\n id: id++, // question ID, for answer checking\n type: template.type,\n question: template.question,\n checkAnswer: template.checkAnswer\n };\n });\n}", "function makeQuestion(question, answers, picture){\n var answersPush = [];\n var correctAnswer = new Answer(\"c\", answers[0], true);\n\n answersPush.push(correctAnswer);\n\n for(var i = 1; i < answers.length; i++){\n var wrongAnswer = new Answer(\"w\", answers[i], false);\n answersPush.push(wrongAnswer);\n }\n \n var question = new Question(question, answersPush, picture);\n return(question);\n}", "function newGame(){\n\tvar create1 = new genQuestion(question1);\n\tvar create2 = new genQuestion(question2);\n\tvar create3 = new genQuestion(question3);\n\tvar create4 = new genQuestion(question4);\n\tvar create5 = new genQuestion(question5);\n}", "function generateQuestion() {\n\n let questionLanguage;\n let answerLanguage;\n\n // Assign values dependent on difficulty chosen\n if (gameDifficulty === \"easy\") {\n numOfQuestions = 4;\n questionLanguage = \"French\";\n answerLanguage = \"English\";\n } else if (gameDifficulty === \"medium\") {\n numOfQuestions = 5;\n questionLanguage = \"English\";\n answerLanguage = \"French\";\n } else {\n numOfQuestions = 6;\n questionLanguage = \"English\";\n answerLanguage = \"French\";\n document.getElementById(\"skip-question-btn\").disabled = true;\n }\n\n let mcRandomNums = [];\n let mcQuestions = [];\n let mcAnswers = [];\n\n for (i = 0; i < numOfQuestions; i++) {\n\n // Create random numbers between 1 and max length of language array\n mcRandomNums[i] = Math.floor(Math.random() * options[questionLanguage][gameDifficulty].length);\n\n // Index words from language arrays using these random numbers\n mcQuestions[i] = options[questionLanguage][gameDifficulty][mcRandomNums[i]];\n mcAnswers[i] = options[answerLanguage][gameDifficulty][mcRandomNums[i]];\n\n // Remove the chosen words in each language to prevent them being repeated\n options[questionLanguage][gameDifficulty].splice(mcRandomNums[i], 1);\n options[answerLanguage][gameDifficulty].splice(mcRandomNums[i], 1);\n }\n\n // Pick a value between 1 and 4 (5 for med, 6 for hard) to be the \"chosen\" question and answer word\n let chosenRandomNum = Math.floor(Math.random() * (numOfQuestions - 1)) + 1;\n\n // Index the chosen question and answer from multiple choice\n mcAnswer = mcAnswers[chosenRandomNum];\n mcAnswer.id = \"mc-answer\";\n trueAnswers.push(mcAnswer);\n\n mcQuestion = mcQuestions[chosenRandomNum];\n mcQuestion.id = \"mc-question\";\n trueQuestions.push(mcQuestion);\n\n // Create progress tally - updated when next question or skip question is clicked\n let gameProgress = createElement(\"p\", \"game-progress\");\n gameProgress.innerHTML = (`Question ${questionsAnswered + 1} of ${gameLength}`);\n document.getElementById(\"game-area-right-1\").appendChild(gameProgress);\n\n // Create the question\n let questionText = createElement(\"h1\", \"question-text\");\n questionText.innerHTML = (`What is &nbsp;<span id=\"question-span\">${mcAnswer}</span>&nbsp; in ${questionLanguage}?`);\n document.getElementById(\"game-area-left-1\").appendChild(questionText);\n\n // Create form for the multiple choice radio buttons\n let mcFormLeft = createElement(\"form\", \"mc-form-left\");\n document.getElementById(\"game-area-left-2\").appendChild(mcFormLeft);\n\n let mcFormRight = createElement(\"form\", \"mc-form-right\");\n document.getElementById(\"game-area-left-2\").appendChild(mcFormRight);\n\n let mcRadioList = createElement(\"ul\", \"mc-radios-list\");\n mcFormRight.appendChild(mcRadioList);\n\n let mcLabelsList = createElement(\"ul\", \"mc-labels-list\");\n mcFormLeft.appendChild(mcLabelsList);\n\n // Create the multiple choice radio buttons & labels\n for (let i = 0; i < mcRandomNums.length; i++) {\n\n var mcRadiosLi = document.createElement(\"li\");\n var mcLabelsLi = document.createElement(\"li\");\n\n var mcRadios = document.createElement(\"input\");\n mcRadios.type = \"radio\";\n mcRadios.name = \"mcRadios\";\n mcRadios.classList.add(\"radio-styling\");\n\n var mcLabels = document.createElement(\"label\");\n mcLabels.innerHTML = mcQuestions[i];\n\n mcRadioList.appendChild(mcRadiosLi);\n mcLabelsList.appendChild(mcLabelsLi);\n mcLabelsLi.appendChild(mcLabels);\n mcRadiosLi.appendChild(mcRadios);\n }\n}", "function randomQuiz() {\n let randomNum = Math.floor(Math.random() * questions.length);\n currentQuestionIndex = randomNum;\n randomQuestion = questions[randomNum];\n\n /* If randomQuestion is not in usedQuestions, it shows\n Then, the question is put in the array*/\n\n if (!usedQuestions.includes(randomQuestion)) {\n usedQuestions.push(randomQuestion);\n } else {\n randomQuiz();\n }\n /*Returns a random, non-repeating question\n from the chosen array*/\n return randomQuestion;\n}", "function pickQuestion() {\n\t//console.log(\"Executed pickQuestion() --> \");\n\n\tarrTriviaDataLength = 0;\n\tcompIndexQuestion = 0;\n\tcompQuestion = \"\";\n\tcompAnswers = [];\n\tcompImageName = \"\";\n\tarrTriviaDataAnswersLenght = 0;\n\n\t// Length of triviaData[]\n\tarrTriviaDataLength = triviaData.length;\n\n\t// Get random number between 0 and lenght of triviaData[] to chose question\n\tcompIndexQuestion = generateRandom(0, triviaData.length - 1);\n\tcompQuestion = triviaData[compIndexQuestion].questionText;\n\n\t// Length of triviaData[].answers[]\n\tarrTriviaDataAnswersLength = triviaData[compIndexQuestion].answers.length;\n\n\t// Load answers of chosen trivia question\n\tfor (var i = 0; i < arrTriviaDataAnswersLength; i++) {\n\t\tcompAnswers.push({ answerText: triviaData[compIndexQuestion].answers[i].answerText, isCorrect: triviaData[compIndexQuestion].answers[i].isCorrect });\n\t}\n\n\t// Load image of chosen trivia question\n\tcompImageName = triviaData[compIndexQuestion].imageName;\n}", "function handleRandomQuestion() {\n // randomly choose a question from the array of questions and set it as the current input\n const randomQuestion = randomQuestions[Math.floor(Math.random() * randomQuestions.length)];\n setInputValue(randomQuestion);\n }", "function constructTheQuestion(){\n const counters = ['1st', '2nd', '3rd', '4th'];\n\n const rightAnswer = unanswered[currentIdIndex];\n\n const availableAnswers = [...unanswered];\n availableAnswers.splice(currentIdIndex, 1);\n\n let questionAnswers = [];\n let index = generateRandomInteger(availableAnswers.length);\n let answer = availableAnswers.splice(index, 1)[0];\n questionAnswers.push(<Button variant=\"outline-dark\" size=\"lg\" onClick={onClickWrong}>{answer.stageName}</Button>);\n index = generateRandomInteger(availableAnswers.length);\n answer = availableAnswers.splice(index, 1)[0];\n questionAnswers.push(<Button variant=\"outline-dark\" size=\"lg\" onClick={onClickWrong}>{answer.stageName}</Button>);\n index = generateRandomInteger(availableAnswers.length);\n answer = availableAnswers.splice(index, 1)[0];\n questionAnswers.push(<Button variant=\"outline-dark\" size=\"lg\" onClick={onClickWrong}>{answer.stageName}</Button>);\n questionAnswers.push(<Button variant=\"outline-dark\" size=\"lg\" onClick={onClickRight}>{rightAnswer.stageName}</Button>);\n\n\n\n let randomizedAnswers = questionAnswers.map((value) => ({ value, sort: Math.random() }))\n .sort((a, b) => a.sort - b.sort)\n .map(({ value }) => value);\n return <div><h1 className=\"description\">\n What is the <span style={{backgroundColor:\"yellow\"}}>{counters[rightAnswer.stageNumber]}</span> stage of Evolution for component type <span style={{backgroundColor:\"yellow\"}}>{rightAnswer.componentType}</span> ?</h1>\n\n <div className=\"d-grid gap-2\">\n\n {randomizedAnswers}\n </div>\n\n </div>;\n }", "function genarateQuestion() {\r\n if(quiz.isEnded()){\r\n //showScore\r\n showScore();\r\n } else {\r\n //show question\r\n let element = document.getElementById(\"question\");\r\n element.innerHTML = quiz.getQuestion().question;\r\n\r\n //show choices\r\n let choices = quiz.getQuestion().choices;\r\n\r\n for(let i = 0; i < choices.length; i++) {\r\n let element = document.getElementById(\"choice\" + i);\r\n\r\n element.innerHTML = choices[i];\r\n guessCorrectAnswer(\"choice\" + i, choices[i]);\r\n \r\n }\r\n\r\n showProgress();\r\n \r\n }\r\n}", "function getNewQuestion() {\n\tif(availableQuestions.length === 0 || questionCounter >= MAX_QUESTIONS) {\n\t\tlocalStorage.setItem('recentScore', score);\n\n\t\t// Go to the end page\n\t\twindow.location.assign('./end.html')\n\t}\n\tif(questionCounter < MAX_QUESTIONS) {\n\t\tquestionCounter++;\n\t}\n\tprogressTextElement.innerText = `Question: ${questionCounter}/${MAX_QUESTIONS}`;\n\tprogressBarFullElement.style.width = `${(questionCounter / MAX_QUESTIONS) * 100}%`;\n\n\tquestionIndex = Math.floor(Math.random() * availableQuestions.length);\n\tconst currentQuestion = availableQuestions[questionIndex];\n\tquestionElement.innerText = currentQuestion.question;\n\n\t// Shuffle the answer choices and display them\n\tconst choices = [...currentQuestion.incorrect_answers, currentQuestion.correct_answer];\n\n\tshuffleArray(choices)\n\tchoiceElements.forEach((choiceElement, index) => {\n\t\tchoiceElement.innerText = choices[index];\n\t\tchoiceElement.dataset.number = index; // set the data-number attribute for answer comparison\n\t})\n\n\t// availableQuestions.splice(questionIndex, 1);\n}", "function newQuestion() {\n randomIndex = Math.floor(Math.random() * countriesAndCodes.length)\n randomCountryElement.innerHTML = countriesAndCodes[randomIndex].name\n}", "function getRandomQuestion(answer) {\n let objectkeys = Object.keys(data);\n let randomKey = objectkeys[Math.floor(Math.random() * objectkeys.length)];\n\n if (!res.includes(answer)) {\n //if our res does not have our answer in it, push it in\n res.push(answer);\n // if our res has the answer already in it\n if (res.includes(data[randomKey].correct)) {\n //while loop for when we already had the random key in our list to create a new number to push into the list\n //I know this probably isn't the fastest implementation but It works well for this example\n while (res.includes(data[randomKey].correct)) {\n //fetch a new randomKey\n randomKey = objectkeys[Math.floor(Math.random() * objectkeys.length)];\n }\n return data[randomKey];\n }\n }\n return data[randomKey];\n }", "function populateQuiz() {\n\n if (randomQuestion == myArray[0][0] || randomQuestion == myArray[1][0] || randomQuestion == myArray[2][0] || randomQuestion == myArray[3][0] || randomQuestion == myArray[4][0]) {\n\n $(\"#quesBody\").text(chooseQuestion());\n \n }\n\n checkAns();\n\n}", "function questions(prize, category, question, alt, hint, publicVote, fifty1, fifty2) {\n this.prize = prize;\n this.category = category;\n this.question = question;\n this.alt = alt;\n this.hint = hint;\n this.publicVote = publicVote;\n this.fifty1 = fifty1;\n this.fifty2 = fifty2;\n \n //Method to print question and elements\n this.addData = function addData() {\n $(\"#prize\").text(this.prize);\n $(\"#category\").text (this.category);\n $(\"#question\").text (this.question);\n $(\"#prpr\").text (this.prize);\n }\n \n //Marking the 4th answer as correct\n this.correct = function correct() {\n sakte = this.alt[3];\n }\n \n //Shuffling answers so they are not the same all the time\n this.shuffle = function shuffle() {\n for(var i = 0; i<4; i++) {\n shuff[i] = rand(this.alt);\n while(shuff[i] == shuff[i-1] || shuff[i] == shuff[i-2] || shuff[i] == shuff[i-3]) {\n shuff[i] = rand(this.alt);\n } \n \n ev = $(\"#a\"+(i+1));\n //printing alternatives\n ev.html(shuff[i]);\n \n //if it is correct or not\n if(ev.text() == sakte){\n ev.on(\"click\", function(){\n $(this).css(\"background\", \"linear-gradient(green, lime, green)\");\n $(\"#youwon\").show(500);\n });\n } else {\n ev.on(\"click\", function(){\n $(this).css(\"background\", \"linear-gradient(red, pink, red)\");\n $(\"#youlost\").show(500);\n });\n }\n }\n }//end of shuffle method\n \n //REMOVE\n this.removing = function removing() {\n $(\".alt\").off(\"click\");\n $(\".alt\").css(\"background\", \"linear-gradient(#CCC, #DDD, #CCC)\");\n }\n \n //Hint method\n this.useHint = function useHint() {\n $(\"#hintbox\").html (this.hint);\n }\n //Public Vote method\n this.usePubVote = function usePubVote(){\n $(\"#publicbox\").html (this.publicVote);\n }\n //Fifty method\n this.useFifty = function useFifty() {\n for(var x = 1; x<5; x++) {\n if(($(\"#a\" + x).text() == this.fifty1) || ($(\"#a\" + x).text() == this.fifty2)) {\n $(\"#a\" + x).hide(1000);\n }\n }\n }\n }", "function correctAnswerFeedback() {\n const responses = [\"Fantastic Job!\",\"You have a great ear!\",\"Your Doing Great!\",\"Are you a composer?\"];\n let randomResponse = responses[Math.floor\n (Math.random()*responses.length)];\n $(\".questionPage\").html(`\n <div class=\"feedback\">\n <p>${randomResponse}</p>\n <img src=\"${STORE[questionNumber].correctAnswerIcon}\" alt\"${STORE[questionNumber].alt}\">\n <p> You got it correct!<br>The answer was ${STORE[questionNumber].correctAnswer}!</p>\n <button type=\"button\" class=\"nextInstrument\"> Next Instrument\n </button>\n </div>`);\n}", "function createWrongPick(){\n incrct++;\n questionArea = '<div class=\"panel-default text-center\" id=\"questionArea\"><h2 id=\"title\"></h2><div class=\"row text-center\"><div class=\"col-xs-offset-1 col-xs-10\"><h3 id=\"questiontext\">The correct answer is: ' + crctAnswers[questionCount] + '!</h3>' + imageArr[questionCount] + '</div></div></div>';\n $('.questionDiv').html(questionArea);\n $('#title').text(wrongAns[rdm(wrongAns)]);\n $('.answerDiv').empty();\n $('#timer').hide();\n nextPage();\n \n }", "function correct() { \n var good = approval[Math.floor(Math.random() * approval.length)];\n $('#question').html(good);\n setTimeout(correct, 3000)\n}", "function askQuestionRandom(){\n \n //Question\n var quote = \"\\\"Asta Lavista Baby\\\"\";\n \n //Answers\n var one=\"Arnold Shwarznegger\";\n var two=\"Sylvester Stalone\";\n var three=\"Bruce Willis\";\n var four=\"Tom Hanks\";\n \n $(\"#question\").html(quote); \n\t$(\"#one\").html(one); \n\t$(\"#two\").html(two); \n\t$(\"#three\").html(three); \n\t$(\"#four\").html(four); \n return one;\n}", "function showQuestions() { \n const randNum = Math.floor(Math.random() * images.length);\n $mainScreen.find(\"img\").attr(\"src\", `${images[randNum]}`);\n rightAnswer = continents[randNum];\n continents.splice(randNum, 1);\n images.splice(randNum, 1);\n noRepeat = [...noRepeat, rightAnswer]; \n // Add two more random questions to the noRepeat array\n while (noRepeat.length < 3) {\n let rand = continents[Math.floor(Math.random() * continents.length)];\n if (noRepeat.indexOf(rand) == -1) {\n noRepeat.unshift(rand);\n }\n }\n \n shuffle(noRepeat);\n // Display shuffled questions\n for (let i in questionNum) {\n $(`${questionNum[i]}`).html(tempArr[i]);\n }\n }", "function check() {\n let answerArr = [];\n let answerSimple = document.getElementById('pastsimple').value.replace(/\\s+/g, ' ').trim();\n let answerParticiple = document.getElementById('pastparticiple').value.replace(/\\s+/g, ' ').trim();\n answerArr.push(verbsArr[verbNumber][0], answerSimple, answerParticiple);\n if (verbsArr[verbNumber].join() !== answerArr.join()) {\n answersClient[`${verbsArr[verbNumber][0]}`] = [verbsArr[verbNumber][1] + ' ' + verbsArr[verbNumber][2], answerSimple + ' ' + answerParticiple];\n wrongCounter = wrongCounter + 1;\n }\n\n counter = counter + 1;\n verbsArr.splice(verbNumber, 1);\n max = verbsArr.length - 1;\n verbNumber = Math.floor(Math.random() * (max - min + 1)) + min;\n document.getElementById('pastsimple').value = \"\";\n document.getElementById('pastparticiple').value = \"\";\n\n if (max < 0) {\n inputs.style.display = 'none';\n counterVerbs.style.display = 'none';\n infoResults.style.display = 'flex';\n rightNumber.innerHTML = verbs.length - wrongCounter;\n wrongNumber.innerHTML = wrongCounter;\n let wrong = document.getElementById('content-results');\n wrong.innerHTML = `<table id=\"wrongAnswers\" class=\"content-result__wrongAnswers\"></table>`;\n for (let key in answersClient) {\n let row = document.createElement('tr');\n row.innerHTML = `<td class=\"resultPres\">${key}</td>` + `<td><span class=\"true\">${answersClient[key][0]}</span><br><span class=\"false\">${answersClient[key][1]}</span></td>`;\n document.getElementById('wrongAnswers').appendChild(row);\n }\n } \n else {\n create();\n }\n}" ]
[ "0.7221694", "0.7201865", "0.7160253", "0.71464235", "0.71188885", "0.7106067", "0.7101595", "0.70957786", "0.7049869", "0.70456904", "0.70220155", "0.69543093", "0.6868389", "0.68553853", "0.6846937", "0.68428344", "0.68218726", "0.6817824", "0.6813044", "0.68067133", "0.68064815", "0.6777996", "0.67696285", "0.6735275", "0.67345816", "0.6734065", "0.6715811", "0.6709148", "0.6703597", "0.6671052", "0.66575396", "0.6646768", "0.66464114", "0.6631535", "0.6627307", "0.65987134", "0.6597152", "0.65967053", "0.65967053", "0.6593774", "0.658344", "0.65811986", "0.6569548", "0.6564275", "0.65597737", "0.65346265", "0.65260386", "0.6520946", "0.650225", "0.6481764", "0.64709735", "0.64617205", "0.6447175", "0.6439083", "0.6438925", "0.6435384", "0.64135736", "0.6406503", "0.6394629", "0.6388439", "0.63840926", "0.63821864", "0.63801616", "0.6379949", "0.6375803", "0.6375667", "0.6362302", "0.63616896", "0.63570946", "0.63537174", "0.63356084", "0.6330354", "0.6329903", "0.6327265", "0.6324539", "0.6321952", "0.63181496", "0.63153195", "0.63141793", "0.6309327", "0.63039595", "0.6303431", "0.6294653", "0.6293773", "0.6292372", "0.62913316", "0.6281208", "0.6279398", "0.6277216", "0.62745935", "0.6265077", "0.6249286", "0.62462455", "0.62383026", "0.6237703", "0.6233794", "0.62313694", "0.62291145", "0.6221274", "0.621826" ]
0.68784636
12
dynamically added correct/incorrect equations..
function populateGamePage(){ //Reset Dom,set Blank space above itemContainer.textContent = ''; //spacer const topSpacer =document.createElement("div"); topSpacer.classList.add("height-240"); //selected items const selectedItem = document.createElement("div"); selectedItem.classList.add("selected-item"); //append itemContainer.append(topSpacer,selectedItem); createEquations(); equationsToDOM(); const bottomSpacer =document.createElement("div"); bottomSpacer.classList.add("height-500"); itemContainer.append(bottomSpacer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createEquations() {\n // Randomly choose how many correct equations there should be\n // const correctEquations = \n // Set amount of wrong equations\n // const wrongEquations = \n // Loop through, multiply random numbers up to 9, push to array\n // for (let i = 0; i < correctEquations; i++) {\n // firstNumber = \n // secondNumber = \n // const equationValue = firstNumber * secondNumber;\n // const equation = `${firstNumber} x ${secondNumber} = ${equationValue}`;\n // equationObject = { value: equation, evaluated: 'true' };\n // equationsArray.push(equationObject);\n // }\n // Loop through, mess with the equation results, push to array\n // for (let i = 0; i < wrongEquations; i++) {\n // firstNumber = \n // secondNumber = \n // const equationValue = firstNumber * secondNumber;\n // wrongFormat[0] = `${firstNumber} x ${secondNumber + 1} = ${equationValue}`;\n // wrongFormat[1] = `${firstNumber} x ${secondNumber} = ${equationValue - 1}`;\n // wrongFormat[2] = `${firstNumber + 1} x ${secondNumber} = ${equationValue}`;\n // const formatChoice = \n // const equation = wrongFormat[formatChoice];\n // equationObject = { value: equation, evaluated: 'false' };\n // equationsArray.push(equationObject);\n // }\n}", "function questionCalculations()\r\n\t{\r\n\t\t// here, calculations for all the above variables should occur\r\n\t}", "function createEquations(){\r\n //ranodm choose how many correct equations.\r\n const correctEquations = getRandomInt(questionAmount);\r\n const wrongEquations =questionAmount - correctEquations;\r\n\r\n //loop create equestions\r\n for(let i=0;i<correctEquations;i++){\r\n firstNumber = getRandomInt(9);\r\n secondNumber = getRandomInt(9);\r\n const equationValue = firstNumber * secondNumber;\r\n const equation = `${firstNumber} X ${secondNumber} = ${equationValue}`;\r\n equationObject ={value: equation, evaluated: 'true'};\r\n equationsArray.push(equationObject);\r\n\r\n }\r\n\r\n //loop create wrong equation and push into array\r\n for(let i=0;i<wrongEquations;i++){\r\n firstNumber = getRandomInt(9);\r\n secondNumber = getRandomInt(9);\r\n const equationValue = firstNumber * secondNumber;\r\n wrongFormat[0] = `${firstNumber} X ${secondNumber+1} = ${equationValue}`;\r\n wrongFormat[1] = `${firstNumber+1} X ${secondNumber} = ${equationValue}`;\r\n wrongFormat[2] = `${firstNumber} X ${secondNumber+1} = ${equationValue+2}`;\r\n \r\n const formatChoice = getRandomInt(3);\r\n const equation = wrongFormat[formatChoice];\r\n equationObject ={value: equation, evaluated: 'false'};\r\n equationsArray.push(equationObject);\r\n }\r\n shuffleArray(equationsArray);\r\n //console.log(\"Equestion = \",equationsArray);\r\n //equationsToDOM();\r\n}", "function updateEquations() {\n equation = `erf(x) + ${variable - 0.5}`;\n}", "function special_cases() {\n //Inserts a zero into index 1 of equation array if the first input is an operation\n if (is_operator(equation_array[0])) {\n equation_array.unshift(\"0\");\n }\n ;\n var store_i = [];\n for (var i = 0; i < equation_array.length; i++) {\n //Checks for a divid by zero case\n if (equation_array[i] == \"/\" && equation_array[i + 1] == 0) {\n display_val = \"Cannot Divid By Zero!\"\n divid_by_zero = true;\n }\n //Checks for a percentage and inserts 100 to divid with\n if (equation_array[i] == \"%\") {\n equation_array.splice(i + 1, 0, \"100\");\n }\n\n }\n ;\n\n //Checks if an equation ends with an operation, if true duplicates last input\n if (is_operator(equation_array[equation_array.length - 1])) {\n equation_array.push(equation_array[equation_array.length - 2]);\n }\n ;\n\n\n}", "function equalResult(){\n equation.push(aNumber);\n aNumber = \"\";\n var result = math.eval(equation.join(\"\"));\n equation = [];\n equation.push(result);\n if (Number.isNaN(result)){\n result = \"Error\"; \n }\n answerBox.textContent = result;\n eqtext += \" \" + \"=\" + \" \" + result;\n result = \"\";\n equationBox.textContent = eqtext;\n eqtext = \"\";\n \n}", "function addToEquation(e) {\n\tif (this.textContent === \"x\") {\n\t\tstoredEquation += \"*\";\n\t\tcalculationField.textContent += \"*\";\n\t} else {\n\t\tstoredEquation += this.textContent;\n\t\tcalculationField.textContent += this.textContent;\n\t}\n}", "function loadEqn() {\n\t//randomize integers between 1 and 20 for the equations\n\tint1 = Math.floor( Math.random() * 20 + 1);\n\tint2 = Math.floor( Math.random() * 20 + 1);\n\t//random integer to determine addition or subtraction\n\tiSymb = Math.floor( Math.random() * 2 + 1);\n\t//initialize whether or not to display the correct or incorrect answer\n\trandError = Math.floor( Math.random() * 50 + 1);\n\t\n\t//set addition or subtraction symbol, and set the answer to the equation to int3\n\tif (iSymb == 1) {\n\t\tint3 = int1 + int2;\n\t\tsSymb = '+';\n\t} else {\n\t\tint3 = int1 - int2;\n\t\tsSymb = '-';\n\t}\n\t\n //adjust the answer based off of randError\n if (randError <= 1) {\n int3 *= -1;\n } else if (randError <= 4) {\n int3 -= 10;\n } else if (randError <= 7) {\n int3 += 10;\n } else if (randError <= 11) {\n int3 -= 2;\n } else if (randError <= 15) {\n int3 += 2;\n } else if (randError <= 20) {\n int3--;\n } else if (randError <= 25) {\n int3++;\n }\n \n\t//construct the equation string\n\tsEqtn = int1 + ' ' + sSymb + ' ' + int2 + ' = ' + int3;\n\t\n\t//remove play window equation text\n\tplayWindow.remove(equationText);\n\t\n\t//add the equation string to the window\n\tequationText.text(sEqtn);\n\t\n\t//display equation on the play window\n\tplayWindow.add(equationText);\n}", "function solucion() {\n removeZero()\n var equation = document.getElementById(\"output\").innerHTML;\n var solved = eval(equation);\n document.getElementById('output').innerHTML = solved;\n}", "function solve() {\r\n removeZero()\r\n var equation = document.getElementById(\"output\").innerHTML;\r\n var solved = eval(equation);\r\n document.getElementById('output').innerHTML = solved;\r\n}", "function updateFormula() {\n var outputStr = \"\";\n for (var i = 0; i < fixedNumberArr.length; i++) {\n if (i <= operatorArr.length - 1) {\n outputStr += fixedNumberArr[i] + \" \" + operatorArr[i] + \" \";\n }\n else {\n outputStr += fixedNumberArr[i];\n }\n\n }\n $(\"#formula-p\").text(outputStr);\n}", "function randomEquationQuadratic() {\n\trandomx1 = randomNumber();\n\trandomx2 = randomNumber();\n\tanswer = new QuadEquation();\n\tanswer.new_x1 = randomx1;\n\tanswer.new_x2 = randomx2;\n\tvar new_a = randomA();\n\tanswer.a = new_a;\n\n\tif (answer.a === 1){\n\t\tanswer.findNewPoint();\n\t} else {\n\t\tanswer.findNewPointNegative();\n\t}\n\n\tvar output_a = answer.a;\n\tvar output_b = answer.b;\n\tvar output_c = answer.c;\n\n\tif (output_c > 0) {\n\t\toutput_c = \"+ \" + output_c;\n\t} else if (output_c === 0) {\n\t\toutput_c = \"\";\n\t} else {\n\t\toutput_c = \"- \" + -output_c;\n\t}\n\tif(output_b === 1) {\n\t\toutput_b = \"+ \";\n\t} else if(output_b === 0) {\n\t\toutput_b = \"+ 0\";\n\t} else if(output_b < 0) {\n\t\toutput_b + \"- \" + output_b;\n\t} else {\n\t\toutput_b = \"+ \" + output_b;\n\t}\n\tif(output_a === 1) {\n\t\toutput_a = \"x&sup2;\";\n\t}else{\n\t\toutput_a = \"-x&sup2;\";\n\t}\n\ta.innerHTML = output_a;\n\tm.innerHTML = output_b;\n\tc.innerHTML = output_c;\n}", "function verifierEquation(item,min,max,numberDisplay) {\n\t\n\tvar reponseUser = item.innerHTML;\n\tvar nbr1 = parseInt(document.getElementById(\"nbr1\").innerHTML);\n\tvar nbr2 = parseInt(document.getElementById(\"nbr2\").innerHTML);\n\tvar signe = document.getElementById(\"signe\").innerHTML;\n\t\n\tclearAnswer(numberDisplay);\n\t\n\tvar reponseEquation = calculEquation(nbr1,nbr2,signe);\n\t\n\tif (reponseUser == reponseEquation) {\n\t\t\n\t\tdisplayAfterGoodAnswer(reponseEquation)\n\t\t\n\t\tnumberGoodAnswer ++; \n\t\tnumberTotalAnswer ++;\n\t\t\n\t\tafficheNumberGoodAnswer();\n\t\t\n\t\tsetTimeout(load_game_mathEquation, 2000, signe,min,max,numberDisplay);\n\t}else {\n\n\t\tdisplayAfterBadAnswer(reponseEquation)\n\t\t \n\t\tnumberTotalAnswer ++;\n\t\t\t\n\t\tafficheNumberGoodAnswer();\n\t\t\n\t\tsetTimeout(load_game_mathEquation, 2000, signe,min,max,numberDisplay);\n\t}\t\n}", "function compEquation(correct, submitted, rules, equivType)\n{\n// console.log(\"correct = \" + correct + \"; submitted = \" + submitted + \"; rules = \" + rules + \"; equivType = \" + equivType);\n\t\n // Verify 'correct' parameter\n\tif (typeof(correct) !== 'string' || typeof(submitted) !== 'string'\n || correct.length < 1 || submitted.length < 1)\n\t\treturn errorResponse;\n\n if (!rules) // prevent empty rules object\n rules = {};\n\n\t// Perform the actual comparison\n\tvar result = equation.compare(correct, submitted, rules);\n\n\t// add the missing field:\n result.wrong = [];\n \n\treturn result;\n}", "function doLogic() {\n \"use strict\";\n // Here we snatch values from the answer box....\n var Formula = document.getElementById(\"answerBox\").value;\n // Evaluate the formula....\n var Result = eval(\"(\" + Formula + \")\");\n // Display results!\n li(Result);\n\n // Check and handle any errors that occur during formula evaluation.\n if (answerBox.value === \"undefined\") {\n document.getElementById(\"answerBox\").value = \"Syntax Error\";\n }\n if (answerBox.value === \"NaN\") {\n document.getElementById(\"answerBox\").value = \"Not Possible!\";\n }\n}", "calculate(equation){\n console.log( typeof eval(equation))\n if(eval(equation)%1==0) return eval(equation);\n return eval(equation).toFixed(3);\n }", "function checkEquation(ArrValues_str){\n // non linked equations \n var equation = ArrValues_str; // convert array to string\n console.log(equation);\n equation = equation.replace(/<\\/?[^>]+(>|$)/g, \"\"); //remove span tags\n console.log(equation);\n equation = equation.replace(/\\|/g,''); //remove | delimiter\n equation = equation.replace(/\\,/g,''); //remove | delimiter\n console.log(equation);\n // return EquationParser.parse(_myEquation); //Peg.js generated grammar parser\n console.log(\"equation Left handside\"+equation.split('=')[0])\n //return the left handside of the equation - EVIL EVAL - I will change this monstruositywhen i'm rested ...\n try{\n return (EquationParser.parse(equation) ? eval(equation.split('=')[0]):\"FAILED\"); //Peg.js generated grammar parser\n \n }catch(e){\n console.error(e);\n console.log(\"equation not evaluated because \"+ e);\n }\n\n }", "function updateEquation(){\n // clear if previous button clicked is equal\n if (equalClickedPrev){\n clearClickUpdate();\n // update equation if previous button clicked was an operator\n } else if (curOperator != ''){\n equation = equation+displayVal+curOperator;\n curOperator = '';\n displayVal = '';\n } \n}", "function reCalculate(){\n displayEquation = calcDisplay+displayOperations[opCheck.lastIndexOf(1)]+ prevDisplay+\"=\";\n if ( displayEquation != 'undefined')\n {equation.innerHTML = displayEquation;}\n answer = eval(calcDisplay+operations[opCheck.lastIndexOf(1)]+ prevDisplay)\n return(answer)\n}", "function addDefsEquation(name) {\n figure.add({\n name,\n make: 'equation',\n color: colorLight,\n font: { family: 'Open Sans', width: 1.12, midAscent: 1.1, maxAscent: 1.5 },\n textFont: { family: 'Open Sans', style: 'normal', width: 1.12, midAscent: 1.1, maxAscent: 1.5 },\n scale: 4.7,\n position: [12, 1],\n formDefaults: { alignment: { xAlign: 'center' }, lazyLayout: true },\n mods: {\n scenarios: {\n default: { position: [12, 1] },\n top: { position: [12, 10.5] },\n highSmall: { position: [12.5, 5.5], scale: 1.4 },\n wave: { position: [12, 2.5], scale: 1.4 },\n definition: { position: [12, 10.5], scale: 1 },\n },\n },\n elements: {\n Transverse: { color: colorYellow },\n Transverse_1: { color: colorYellow },\n Wave: { color: colorYellow },\n propDisturb: 'propagating disturbance',\n across: 'extend or direct across',\n colon: ': ',\n adjective: { text: 'adjective', style: 'italic' },\n long: { text: 'Longitudinal', color: colorYellow },\n long1: { text: 'Longitudinal', color: colorYellow, width: 1.1 },\n along: 'lengthwise or along',\n Single: { color: colorYellow },\n Multiple: { color: colorYellow },\n 'Wave Equation': { color: colorYellow },\n 'Second Derivative: ': { color: colorYellow },\n },\n forms: {\n waveDef: ['Wave', 'colon', 'propDisturb'],\n transverseWave: ['Transverse', ' ', 'Wave'],\n transverseDef: lines([\n ['Transverse', ' ', 'Wave'],\n scale(['Transverse_1', '_: ', '(adjective) extended or directed across'], 0.5),\n ], 0.8, 'center'),\n longWave: ['long', ' ', 'Wave'],\n longDef: lines([\n ['long', ' ', 'Wave'],\n scale(['long1', '_: ', '(adjective) placed or running lengthwise'], 0.5),\n ], 0.8, 'center'),\n ocean: ['Transverse', '_ and ', 'long', '_ '],\n single1: ['Single', ' ', cont('', 4), ' ', cont('', 2.2)],\n single2: ['Single', ' ', cont('travelling', 3.9), ' ', cont('', 2.1)],\n single3: ['Single', ' ', cont('travelling', 3.9), ' ', cont('wave', 2.1)],\n multi: ['Multiple', ' ', cont('wave', 2), 's'],\n waveEqn: 'Wave Equation',\n waveEqn1: bc('Wave Equation', '(For one dimension)', '', 0.04, 0.04, 0.5),\n derivative1: scale(['Second Derivative: ', cont('', 5.9)], 0.7),\n derivative2: scale(['Second Derivative: ', cont('Shape or Curvature', 5.9)], 0.7),\n },\n });\n}", "function do_math() {\n\n\t\t\t\tvar end = Mt;\n\n\t\t\t\tfor (var i = end; i >= Mf; i--) {\n\n\t\t\t\t\tX = (W - ((B - 1) * i)) / B;\n\n\t\t\t\t\tif (X % 1 == 0) {\n\n\t\t\t\t\t\tsolutions++;\n\n\t\t\t\t\t\t$('.tbody').append('<tr class=\"trow\"><td class=\"td_block\">' + X + '</td><td class=\"td_margin\">' + i + '</td></tr>');\n\n\t\t\t\t\t};\n\n\t\t\t\t};\n\n\t\t\t\t$('.output_title').html('You have ' + solutions + ' solution(s):');\n\n\n\t\t\t}", "function evaluateExpression() {\n\n try {\n var result = eval($('.equation').html());\n $('.result').text(result);\n } catch (e) {\n if (e instanceof SyntaxError) {\n //$('.result').text(\"Syntax Error\");\n }\n }\n\n }", "function feedbackForAnswer(answer) {\n var curvature = TreeConstructor.root.curvature;\n var suffix = \". \" + CONTINUE_BUTTON;\n if (curvature == answer) {\n var message = \"The expression is \" + \n CURVATURE_DISPLAY_NAME[curvature] + suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-success\">' +\n '<span><strong>Correct!</strong> ' + message + '</span></div>')\n } else {\n var message = \"The expression is \" + CURVATURE_DISPLAY_NAME[curvature] + \n \", but you answered \" + CURVATURE_DISPLAY_NAME[answer] +\n suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-error\">' +\n '<span><strong>Incorrect!</strong> ' + message + '</span></div>')\n }\n // Increase/decrease difficulty\n updateLevel(curvature == answer);\n // Listen to new expression button.\n $(\"#newExpression\").click(loadNewExpression);\n }", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function calculate() {\n var operand1 = '';\n var operator = '';\n var operand2 = '';\n\n //calls the function special_cases to condition the equation variable to correct format\n special_cases();\n\n if (divid_by_zero) {\n return;\n }\n\n //checks to see if the equation array has a need to be calculated. If not it just\n //returns the equation array as the answer\n if (equation_array.length == 1) {\n answer = equation_array[0];\n }\n\n var done = false;\n while (!done) {\n\n\n done = order_of_operations(equation_array);\n operand1 = equation_array[ordered_index - 1];\n operator = equation_array[ordered_index];\n operand2 = equation_array[ordered_index + 1];\n console.log(\"calculated equation_array:\", equation_array)\n console.log(\"ordered_index:\", ordered_index)\n switch (operator) {\n case \"+\":\n answer = parseFloat(operand1) + parseFloat(operand2);\n break;\n case \"-\":\n answer = parseFloat(operand1) - parseFloat(operand2);\n break;\n case \"x\":\n answer = parseFloat(operand1) * parseFloat(operand2);\n break;\n case \"/\":\n answer = parseFloat(operand1) / parseFloat(operand2);\n break;\n case \"^\":\n answer = Math.pow(parseFloat(operand1), parseFloat(operand2));\n break;\n case \"%\":\n answer = parseFloat(operand1) / parseFloat(operand2);\n break;\n }\n equation_array.splice(ordered_index - 1, 3, answer);\n }\n\n}", "function calcWrongAnswers(){\n showVariables();\n $(\"#wrongAns\").html(\"Number of wrong answers : \"+wrongAnswers);\n\n }", "function alg(){\nalert(\"Algebra is a branch of mathematics in which letters of the alphabet represent numbers. Algebraic expressions are a mixture of letters and numbers eg 3x+4y is an algebraic expression. More examples are 5z, 7g-4t, 2r(d-3) etc.\");\nalert(\"An algebraic expression is made up of terms eg 3x+5y is made up of the terms 3x and 5y. The terms are joined by either the plus(+) or minus(-) signs. In a term like 3x this is the same as 3×x or 3(x).In other words the number and letter are multiplying each other.In whatever operation you do the term always goes with its sign.In other words in the term 3x+5y the + sign goes with the term 5y.\");\nalert(\"Terms can either be like or unlike terms. Terms of the same letter are called like terms eg 2a and -7a are like terms. Terms of different letters are called unlike terms eg 8y and 7p are unlike terms.Always remember that LIKE TERMS COMBINE AND UNLIKE TERMS DO NOT COMBINE.In other words you can add or subtract like terms but you cannot do so with unlike terms.\");\nalert(\"Expressions in which the highest power is 1 are called linear expressions eg 3x+y, 5y+3x+y-7x+3 are linear terms.Expressions in which the highest power is two are called quadratic expressions eg 4x²-3, a²(a+1)-a²(a-1) are quadratic expressions.\");\nalert(\"Lets do some examples on like and unlike terms.\");\nalert(\"Simplify 5y+3x+y-7x+3.First rearrange the expression to group like terms like this: 5y+y+3x-7x+3.Now combine like terms like this:6y-4x+3.There are no more like terms hence we stop here.\");\nalert(\"7-(x-2y)+3(5x-2).First multiply each term in the bracket by the term outside the bracket(- is the same as -1) ie multiply bracket (x-2y) by -1 and (5x-2) by 3 hence 7-x+2y+15x-6.Now group like terms like this 7-6-x+15x+2y and combining like terms 1+14x+2y(REMEMBER A TERM GOES WITH ITS SIGN)\");\nalert(\"Simplify 5x-(3-x+3y)-7(5-y). First 5x-3+x-3y-35+7y. Now 5x+x-3y+7y-3-35 and this gives 6x+4y-38.\");\nalert(\"Sometimes you need to multiply a bracket by a bracket eg (x+1)(x-1). To do so break up the first bracket into two ie into x and +1.Now multiply the second bracket by each term from the first bracket ie x(x-1)+1(x-1)=x²-x+x-1=x²-1.\");\nalert(\"Lets do more examples on multiplying a bracket by a bracket.\");\nalert(\"(x+3)(x-5)=x(x-5)+3(x-5)=x²-5x+3x-15=x²-2x-15.\");\nalert(\"(3x-2)(3x+2)=3x(3x+2)-2(3x+2)=9x²+6x-6x-4=9x²-4.\");\nalert(\"(2y+3)²=(2y+3)(2y+3)=2y(2y+3)+3(2y+3)=4y²+6y+6y+9=4y²+12y+9.\");\n}", "function checkMath2() {\n var answer, text;\n\n // Get the value of the input field with id=\"numb-2\"\n answer = document.getElementById(\"numb-2\").value;\n\n // Will return true if answer is 5 psi above or below the answer\n if (answer == totalFriction2() ||\n answer == totalFriction2() - 5 ||\n answer == totalFriction2() + 5 ||\n answer == totalFriction2() - 4 ||\n answer == totalFriction2() + 4 ||\n answer == totalFriction2() - 3 ||\n answer == totalFriction2() + 3 ||\n answer == totalFriction2() - 2 ||\n answer == totalFriction2() + 2 ||\n answer == totalFriction2() - 1 ||\n answer == totalFriction2() + 1) {\n text = \"This is the correct PSI\";\n } else {\n text = \"Nope, remember your training my young padawan!\";\n };\n document.getElementById(\"demo-2\").innerHTML = text;\n}", "function showAnswer(){\n equalsToIsClicked=true;\n numberIsClicked=true;\n numberOfOperand=1;\n if(numberIsClicked && operatorIsClicked && numberOfOperand===1 && equalsToIsClicked===true){\n switch(myoperator){\n case \"*\":\n num1*=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n \n }\n break;\n case \"+\":\n num1+=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n }\n break;\n case \"-\":\n num1-=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(2);\n throw \"the number of digits exceeded\";\n }\n break;\n case \"/\":\n num1/=(Number($values.innerText));\n $values.innerText=num1;\n if($values.innerText.length>8){\n $values.innerText=num1.toPrecision(3);\n throw \"the number of digits exceeded\";\n }\n break;\n\n }\n }\n numberIsClicked=false;\n operatorIsClicked=false;\n equalsToIsClicked=false;\n numberOfOperand=0;\n numberChecker=0;\n\n}", "function complicatedAnswer(){\n var comp = (5 + 10) * 210 / 87 - 123;\n document.getElementById(\"math5\").innerHTML= comp;\n}", "function createAdditionEquation() {\n var a = randomNumber();\n b = randomNumber();\n EQUATION.innerHTML = a + \" + \" + b;\n var answer = a + b;\n return answer;\n}", "function displayEquation() {\n // do not redraw eq if points pinned\n if (!(pt1.pinned && pt2.pinned)) {\n let eq = document.getElementById(\"eq\");\n let html;\n // recalculates slope and y intercept\n m = calcSlope(pt1, pt2);\n b = calcYInt(pt1, m);\n // if there's no points, default to displaying \"y=mx+b\"\n if (!pt1.pinned) {\n html = 'y=<span id=\"slope\">m</span>x+<span id=\"yint\">b</span>';\n }\n // account for undefined slope\n else if (!isFinite(m) || isNaN(m)) { html = \"Undefined slope\"; }\n else if (m == 0) { html = 'y=<span id=\"yint\">' + b.toFixed(2) + '</span>'; }\n else if (b == 0) { html = 'y=<span id=\"slope\">' + m.toFixed(2) + '</span>x'; }\n else { // change m and y values in equation header\n html = 'y=<span id=\"slope\">' + m.toFixed(2) + '</span>x+<span id=\"yint\">' +\n b.toFixed(2) + '</span>';\n }\n // do not redraw eq if nothing is changing -- no extra work\n if (eq.innerHTML !== html) {\n eq.innerHTML = html;\n // listeners for equation elements must be reapplied if eq changes\n reapplyListeners();\n }\n }\n}", "function equals(e) {\n //stores equation to be calculated into the history display\n var display4 = $(\"#display_history3\").val();\n $(\"#display_history4\").val(display4);\n var display3 = $(\"#display_history2\").val();\n $(\"#display_history3\").val(display3);\n var display2 = $(\"#display_history\").val();\n $(\"#display_history2\").val(display2);\n\n $(\"#display_history\").val(display_val);\n\n calculate();\n\n //checks to see if a division of zero has occured, if not proceed as normal\n if (!divid_by_zero) {\n display_val = answer;\n equation_array = [];\n equation_array[0] = display_val.toString();\n }\n update_display();\n equals_just_used = true;\n\n}", "function isIncorrect(){\r\n $('form').append(`<h3>Woops! the correct answer is, <i>${store.questions[store.questionNumber + 1].correctAnswer}</i></h3>`); \r\n}", "function solve(val)\n{\n let x= document.getElementById(\"cal\").value;\n let y=eval(x);\ndocument.getElementById(\"cal\").value=y;\n\n}", "function processEquation (curEq, input, setter, dcmCount, dcmSetter, minusCount, minusSetter) {\n // Catch last number (before input is added do currentEquation)\n const lastNumberExpression = getLastNumber(curEq + input)\n // evaluate the value of current number (2nd condition) and if it's zero you just can't type more than one zero consecutively\n // 1st condition allows for a zero to be passed\n // console.log('lastNum: ' + lastNumberExpression)\n console.log(minusCount)\n if(lastNumberExpression.length > 1 && parseInt(lastNumberExpression) === 0) {\n return\n } else if(lastNumberExpression[0] === '0') {\n setter(prevStr => {\n const lastNumBeforeInput = getLastNumber(curEq)\n if(lastNumBeforeInput === '0') {\n // cut out the whole substring without the zero at the end (so transform 123+3221*0 to 123+3221*) and then add input to it and return it\n return curEq.substr(0, curEq.length - 1) + input\n } else {\n // just perform standard concatenation\n return curEq + input\n }\n })\n } else if(/[\\/+*\\-]/.test(curEq[curEq.length - 1]) && /[\\/+*]/.test(input)) {\n // cut out the whole substring without the operator and replace it with the new one (ie. input) - except the minus operator\n setter(curEq.substr(0, curEq.length - 1) + input) \n } \n// else if (/[0-9.]/.test(input)) {\n// // reset the minusCount after the number or decimal point\n// minusSetter(0)\n// setter(prevStr => prevStr + input) \n// // } \n// else if (/[\\/*+]/.test(input)) {\n// // reset the minusCount after every other operator\n// minusSetter(0)\n// setter(prevStr => prevStr + input) \n// } \n// else if(input === '-') {\n// if(minusCount > 0) {\n// return\n// }\n// minusSetter(1)\n// setter(prevStr => prevStr + input) \n// } \n else if(/[\\/+*\\-]/.test(input)) {\n // reset count after each operator (so in every new number)\n dcmSetter(0)\n setter(prevStr => prevStr + input) \n } else if(input === '.') {\n if(dcmCount > 0) {\n return\n }\n dcmSetter(prevCount => prevCount + 1)\n setter(prevStr => prevStr + input) \n } else {\n setter(prevStr => prevStr + input) \n }\n}", "function sim(){\nalert(\"Simultaneous means at the same time.We are going to deal with a system of linear equations with two variables which have to be solved at the same time.When two unknown variables are involved then 2 equations are needed to find the two unknowns and these are known as simultaneous equations.\");\nalert(\"We are going to make use of two methods of solving simultaneous equations known as the SUBSTITUTION method and the ELIMINATION method.\");\nalert(\"Lets do an example using the substitution method.Lets solve the equations x-5y=5 and 2x+y=-1 simultaneously.To solve first make either x or y the subject in any of the equations.In this case we are going to make x the subject in the first equation ie x=5+5y.Now substitute 5+5y for x in the second equation(since x=5+5y) ie 2(5+5y)+y=-1, expand the bracket ie 10+10y+y=-1,now move numbers to one side ie 10y+y=-1-10,this gives 11y=-11 hence y=-1. Now substitute -1 for y in any of the first two equations.In this case we substitute into the first equation ie x+5(-1)=5, this gives x-5=5 hence x=0.The solutions are x=0 and y=-1.\");\nalert(\"To eliminate is to get rid of something.The aim of this method is to get rid of one of the letters so the remaining can be found.\");\nalert(\"Lets do an example using the elimination method.Lets solve x-y=6 and 4x+7y=-9 simultaneously.To solve make the coefficients of either x or y the same magnitude in both equations.In this case lets make coefficients of y the same magnitude hence multiply the first equation by 7 ie x-y=6 ×7 and this becomes 7x-7y=42.To eliminate y we add the first equation to this new equation ie add the left hand terms together and the right hand terms together ie 4x+7y+7x-7y=-9+42 this gives 11x=33 hence x=3.Now substitute 3 for x in any one of the original equations.In this case we substitute 3 for x in the first equation ie 3-y=6,taking numbers to one side -y=6-3,this gives -y=3 hence y=-3.The solutions are x=3 and y=-3.\");\nalert(\"Lets do one more example.Lets solve 10x+7y=-1 and 2x+y=5 simultaneously.Lets make the coefficients of x the same in both equations.To do so we multiply the second equation by 5 ie 2x+y=5×5 and this gives 10x+5y=25.Now subtract this equation from the first equation ie 10x+7y-10x-5y=-1-25 and this gives 2y=-26 hence y=-13.Now substitute -13 for y in any one of the original equations.In this case we substitute -13 for y in the second equation ie 2x-13=5,this gives 2x=5+13, 2x=18 hence x=9.Hence the solutions are x=9 and y=-13.\");\nalert(\"See test questions section for more work on simultaneous equations.\");\n}", "function checkMath() {\n var answer, text;\n\n // Takes the checked value and the answer to see if they are true\n answer = document.getElementById(\"numb\").value;\n\n // If answer is between 5 psi on either side of totalFriction\n if (answer == totalFriction() ||\n answer == totalFriction() - 5 ||\n answer == totalFriction() + 5 ||\n answer == totalFriction() - 4 ||\n answer == totalFriction() + 4 ||\n answer == totalFriction() - 3 ||\n answer == totalFriction() + 3 ||\n answer == totalFriction() - 2 ||\n answer == totalFriction() + 2 ||\n answer == totalFriction() - 1 ||\n answer == totalFriction() + 1)\n {\n text = \"This is the correct PSI\";\n } else {\n text = \"Nope, remember your training my young padawan!\";\n };\n document.getElementById(\"demo\").innerHTML = text;\n }", "function evaluate(operator) {\n let op2 = document.getElementById(\"lower\").value\n\n //Evaluating the expression \n let ch = expression.charAt((expression.length) - 1)\n if (ch == \"+\" || ch == \"-\" || ch == \"*\" || ch == \"/\") {\n //If user has clicked to evluate without the value of second operand,then add 0 automatically to complete it\n if (op2 == \"\") {\n op2 = 0\n }\n expression += op2;\n answer = calculate(parseInt(answer), parseInt(op2), operator)\n }\n\n //Updating the expression and displaying the result\n expressionSection.innerHTML = expression;\n inputSection.value = answer;\n}", "function main() {\n finalDerivative = \"\";\n tempDerivative = \"\";\n\n var funcInput = $(\".input\").val();\n\n funcInput = cleanFunction(funcInput);\n var funcTerms = findTerms(funcInput);\n //calculateDerivative(funcInput);\n\n for (i in funcTerms) {\n //console.log(funcTerms[i]);\n console.log(determineWhichRule(funcTerms[i]));\n }\n\n console.log(\"input: \" + funcInput);\n\n //$(\".answer\").text(tempDerivative);\n $(\".input\").val(\"\");\n}", "function calculateCorrectAnswer() {\n let operand1 = parseInt(document.getElementById('operand1').innerText);\n let operand2 = parseInt(document.getElementById('operand2').innerText);\n let operator = document.getElementById(\"operator\").innerText;\n\n if (operator === \"+\") {\n return [operand1 + operand2, \"addition\"];\n } else if (operator === \"x\") {\n return [operand1 * operand2, \"multiply\"];\n } else if (operator === \"-\") {\n return [operand1 - operand2, \"subtract\"];\n }\n else {\n alert(`Unimplemented operator ${operator}`);\n throw `Unimplemented operator ${operator}. Aborting!`;\n }\n\n}", "calculateHandler() {\n\t\tlet formula = this.m_formulaMenu.value;\n\t\tlet formulaFields = this.m_formulaFields.elements;\n\t\tswitch(formula) {\n\t\t\tcase \"PVNRT\":\n\t\t\t\tfor(let i = 0; i < formulaFields.length; i++) {\n\t\t\t\t\tthis.unHighlight(formulaFields[i].id);\n\t\t\t\t}\n\t\t\t\tif(this.valOneEmpty()) {\n\t\t\t\t\tlet emptyInput = this.findEmptyInput();\n\t\t\t\t\tlet inputs = this.packageInputs();\n\t\t\t\t\tlet calculated = this.CALCULATOR.calcPVNRT(inputs);\n\t\t\t\t\tif(calculated !== undefined) {\n\t\t\t\t\t\tformulaFields[emptyInput].value = calculated;\n\t\t\t\t\t\tthis.highlight(emptyInput);\n\t\t\t\t\t\tthis.hideElement(\"formula-helptext\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.showBlock(\"formula-helptext\");\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"REYNOLDS1\":\n\t\t\tcase \"REYNOLDS2\":\n\t\t\t\tif (!(this.valNoneEmpty())) {\n\t\t\t\t\tthis.showBlock(\"formula-helptext\");\n\t\t\t\t\tdocument.getElementById(\"answer\").innerHTML = \"\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tlet inputs = this.packageInputs();\n\t\t\t\t\tlet calc = this.CALCULATOR.calcREYNOLDS(inputs);\n\t\t\t\t\tif(calc !== undefined) {\n\t\t\t\t\t\tthis.hideElement(\"formula-helptext\");\n\t\t\t\t\t\tdocument.getElementById(\"answer\").innerHTML = calc;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.log(\"Error, calc came back undefined. Check inputs\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"BERNOULLI\":\n\t\t\t\tthis.hideElement(\"formula-helptext\");\n\t\t\t\tdocument.getElementById(\"answer\").innerHTML = \"\";\n\t\t\t\t// validation that doesn't depend on calculation type\n\t\t\t\tlet KcaseStr = this.getCheckedRadio(\"isK\");\n\t\t\t\tlet Kcase;\n\t\t\t\tif(document.getElementById(\"K\").value == \"\" || !(this.checkKVals(KcaseStr))) {\n\t\t\t\t\tthis.showBernHelptext(\"K\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(KcaseStr == \"true\") {\n\t\t\t\t\t\tKcase = true;\n\t\t\t\t\t}\n\t\t\t\t\telse if(KcaseStr == \"false\") {\n\t\t\t\t\t\tKcase = false;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Error: KcaseStr = \" + KcaseStr);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// check if conditions are correct to calculate a single solution, an iterative solution, or neither\n\t\t\t\tlet solveFor = this.checkSingleSoln();\n\t\t\t\tif(solveFor == \"n/a\") {\t// user needs to fix inputs\n\t\t\t\t\tthis.showBernHelptext(\"SINGLE1\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(solveFor == \"false\") {\t// calculate iteratively\n\t\t\t\t\tif(this.inputsEmpty([\"L\", \"D\", \"rho\", \"gamma\", \"epsilon\"])) {\n\t\t\t\t\t\tthis.showBernHelptext(\"ITER\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(document.getElementById(\"v\").value != \"\") {\n\t\t\t\t\t\tthis.showBernHelptext(\"V\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet inputs = this.packBernoullis(Kcase, false, \"v\");\n\t\t\t\t\tlet solution = this.CALCULATOR.calcBernoullis(inputs);\n\t\t\t\t\tif(solution !== undefined) {\n\t\t\t\t\t\tthis.outputBernoullis(\"v\", solution);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Iterative soln returned undefined.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\t// calculate a single solution\n\t\t\t\t\tif(this.inputsEmpty([\"L\", \"v\", \"D\", \"f\", \"rho\"])) {\n\t\t\t\t\t\tthis.showBernHelptext(\"SINGLE2\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tlet inputs = this.packBernoullis(Kcase, false, solveFor);\n\t\t\t\t\tlet solution = this.CALCULATOR.calcBernoullis(inputs);\n\t\t\t\t\tif(solution !== undefined) {\n\t\t\t\t\t\tthis.outputBernoullis(solveFor, solution);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"single Soln returned undefined.\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log(\"calculateHandler: \" + formula + \" did not match any case.\");\n\t\t\t\tbreak;\n\t\t}\n\t}", "function convertEquation(equation) {\n let convertedEquation = {}\n \n if (equation.operator === 'add') {\n // 5 + 2\n if (equation.op1Pos && equation.op2Pos) {\n convertedEquation = equation\n } \n // 5 + (-2) => 5 - 2\n if (equation.op1Pos && !equation.op2Pos && isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = true;\n }\n // 5 + (-8) => 8 - 5, solution sign neg\n if (equation.op1Pos && !equation.op2Pos && !isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op2;\n convertedEquation.op2 = equation.op1;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = false;\n }\n // -2 + 5 => 5 - 2\n if (!equation.op1Pos && equation.op2Pos && !isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op2;\n convertedEquation.op2 = equation.op1;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = true;\n }\n // -2 + 1 => 2 - 1, sign neg\n if (!equation.op1Pos && equation.op2Pos && isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = false;\n }\n // -2 + (-3) => 2 + 3, sign neg\n if (!equation.op1Pos && !equation.op2Pos ) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'add';\n convertedEquation.isSolutionPos = false;\n }\n }\n \n if (equation.operator === 'subtract') {\n // 5 - 2\n if (equation.op1Pos && equation.op2Pos && isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = true;\n }\n // 2 - 5 => 5 - 2, sign neg\n if (!equation.op1Pos && equation.op2Pos && isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op2;\n convertedEquation.op2 = equation.op1;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = false;\n }\n // 5 - (-2) => 5 + 2\n if (equation.op1Pos && !equation.op2Pos ) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'add';\n convertedEquation.isSolutionPos = true;\n }\n // -5 - 2 => 5 + 2, sign neg\n if (!equation.op1Pos && equation.op2Pos ) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'add';\n convertedEquation.isSolutionPos = false;\n }\n // -5 - (-2) => 5 - 2, neg\n if (!equation.op1Pos && !equation.op2Pos && isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = false;\n }\n // -5 - (-8) => 8 - 5, pos\n if (!equation.op1Pos && !equation.op2Pos && !isFirstArrayGreater(equation.op1, equation.op2)) {\n convertedEquation.op1 = equation.op2;\n convertedEquation.op2 = equation.op1;\n convertedEquation.operator = 'subtract';\n convertedEquation.isSolutionPos = true;\n }\n }\n\n if (equation.operator === 'multiply') {\n convertedEquation.operator = equation.operator;\n if( (equation.op1Pos && equation.op2Pos) ||\n (!equation.op1Pos && !equation.op2Pos) ) {\n convertedEquation.isSolutionPos = true\n } else {\n convertedEquation.isSolutionPos = false\n }\n //aligns equation by significant digits, op1 will be same or greater number of significant digits\n if (equation.op1[0].length + equation.op1[1].length >=\n equation.op2[0].length + equation.op2[1].length ) {\n convertedEquation.op1 = equation.op1;\n convertedEquation.op2 = equation.op2;\n } else {\n convertedEquation.op1 = equation.op2;\n convertedEquation.op2 = equation.op1;\n \n }\n }\n \nreturn convertedEquation\n}", "function reEnterData (){\n //get the li index\n let clickedIndex = $( this ).data( 'index' );\n //get the objects instead of the array\n let anObject = arrayOfEquations[0];\n //get clicked on equation \n let desiredEquation = anObject[clickedIndex];\n \n if (desiredEquation.numOne === 'empty'){\n desiredEquation.numOne = 0;\n } \n\n\n // parse out individual data of equation\n reInputOne = Number(desiredEquation.numOne);\n reInputTwo = Number(desiredEquation.numTwo);\n operator = desiredEquation.operator;\n\n // sanity check\n console.log(reInputOne, reInputTwo, operator);\n \n // reset the values of inputs and operator buttons to match parsed equation data\n $('#firstValue').val(reInputOne);\n $('#secondValue').val(reInputTwo);\n\n \n // repress operator button, COOL!\n if (operator === '+') {\n $('#plusOperator').trigger('click');\n } else if (operator === '-') {\n $('#minusOperator').trigger('click');\n } else if (operator === '*') {\n $('#multiplyOperator').trigger('click');\n } else if (operator === '/') {\n $('#divideOperator').trigger('click');\n } else if (operator === '√') {\n $('#squareRoot').trigger('click');\n } \n\n \n}", "function addPoints(){\n \tpoints += pointsPerCorrectAnswer;\n\t\tdocument.getElementById(\"boxThree\").innerHTML = points;\n\n }", "function addPoints(){\n \tpoints += pointsPerCorrectAnswer;\n\t\tdocument.getElementById(\"boxThree\").innerHTML = points;\n\n }", "function addPoints(){\n \tpoints += pointsPerCorrectAnswer;\n\t\tdocument.getElementById(\"boxThree\").innerHTML = points;\n\n }", "function setValues(equation, value) {\n $('#result-equation').text(equation);\n $('#result-value').text(value);\n}", "function do_math(num1, num2, equation){\n if(equation === '+'){\n arithmetic.numbers = [num1 + num2];\n };\n if(equation === '-'){\n arithmetic.numbers = [num1 - num2];\n };\n if(equation === '/'){\n if(num2 === 0){\n arithmetic.numbers = ['Error'];\n }else{\n arithmetic.numbers = [num1 / num2];\n };\n };\n if(equation === 'x'){ \n arithmetic.numbers = [num1 * num2]\n };\n \n i = 0;\n x = 0;\n\n //Checks if number is a float\n function checkIfFloat(value) {\n return Number(value) === value && value % 1 !== 0;\n };\n if(checkIfFloat(arithmetic.numbers[0])){\n arithmetic.numbers[0] = arithmetic.numbers[0].toFixed(3)\n };\n //Prevents screen out of bonds\n if(arithmetic.numbers[i].toString().length >= 9){\n arithmetic.numbers = ['Error'];\n };\n screen_function(arithmetic.numbers[0]);\n}", "function solveValue(){\n //ph, pka, a, ha\n // ensure that all 3 inputsValue is not null\n let valid = 0;\n for(let i = 0; i < inputsValue.length; i++){\n if(!solve[i] && (inputsValue[i] != null) && inputsValue[i] != ''){\n valid++;\n }\n }\n\n if(valid == 3){\n switch(getSolve()){\n case 0:\n try{\n if(inputsValue[3] == 0){\n throw \"invalid value\";\n }\n inputs[0].value = Number(inputsValue[1]) + Number(Math.log10(inputsValue[2]/inputsValue[3]));\n inputsValue[0] = inputs[0].value;\n } catch (err){\n inputs[0].value = 0;\n }\n break;\n case 1:\n try{\n if(inputsValue[3] == 0){\n throw \"invalid value\";\n }\n inputs[1].value = -1 * (-Number(inputsValue[0]) + Number(Math.log10(inputsValue[2]/inputsValue[3]) ));\n\n } catch (err){\n inputs[1].value = 0;\n }\n\n break;\n case 2:\n try{\n if(inputsValue[3] == 0){\n throw \"invalid value\";\n }\n inputs[2].value = Math.pow(10, (Number(inputsValue[0]) - Number(inputsValue[1]))) * Number(inputsValue[3]);\n } catch{\n inputs[2].value = 0;\n }\n\n break;\n case 3:\n try{\n if(inputsValue[3] == 0){\n throw \"invalid value\";\n }\n inputs[3].value = Math.pow(Math.pow(10, (Number(inputsValue[0]) - Number(inputsValue[1]))) /Number(inputsValue[2]), -1);\n } catch{\n inputs[3].value = 69;\n }\n break;\n }\n }\n}", "function solve()\r\n{\r\n let x = document.getElementById(\"input\").value;\r\n document.getElementById(\"input\").value = eval(x);\r\n document.getElementById(\"result\").value = eval(x);\r\n\r\n if(x == 0)\r\n {\r\n document.getElementById(\"input\").value = \"\";\r\n document.getElementById(\"result\").value = \"\";\r\n }\r\n}", "function eqsol(anno){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2010.\n // calcola la data degli equinozi e dei solstizi per l'anno indicato nel parametro.\n\n\nvar Y=anno;\nvar y1=Y/1000;\n\nvar jd1=1721139.2855+365.2421376*Y+0.0679190*y1*y1-0.0027879*y1*y1*y1; // EQUINOZIO DI MARZO\n\nvar jd2=1721233.2486+365.2417284*Y-0.0530180*y1*y1+0.0093320*y1*y1*y1; // SOLSTIZIO DI GIUGNO\n\nvar jd3=1721325.6978+365.2425055*Y-0.1266890*y1*y1+0.0019401*y1*y1*y1; // EQUINOZIO DI SETTEMBRE\n\nvar jd4=1721414.3920+365.2428898*Y-0.0109650*y1*y1-0.0084885*y1*y1*y1; // SOLSTIZIO DI DICEMBRE\n\nvar tempi= new Array(jd1,jd2,jd3,jd4);\n\nreturn tempi;\n\n\n}", "function calculate(equality) {\n try {\n var content = splitInput(equality);\n rightContent(content);\n var cal = expression(content);\n if (String(cal) == \"NaN\") {\n alert(\"Error: Something is wrong.\");\n deleteContent();\n return;\n }\n }\n catch (err) {\n alert(\"Error: \" + err + \".\");\n deleteContent();\n return;\n }\n output.innerText = cal;\n}", "function displayAnswer(equationArray) {\n let answerEl = $('#calcDisplay');\n answerEl.empty();\n if (equationArray.length < 1) {\n return;\n }\n else if (submissions < 1) {\n return;\n }\n else {\n answerEl.empty(); \n answerEl.append(`${equationArray[equationArray.length - 1].answer}`);\n }\n}", "function showEquationEditor(){\n //count number of equations\n /*var iCount = $('.equations').length ; \n \n //set the html to append\n var sHtml = '<p class=\"equations\" id=\"equation_'+ (iCount + 1) + '\"></p>';\n \n //apend the html\n //$('#page').append(sHtml);\n //$('#redactor').insertHtml('<p>insert</p>');\n //$('#redactor_content').insertHtml(sHtml);\n \n //launch the equation editor\n OpenLatexEditor('equation_' + (iCount + 1),'html','');*/\n \n $('#postOnWallDialog').css('z-index' , '2');\n $('#equationDialog').fadeIn('normal');\n}", "function equalClickUpdate(){\n // display new value, set equalCLikedPrev to true, and reset variables\n if (equation != ''){\n equation = equation+displayVal;\n displayVal = eval(equation);\n displayValElement.value = displayVal;\n // change input background color if answer is 27\n if (displayVal == \"27\"){\n equal.className='btn-danger';\n }\n equation = '';\n curOperator = '';\n equalClickedPrev = true;\n }\n}", "function calculate(){\r\n var output = document.getElementById(\"ans\").value;\r\n var sol = eval(output);\r\n document.getElementById(\"ans\").value = sol;\r\n}", "function updateFacialExpression(correctPrediction) {\n\tif (correctPrediction) {\n\t\twinStreak = winStreak >= 0 ? winStreak + 1 : 0;\n\t} else {\n\t\twinStreak = winStreak <= 0 ? winStreak - 1 : 0;\n\t}\n\n\tlet face = 4;\n\tif (winStreak <= -5) {\n\t\tface = 0;\n\t} else if (winStreak <= -2) {\n\t\tface = 1;\n\t} else if (winStreak <= 2) {\n\t\tface = 2;\n\t} else if (winStreak <= 5) {\n\t\tface = 3;\n\t}\n\n\t$(\".pyotr-face\").hide();\n\t$(`#face-${face}`).show();\n}", "function math_editor() {\n generateMathPanel('math-equation-menu', 1, 5, 5, 48, 20, -46, 0, 0, 0);\n generateMathPanel('math-equation-1', 6, 7, 40, 20, 20, -18, 0, 0, -30);\n generateMathPanel('math-equation-2', 5, 7, 33, 20, 20, -18, 0, 0, -50);\n generateMathPanel('math-equation-3', 3, 7, 21, 20, 20, -18, 0, 0, -70);\n generateMathPanel('math-equation-4', 2, 10, 20, 30, 56, -30, 0, 0, -90);\n generateMathPanel('math-equation-5', 1, 12, 12, 20, 20, -18, 0, 0, -150);\n\n math_menuPopover(5);\n bind_MathCellHover(1, 135);\n\n // dynamic rendering tex formular\n var texTimer = null;\n $('#tex-formula').on('change keyup paste', function() {\n clearTimeout(texTimer);\n texTimer = setTimeout(function() {\n renderEquation();\n }, 800);\n });\n\n // popover click outside auto hide\n $('html').on('click', function (e) {\n if (!$(e.target).parents().hasClass('math-equation-menu')\n && $(e.target).parents('.popover.in').length === 0) {\n $('#math-equation-menu').find('td[id^=math-cell]').popover('hide');\n }\n });\n\n // bootstrap v3.3.6 #16732 bug fixed\n $('body').on('hidden.bs.popover', function (e) {\n $(e.target).data(\"bs.popover\").inState.click = false;\n });\n}", "function addEquation() {\n let number1 = $('#first-number').val();\n let number2 = $('#second-number').val();\n if (number1 === '' || number2 === '') {\n alert(`You need to enter two numbers`)\n }\n else {\n $.ajax({\n method: 'POST',\n url: '/equations',\n data: {\n number1: number1,\n number2: number2,\n operation: operation,\n answer: answer\n }\n }).then(function (response) {\n getAllEquations();\n console.log('Woot! addEquation worked!');\n emptyInputs();\n }).catch(function (response) {\n console.log(`Whoops, this didn't work!`);\n alert((`Whoops, this didn't work!`))\n }) // end ajax post\n }\n} // end addEquation", "function mainCompute()\n{\n\tlet expr = document.getElementById(\"inputSpecificFunction\").value;\n\tlet optionF\n\tif(expr != \"\")\n\t{\n\t\ttry {\n\t\t\toptionF = math.parse(expr)\n\t\t} catch (e) {\n\t\t\tconsole.log(\"Wrong syntax\")\n\t\t\talert(\"The entered function has a syntax error\")\n\t\t}\n\n\t\tlet latex = optionF.toTex()\n\t\tdocument.getElementById(\"labelSpecificFunction\").innerHTML = \"\\\\(f(x) = \" + latex + \"\\\\)\"\n\t\tMathJax.typeset()\n\t}\n\telse{\n\t\toptionF = f;\n\t}\n\n let optionN = parseFloat(document.getElementById(\"optionN\").value);\n\tlet optionH = parseFloat(document.getElementById(\"optionH\").value);\n\tlet optionA = parseFloat(document.getElementById(\"optionA\").value);\n\tlet optionI = {\"a\": parseFloat(document.getElementById(\"optionRangeStart\").value), \"b\": parseFloat(document.getElementById(\"optionRangeEnd\").value)};\n\tlet optionDX = parseFloat(document.getElementById(\"optionDX\").value);\n\tlet optionNaive = document.getElementById(\"checkOldMethod\").checked;\n let tmp = document.getElementById(\"optionDerivatives\").value.split(\",\");\n let optionDerivative = [];\n tmp.forEach( i => {\n optionDerivative.push(parseInt(i)); //Transform to int\n });\n\n\tneedsRebuild = true;\n\n\tcompute(optionF, optionN, optionH, optionA, optionI, optionDX, optionDerivative, optionNaive);\n\tmainGraph.update();\n}", "function ans(){\n if(calc.input.value !== \"\"){\n calc.input.value =eval( calc.input.value);\n} else {\n calc.input.value = \"0\";\n} \n end =false; \n}", "function calculate() {\n var val = formulaInput.val();\n if(val === \"\") {\n resultDisplay.html(\"0\");\n return;\n }\n val = cleanUpFormula(\"0+\"+val);\n hintText.html(\"&nbsp;\");\n if(!val || val === \"0+\") {\n return;\n }\n var invalidCharacters = extractInvalidCharacters(val);\n if(invalidCharacters.length !== 0) {\n hintText.html(\"Invalid characters in formula (\"+invalidCharacters.join(\", \")+\")\");\n return;\n }\n var postfix = infixToPostfix(val);\n var result = calculatePostfix(postfix);\n if(result == null) {\n hintText.html(\"Invalid formula\");\n return;\n }\n resultDisplay.html(result);\n }", "function checkAnswers(answers){\n var correctAns = model.transition(false);\n var result = []; var sum = 0;\n var allCorrect = 1;\n var error = {errorName:\"none\",badInputs:[]};//[error name, position that error was found]\n \n for (var i = 0; i < answers.length; i++){\n sum += answers[i];\n if(isNaN(answers[i])){\n error.errorName = \"nonnumber_error\";\n error.badInputs.push(i);\n }\n else if(answers[i] <0){\n error.errorName = \"negative_error\";\n error.badInputs.push(i);\n }\n if (round_number(answers[i],3) == round_number(correctAns[i],3)){\n result[i] = \"right\"; \n }\n else {result[i] = \"wrong\"; allCorrect = 0;}\n }\n result[answers.length] = allCorrect;\n if (round_number(sum,3) != round_number(1,3) && error.errorName==\"none\"){ error.errorName = \"sum_error\"; error.badInputs =[]}\n// else {result[answers.length+1] = \"sum_correct\";}\n \n result[answers.length+1] = error;\n return result;\n }", "correct() {\n\n\n }", "function evaluateAnswer(){\n\tvar y = parseInt(second.innerHTML);\n\tvar x = parseInt(first.innerHTML);\n\tvar i = operator.innerHTML;\n\t// checks the operator passed\n\tswitch(i){\n\t\tcase '+':\n\t\t\tcompute = x + y;\n\t\t\tbreak;\n\t\tcase '-': \n\t\t\tcompute = x - y;\n\t\t\tbreak;\n\t\tcase '*':\n\t\t\tcompute = x * y;\n\t\t\tbreak;\n\t\tcase '/': \n\t\t\tcompute = x / y;\n\t\t\tbreak;\n\t}\n\n\tif (compute === parseFloat(document.getElementById('result').value)){\n\t\tdocument.getElementById('right').innerHTML = ++right;\n\t\tdisplayMessage('Congrats, you have won the game');\n\t}\n\telse{\n\t\tdocument.getElementById('wrong').innerHTML = ++wrong;\n\t\tdisplayMessage('That is not correct, Please try next problem');\t\t\n\t}\n\tsetTimeout(init, 5000);\n }", "function refresh(a) {\n\n\tif (a == -1)//when divide by 0. \n\t{\n\t\tclear();\n\t\t$(\".textview\").attr(\"value\", \"MATH ERROR\");\n\t}\n\telse {\n\t\tvar str = left;\n\t\tif (symbolFlag != none)\n\t\t\tstr += symbolFlag;\n\t\tif (rightflag)\n\t\t\tstr += right;\n\t\t$(\".textview\").attr(\"value\", str);\n\t}\n}", "function evalAns(){\n\t// evaluating data \n\tvar solution = eval(document.getElementById('display').innerHTML);\n\t// displaying calculations\n\tdocument.getElementById('display').innerHTML = solution;\n\t// capping to a set number of characters\n\tcappingChar();\n}", "function solve()\n {\n let x = document.querySelector(\"#result\").value\n let y = eval(x)\n document.querySelector(\"#result\").value = y\n document.addEventListener(\"click\");\n }", "function LogicEvaluator() {}", "function equals() {\n if (!$('.equation').text() == \"\") {\n del = false;\n $('.delete').find('span').text('CLR');\n $('.equation').hide();\n $('.result').css('font-size', 'x-large');\n }\n }", "function calcul(randq)\n{\n\t\n randq = randq.trim(); \n temp=randq.split(\"(\");\n temp1=temp[1].split(\")\");\n chars=temp1[0].split(\"\");\n //here we are taking out number and operator in 2 diffrent arrent number in array n and operator in array op\n var n = [], op = [], index = 0, oplast = true;\n \n for(c=0;c<chars.length;c++)\n {\n if (isNaN(parseInt(chars[c])))\n {\n op[index] = chars[c];\n index++;\n n[index] = \"\";\n oplast = true;\n }\n else\n { if(n[index])\n n[index] += chars[c];\n else\n n[index]= chars[c];\n oplast = false;\n }\n \n }\n //alert(randq);\n //here we are removing the blank entry from number array.\n var n = n.filter(function(v){return v!==''});\n //alert(n);\n // As some case we will get only one operator that case in op array first position adding oeration plus operator.\n if(op.length==1)\n {\n\t op.unshift(\"+\");\n }\n //alert(op);\nres=0;\n // res = op[0] + parseInt(n[0]) + op[1] + parseInt(n[1]);\n\t //here we are calculating the number value\n\t for(i=0;i<op.length;i++)\n\t {\t\t \n\t\t if(op[i].trim()==\"+\")\n\t\t res=res + parseInt(n[i]);\n\t\t else\n\t\t res=res - parseInt(n[i]);\n\t }\n\t \n//here calculating final result value and doing round of to dicimal 2 digit.\t \nif(temp[0].trim()=='sin')\n {\t \n\t ans=Math.round(Math.sin(Math.radians(res))*100)/100;\n\t }\nif(temp[0].trim()=='cos')\n {\n\t ans=Math.round(Math.cos(Math.radians(res))*100)/100;\n }\n //alert(res);\n //alert(ans);\n return ans;\n}", "function qqq(){\r\n calc.disp.value=eval(calc.disp.value)\r\n // console.log(\"asd\")\r\n if(e1.value=undefined){\r\n document.getElementById(\"disp\").innerText=\"INVALID INPUT\"\r\n }\r\n}", "function solve() {\n let x = document.getElementById(\"result\").value\n let y = eval(x)\n document.getElementById(\"result\").value = y\n}", "function solve() {\n let x = document.getElementById(\"result\").value\n let y = eval(x)\n document.getElementById(\"result\").value = y\n}", "function createResultExpression() {\n let operatorCode = getRandomArbitrary(0, 2); // 0 - plus, 1 - minus\n\n let first, second, operator, correctAnswer;\n // random + - operator\n if (operatorCode == 1) {\n operator = ' - ';\n first = getRandomArbitrary(8, 15);\n second = getRandomArbitrary(1, 7);\n correctAnswer = first - second;\n } else {\n operator = ' + ';\n first = getRandomArbitrary(3, 9);\n second = getRandomArbitrary(2, 7);\n correctAnswer = first + second;\n }\n correctAnswers.push(correctAnswer);\n return '<div class=\"mb-3 d-flex justify-content-center\">' + first + operator + second + ' = <input type=\"number\" class=\"result col-2 inpResult\"/><p class=\"getAnswer\"></p></span>';\n}", "function gradenumeric() {\n //var fasit = qobj.fasit;\n // for numeric the fasit is a template like this\n // 33.13:0.5 the answer is 33.13 +- 0.5\n // 32.0..33.5 the answer must be in the interval [32.0,33.5]\n // TODO a..b is the same as rng:a,b -- should we drop one of them?\n // nor:m,s the answer x is scored as e^-((1/(2) * ((x-m)/s)^2\n // sym:exp the answer x is scored as pycas(x - exp) == 0\n // eva:exp|a|b the answer x is scored as eval(x) == exp\n // zro:exp|a the answer x is correct if |exp(x)| < a\n // reg:r the answer x is scored as regular exp match for x,r\n // lis:a:A,b:B,c the answer x is scored as x == one of a,b,c - score is given by :A or 1\n var cor = ff;\n switch (swi) {\n case 'nor:':\n var norm = tch.split(',');\n var med = +norm[0];\n var std = +norm[1];\n var ex = ((uanum - med)/std);\n var sco = Math.pow(2.712818284,-(0.5*ex*ex));\n if (sco > 0.05) {\n ucorr += sco;\n feedb = Math.floor((1-sco)*10);\n } else {\n uerr++;\n }\n cor = med;\n break;\n case 'rng:': // [[rng:10,20]]\n var lims = tch.split(',');\n var lo = +lims[0];\n var hi = +lims[1];\n if (uanum >= lo && uanum <= hi) {\n ucorr += 1;\n feedb = 1;\n } else {\n uerr++;\n }\n cor = lo;\n break;\n case 'sym:':\n simple = false; // callback done after sympy is finished\n // fixup for 3x => 3*x etc\n var completed = { comp:0, lock:0 };\n if (uatxt == undefined || uatxt == '') {\n callback(score,'no input',completed,ua,1);\n } else {\n var elem = tch.split('|');\n var target = elem[0];\n var differ = elem[1]; // optional text that useranswer must NOT EQUAL\n // for symbolic equality - dont accept original equation\n // or new eq that is longer (not simpler)\n if (differ && (differ == uatxt || differ.length < uatxt.length) ) {\n callback(score,'sicut prius',completed,ua,1);\n } else {\n var ufu = sympify(target); // fasit\n cor = ufu;\n var fafu = sympify(uatxt); // user response\n var diffu = sympify(differ); // if testing equality - must be as short or shorter than this\n var intro = '# coding=utf-8\\n'\n + 'from sympy import *\\n';\n var text = 'x,y,z,a,b,c,d,e,f,u,v,w = symbols(\"x,y,z,a,b,c,d,e,f,u,v,w\")\\n'\n + 'a1=sympify(\"'+ufu+'\")\\n'\n + 'b1=sympify(\"'+fafu+'\")\\n'\n + 'c1=a1-b1\\n'\n + 'print simplify(c1)\\n';\n var score = 0;\n console.log(intro+text);\n fs.writeFile(\"/tmp/symp\"+now, intro+text, function (err) {\n if (err) { callback(score,'error1',completed,ua,1); throw err; }\n try {\n var child = exec(\"/usr/bin/python /tmp/symp\"+now, function(error,stdout,stderr) {\n fs.unlink('/tmp/symp'+now);\n //console.log(\"err=\",stderr,\"out=\",stdout,\"SOO\");\n if (error) {\n console.log(error,stderr);\n callback(score,'error2',completed,ua,1);\n } else {\n if (stdout && stdout != '') {\n //console.log(stdout);\n var feedb = stdout;\n var eta = +stdout.trim();\n if (_.isFinite(eta) && eta == 0 || Math.abs(eta) < 0.001 ) {\n score = 1\n if (differ) {\n // we are testing for simplification\n // minimum assumed to be ufu, diffu.length is original length (unsimplified)\n var span = diffu.length - ufu.length; // max shortening possible\n var dif = fafu.length - ufu.length; // how much shorter\n if (span > 0) {\n score = Math.max(0,Math.min(1,1-dif/span));\n // relative score depending on how many chars\n // you have shortened the eq - span assumed to be max\n feedb = (score > 0.8) ? 'Good answer' : (score > 0.5) ? 'Nearly' : 'Not quite';\n }\n } else {\n feedb = 'Correct answer';\n }\n } else {\n feedb = 'Incorrect answer';\n score = 0;\n }\n var cutcost = (attnum > 2) ? Math.min(1,cost*attnum*2) : cost*attnum;\n var adjust = score * (1 - cutcost - hintcost*hintcount);\n //console.log(qgrade,adjust,attnum,cost);\n score = aquest.points * Math.max(0,adjust);\n }\n //console.log(\"CAME SO FAR SYMBOLIC PYTHON \",eta,score,stdout,stderr,error);\n callback(score,feedb,completed,ua,1);\n }\n });\n } catch(err) {\n callback(score,'error3',completed,ua,1);\n }\n });\n }\n }\n break;\n case 'zro:':\n // zro:exp|a the answer x is correct if |exp(x)| < a\n var elem = tch.split('|');\n var exp = elem[0];\n var tol = elem[1] || 0.001 ;\n var sco = 0;\n exp = normalizeFunction(exp,0,ua);\n var num = +uatxt;\n if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n // user supplied root checked\n console.log(\"Checking if root:\",uatxt,exp);\n var bad = false;\n try {\n var fu1 = new Function(\"x\",' with(Math) { return ' +exp+'; }' );\n var f1 = Math.abs(fu1(num));\n console.log(\"Evalueated to \",f1,tol)\n if (f1 <= tol) {\n sco = 1;\n feedb = '1'; // mark as correct\n } else {\n bad = true;\n }\n }\n catch (err) {\n console.log(\"EVAL fu \",err);\n bad = true;\n }\n if (bad) {\n uerr++;\n } else {\n ucorr += sco;\n }\n }\n cor = 'NaN';\n break;\n case 'eva:':\n // eva:exp|a|b the answer x is scored as eval(x) == exp\n // the user answer must NOT EQUAL a,\n // Quiz: multiply (x+6) by 2, do not accept 2*(x+2)\n // eva:2x+12|2(x+6)\n // the answer should be as short as b (punished for extra chars - up to a.length)\n // simplify (2+4)*(7-5)\n // eva:12|(2+4)*(7-5)|12\n // so the constraints are : evaluate as 12, not eq \"(2+4)*(7-5)\" , as short as 12\n // partial score if between \"12\" and \"(2+4)*(7-5)\" in length\n var elem = tch.split('|');\n var exp = elem[0];\n var differ = elem[1]; // optional text that useranswer must NOT EQUAL\n var simply = elem[2]; // optional text that useranswer should match in length\n var lolim = -5;\n var hilim = 5;\n var sco = 0;\n exp = normalizeFunction(exp,0,ua);\n cor = exp;\n var ufu = normalizeFunction(uatxt,0);\n var udiff =normalizeFunction(differ,0);\n //console.log(exp,lolim,hilim,ufu);\n if (differ && (differ === uatxt || udiff === ufu) ) {\n uerr++;\n console.log(\"sicut prius\");\n } else if (exp === ufu) {\n ucorr++; // they are exactly equal\n feedb = '1'; // mark as correct\n //console.log(\"exact\");\n } else {\n //console.log(\"EVA:\",exp,ufu);\n if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n // user supplied function numericly tested against fasit\n // for x values lolim .. hilim , 20 steps\n var dx = (+hilim - +lolim) / 20;\n var bad = false;\n try {\n //return 'with(Math) { return ' + fu + '; }';\n var fu1 = new Function(\"x\",' with(Math) { return ' +exp+'; }' );\n var fu2 = new Function(\"x\",' with(Math) { return ' +ufu+'; }' );\n var reltol,f1,f2;\n for (var pi=0,xi = lolim; pi < 20; xi += dx, pi++) {\n //console.log(\"testing with \",xi);\n f1 = fu1(xi);\n f2 = fu2(xi);\n if (!isFinite(f1) && !isFinite(f2)) {\n reltol = 0;\n //console.log(\"NaN/inf\",xi,reltol);\n } else {\n reltol = f1 ? Math.abs(f1-f2)/Math.abs(f1) : Math.abs(f1-f2);\n }\n //console.log(xi,f1,f2,reltol);\n if (reltol > 0.005) {\n bad = true;\n break;\n }\n sco += reltol;\n }\n }\n catch (err) {\n console.log(\"EVAL fu \",err);\n bad = true;\n }\n if (bad) {\n uerr++;\n } else {\n if (simply) {\n // we are testing for simplification\n // minimum assumed to be simply.length, differ.length is original length (unsimplified)\n var span = differ.length - simply.length; // max shortening possible\n var dif = Math.min(span,Math.max(0,differ.length - ufu.length)); // how much shorter\n if (span > 0) {\n sco = 1 - Math.max(0,Math.min(1,dif/span));\n // relative score depending on how many chars\n // you have shortened the eq - span assumed to be max\n }\n }\n ucorr += 1 - sco;\n feedb = '1'; // mark as correct\n }\n }\n }\n break;\n case 'reg:':\n try {\n tch = tch.trim();\n var myreg = new RegExp('('+tch+')',\"gi\");\n var isgood = false;\n uatxt.replace(myreg,function (m,ch) {\n //console.log(\"REG:\",uatxt,tch,m,ch);\n isgood = (m == uatxt);\n });\n if ( isgood) {\n ucorr++; // good match for regular expression\n feedb = '1'; // mark as correct\n } else if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n uerr++;\n }\n }\n catch (err) {\n console.log(\"BAD REG EXP\",tch);\n if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n uerr++;\n }\n }\n cor = 'NaN';\n break;\n case 'lis:':\n var goodies = tch.split(',');\n if (goodies.indexOf(uatxt) > -1) {\n ucorr++;\n feedb = '1'; // mark as correct\n } else if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n uerr++;\n }\n cor = goodies[0];\n break;\n default:\n var num,tol,cor;\n cor = ff;\n //console.log(\"trying numeric\",ff,uatxt );\n if (ff == num) feedb = 1;\n if ( ff.indexOf(':') > 0) {\n // we have a fasit like [[23.3:0.5]]\n var elm = ff.split(':');\n num = +elm[0];\n tol = +elm[1];\n cor = num;\n //console.log(\"NUM:TOL\",ff,num,tol,uanum);\n } else if ( ff.indexOf('..') > 0) {\n // we have a fasit like [[23.0..23.5]]\n var elm = ff.split('..');\n var lo = +elm[0];\n var hi = +elm[1];\n tol = (hi - lo) / 2;\n num = lo + tol;\n cor = num;\n //console.log(\"LO..HI\",ff,lo,hi,num,tol,uanum);\n } else {\n num = +ff; tol = 0.0001;\n }\n if ( ff == 'any' || ff == 'anytext' || Math.abs(num - uanum) <= tol) {\n ucorr++;\n feedb = '1'; // mark as correct\n } else if (uatxt != undefined && uatxt != '' && uatxt != '&nbsp;&nbsp;&nbsp;&nbsp;') {\n uerr++;\n }\n break;\n }\n return cor;\n }", "function solve() {\n let y = eval(document.getElementById(\"result\").value)\n document.getElementById(\"result\").value = y\n}", "function Correct()\n{\nif(obj.spellings[x].correct==\"1\")\n{right();}\nelse\n{wrong();}\n}", "function evaluate() {\n if (firstNum !== null && secondNum !== null) {\n switch (equation) {\n case \"add\":\n firstNum += secondNum;\n\n break;\n case \"subtract\":\n firstNum -= secondNum;\n\n break;\n case \"divide\":\n firstNum /= secondNum;\n\n break;\n case \"multiply\":\n firstNum *= secondNum;\n\n if (displayNum > 10000000) {\n setDisplayNum(\"8======D\");\n }\n break;\n default:\n break;\n }\n setDisplayNum(firstNum);\n }\n }", "function calculate()\n {\n if (operator == 1)\n {\n current_input = eval(memory) * eval(current_input);\n };\n if (operator == 2)\n {\n current_input = eval(memory) / eval(current_input);\n // If divide by 0 give an ERROR message\n var initial_value = current_input.toString();\n if (initial_value == \"Infinity\")\n {\n current_input = \"ERROR\"\n };\n };\n if (operator == 3)\n {\n current_input = eval(memory) + eval(current_input);\n };\n if (operator == 4)\n {\n current_input = eval(memory) - eval(current_input);\n };\n if (operator == 5)\n {\n current_input = Math.pow(eval(memory), eval(current_input));\n };\n operator = 0; //clear operator\n memory = \"0\"; //clear memory\n displayCurrentInput();\n }", "function calculation(op) {\r\n var firstNumb = parseFloat(document.getElementById('firstNumb').value);\r\n var secondNumb = parseFloat(document.getElementById('secondNumb').value);\r\n var values = document.getElementById('values');\r\n //var operations = new Array(added, subtracted, divided, multiplied); Not all operations work, still working on a fix\r\n //switch statement--when written like this only the first added work\r\n switch (op) {\r\n case '+':\r\n values.textContent = firstNumb + secondNumb;\r\n break;\r\n\r\n case '-':\r\n values.textContent = firstNumb - secondNumb;\r\n break;\r\n\r\n case '&#247;':\r\n values.textContent = firstNumb / secondNumb;\r\n break;\r\n\r\n case '*':\r\n values.textContent = firstNumb * secondNumb;\r\n break;\r\n\r\n default:\r\n values.textContent = 'Try again';\r\n break;\r\n }\r\n\r\n}", "function operator(x)\r\n{\r\n form.display.value=form.display.value+x;\r\n var y=form.display.value;\r\n \r\n for(var i=1;i<y.length;i++)\r\n {\r\n if(y[i]==\"/\" || y[i]==\"*\")\r\n {\r\n if(y[i-1]==\"/\" || y[i-1]==\"+\" || y[i-1]==\"-\")\r\n {\r\n alert(\"sorry not possible :)\");\r\n form.display.value=\"\";\r\n }\r\n }\r\n }\r\n for(var j=0;j<y.length-1;j++)\r\n {\r\n if(y[j]==\".\")\r\n {\r\n if(y[j+1]==\"+\" || y[j+1]==\"-\" || y[j+1]==\"/\" || y[j+1]==\"*\")\r\n {\r\n alert(\"INVALID EXPRESSION\");\r\n form.display.value=\"\";\r\n break;\r\n }\r\n }\r\n } \r\n}", "function Quadratic() {\n\n let calc = () => {\n\t\tconsole.log('huj');\n\t\tlet a = document.querySelector(\"#a\");\n\t\tlet b = document.querySelector(\"#b\");\n\t\tlet c = document.querySelector(\"#c\");\n\n\t\tlet D;\n\t\tlet x;\n\t\tlet x1;\n\t\tlet x2;\n\n\t\tD = (b.value**2) - (4*a.value*c.value);\n\t\tconsole.log(`D is ${D}`);\n\n\t\tif (D > 0) {\n\t\t\tx1 = (-b.value + Math.sqrt(D)) / (2*a.value);\n\t\t\tx2 = (-b.value - Math.sqrt(D)) / (2*a.value);\n\t\t\tconsole.log(`x1 = ${x1}, x2 = ${x2}`);\n\t\t} else if (D == 0) {\n\t\t\tx = -b.value / 2*a.value;\n\t\t\tconsole.log(`As D is 0, solution is ${x}`);\n\t\t} else {\n\t\t\tconsole.log(\"Equation has no solutions.\")\n\t\t}\n }\n \n return (\n <div className=\"App\">\n <div className=\"App\">\n\t\t\t<div>\n\t\t\t\t<div>\n\t\t\t\t\t<h2>You have next type expression: </h2>\n <h3>x&#178; + bx + c = 0</h3>\n\t\t\t\t</div>\n\t\t\t\t<p>Please enter needed numbers</p>\n\t\t\t\t<div>\n <input type=\"number\" style={{width: \"25px\"}} id=\"a\"></input>\n x&#178; + <input type=\"number\" style={{width: \"25px\"}} id=\"b\"></input>x + <input type=\"number\" style={{width: \"25px\"}} id=\"c\"></input> = 0\n </div>\n\t\t\t <div style={{marginTop: \"10px\"}}>\n\t\t\t <button onClick={calc}>Calculate</button>\n\t\t\t </div>\n\t\t\t</div>\n\t\t</div>\n </div>\n );\n}", "function equals() {\n\tlet lastEntry = equation[equation.length - 1];\n\tlet isAnOperator = /[+-/*]/;\n\n\tif (entry.length === 0 && isAnOperator.test(lastEntry) === true) {\n\t\tequation.pop();\n\t}\n\tif (entry.length - 1 === \".\") {\n\t\tentry.pop();\n\t} else if (equation.length < 2) {\n\t\tequation.push(entry.join(\"\"));\n\t\toutput.textContent = \"error\";\n\t\tformula.textContent = equation.join(\" \"); //show user the faulty formula\n\n\t\tequation = [];\n\t\tentry = [];\n\t\tresult = 0;\n\t\tdecimal = null;\n\t\treturn;\n\t}\n\tif (entry.length === 1) equation.push(Number(entry));\n\tif (entry.length > 1) equation.push(Number(entry.join(\"\")));\n\n\tlet final = equation.join(\" \").toString();\n\tresult = eval(final);\n\n\toutput.textContent = result.toString().slice(0, 10);\n\tformula.textContent = (equation.join(\" \") + \" = \" + result)\n\t\t.toString()\n\t\t.slice(0, 50);\n\tequation = [];\n\tentry = [];\n\tdecimal = null;\n\tresult = 0;\n}", "function operation(mathoper){\n // Add the previous number into the equation if it hasn't been yet.\n if (Number.isFinite(Number.parseInt(aNumber)) || \n Number.isFinite(Number.parseFloat(aNumber)) ) {\n equation.push(aNumber);\n equation.push(mathoper);\n eqtext += \" \" + mathoper + \" \";\n equationBox.textContent = eqtext;\n aNumber = \"\";\n mathoper = \"\"\n }\n //If there is already a number stored\n if (Number.isFinite(equation[equation.length-1])){\n // Update the text used in the equation box.\n eqtext = equation[equation.length-1] + \" \" + mathoper + \" \";\n equation.push(mathoper);\n equationBox.textContent = eqtext;\n mathoper = \"\";\n }\n \n // If the operator was subtract and the previous number hasn't been entered then user is trying to \n // enter a negative number.\n if (mathoper == \"-\" && aNumber == \"\") {\n aNumber = mathoper;\n }\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function isAnswer() {\n var input = document.getElementsByName('number');\n \n for (let x = 0; x < input.length; x++) {\n let li = input[x].parentElement;\n let span = li.getElementsByTagName('span');\n let [number1, number2, symbol] = [\n span[0].innerHTML,\n span[2].innerHTML,\n span[1].innerHTML\n ];\n let math = new mathNumber(number1, number2);\n\n if (input[x].value == '' || input[x].value == null) {\n continue;\n } else {\n switch (symbol) {\n case '+':\n if (parseInt(input[x].value) === math.add()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n \n case '-':\n if (parseInt(input[x].value) === math.minus()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n\n case '×':\n if (parseInt(input[x].value) === math.multiplication()) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n\n case '÷':\n if (parseInt(input[x].value) === Math.round(math.division())) {\n li.classList.add(\"z-right\");\n } else {\n li.classList.add(\"z-error\");\n }\n break;\n }\n }\n }\n }", "function evalComplexOperator(el) {\n switch (el.value) {\n case \"LOG\":\n display = eval(\"Math.log(\" + lastDigitClicked + \")\")\n if(!isNaN(display)){\n evaluationString = eval(\"Math.log(\" + lastDigitClicked + \")\")\n }else{\n display = evaluationString =0;\n }\n lastDigitClicked = display\n break\n case \"SQRT\":\n display = eval(\"Math.sqrt(\" + lastDigitClicked + \")\")\n if(!isNaN(display)){\n evaluationString = eval(\"Math.sqrt(\" + lastDigitClicked + \")\")\n }else{\n display = evaluationString =0;\n }\n lastDigitClicked = display\n break\n case \"CUBRT\":\n display = eval(\"Math.cbrt(\" + lastDigitClicked + \")\")\n evaluationString = eval(\"Math.cbrt(\" + lastDigitClicked + \")\")\n lastDigitClicked = display\n break\n case \"TAN\":\n display = eval(\"Math.tan(\" + lastDigitClicked + \")\")\n evaluationString = eval(\"Math.tan(\" + lastDigitClicked + \")\")\n lastDigitClicked = display\n break\n case \"COS\":\n display = eval(\"Math.cos(\" + lastDigitClicked + \")\")\n evaluationString = eval(\"Math.cos(\" + lastDigitClicked + \")\")\n lastDigitClicked = display\n break\n case \"SIN\":\n display = eval(\"Math.sin(\" + lastDigitClicked + \")\")\n evaluationString = eval(\"Math.sin(\" + lastDigitClicked + \")\")\n lastDigitClicked = display\n break\n default:\n return false\n }\n console.log(evaluationString)\n return true\n\n}", "function traceAvecP() {\n\tvar equation = document.getElementById('input').value;\n\tequation = equation.replace(/,/g, '.');\n\t// rempalce les \",\" par \".\"\n\tvar erreur = validation(equation);\n\tdocument.getElementById('btnresetter').disabled = false;\n\t//activation du bouton Reset\n\tif (erreur < 0) {\n\t\tdocument.getElementById('btnrnd').disabled = true;\n\t\t// on scelle le bouton de soummission\n\t\tpente = parametreA(tokenize(equation));\n\t\tordonnee = parametreB(tokenize(equation));\n\t\texp = exposant(tokenize(equation));\n\t\tzoomPlan(exp, pente, ordonnee);\n\t\tif (exp == 0) {\n\t\t\ttypeEquation = 0;\n\t\t\tdocument.getElementById('btnpente').disabled = false;\n\t\t\t//activation du bouton Pente\n\t\t\tdocument.getElementById('btnAfficOrd').disabled = false;\n\t\t\t//activation du bouton Ordonnee\n\t\t\tpointLineaire();\n\t\t} else if (exp != 0) {\n\t\t\ttypeEquation = 1;\n\t\t\tdocument.getElementById('btnAfficOrd').disabled = false;\n\t\t\t//activation du bouton Ordonnee\n\t\t\tdocument.getElementById('btnAxeStm').disabled = false;\n\t\t\t//activation du bouton Axe symétrie\n\t\t\tdocument.getElementById('btnAfficZero').disabled = false;\n\t\t\t//activation du bouton Les zéros\n\t\t\tpointQuadratique();\n\t\t}\n\n\t\t// affichage dynamique de l'ordonnée dans la bulle externe\n\t\tif (typeEquation == 1) {\n\t\t\tif (dynamiqueB() < 0 && dynamiqueC() < 0) {// si l'ordonnee ou la pente est une valeur negative, les mettre entre ()\n\t\t\t\tboard.on('update', function() {\n\t\t\t\t\tdocument.getElementById('ordonneeEquationQuadratique').innerHTML = \"y = \" + dynamiqueA() + 'x² +(' + dynamiqueB() + ')' + '+(' + dynamiqueC() + ')';\n\t\t\t\t});\n\t\t\t} else if (dynamiqueB() < 0 && dynamiqueC() >= 0) {\n\t\t\t\tboard.on('update', function() {\n\t\t\t\t\tdocument.getElementById('ordonneeEquationQuadratique').innerHTML = \"y = \" + dynamiqueA() + 'x² +(' + dynamiqueB() + ')' + \"+ \" + dynamiqueC();\n\t\t\t\t});\n\t\t\t} else if (dynamiqueC() < 0 && dynamiqueB() >= 0) {\n\t\t\t\tboard.on('update', function() {\n\t\t\t\t\tdocument.getElementById('ordonneeEquationQuadratique').innerHTML = \"y = \" + dynamiqueA() + 'x² + ' + dynamiqueB() + \"+(\" + dynamiqueC() + ')';\n\t\t\t\t});\n\t\t\t} else if (dynamiqueC() >= 0 && dynamiqueB() >= 0) {\n\t\t\t\tboard.on('update', function() {\n\t\t\t\t\tdocument.getElementById('ordonneeEquationQuadratique').innerHTML = \"y = \" + dynamiqueA() + 'x² + ' + dynamiqueB() + dynamiqueC();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tboard.on('update', function() {\n\t\t\t\tdocument.getElementById('ordonneeFormuleQuadratique').innerHTML = \"Ordonnée = \" + dynamiqueC();\n\t\t\t});\n\t\t}\n\t} else {// affichage des erreurs\n\t\tvar input = document.getElementById('input');\n\t\tinput.selectionStart = erreur;\n\t\tinput.selectionEnd = ++erreur;\n\t\tinput.focus();\n\t\tenterPr = false;\n\t}\n}", "function evaluate() {\n $('#quizBoard').hide();\n $('#results').show();\n if ($('#q1f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q2t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q3f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q4f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q5t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q6t').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q7f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q8f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n if ($('#q9f').is(':checked')) {\n correct++\n } else {\n incorrect++\n }\n $('#corr').html(correct)\n $('#incorr').html(incorrect)\n $('#percent').html(correct/9)\n}", "function checkOperand(operator) {\n if (operand && operatorCount <= 1) {\n $('.equation').append(operator);\n }\n else {\n $('.equation').append(\"\");\n }\n }", "function correctAnswer(){\n\tscore += addScore(time);\n\tupdateScore();\n if(++level == 10){\n difficulty = 1;\n } else if(level == 20){\n difficulty = 2;\n }\n document.getElementById('level').innerHTML = \"Level : \" + level;\n\tresetComponent();\n}", "function calculate(e){\n if(!x){\n return\n }\n //needs to clear numberArray\n console.log('operand event', e.target.innerText)\n //is the operand available? if so calculate x and y following the math hash map\n operand ? x = math[operand](x, y) : null\n display(x)\n operand = e.target.innerText\n setX ? setX = !setX : null\n numberArray = []\n console.log('x', x, 'y', y)\n\n}", "function fillQAndA(){\t\t\n\t\tvar count = 0;\n\t\tvar arraySpot = 0;\n\t\twhile(count <=15){\n\t\t\t\n\t\t\n\t\t\t/* **get 2 random numbers from array ranNum1,ranNum2 */\n\t\t\t\n\t\t\tvar ranNum1 = Math.floor(Math.random() * nums.length);\n\t\t\tvar ranNum2 = Math.floor(Math.random() * nums.length);\n\t\t\t\n\t\t\t\n\t\t\t/* **get and operator */ \n\t\t\t\n\t\t\tvar whichOperator = Math.floor(Math.random() * operands.length);\n\t\t\tvar operator = operands[whichOperator];\n\t\t\t\n\t\t\t\n\t\t\t\tif (operator == '+') /* creates correct problems for operand */\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar answer = ranNum1 + ranNum2;\n\t\t\t\t\t\tanswer = answer.toFixed(1);\n\t\t\t\t\t\tqAndA[count] = ranNum1+ ' + ' +ranNum2;\n\t\t\t\t\t\tquestions[arraySpot] = ranNum1+ ' + ' +ranNum2;\n\t\t\t\t\t\tanswers[arraySpot]= answer;\n\t\t\t\t\t\tqAndA[count+1] = answer;\n\t\t\t\t\t\tcount = count+2;\n\t\t\t\t\t\tarraySpot++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\telse if (operator == '-')\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar answer = ranNum1 - ranNum2;\n\t\t\t\t\t\tanswer = answer.toFixed(1);\n\t\t\t\t\t\tqAndA[count] = ranNum1+ ' - ' +ranNum2;\n\t\t\t\t\t\tquestions[arraySpot] = ranNum1+ ' - ' +ranNum2;\n\t\t\t\t\t\tanswers[arraySpot]= answer;\n\t\t\t\t\t\tqAndA[count+1] = answer;\n\t\t\t\t\t\tcount = count+2;\n\t\t\t\t\t\tarraySpot++;\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (operator == '*')\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar answer = ranNum1 * ranNum2;\n\t\t\t\t\t\tanswer = answer.toFixed(1);\n\t\t\t\t\t\tqAndA[count] = ranNum1+ ' * ' +ranNum2;\n\t\t\t\t\t\tquestions[arraySpot] = ranNum1+ ' * ' +ranNum2;\n\t\t\t\t\t\tanswers[arraySpot]= answer;\n\t\t\t\t\t\tqAndA[count+1] = answer;\t\n\t\t\t\t\t\tcount = count+2;\n\t\t\t\t\t\tarraySpot++;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\telse if (operator == '/')\n\t\t\t\t\t{\n\t\t\t\t\t\tvar answer = ranNum1 / ranNum2;\n\t\t\t\t\t\tanswer = answer.toFixed(1);\n\t\t\t\t\t\tqAndA[count] = ranNum1+ ' / ' +ranNum2;\n\t\t\t\t\t\tquestions[arraySpot] = ranNum1+ ' / ' +ranNum2;\n\t\t\t\t\t\tanswers[arraySpot]= answer;\n\t\t\t\t\t\tqAndA[count+1] = answer;\n\t\t\t\t\t\tcount = count+2;\n\t\t\t\t\t\tarraySpot++;\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.alert(\"Error in Operand\");\n\t\t\t\t\t}\n\t\t\t\t}\n}", "function quad(){\nalert(\"The general formula of quadratic equations is ax²+bx+c=0 where a is the coefficient of x²,b is the coefficient of x and c is a constant.\");\nalert(\"Quadratic equations can be solved by factorisation,completing the square and by the quadratic formula.\");\nalert(\"To solve 2x²+3x+1=0 by factorisation multiply 2 and 1(a and c) and this is 6.Now look for two numbers which when you add give you 3(b) and these are 2 and 1.Substitute these for 3 and we get 2x²+2x+1x+1=0.Notice that 2x+1x=3x.Now we factor out 2x and 1 and we get 2x(x+1)+1(x+1)=0.We factor out (x+1) and we get (x+1)(2x+1)=0 hence x+1=0 or 2x+1=0, x=-1 or 2x=-1, x=-1 or x=-0.5\");\n}", "function compute() {\n var input = document.getElementById(\"equationInput\").value;\n document.getElementById(\"equationOutput\").innerHTML = evaluate(input);\n}", "function finish_equation (equation, onum, opens) {\n // do not try to eveluate if there is ...((...)) as it is same as ...(...)\n for (var k=1; k<onum; k++) {\n if (opens[k] == opens[k-1]) {\n return;\n }\n }\n // close all unclosed brackets\n if (onum > 0) for (var n=0; n<onum; n++) equation += ')';\n var fn = true;\n \n try {\n v = eval(equation);\n } catch (e) {\n v = 0;\n }\n if (isNaN(v)) v = 0; // for case of division by zero\n delta = Math.abs(v - target)\n if (delta < best_delta) {\n best_equation = equation;\n best_delta = delta;\n best_value = v;\n console.log('New best value '+v+' for equation '+equation+' delta '+delta);\n }\n count++;\n if (count % 10000000 == 0) {\n console.log('Checked '+count+' possibilities. Last checked: '+equation);\n console.log('Best so far: '+best_equation+' with value: '+best_value+' and delta: '+best_delta);\n }\n if (show_all) {\n console.log('Current: '+equation+' value '+v+' delta: '+delta);\n }\n}", "function generateQA() {\r\n var x = 1 + Math.round(9*Math.random());\r\n var y = 1 + Math.round(9*Math.random());\r\n correctAnswer = x*y;\r\n document.getElementById(\"question\").innerHTML = x + \"x\" + y;\r\n correctPosition = 1 + Math.round(3*Math.random());\r\n document.getElementById(\"variant\" + correctPosition).innerHTML = correctAnswer;//fill one box with the correct answer\r\n \r\n //fill other boxes with wrong answers\r\n var answers = [correctAnswer];\r\n\r\n for(i=1; i<5; i++) {\r\n if(i != correctPosition) {\r\n var wrongAnswer;\r\n do {\r\n wrongAnswer = (1 + Math.round(9*Math.random()))*(1 + Math.round(9*Math.random()));//a wrong answer\r\n }while(answers.indexOf(wrongAnswer)>-1)\r\n document.getElementById(\"variant\" + i).innerHTML = wrongAnswer;\r\n answers.push(wrongAnswer);\r\n }\r\n }\r\n}", "function Ctrl($scope) {\n $scope.answer1 = /^1\\/sinx\\b/;\n $scope.answer2 = /^1\\/cosx\\b/;\n $scope.answer3 = /^1\\/tanx\\b/;\n $scope.answer4 = /^sinx\\/cosx\\b/;\n $scope.answer5 = /^cosx\\/sinx\\b/;\n $scope.answer6 = /^1\\b/;\n $scope.answer7 = /^sec\\^2x\\b/;\n $scope.answer8 = /^csc\\^2x\\b/;\n $scope.answer9 = /^1\\/2sin2x\\b/;\n $scope.answer10 = /^cos\\^2x\\-sin\\^2x\\b/;\n $scope.answer11 = /^1\\/cosx\\b/;\n $scope.answer12 = /^1\\/cosx\\b/;\n $scope.answer13 = /^1\\/cosx\\b/;\n $scope.answer14 = /^1\\/cosx\\b/;\n $scope.answer15 = /^1\\/cosx\\b/;\n $scope.answer16 = /^1\\/cosx\\b/;\n $scope.answer17 = /^1\\/cosx\\b/;\n $scope.answer18 = /^1\\/cosx\\b/;\n $scope.answer19 = /^1\\/cosx\\b/;\n $scope.answer20 = /^1\\/cosx\\b/;\n $scope.answer21 = /^1\\/cosx\\b/;\n $scope.answer22 = /^1\\/cosx\\b/;\n \n\n}", "function init() {\n\n // Create display\n formulaInput = $(\"<input type='text' class='form-control form-inline' placeholder='Enter formula' aria-describedby='calculator-hint'>\");\n formulaInput.on(\"keyup change\", calculate);\n hintText = $(\"<span id='calculator-hint' class='help-block'>&nbsp;</span>\");\n var resultBox = $(\"<h2>\");\n resultDisplay = $(\"<span>0</span>\");\n var useResultButton = $(\"<a href='#' class='btn btn-default btn-xs'>&uarr;</a>\").click(useResult);\n resultBox.append(resultDisplay).append(\"&nbsp;\").append(useResultButton);\n container.append($(\"<div class='col-md-12'>\").append(formulaInput).append(hintText).append(resultBox));\n\n // Create function buttons\n var row = $(\"<div class='btn-group btn-group-justified'>\");\n row.append($(\"<a href='#' class='btn btn-default'>C</a>\").click(reset));\n row.append($(\"<a href='#' class='btn btn-default'>CE</a>\").click(clear));\n row.append($(\"<a href='#' class='btn btn-default'>&larrhk;</a>\").click(undo));\n container.append(row);\n\n // Create all non-function buttons\n var buttons = [\"(\", \")\", \"7\", \"8\", \"9\", \"%\", \"^\", \"4\", \"5\", \"6\", \"/\", \"*\", \"1\", \"2\", \"3\", \"+\", \"-\", \"0\", \".\"];\n $.each(buttons, function(i, v) {\n if((i+3) % 5 == 0) {\n container.append(row);\n row = $(\"<div class='btn-group btn-group-justified'>\");\n }\n row.append($(\"<a href='#' class='btn btn-default'>\"+v+\"</a>\").click(symbolClick));\n });\n\n // Add more function buttons\n row.append($(\"<a href='#' class='btn btn-default'>&plusmn;</a>\").click(togglePositivity));\n row.append($(\"<a href='#' class='btn btn-default'>&larr;</a>\").click({amount: -1}, moveCursor));\n row.append($(\"<a href='#' class='btn btn-default'>&rarr;</a>\").click({amount: 1}, moveCursor));\n container.append(row);\n\n // Stop default event behaviour to prevent input losing focus\n container.on(\"mousedown\", \"a\", function(e) {\n if(!formulaInput.is(\":focus\")) {\n formulaInput.focus();\n }\n e.preventDefault();\n });\n\n\n }" ]
[ "0.6916964", "0.67190486", "0.6631508", "0.6616764", "0.6508894", "0.6444627", "0.64336175", "0.6404153", "0.63975066", "0.6380154", "0.63615566", "0.63269603", "0.62299097", "0.6201372", "0.6198595", "0.61376363", "0.60938096", "0.6073839", "0.6067977", "0.60320926", "0.6031127", "0.60102654", "0.5991875", "0.598647", "0.5982423", "0.59603316", "0.5952082", "0.59473485", "0.5929489", "0.591801", "0.5914072", "0.5846129", "0.58427966", "0.58294845", "0.5809023", "0.5806542", "0.5805061", "0.57903296", "0.5787702", "0.5785002", "0.5781765", "0.57755625", "0.57672143", "0.57670164", "0.57610244", "0.57610244", "0.57610244", "0.5759336", "0.57554996", "0.5748002", "0.5743795", "0.5741836", "0.57388014", "0.5736941", "0.5733073", "0.57330453", "0.5728862", "0.5726794", "0.572529", "0.5709798", "0.5707929", "0.5697983", "0.5693761", "0.56922734", "0.5684811", "0.5678301", "0.5672308", "0.5671572", "0.5671234", "0.5665661", "0.5660274", "0.56507355", "0.56438524", "0.5638691", "0.5638691", "0.5635815", "0.5631151", "0.5629314", "0.562642", "0.5618804", "0.5615137", "0.56118494", "0.55926627", "0.5591704", "0.5586762", "0.55764604", "0.55499804", "0.5549392", "0.55383015", "0.5536352", "0.5531932", "0.552761", "0.55219483", "0.5512675", "0.5512291", "0.55111533", "0.5508099", "0.55055773", "0.55001265", "0.55000126", "0.5499388" ]
0.0
-1
stop timer prcess result
function checkTime(){ //console.log(timePlayed); if(playerGuessArray.length == questionAmount){ console.log("guess array",playerGuessArray) clearInterval(timer); //check for the wrong guess and add penalty time equationsArray.forEach((equation,index) => { if(equation.evaluated === playerGuessArray[index]){ //no penalty } else{ penaltyTime +=0.5; } }); finalTime = timePlayed + penaltyTime; console.log("Time :",timePlayed); console.log("Penalty :",penaltyTime); console.log("finalTime :",finalTime); scoresToDOM(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_stopTimer() {\n this._tock.end();\n }", "function stopTimer() {clearTimeout(startTimer)}", "function stop() {\n timer.stop();\n}", "stop() {\n\t if (this.iObj != null) {\n\t\tclearTimeout(this.iObj);\n\t\tthis.iObj = null;\n\t }\n\t else {\n\t\tconsole.log(\"lTimer: \" + this.name + \" not running.\");\n\t }\n\t}", "function stop() {\n\n clearInterval(timerId);\n displayResults();\n }", "function stop() {\n clearTimeout(t);\n }", "function stopTimer(){ clearInterval(interval)}", "function stopTimer(){\r\n clearInterval(timer);\r\n }", "function stopTimer() {\n clearTimeout(timeCounter);\n }", "function stop () {\n clearInterval(timerHandle)\n }", "function stopTimer() {\n if (!stoptime) {\n stoptime = true;\n }\n}", "function stopTimer(){\n clearInterval(timer);\n }", "Stop() {}", "function timerStop() {\n clearInterval(timer);\n}", "function _stop() {\r\n\t\tclearInterval(_timer);\r\n\t\t_timer = null;\r\n\t}", "function time_stop(){\n\t\t\t\tclearInterval(timeinterval);\n\t\t\t}", "function stopTimer(){\n clearInterval(timer); // stops interval.\n } // end stopTimer.", "function stopTimer() {\n // check timer is on or off\n if (stopTime == false) {\n stopTime = true;\n }\n }", "function stopTimer() {\n clearInterval(timer);\n }", "function stopTimer(){\n clearTimeout(t);\n}", "function stopTime(){\n clearInterval(start);\n }", "function stop() {\n clearInterval(startTime);\n }", "function stopTime ()\t{\n\t\t\tclearInterval (time);\n\t\t}", "function stopTimer()\n {\n clearInterval(timer);\n }", "stopTimer() {\n\t\t\tclearInterval(this.timer);\n\t}", "stop(){\n\n\t\tif(this.timeoutTime){\n\t\t\tclearTimeout(this.timeoutTime);\n\t\t\tthis.timeoutTime = 0;\n\t\t}\n\t}", "function stopTimer() {\n clearTimeout(timeFunc);\n }", "function stop() {\n\t\tdisabled(\"start\", false);\n\t\tdisplayText(true);\n\t\tclearInterval(timer);\n\t\ttimer = null; // for checking whether it is stopped\n\t\tcount = 0; // to restart reading from the beginning\n\t}", "function stopTimer() {\n\tclearInterval(timer.timer);\n\t$(\"#final-time\").html($(\"#time\").html());\n}", "function stop () {\n\tclearInterval(timer);\n\ttimer=null;\n}", "stopTimer() {\n clearInterval(this.timer);\n }", "function stopTimer(){\n\t\tif(clock.inProgress == false){\n\t\t\taddInProgressRow();\n\t\t}\n\n\t\tclock.stopped = !clock.stopped;\n\t\tif(clock.stopped == false){\n\t\t\tclock.clockInterval = window.setInterval(addSecond, 1000);\n\t\t\tstop_btn.innerText= \"Stop\";\n\t\t\tstop_btn.style.backgroundColor = \"#96838F\";\n isTaskActive = true;\n\t\t} else{\n\t\t\tclearInterval(clock.clockInterval);\n\t\t\tstop_btn.innerText= \"Start\";\n\t\t\tstop_btn.style.backgroundColor = \"#53b56d\";\n isTaskActive = false;\n\t\t}\n\t}", "function stop () {\n stopTimerAndResetCounters();\n dispatchEvent('stopped', eventData);\n }", "function stop() {\n clearInterval(gameTime);\n result();\n console.log(\"Times Up\");\n}", "stop(){\n // when stop is called, clear the setInterval - or just stop the timer\n clearInterval(this.timer)\n }", "function stopTimer() {\n secondsElapsed = 0;\n setTime();\n renderTime();\n}", "function stopTimer() {\n\tclearInterval(clock);\n}", "function stopTimer(_timer){\n _timer.stop();\n }", "stopTimer() {\n if (this.start) {\n this.totalTime += new Date().getTime() - this.start;\n }\n }", "function stop() {\n clearInterval(interval);\n able_start_button();\n $.post(\n '/server/index.php',\n { action : 'timer_pause', seconds : seconds }\n );\n }", "stop(id){\n clearInterval(id);\n this.sucess=true;\n }", "stopTimer() {\n\t\t\tconst self = this;\n\t\t\tclearInterval(this.timer);\n\t\t}", "function stop() {\n clearInterval(timer);\n clearInterval(questionTimer);\n $(\".question\").hide();\n $(\"#timer\").hide();\n $(\"#stats\").show();\n time = 30;\n displayResults();\n setTimeout(empty, 5000);\n //display the stats\n }", "stop() {\n clearTimeout(this.currentTimeout);\n this.currentTimeout = null;\n this.wantedTime = null;\n this.callback = null;\n this.paused = false;\n this.timeleft = null;\n this.expected = null;\n this.repeated = false;\n }", "function stopTimer () {\n\t\tif (time) {\n\t\t\twindow.clearTimeout(time);\n\t\t}\n\t\ttime = 0;\n\t}", "function stopTimer() {\n clearInterval(timer)\n}", "function stop () {\n if (timer) {\n clearTimeout(timer)\n timer = undefined\n }\n\n started = false\n }", "function stopTimer() {\n clearInterval(timer);\n}", "function stopTimer() {\n clearInterval(interval);\n }", "function stopTimer(){\n clearInterval(timer);\n}", "function stopTimer() {\n clearTimeout(interval);\n }", "chronoStop(){\n clearTimeout(this.timerID);\n }", "function stopClock() {\n clearInterval(timer); \n }", "stop() {}", "stop() {\n if (this.getStatsInterval) {\n window.clearInterval(this.getStatsInterval);\n }\n\n this.pc.close();\n this.stopped = true;\n }", "stop(){\n clearInterval(this.timer);\n }", "function stop() {\n clearInterval(timerInterval);\n}", "function stop() {\n\n clearInterval(intervalId);\n timerRunning = false;\n \n }", "function stopCount() {\n\tclearTimeout(t);\n\ttimer_is_on = 0;\n}", "function stopTimer(){\n clearTimeout(setCountdownTimer);\n}", "function stop() {\n clearInterval(intervalId);\n clockRunning = false;\n }", "function stopTimer() {\r\n clearInterval(gMyTime);\r\n //document.querySelector('.stop').innerText;\r\n}", "function breakTimer() {}", "stop() {\n this.isStarted = false;\n if (this.timeoutID !== undefined)\n clearTimeout(this.timeoutID);\n }", "stop() {\n if(!(this.timeoutVariable == null)) {\n clearTimeout(this.timeoutVariable);\n }\n }", "function stop() {\n $timeout.cancel(nextComoboTimer);\n $timeout.cancel(startTimeout);\n hitCallerService.stop();\n stopped = true;\n }", "stopTimer() {\n clearInterval(this.timerId);\n }", "function stopTimer() {\n\tstopTimerUtils(currSessionTimeElapsedSeconds, currTimeFormatted);\n}", "stop() {\n const privateProps = internal(this);\n clearTimeout(privateProps.timeoutId);\n privateProps.timeoutId = null;\n }", "stop() {\n\t\tthis.endTime = Date.now();\n\t\tthis.difference = this.endTime - this.startTime;\n\t}", "stopTimer() {\n if ( this._interval ) {\n clearInterval( this._interval );\n this._interval = null;\n }\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}", "function stopTimer() {\n clearInterval(intervalId);\n }", "function stopTimer() {\n clearInterval(intervalId);\n }", "function stop() {\n clearInterval(timerId);\n timerId = undefined;\n pauseTimePassed = (new Date().valueOf()) - startTime;\n console.log(`Pausing at ${pauseTimePassed}`);\n viewManager.stop();\n }", "function stopTime() {\n clearInterval(currentTimer);\n}", "function stopTimer()\n{\n isStarted = false;\n clearInterval(intervalId);\n}", "function stopTimer() {\n if (timeout) {\n\tclearTimeout(timeout);\n\ttimeout = null;\n }\n}", "function stopTimer(){\n clearInterval(intervalId);\n }", "function _stopTimer(timer, options) {\n if (timer) {\n options.timeLimit = _getTimeLeft(timer);\n clearTimeout(timer);\n }\n }", "function stopTimer() {\n flagTimer = false;\n clearInterval(timerInterval);\n }", "function stopTimer() {\n flagTimer = false;\n clearInterval(timerInterval);\n }", "function stopTimer() {\n\n // stop the countdown\n clearInterval(time);\n // removes the timer from the html\n $(\"#timer\").empty();\n // call the check answers function\n checkAnswers();\n }", "function TimeOutProc(doc)\r\n{\r\n\ttry {\r\n\t\tapp.clearInterval(runTimeBar);\r\n\t\tapp.clearTimeOut(stopTimeBar);\r\n\t\tdoc.removeField(\"timeMonitorFields\");\r\n\t\tdoc.removeField(\"newTimerShort\");\r\n\t\tACROSDK.nSpentSec = 0;\r\n\t} catch (e) {}\r\n}", "function stop(){\n clearInterval(cron);\n hh= 0;\n mm= 0;\n ss= 0;\n\n document.getElementById('counter').innerText = '00:00:00';\n}", "function end_trial() {\n response.rt = performance.now() - start_time;\n\n // kill any remaining setTimeout handlers\n jsPsych.pluginAPI.clearAllTimeouts();\n // clear the display\n display_element.innerHTML = '';\n\n // move on to the next trial\n jsPsych.finishTrial(response);\n }", "function stop() {\n\t\trunning = false;\n\t}", "function stopclock()\n{\n\tif(timerRunning)\n\t\tclearTimeout(timerID);\n\ttimerRunning = false;\n}", "function stopTimer() {\n\tclearInterval(counter);\n\t$(\"#timer\").text(count);\n\treturn;\n}", "function stopPVT(){\n\t\tdocument.getElementById(\"buttons\").innerHTML=\"\";\n\t\tdocument.bgColor = '';\n\t\tclearTimeout(t);\n\t\tcount=0;\n\t\ttimerOn=0;\n\t\tdocument.getElementById(\"numeric\").innerHTML=\"\";\n\t\t//document.getElementById(\"buttons\").innerHTML='<input type= \"button\" value=\"Start Test\" onclick=\"startPVT()\" />';\n\t\ttestStop=(new Date()).getTime();\n\t\tvar duration=parseInt((testStop-testStart)/1000);\n\t\tvar numResponses= responseTimes.length;\n\t\tvar avgResponseTime=parseInt(responseTimes.avg());\n\t\t//alert(\"Average response Time= \"+responseTimes.avg());\n\t\tvar str=\"<h2>Results:</h2><p>Test Duration= \"+duration+\" seconds</p><p>Number of false starts= \"+numFalseStarts+\"</p>\";\n\t\tstr += \"<p>Average response time= \"+ avgResponseTime+\" msec over \"+numResponses+\" attempts.</p>\";\n\t\tif(avgResponseTime<=300){\n\t\t\tstr+=\"<p><b>Your results show that your vigilance and alertness are excellent</b></p>\";\n\t\t}else{\n\t\t\tstr+=\"<p><b>Your results show that your alertness may be suboptimal. Consider medical evaluation.</b></p>\";\n\t\t}\n\t\tif(numResponses==0){\n\t\t\tstr=\"<p>Test aborted. Refresh or reload this page to try again.</p>\";\n\t\t}\n\t\tdocument.getElementById(\"responseOut\").innerHTML=str;\n\t\twindow.location.href=\"#responseOut\";\n\t}", "function stopCountdownTimer(isByTimer){\n countdownTimer.stop();\n room.roomStatus = 'initial';\n io.emit('breakTimeEnded', room.roomStatus, isByTimer);\n console.info('stopCountdownTimer', countdownTimer.status);\n}", "function stop(){\n p.currentTime = 0;\n p.pause();\n}", "function ptolemyStop(){\n// Do nothing\n}", "function stopTimer() {\n clearInterval(interval);\n}", "function stopTimer() {\n window.clearInterval(timeinterval);\n}", "stopTimer() {\n console.log('stopTimer() called, timer instance is stopped.');\n window.clearInterval(mTimerIntervalId);\n }", "stop() {\n if(this.timer){\n clearInterval(this.timer)\n }else{\n super.emit('error', {\n name: 'OperationFailed',\n message: 'There is no timer to clear for the telemetry'\n })\n }\n }", "function stopTimer() {\n timerRunning = false\n clearInterval(intervalId)\n }", "function stop(){\r\n\tstopped = 1;\r\n}", "function _stopTimer() {\n $log.info('Timer Service Stop Timer!');\n service.timer.stop();\n service.timer.reset(); // side-effect of resetting to 0, so the timer will restart correctly\n }", "function abortTimer() {\n clearInterval(tid);\n}" ]
[ "0.76767725", "0.7482853", "0.7459706", "0.7428949", "0.7360145", "0.7357664", "0.733257", "0.73029613", "0.7276386", "0.7260394", "0.72554463", "0.7245807", "0.7194946", "0.7187756", "0.7178941", "0.7165328", "0.71628785", "0.71498036", "0.71453375", "0.7144782", "0.7140687", "0.71400315", "0.7139877", "0.71153086", "0.7100993", "0.7074956", "0.70689446", "0.70683336", "0.7065081", "0.705987", "0.7047606", "0.70257944", "0.70213974", "0.700968", "0.7003258", "0.69977796", "0.699469", "0.69812727", "0.69768524", "0.69704413", "0.6966207", "0.69581527", "0.6954632", "0.69512254", "0.6950634", "0.6937018", "0.6936925", "0.6930607", "0.6905819", "0.689995", "0.6890113", "0.68826723", "0.6880992", "0.6880162", "0.6876376", "0.6873605", "0.6869132", "0.6846353", "0.68463445", "0.6842145", "0.68409395", "0.6835804", "0.68322766", "0.68267655", "0.6826201", "0.6825474", "0.68198496", "0.681743", "0.6810175", "0.68063104", "0.6784997", "0.6781266", "0.677544", "0.677544", "0.67743134", "0.6767317", "0.6764843", "0.67589384", "0.6756898", "0.67546725", "0.6747433", "0.6747433", "0.6744668", "0.6731444", "0.6730426", "0.67203176", "0.6718858", "0.67174196", "0.67086446", "0.6698677", "0.66898483", "0.66830206", "0.6672527", "0.667131", "0.66700417", "0.66691893", "0.66612667", "0.6659821", "0.6659115", "0.663443", "0.66334337" ]
0.0
-1
add a tenth of a second to timeplayed
function addTime(){ timePlayed += 0.1; checkTime(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTime() {\n scorePanel.playTime = Math.trunc((performance.now() - scorePanel.startTime) / 1000);\n $(\".time\").text(scorePanel.playTime.toString().padStart(3, \"0\").concat(\" seconds\"));\n}", "increaseTime(t) {\n this.currentTime += t;\n this.timeElement.textContent = this.currentTime;\n }", "function setTime() {\n\t\tseconds += 500;\n\t}", "function updateCurrentTime()\n{\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n \n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration);\n \n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n \n}", "updateTime() {\r\n if (this.state == STATES.play) {\r\n if (this.remain === 0) {\r\n return this.winner();\r\n }\r\n this.time += 0.1; \r\n this.htmlScore.innerHTML = (this.mines-this.flags) +\r\n \" / \" + this.mines + \" \" + this.time.toFixed(1);\r\n }\r\n }", "function incTime() {\n debug(\"incTime\");\n let secs = parseInt(document.querySelector('.timer').innerHTML, 10);\n let x = secs +1;\n\n document.querySelector('.timer').innerHTML = `${x} Seconds`;\n }", "function updateTimer(){\n var song = document.querySelector('audio');\n var current_time = song.currentTime;\n var total_time = song.duration;\n var percentage = (current_time/total_time)*100; //cullculatin for curreret percentege\n $('.progress-filled').css('width',percentage+\"%\"); //by using css width property it show the duration of song played\n }", "function timeplayed(playtime_forever) {\n let timecalc = (playtime_forever/60).toFixed(1);\n let timeINt = parseInt(timecalc)\n let r = \"\";\n if (timecalc%timeINt==0){\n r = timeINt\n }\n else {\n r = timecalc\n }\n return r\n}", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration)\n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n\n }", "function incrementSeconds() {\n Consts.stockTime += 1;\n}", "addTime(s){\n if (timer.minutes === 59 && (timer.secondes + s) >= 60){\n timer.hours++\n timer.minutes = 0\n timer.secondes = (timer.secondes + s) - 60\n } else if (timer.secondes + s >= 60){\n timer.minutes++\n timer.secondes = (timer.secondes + s) - 60 \n } else {\n timer.secondes = timer.secondes + s\n }\n }", "function setTime()\n {\n ++totalSeconds;\n $('#timer > #seconds').html(pad(totalSeconds%60));\n $('#timer > #minutes').html(pad(parseInt(totalSeconds/60)));\n }", "function addOneSec() {\n sec += 1;\n updateTimer();\n waitOneSec();\n}", "function UpdateTheTime() {\n var sec = track1.currentTime;\n track1.volume = 1;\n var min = Math.floor(sec / 60);\n sec = Math.floor(sec % 60);\n if (sec.toString().length < 2) sec = \"0\" + sec;\n if (min.toString().length < 2) min = \"0\" + min;\n document.getElementById('timer').innerHTML = min + \":\" + sec + \"/\";\n var bar = document.getElementById(\"progressBar\");\n bar.setAttribute(\"max\", track1.duration.toString());\n bar.setAttribute(\"value\", track1.currentTime.toString());\n }", "function timer() {\n\t\t--secs;\n\t\tmins = (secs < 0) ? --mins : mins;\n\t\tif (mins < 0) {\n\t\t\tstop();\n\t\t\tmins += 1;\n\t\t\taudio.play();\n\t\t}\n\t\tsecs = (secs < 0) ? 59 : secs;\n\t\tsecs = (secs < 10) ? '0' + secs : secs;\n\t\t$('#timer').html(mins + ':' + secs);\n\t\tdisplayTime = mins + ':' + secs;\n\t}", "function updateTime(){\n timer.count += 1000\n $('#timer').text(new Date(timer.count).toLocaleTimeString(undefined, {\n minute: '2-digit',\n second: '2-digit'\n }))\n}", "function timeUpdate() {\r\n var $playPercent = (song.currentTime / song.duration) * 100;\r\n\r\n $('#playhead').css({\r\n \"margin-left\": $playPercent + \"%\"\r\n });\r\n }", "function timeReduce () {\n var soundSource = 'http://soundbible.com/grab.php?id=187&type=mp3';\n var soundAlert = new Audio(soundSource);\n if (sessionTextHead === 'Session') {\n var displayTime = convertTo(numSec);\n $('#mainTextTime').html(displayTime);\n \n if (numSec === 0) {\n sessionTextHead = 'Break';\n soundAlert.play();\n $('#sessionTextHead').html(sessionTextHead);\n $('.sessionArea').css('background-color', '#F2EBC7');\n $('#mainTextTime').css('color', '#343642');\n $('#sessionTextHead').css('color', '#343642');\n numSec = sessionTimeCounter*60;\n }\n numSec = numSec - 1;\n }\n\n else if (sessionTextHead === 'Break') {\n var displayTime2 = convertTo(numSec2);\n $('#mainTextTime').html(displayTime2);\n \n if (numSec2 === 0) {\n soundAlert.play();\n sessionTextHead = 'Session';\n $('#sessionTextHead').html(sessionTextHead);\n $('.sessionArea').css('background-color', '#962D3E');\n $('#mainTextTime').css('color', 'white');\n $('#sessionTextHead').css('color', 'white');\n numSec2 = breakTimeCounter*60;\n }\n numSec2 = numSec2 - 1;\n }\n }", "function timer(){\n\t\tsetInterval(function(){\n\t\t\tvar sec_curr = Math.floor(vid.currentTime);\n\t\t\tvar zero_curr = \"\";\n\t\t\tif((sec_curr % 60) < 10){\n\t\t\t\tzero_curr = \"0\";\n\t\t\t} else{\n\t\t\t\tzero_curr = \"\";\n\t\t\t}\n\t\t\tvar current_time = Math.floor(sec_curr / 60) + \":\" + zero_curr + (sec_curr % 60);\n\t\t\t$('#curr_time').text(current_time);\n\t\t\t$('progress').attr('value', sec_curr);\n\t\t}, 1000);\n\t}", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration);\n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n }", "function updateCurrentTime() {\n\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime); //it sends the value to the from currenttime to 'time' and after that get value from ret to CurrentTime\n currentTime = fancyTimeFormat(currentTime);\n\n var duration = Math.floor(song.duration); //it sends the value to the from duration to 'time' and after that get value from ret to duration\n duration = fancyTimeFormat(duration)\n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n}", "function updateStartTime(){\n if(mode == \"play\"){\n startTime = millis();\n }\n}", "updateAudio(dt,t) {}", "function countTime( time ) {\n\t\tgong.play();\n\t\t// Record the start time\n\t\tvar start = new Date();\n\t\tvar elapsed = 0;\n\t\tvar int = setInterval( function() {\n\t\t\tvar now = new Date();\n\t\t\telapsed = (now - start)/1000;\n\t\t\tcurrentDisplayTime.innerHTML = convertTimeToMinutes(elapsed);\n\t\t\tshowProgress( time, elapsed );\n\t\t\tif ( elapsed >= time || stopped == true ) {\n\t\t\t\tclearInterval(int);\n\t\t\t\tstartNextSection();\n\t\t\t}\n\t\t}, 200);\n\t}", "function runTimer(){\n \n let currentTime = leadingZero(timer[0]) + \":\" + leadingZero(timer[1]) + \":\" + leadingZero(timer[2]);\n \n theTimer.innerHTML = currentTime;\n \n timer[3]++;\n \n //.floor means no decimals\n // convertion to min/sec/10 milli\n timer[0]=Math.floor((timer[3]/100)/60);\n timer[1]=Math.floor((timer[3]/100)-(timer[0]*60)); \n timer[2]=Math.floor((timer[3])-(timer[1]*100)-timer[0]*6000);\n \n}", "function increment() {\n if (running == 1) {\n setTimeout(function () {\n timeing++;\n var mins = Math.floor(timeing / 10 / 60);\n if (mins <= 9) {\n mins = \"0\" + mins;\n }\n var secs = Math.floor((timeing / 10) % 60);\n if (secs <= 9) {\n secs = \"0\" + secs;\n }\n var tenths = Math.floor(timeing % 10);\n if (tenths <= 9) {\n tenths = \"0\" + tenths;\n }\n txtTime.innerHTML = mins + \":\" + secs + \":\" + tenths;\n increment();\n }, 100);\n }\n}", "function runTimer() {\n let currentTime = leadingZero(timer[0]) + \":\" + leadingZero(timer[1]) + \":\" + leadingZero(timer[2]);\n theTimer.innerHTML = currentTime;\n timer[3]++;\n\n timer[0] = Math.floor((timer[3]/100)/60);\n timer[1] = Math.floor((timer[3]/100) - (timer[0] * 60));\n timer[2] = Math.floor(timer[3] - (timer[1] * 100) - (timer[0] * 6000));\n\n}", "function timeUpdate() {\n\t\t\tvar playPercent = timelineWidth * (audio.currentTime / duration);\n\t\t\tplayhead.style.width = playPercent + \"px\";\n\t\t\tif (audio.currentTime == duration) {\n\t\t\t playIcon.style.display = \"inline-block\";\n\t\t\t playingIcon.style.display = \"none\";\n\t\t\t}\n\t\t }", "function updateTimer(){\n var song = document.querySelector('audio');\n var ct =song.currentTime;\n var td =song.duration;\n var percentage = (ct/td)*100;\n $(\".progress-filled\").css('width',percentage+\"%\");\n}", "function updateTime() {\n seconds += 1;\n document.querySelector(\"#timer\").innerText = \"Time elapsed: \" + seconds;\n}", "function timeTrack() {\r\n timer++;\r\n }", "function seektimeupdate(){\n if(audio.duration){\n var nt = audio.currentTime * (100 / audio.duration);\n slider.value = nt;\n var curmins = Math.floor(audio.currentTime / 60); \n var cursecs = Math.floor(audio.currentTime - curmins * 60); \n var durmins = Math.floor(audio.duration / 60); \n var dursecs = Math.floor(audio.duration - durmins * 60); \n if(cursecs < 10){ cursecs = \"0\"+cursecs; }\n if(dursecs < 10){ dursecs = \"0\"+dursecs; }\n if(curmins < 10){ curmins = \"0\"+curmins; }\n if(durmins < 10){ durmins = \"0\"+durmins; }\n currenttimetext.innerHTML = curmins+\":\"+cursecs;\n durationtimetext.innerHTML = durmins+\":\"+dursecs;\n }else{\n currenttimetext.innerHTML = \"00\"+\":\"+\"00\";\n durationtimetext.innerHTML = \"00\"+\":\"+\"00\";\n }\n}", "function Update ()\r\n{\r\n\t//print (Time.time);\r\n\tplayTime = Time.time; // runs in background keeping up with time\r\n\tdays = hours / 24;\r\n\thours = minutes / 60;\r\n\tminutes = playTime / 60;\r\n\tseconds = playTime % 60;\r\n\tfraction = ( playTime * 10 ) % 10;\r\n}", "function updateElapsedTime() {\n var ct = video.playPosition/1000;\n document.getElementById('duration').innerHTML = Time.format(ct);\n\n var sliceTime = Math.round(ct * durationIndex);\n document.getElementById('progressbar-front').style.width = sliceTime+'px';\n }", "function updateTime() {\n time -= 1000;\n showTime(); \n}", "function addPauseTime () {\n if (timerPauseTimestamp) {\n timerStartFinishTimestamp += Date.now() - timerPauseTimestamp;\n timerPauseTimestamp = null;\n };\n}", "function howManySeconds(num){\n return num * 60 * 60\n }", "function increaseTime() {\n\t\tlet seconds = 0;\n\t\tlet addSec = setInterval(increaseSeconds, 1000);\n\n\t\tfunction increaseSeconds() {\n\t\t\tseconds += 1;\n\t\t\tlet matchedCards = document.querySelectorAll('li.card.open.show.match');\n\n\t\t\tif (matchedCards.length === 16) {\n\t\t\t\tclearInterval(addSec);\n\t\t\t\tcongrats();\n\t\t\t}\n\t\t\ttimer.innerHTML = seconds;\n\t\t}\n\t}", "function incrementTime() {\n //Check clock is running\n if(running === 1) {\n setTimeout(function() {\n time++;\n let mins = Math.floor(time / 10 / 60);\n if(mins <= 9) {\n mins = \"0\" + mins;\n minutes.innerHTML = mins;\n }\n let secs = Math.floor(time / 10);\n if(secs <= 9) {\n secs = \"0\" + secs;\n seconds.innerHTML = secs;\n }\n let tenths = Math.floor(time % 10);\n if(tenths <= 9) {\n tenths = \"0\" + tenths;\n miliseconds.innerHTML = tenths;\n }\n incrementTime();\n }, 100);\n }\n}", "function appendTime() {\n count -= 10;\n}", "function countT() {\n ++Seconds;\n var hour = Math.floor(Seconds /3600);\n var minute = Math.floor((Seconds - hour*3600)/60);\n var xseconds = Seconds - (hour*3600 + minute*60);\n document.getElementById(\"time\").innerHTML = hour + \":\" + minute + \":\" + xseconds;\n}", "function updateTrackTime(){\n var currTimeDiv = document.getElementById('currentTime');\n var durationDiv = document.getElementById('duration');\n \n var currTime = (Math.floor(audio.currentTime * 1000)/1000).toString(); \n var duration = (Math.floor(audio.duration * 1000)/1000).toString();\n \n currTimeDiv.innerHTML = formatSecondsAsTime(currTime);\n \n if (isNaN(duration)){\n durationDiv.innerHTML = '00:00';\n } \n else{\n durationDiv.innerHTML = formatSecondsAsTime(duration);\n }\n }", "function addTime() {\n seconds++;\n if (seconds >= 60) {\n seconds = 0;\n minutes++;\n }\n time.textContent = `${(minutes ? (minutes > 9 ? minutes : '0' + minutes) : '00')}:${(seconds ? (seconds > 9 ? seconds : '0' + seconds) : '00')}`;\n}", "function increaseSeconds() {\n const elementSeconds = document.getElementById(\"seconds\");\n\n if (numSeconds < 59) {\n numSeconds++;\n } else {\n numSeconds = 0;\n }\n\n elementSeconds.innerHTML = numSeconds.toString().padStart(2, \"0\");\n}", "function timer() {\n\ttotalSeconds += 1;\n\tmins.textContent = Math.floor(totalSeconds / 60);\n\tsecs.textContent = zeroFill(totalSeconds % 60);\n}", "function add() {\n seconds++;\n if (seconds >= 60) {\n seconds = 0;\n minutes++;\n if (minutes >= 60) {\n minutes = 0;\n hours++;\n }\n }\n h2.textContent = (hours ? (hours > 9 ? hours : \"0\" + hours) : \"00\") + \":\" + (minutes ? (minutes > 9 ? minutes : \"0\" + minutes) : \"00\") + \":\" + (seconds > 9 ? seconds : \"0\" + seconds);\n timer();\n}", "function timeUpdate() {\n timeEngaged += delta();\n}", "function timeTrack() {\r\n tracker++;\r\n time = tracker / 50;\r\n}", "function update_time()\n{\n\ttime.timer++;\n\ttime.x += 2;\n\ttime.w -= 2;\n}", "function updateTime() {\r\n\ttimeSec += 1;\r\n\t\r\n\tif (timeSec > 60) {\r\n\t\ttimeSec = 0;\r\n\t\ttimeMin += 1;\r\n\t}\r\n\t\r\n\tvar t = document.getElementById(\"time\");\r\n\t\r\n\tif (timeSec < 10) {\r\n\t\tt.innerHTML = \"Time \" + timeMin + \":0\" + timeSec;\r\n\t} else {\r\n\t\tt.innerHTML = \"Time \" + timeMin + \":\" + timeSec;\r\n\t}\r\n}", "function showTime() {\n var elTimer = document.querySelector('.timer');\n gGame.secsPassed = parseInt((Date.now() - gStartTime) / 1000);\n elTimer.innerHTML = `${gGame.secsPassed}s`\n}", "function runTimer() {\r\n let currentTime =\r\n leadingZero(timer[0]) +\r\n \":\" +\r\n leadingZero(timer[1]) +\r\n \":\" +\r\n leadingZero(timer[2]);\r\n\r\n theTimer.innerHTML = currentTime;\r\n timer[3]++;\r\n\r\n timer[0] = Math.floor(timer[3] / 100 / 60);\r\n timer[1] = Math.floor(timer[3] / 100 - timer[0] * 60);\r\n timer[2] = Math.floor(timer[3] - timer[1] * 100 - timer[0] * 6000);\r\n}", "function setShotclockTimer(time) {\n var sec_ten = Math.floor(time / 10);\n var sec_one = time % 10;\n\n\tonLED('#shotclock_tens', SMALL_NUMBERS[sec_ten]);\n\tonLED('#shotclock_ones', SMALL_NUMBERS[sec_one]);\n}", "function incrementSeconds() {\n\t\t$(this.element).data('totalSeconds', getUnixSeconds() - $(this.element).data('startTime'));\n\t\trender(this);\n\n\t\t// Check if totalSeconds is equal to duration if any\n\t\tif ($(this.element).data('duration') &&\n\t\t\t$(this.element).data('totalSeconds') % $(this.element).data('duration') === 0) {\n\n\t\t\t// If 'repeat' is not requested then disable the duration\n\t\t\tif (!this.options.repeat) {\n\t\t\t\t$(this.element).data('duration', null);\n\t\t\t\tthis.options.duration = null;\n\t\t\t}\n\n\t\t\t// If this is a countdown, then end it as duration has completed\n\t\t\tif (this.options.countdown) {\n\t\t\t\tstopTimerInterval(this);\n\t\t\t\tthis.options.countdown = false;\n\t\t\t\t$(this.element).data('state', TIMER_STOPPED);\n\t\t\t}\n\n\t\t\t// Run the default callback\n\t\t\tthis.options.callback();\n\t\t}\n\t}", "function updateTimer() {\n //console.log(currentTime);\n formatTimeDuration(currentTime);\n var timeString = formatTime(currentTime);\n $stopwatch.html(timeString);\n currentTime += incrementTime;\n }", "function startTimer() {\r\n time++;\r\n let mins = Math.floor(time / 100 / 60);\r\n let secs = Math.floor(time / 100) - (mins * 60);\r\n mins.toFixed(2);\r\n secs.toFixed(2);\r\n if (mins < 10) {\r\n mins = `0${mins}`;\r\n }\r\n if (secs < 10) {\r\n secs = `0${secs}`;\r\n }\r\n timer.textContent = `${mins}:${secs}`;\r\n}", "timer(){\n //This sets the time for the seconds based upon the update speed\n this.secondCount = this.secondCount + 1;\n //A variable thats assigned the seconds to calculate the minutes\n this.secHolder = Math.trunc(this.secondCount/60)\n\n}", "timer(){\n //This sets the time for the seconds based upon the update speed\n this.secondCount = this.secondCount + 1;\n //A variable thats assigned the seconds to calculate the minutes\n this.secHolder = Math.trunc(this.secondCount/60)\n\n}", "function setTotalDuration(player) {\n const setTotalDuration = document.querySelector(\"#songTotalDuration\"); \n setTotalDuration.innerHTML = convertSecs(player.duration);\n}", "function startSeconds() {\n seconds++;\n}", "function timeUpdate() {\n // timeline width adjusted for playhead\n var timelineWidth = timeline_begin.offsetWidth - playhead_begin.offsetWidth;\n var playPercent = timelineWidth * (audio_begin.currentTime / duration_begin);\n playhead_begin.style.marginLeft = playPercent + \"px\";\n if (audio_begin.currentTime == duration_begin) {\n pButton_begin.className = \"\";\n pButton_begin.className = \"play\";\n }\n currentTime_begin.textContent = formatTime(audio_begin.currentTime);\n }", "function updateTimer(){\n if (pomo.isPaused) return;\n\n seconds -= 1;\n pomo.timerDisplay.innerHTML = makeSecondsReadable(seconds);\n\n if(seconds<=0) { //if timer is done then 'ding' and set timer to next interval\n console.log(\"play()\")\n pomo.isWork()? document.querySelector(\".tom\").play() : document.querySelector(\".tink\").play();\n setTimer() ;\n }\n }", "function fn() {\r\n let hours = Number.parseInt(counter / 3600);//\"Number.parseInt\" string ko no. mai convert kardega\r\n let RemSeconds = counter % 3600;\r\n let mins = Number.parseInt(RemSeconds / 60);\r\n let seconds = RemSeconds % 60;\r\n hours = hours < 10 ? `0${hours}` : hours;\r\n mins = mins < 10 ? `0${mins}` : mins;\r\n seconds = seconds < 10 ? `0${seconds}` : seconds;\r\n\r\n timings.innerText = `${hours}:${mins}:${seconds}`;\r\n counter++;\r\n }", "function updateTime() {\n\tlet curTime = Date.now();\n\t//divide by 1,000 to get deltaTime in seconds\n deltaTime = (curTime - prevTime) / 1000;\n //cap deltaTime at ~15 ticks/sec as below this threshhold collisions may not be properly detected\n if (deltaTime > .067) {\n \tdeltaTime = .067;\n }\n prevTime = curTime;\n totalTime += deltaTime;\n}", "function countTime() {\n if (!gameCompleted) {\n time++;\n timer[0].innerText = parseInt(time / 60) + ':' + (time % 60);\n } \n}", "adjustTime(tadj) {\nreturn this.timeStamp += tadj;\n}", "function updateTime() {\n time++;\n $('#timer').text('Game time: ' + time);\n}", "function updateTime(){\r\n if(!song_playing.ended){\r\n var currentMin = parseInt(song_playing.currentTime/60);\r\n var currentSec = parseInt(song_playing.currentTime%60);\r\n\r\n var size = parseInt(song_playing.currentTime * barSize/song_playing.duration);\r\n progressBar.style.width = size + \"px\";\r\n if($(\".current-song\").text().length > 27){\r\n song_to_display.innerHTML = $(\".current-song\").text().substring(0,24) + '...';\r\n }else{\r\n song_to_display.innerHTML = $(\".current-song\").text();\r\n }\r\n\r\n if (currentSec > 9) {\r\n\r\n duration.innerHTML = currentMin + \":\" + currentSec;\r\n }else{\r\n duration.innerHTML = currentMin + \":0\" + currentSec;\r\n }\r\n }else{\r\n song_playing.currentTime = 0;\r\n progressBar.style.width = \"0px\";\r\n }\r\n }", "function timeupdate() {\n var lastBuffered = video.buffered.end(video.buffered.length-1);\n seekbar.min = video.startTime;\n seekbar.max = lastBuffered;\n seekbar.value = video.currentTime;\n $('#timer').html(formatTime(video.currentTime));\n if(review == true)\n {\n\t sk.min = video.startTime;\n\t sk.max = lastBuffered;\n\t sk.value = video.currentTime;\n\t reviewText();\n }\n}", "function 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 updateTimeElapsed() {\n const time = formatTime(Math.round(video.currentTime));\n timeElapsed.innerText = `${time.minutes}:${time.seconds}`;\n timeElapsed.setAttribute('datetime', `${time.minutes}m ${time.seconds}s`)\n}", "function updateTime() {\n const toSecondStr = (ms) => (ms / 1000).toFixed(ROUND_DECIMALS);\n if (!isPlayingGame) return;\n id(\"score\").innerHTML = `Score: ${toSecondStr(timeElapsedMs)} seconds`;\n if (timeElapsedMs > highScore) {\n highScore = timeElapsedMs;\n }\n id(\"high-score\").innerHTML = `High score: ${toSecondStr(\n highScore\n )} seconds`;\n }", "function add() {\n seconds++;\n if (seconds >= 60) {\n seconds = 0;\n minutes++;\n if (minutes >= 60) {\n minutes = 0;\n }\n }\n timer.textContent = (minutes ? (minutes > 9 ? minutes : \"0\" + minutes) : \"00\") +\n \":\" + (seconds > 9 ? seconds : \"0\" + seconds);\n startTimer();\n}", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n // console.log(\"play 1\");\n $('.time-elapsed').text(fancyTimeFormat(Math.floor(song.currentTime)));\n $('.song-duration').text(fancyTimeFormat(Math.floor(song.duration)));\n // console.log(song.currentTime);\n // console.log(song.duration);\n if(song.duration==song.currentTime)//play the next song if previous song is over\n nextSong();\n}", "function runTimer() {\n currentTime =\n leadingZero(timer[0]) +\n \":\" +\n leadingZero(timer[1]) +\n \":\" +\n leadingZero(timer[2]);\n theTimer.innerHTML = currentTime;\n timer[3]++;\n\n timer[0] = Math.floor(timer[3] / 100 / 60);\n timer[1] = Math.floor(timer[3] / 100 - timer[0] * 60);\n timer[2] = Math.floor(timer[3] - timer[1] * 100 - timer[0] * 6000);\n}", "seconds(prevTime, curTime){\n let time = curTime - prevTime;\n let seconds = time/1000;\n return seconds.toFixed(2);\n}", "function increment() {\n\tdate.setSeconds(date.getSeconds() + 1);\n\tvar seconds = date.getSeconds();\n\tif (seconds < 10) {\n\t\tseconds = \"0\" + seconds;\t\n\t}\n\ttimeArea[0].innerHTML = date.getMinutes() + \":\" + seconds;\n}", "updateTimer() {\n var currentTime = new Date();\n var timeDifference = this.startTime.getTime() - currentTime.getTime();\n\n this.timeElapsed = Math.abs(timeDifference / 1000);\n\n var timeRemaining = this.totalTime - this.timeElapsed;\n\n var seconds = Math.floor(timeRemaining);\n\n var result = (seconds < 10) ? \"\" + seconds : \"\" + seconds;\n\n if (result >= 0){\n this.timeLabel.text = result;\n }\n }", "function setTime(){\n ++totalSeconds; //increment seconds\n var seconds = totalSeconds%60 + \"\"; //get seconds string \n\tif(seconds.length < 2) seconds = \"0\" + seconds; //to display a \"0\" in front of single-digit seconds\n var minutes = Math.floor(totalSeconds/60); //minutes string\n\ttimeString = (minutes + \":\" + seconds);\n}", "updateTimer() {\n\t\tlet timer = parseInt((Date.now() - this.gameStartTimestamp)/1000);\n\t\tthis.gameinfoElement.childNodes[1].innerHTML = \"<h1>Time: \" + timer + \" s</h1>\";\n\t}", "function timerTick() {\r\n\t\ttime++;\r\n\t\ttimerDiv.html(time);\r\n\t}", "function timeUpdater() {\n var totalValue = (100 / video.duration) * video.currentTime; // Calculate the slider value\n timeBar.value = totalValue; // Update the slider value\n }", "function updateTime(ti) {\n\tvar curDuration = bg.getCurDuration();\n\tvar progress = ti / 400;\n\n\tbg.setTime(progress * curDuration);\n}", "function onPlaybackUpdate(time, duration) {\n}", "function updateTimer() {\n\t\t\tvar timeString = formatTime(currentTime);\n\t\t\t$stopwatch.html(timeString);\n\t\t\tcurrentTime += incrementTime;\n\t\t}", "function UpdateGameTimer() {\n let secs = playingSeconds.toString();\n let mints = playingMinutes.toString();\n secs = secs < 10 ? 0 + secs : secs;\n mints = mints < 10 ? 0 + mints : mints;\n // if()\n displaytimerspan.innerHTML = `0${playingHours}:${mints}:${secs}`;\n\n playingSeconds += 1;//increment\n if (playingSeconds == 60) {//reseting\n playingSeconds = 0;\n playingMinutes += 1\n if (playingMinutes == 60) {\n playingMinutes = 0;\n playingHours += 1;\n }\n }\n}", "set timeRemaining(time){\n\t\tthis.durationInput.value = time.toFixed(2);\n\t}", "function timeElapsed() {\n timer.textContent = `Timer: ${seconds}`;\n seconds++;\n }", "function addSecond() {\n timer.innerHTML = minute+\" min \"+second+\" sec\";\n second++;\n if (second >= 60) {\n second = 0;\n minute++;\n if (minute >= 60) {\n minute = 0;\n hour++;\n }\n }\n stopWatch();\n}", "function sliderAvancement(time) {\n var seconds = player.duration * (time / 100);\n player.currentTime = seconds;\n if (player.paused) {\n player.play();\n }\n}", "function updateTimer(){\n if (secondsLeft < totalSeconds){\n liveTimeValue.textContent = totalSeconds - secondsLeft; \n } else {\n liveTimeValue.textContent = 0;\n } \n}", "function upTime(){\n\t\tif(playlist.length>0){\n\t\t\tmpd.send('status', function(r){\n\t\t\t\tconsole.log(mpd.response['time']);\n\t\t\t\tvar stime= mpd.response['time'].split(\":\");\n\t\t\t\tstatusv = mpd.response['state'];\n\t\t\t\tcurTime=parseInt(stime[0]);\n\t\t\t\tcurSongLength=parseInt(stime[1]);\n\t\t\t\tvar time= sec2min(curTime);\n\t\t\t\tcurSongTime= sec2min(curSongLength);\n\t\t \teveryone.now.updateTime(curTime,curSongLength,time[0],time[1],curSongTime[0],curSongTime[1]);\n\t\t\t});\n\t\t}\n\t\telse{\n\t\t\teveryone.now.updateTime(0,0);\n\t\t}\n\t}", "function advanceTime() {\n gameTime++;\n document.getElementById(\"time\").textContent = parseInt(gameTime/60) + \":\" + (\"0\" + gameTime%60).substr(-2, 2);\n /*The variable gameTimer is used to be able to stop the clock. */\n gameTimer = setTimeout(advanceTime, 1000);\n}", "function timer() {\n sec += 1;\n if (sec === 60) {\n min += 1;\n sec = 0;\n }\n\n for (let i = 0; i < timeEl.length; i++) {\n timeEl[i].innerText = min.pad(2) + \":\" + sec.pad(2);\n }\n }", "function setStartTime(newStart) {\n if (newStart < 0 || newStart < (snipWin / 2)) {\n songStart = 0;\n songEnd = snipWin;\n } else {\n songStart = parseFloat(newStart) - (snipWin / 2);\n songEnd = Math.abs(songStart) + snipWin\n }\n}", "updateTime(deltaTime){\n if(this.timeRemaining>0){\n this.timeRemaining -= deltaTime/1000;\n this.timeText.setText(Math.ceil(this.timeRemaining));\n }else{\n if(!this.gameOverTriggered){\n this.onGameOver();\n\n }\n }\n\n }", "function timer(){\n\tif(!start){\n\t\ttime+=1\n\t\tminutes = (Math.floor(time/60) < 10) ? '0' + Math.floor(time/60).toString() : Math.floor(time/60).toString()\n \tseconds = (time % 60 < 10) ? '0' + (time % 60).toString() : (time % 60).toString();\n\t}\n\t\n\t}", "function timeUpdate() {\n\tvar playPercent = timelineWidth * (music.currentTime / duration);\n\tplayhead.style.marginLeft = playPercent + \"px\";\n\tif (music.currentTime == duration) {\n\t\tpButton.className = \"\";\n\t\tpButton.className = \"play\";\n\t}\n}", "function addTime() {\n timer = timer + 30;\n}", "function adelantar() {\n\n \n video.currentTime += 10;\n console.log(video.currentTime)\n}" ]
[ "0.6950761", "0.68150246", "0.67656493", "0.65703493", "0.6562626", "0.65467334", "0.65063256", "0.64813876", "0.6477621", "0.64759576", "0.6474559", "0.64367175", "0.6428651", "0.64158666", "0.64085037", "0.6401229", "0.6379555", "0.63769436", "0.63725543", "0.63715714", "0.6358886", "0.63525444", "0.63336056", "0.6331998", "0.6331765", "0.63292456", "0.63104326", "0.63046867", "0.6303134", "0.62998873", "0.62965596", "0.62828696", "0.6281231", "0.62779933", "0.62582064", "0.62538755", "0.6249299", "0.6249224", "0.6248447", "0.62444973", "0.6230514", "0.6222969", "0.62098444", "0.6208586", "0.6204047", "0.62007546", "0.6200386", "0.6189359", "0.6188395", "0.6186939", "0.618422", "0.6177084", "0.6176916", "0.6168338", "0.61636347", "0.61621654", "0.614604", "0.614604", "0.6141093", "0.6140703", "0.6139679", "0.6138767", "0.61329776", "0.61313814", "0.61256504", "0.61153305", "0.61124164", "0.61049956", "0.6093618", "0.60890675", "0.6087536", "0.60826635", "0.6073735", "0.60720015", "0.6057589", "0.6056242", "0.60548323", "0.60539925", "0.6046405", "0.6043347", "0.60411507", "0.60385764", "0.60359997", "0.6035317", "0.603373", "0.6030627", "0.6027691", "0.6026064", "0.60238785", "0.60173786", "0.60128653", "0.6010621", "0.6006856", "0.6006577", "0.60047704", "0.60026217", "0.6001918", "0.6000697", "0.60002476", "0.59974533" ]
0.6912446
1
start the timer when game page is clicked
function startTimer(){ timePlayed = 0; penaltyTime = 0; finalTime = 0 ; timer = setInterval(addTime,100); gamePage.removeEventListener('click',startTimer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleStartGame() {\n console.log(\"Start Game clicked...!\");\n\n //------- Timer ------- //\n\n // Start Timer\n startTimer(0);\n}", "function startGame(){\n hideContent();\n unhideContent();\n assignButtonColours();\n generateDiffuseOrder();\n clearInterval(interval);\n setlevel();\n countdown(localStorage.getItem(\"theTime\"));\n listeningForClick();\n}", "function startGame() {\n\t\tvar game = document.getElementById(\"game-area\");\n\t\ttimeStart();\t\t\t\t\n\t}", "function start(data) {\n startGameTimer();\n}", "function startGame() {\n // console.log('Clicked')\n var startTime = new Date(),\n endTime = new Date(),\n seconds = (endTime - startTime) / 1000\n console.log() \n }", "function gameStart(){\n\t\t\tshuffleCards();\n\t\t\ttime = 0;\n\t\t\tstarttime = Date.now();\n\t\t\ttimer = setInterval(function(){\n\t\t\t\ttime++;\n\t\t\t\t$(\".info .timer .sec\").text(time);\n\t\t\t}, 1000);\n\t\t}", "function startGame() {\n timerStat = true;\n showGamePanel();\n runTimer();\n displayImage();\n}", "function startGame()\n{\n \nbuttonStart.disabled = 'disabled';\nisPlaying = true;\nrenderScore();\n\ntimer = setInterval(clock,1000);// 1000 duration counting time\n}", "function startTimer() {\n quizPage.hidden = false;\n homePage.hidden = true;\n setTimer();\n renderQuestions();\n}", "function startIdleGame() {\n score = idleClicks;\n updateScore();\n\n // Enable the click button\n clickButton.disabled = false;\n\n // Remove the timer display\n timerElement.textContent = \"\";\n\n timer = null;\n}", "function startTimer() {\n\tgameData.timer = setInterval(timerData.timeCounter, 1000);\n}", "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 doTimer() {\n\tstartbtn.style.display = 'none'\n\tdocument.querySelector('.blink').innerHTML = '<h3>Your time has started</h3>'\n\tif (!timer_is_on) {\n\t\ttimer_is_on = 1;\n\t\ttimedCount();\n\t}\n}", "function startIdleGame() {\n score = idleClicks;\n updateScore();\n\n // Enable the click button\n clickButton.disabled = false;\n\n // Remove the timer display\n timerElement.textContent = \"\";\n\n timer = null;\n\n // Start the idle timer\n idleTimer();\n}", "function timerStart(){\n\t\n\t\t\n\t}", "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 onStartClick() {\n resetTimer();\n interval = setInterval(function () {\n updateTimer(-1);\n //Stop the time loop when counter reaches 0\n if (counter < 1) {\n clearInterval(interval);\n }\n }, 1000); //1000 ms = 1 seconds which is the interval between the function execution\n \n hideDetails();\n startQuiz();\n}", "function startTimer() {\n setTimeout(function () {\n //when game is stopped timer from previous game shouldn't infere\n if (!pausedGame) timerDone = true;\n }, 10000);\n}", "function startGame() {\n startTimer();\n landingPage.classList.add(\"hide\");\n quizPage.classList.remove(\"hide\");\n timerEl.classList.remove(\"hide\");\n}", "gameStart() {\n this._model.resetState();\n result.stats.percent = false;\n\n this._stopFn = timer(this._model.maxTime, this._goToResults);\n document.body.addEventListener('timer-tick', this._tick, false);\n\n this._timer.classList.remove('invisible');\n this._switchToNext(0, this._questions);\n }", "function startGame() {\n\n initializeGlobalVariables();\n setStars(3);\n $('#deck').empty();\n $('#moves-counter').text(0);\n\n shuffle(cardList);\n renderCards();\n $('.card').click(onClickEvent);\n\n try {\n timer.start();\n } catch (error) {\n if (error.message.includes(\"Timer already running\")) {\n timer.stop();\n timer.start();\n }\n }\n $('#timer').html(\"00:00:00\");\n}", "function startGame(){\n if(!gameStarted){\n gameStarted = true;\n startGame1 = true;\n $scoreP1.text(0);\n timeUp = false;\n p1Score = 0;\n highlight();\n countdown();\n setTimeout(() => {\n timeUp = true;\n $player1PopUp.css('display', 'block');\n $p1ScoreDisplay.text(p1Score);\n },15000);\n }\n }", "function startGame() {\r\n countUp = 0;\r\n setTimeout(endGame, 120000);\r\n startTimer();\r\n cancelTimer = false;\r\n triggerCrime();\r\n}", "startCountdown() {\n this.setGameValues();\n this.timerStart = new Date().getTime();\n this.countdownInterval = setInterval(this.updateTime, 1000);\n }", "function onStartClick() {\n turn = 1;\n // document.getElementById('turn').textContent = `turn: ${turn}`;\n simonTimer = setInterval(onTimerClick, 1000);\n colorArrayIndex = Math.floor(Math.random() * 4);\n simonsTurnArray.push(colorArray[colorArrayIndex]);\n document.getElementById('start').style.visibility = \"hidden\";\n }", "function startTimer() { // Timer begins incrementing 1 second after the user clicks?\n liveTimer = setInterval(function() {\n timer.innerHTML = `${minute} min ${second} sec`;\n second++;\n if (second == 60) {\n minute++;\n second= 0 ;\n }\n if (minute == 60) {\n hour++;\n minute= 0 ;\n }\n }, 1000);\n }", "startGame() {\n //Grab a new word\n words.RandomWord();\n //Disable Start button\n grabStartBTN.disabled = true;\n //Start the timer\n gameTimer();\n }", "function startGame() {\n //startGame function will... reset stats in case coming from results page\n right = 0;\n wrong = 0;\n not = 0;\n counter = 90;\n //hide welcome div\n $(\"#welcome-page\").toggle();\n //show questions div\n $(\"#questions-page\").toggle();\n //start setTimeInterval\n timer = setInterval(countDown, 1000)\n }", "function startTimer(){\n gameTimer= setInterval(countUpTimer, 1000);\n}", "function timerola (){\n\tsetInterval(startGame,1000/60);\n}", "function starttimer()\n{\n\tvar seconds = 1;\n\tthis.timer = setInterval(function(){\n\t\t$('#time').text(`Score: ${seconds}`);\n\t\tseconds++;\n\t},1000);\n}", "function startGame(){\n initializeVariables();\n shuffleCards(cards);\n displayCards(cards);\n hideResults();\n $('.odometer').html(score);\n $('#refresh-column').hide();\n $(\"#timer\").TimeCircles({count_past_zero: false}).addListener(countdownComplete).addListener(activateFreezePowerUp);\n $(\"#timer\").TimeCircles().stop();\n $('#overlay').css('display', 'none');\n $(\"#try-again\").click(function(){\n restartGame();\n });\n $('#start-button').click(function(){\n startTimer();\n });\n $('#refresh-button').click(function(){\n restartGame();\n });\n}", "function moveCounter(){\n moves++;\n counter.innerHTML= moves;\n //start timer on first click\n if(moves == 1){\n second = 0;\n minute = 0; \n hour = 0;\n startTimer();\n } \n}", "function startTime() {\n setTimer();\n}", "function startGameTimer(){\n var timer = setInterval(() => {\n console.log(GMvariables.timerSecs);\n $(\"#timer\").text(GMvariables.timerSecs);\n if(GMvariables.timerSecs == 0){\n $(\"#timer\").text(\"Go\");\n clearInterval(timer);\n setTimeout(() => {\n $(\"#timer\").css(\"display\", \"none\");\n reset();\n changePositionOfElement();\n headerUpdater();\n }, 1000);\n }\n GMvariables.timerSecs -= 1;\n }, 1000);\n \n}", "function timer() {\n count = count - 1;\n\n if (count <= 0) {\n clearInterval(counter);\n if (!$(\".overlay\").hasClass(\"open\")) {\n $(\".overlay h1\").html(\"Isteklo vreme... :/\");\n $(\".overlay\").css({ display: \"flex\" });\n $(\"#new_game\").click(function () {\n location.reload();\n });\n }\n return;\n }\n $(\".time-counter\").html(count);\n }", "function TimerStart()\n{\n\ttimer = window.setInterval(TimerTick, Game.interval);\n}", "function startTimer() {\n if (stoptime) {\n stoptime = false;\n runClock();\n }\n}", "function startTimer() {\n minutes = times.sessionMinutes;\n seconds = minutes * 60;\n document.getElementById('top-label').innerText = times.breakMinutes + ' minute break coming up';\n document.getElementById('label').innerText = 'Session';\n toggleTop();\n document.body.style.background = 'tomato';\n toggleControlButtons();\n interval = setInterval(timer, 1000);\n }", "function startGameClock() {\n if (gameStart == 0) {\n gameStart = 1;\n gameClock(); \n }\n}", "function startTimer() {\n $(\"#timer\").text(\"Time Remaining: \" + timeRemaining);\n // count down by 1 second\n time = setInterval(countDown, 100);\n // hides the start button so start can't be pressed again\n $(\"#start-screen\").empty();\n // calls function to display trivia\n displayQuestions();\n }", "function start() {\n startBtn(); \n setTimer(3);\n changeImage();\n displayTimer();\n active();\n}", "function startTimer() {\n // Each button comes with data-time that is a string of the number of minutes\n const seconds = parseInt(this.dataset.time); // convert to number\n timer(seconds); // start timer\n}", "start() {\n timer.start();\n }", "function startTimer() {\n if(started == false ){\n started = true;\n myp5.background(200, 200, 200, 0);\n startTime = Date.now();\n }\n}", "function startTimer() {\n // Set time remaining based on selection\n if (id(\"time-3\").checked) {\n timeLeft = 180;\n } else if (id(\"time-5\").checked) {\n timeLeft = 300;\n } else {\n timeLeft = 600;\n }\n // Set the timer for first second\n id(\"timer\").textContent = timeConvert(timeLeft);\n // Timer to update every second\n timer = setInterval(function() {\n timeLeft --;\n // If time runs out, end the game\n if (timeLeft === 0) {\n gameOver();\n }\n id(\"timer\").textContent = timeConvert(timeLeft);\n }, 1000); // function runs every 1000 ms\n}", "function startGame() {\n timer = setInterval(start, timerCd) \n}", "function timer(){\n\t//Timer uses global variable time set to zero and continually addes 1 second to its time when start button is activated \n\t//Display the number of seconds\n\t$(\"#timer-display\").html(time);\n\ttime++;\n\tif (running)\n\t\t// use variable for setTimeout method\n\t\tmyVar = setTimeout(timer,1400);\n}", "function startGame() {\n console.log('start button clicked')\n $('.instructions').hide();\n $('.title').show();\n $('.grid_container').show();\n $('.score_container').show();\n $('#timer').show();\n // soundIntro('sound/Loading_Loop.wav');\n }", "go() {\n\t\tthis.context.analytics.record(\"Game Loaded\");\n\t\tthis._$template.css({ \"visibility\": \"visible\"}).hide().fadeIn();\n\t\tthis._$start = $(\".start\", this._$template);\n\n\t\tthis._$start.on('click', (e) => {\n\t\t\te.preventDefault();\n\t\t\tthis._$template.fadeOut(() => {\n\t\t\t\tthis.nextState(\"playing\");\n\t\t\t});\n\t\t});\n\t}", "start() {\n this.isRunning = true;\n this.secondsChecker = new SecondsChecker(Date.now(), Date.now() + 60);\n\n if (typeof this.onGameStart === 'function') {\n this.onGameStart();\n }\n }", "function start() {\n\t\ttimer--;\n\t\t$('#timer').text(\"Time Remaining: \" + timer + \" Seconds\");\n\n\t\tif (timer == 0) {\n\t\t\tclearInterval(countdown);\n\t\t\ttimer = 0;\n\t\t\t$('#timer').text(\"Time Remaining: \" + timer + \" Seconds\");\n\n\t\t\tscore();\n\t\t\t\n\t\t}\n\t}", "function startGame() {\n\t\tstatus.show();\n\t\tinsertStatusLife();\n\t\tsetLife(100);\n\t\tsetDayPast(1);\n\t}", "function startGameTimer() {\n clearInterval(gameClock);\n gameClock = setInterval(gameTimer, 1000);\n}", "function startGame() {\n setTimeRemaining(starting_time)\n setShouldStart(true)\n setText(\"\")\n textboxRef.current.disabled = false\n textboxRef.current.focus()\n }", "function startGame() { //start btn\n\n secs = 60;\n seconds.innerHTML = secs; //set primary time\n startBtn.style.display = \"none\"; //hide the start button\n spinDiv.style.display = \"block\"; // unhide the spiner\n p.innerHTML = grade; //count points on screen\n timer();\n}", "function timeOn(){\n\tgameTime = setInterval(function(){\n\t\tt++;\n\t\t$(\"#time\").html(t);\n\t},1000);\n}", "function startGame() {\n pageTransition(\"blankpage\");\n setTimeout(function(){window.location.href = \"./game.html\"}, 800);\n}", "function startTimer() {\n site.stTime = new Date().getTime();\n}", "function startGame(e) {\n e.preventDefault;\n var timeEl = document.getElementById(\"timer\");\n var timerId = setInterval(function() {\n timeLeft -=1;\n \n if(timeLeft <= 0) {\n clearInterval(timerId);\n }\n timeEl.innerText = timeLeft;\n \n \n },1000)\n \n question();\n}", "function startCountDown(s){\n\tif(t == 0){\n\t\tgameStart = false;\n\t\tclearTimeout(startTimer);\n\t\tresetAll();\n\t\tgameOver(s);\n\t\tbutton[0].removeEventListener(\"click\", quit);\n\t\tbutton[0].addEventListener(\"click\", beginGame);\n\t\taddClick();\n\t}else{\n\t\t\n\t\tpicTimer = setInterval(function(){ \n \t\tsetImage();\n \t\tclearTimeout(picTimer);\n \t}, 20);\n \tresetAll();\n\n\t\tpicDownTimer = setInterval(function(){\n \t\tclearTimeout(picDownTimer);\n \t \t}, 1550);\n \t \tremoveClick();\n\t\ttimer.innerText -= 1; \n\t\tt--;\n\t}\n}", "function timer(){\r\n\tdocument.getElementById(\"myTimer\").innerHTML = \"Time: \" + time;\r\n\ttime++;\r\n\tif (time == 60){\r\n\t\tgame_win();\r\n\t}\r\n}", "function startGame(){\n countStartGame = 30;\n correctAnswers = 0;\n wrongAnswers = 0;\n unanswered = 0;\n\n if (!timerRunning){ \n intervalId = setInterval(timer, 1000);\n timerRunning = true;\n }\n timer();\n console.log(\"game startiiing\");\n \n}", "function startNewGame() {\n // Possible speeds\n var speeds = {\n 0: 60,\n 200: 77,\n 500: 120,\n 800: 300\n };\n\n // Getting speed based on difficulty\n var speed = difficulty.options[difficulty.selectedIndex].value;\n\n var moleTimer = new Timer({\n seconds: speeds[speed],\n speed: speed,\n onTime: function() {\n if (!gameEnded) {\n renderMole();\n }\n }\n });\n\n // Start timer.\n gameTimer.start();\n moleTimer.start();\n\n // New game\n gameEnded = false;\n }", "function startTimer() {\n setTime();\n if (totalSeconds > 0) {\n setInterval(function() {\n secondsElapsed++;\n renderTime();\n }, 1000);\n } \n }", "function setTime() {\n //increments timer\n ++totalSeconds;\n //temporarily stops timer at 5 seconds for my sanity\n if (totalSeconds === 59) {\n totalMinutes += 1;\n totalSeconds = 0;\n }\n\n //stops timer when game is won\n if (gameWon === true) {\n return;\n }\n //calls function to display timer in DOM\n domTimer();\n }", "function startTimer() {\n status = 1;\n timer();\n }", "function onTimer(e) \n{\n\tif (e == \"clock\") \n\t{\n\t\tif (timerRunning) \n\t\t{\n\t\t\tdecreaseSecond();\n\t\t\tscene.setTimer(e, 1);\n\t\t}\n\t}\n}", "function startGame() {\n\taudio.play();\n\tif(!(popup.classList.contains('cache'))){\n\t\tpopup.classList.add('cache');\n\t}\n\trandompresident();\n\twindow.setInterval(function a(){\n\t\tif(mich > 0){\n\t\t\tmich--\n\t\t\ttemps.textContent= mich}}, 1000);\n\tscoreBoard.textContent = 0;\n\ttimeUp = false;\n\tscore = 0;\n\tsortietrou();\n\tsetTimeout(function time(){\n\t\ttimeUp = true;\n\t\tpopup.classList.remove('cache');\n\t\taudio.pause();\n\t},15000)\n\tvar mich = 15;\n}", "function start() {\n var homepageEl = document.getElementById('homepage');\n questionEl.removeAttribute(\"class\"); // removes the main screen display once the button was clicked \n\n timerId = setInterval(timer, 5000); // sets a timer\n\n time.textContent = timeRemaining; // displays timer\n\n pullQuestion(); // once the quiz starts, the function pulls out a question.\n}", "function countDown()\n{\n //Reduce the time\n if (timer > 0)\n {\n timer--;\n document.getElementById('timer').innerHTML = timer;\n }\n //End the turn when time runs out\n else if (timer == 0)\n {\n window.dispatchEvent(thisPlayerEndTurn);\n }\n}", "function startGame(){\n // disable the start button when the timer is still going\n isFinished = false\n headerIntro.style.display = \"none\";\n\n // call renderQuestion() to render the question\n renderQuestion();\n\n // run timer\n var timeInterval = setInterval(function(){\n timeLeft--;\n timerDisplay.textContent = timeLeft;\n\n // Check is the time has run out or if all the questions have been answered\n if (isFinished || timeLeft === 0){\n clearInterval(timeInterval);\n renderScore(); // call renderScore() to display the score and submit initials\n }\n }, 1000);\n \n}", "function startGame() {\n\t\n\t// fill the question div with new random question\n\tgenerateQuestion();\n\t\n\t// start the timer\n\tmoveProgressBar();\n}", "function startGame() {\n const interval = setInterval(() => {\n console.log(\"run interval\", timer);\n setTimer((prevTimer) => {\n if (prevTimer > 0) {\n return prevTimer - 1;\n } else{\n clearInterval(interval);\n return 0;\n }\n });\n }, 1000);\n // refTimer.current = interval;\n setDisabled(true);\n }", "function timerEvent() {\n if (tijd > 0)\n {\n //count down\n tijd -= 1;\n //tekst met tijd erin\n var tekst = \"Time = \" + tijd + \"s\";\n //zet op scherm\n $(\"#time\").text(tekst);\n \n }\n else\n {\n //tijd is op\n $(\"#time\").text(\"Time is up\"); \n //game over\n gameOver();\n //ga naar de gameoverpagina \n $(location).attr( 'href' , \"#pagina_gameOver\");\n } \n \n}", "function startGame() {\n hideStart();\n hideSaveScoreForm();\n resetFinalScore();\n clearCurrentQuestion();\n resetUserScore();\n displayCurrentQuestion();\n startTimer();\n}", "function timerClick() {\n\n \n\n if (timer === null) {\n timer = setInterval(countdown, 1000);\n } else {\n clearInterval(timer);\n timer = null;\n }\n}", "function startTimer() {\r\n let clockOff = true;\r\n $('.deck').click(function() {\r\n if (event.target.classList.contains('card')) {\r\n if (clockOff == true) {\r\n timer();\r\n clockOff = false;\r\n }\r\n }\r\n });\r\n }", "function startGame(){\n\ttime = setInterval(deleteMarker, 5000);\n\t\n\tif (clicked == false) {\n clock = setInterval(stopWatch, 1000);\n clicked = true;\n }\n else if (clicked == true) {\n\t\tstopClock();\n }\n\n}", "function timerStart() {\n timer = setInterval(function tick(){\n timeInSeconds++;\n updateTimerDisplay(timeInSeconds);\n }, 1000);\n}", "function startTimer() {\n if (timeLeft == 0) {\n gameEnded();\n } else {\n gameOn = true;\n setTimeout(printTime, 1000);\n }\n}", "function turnOnGame() {\r\n if (!gameIsStarted) {\r\n gameIsStarted = true;\r\n ticking = setInterval(timeStart, 17.5);\r\n }\r\n}", "function startTimer() {\n saveItemInLocalStorage('start',true);\n timer= setInterval(showTimer,1000 );\n}", "function startTimer() {\n clockRunning = true;\n\n // Reset clock\n clearInterval(countdownTimer);\n countdownTimer = setInterval(decrement, 1000);\n seconds = 20;\n timer.html(seconds);\n }", "function startTimer() {\n\t\tlet timer = localStorage.getItem('Timer') * 60; // turn minutes into seconds\n\t\tlet minutes;\n\t\tlet seconds;\n\t\tconst countdown = document.getElementById('timer');\n\t\tconst overlayEnd = document.getElementById('endgame-overlay');\n\n\t\tsetInterval(() => {\n\t\t\tminutes = parseInt(timer / 60, 10);\n\t\t\tseconds = parseInt(timer % 60, 10);\n\n\t\t\tminutes = minutes < 10 ? `0${minutes}` : minutes;\n\t\t\tseconds = seconds < 10 ? `0${seconds}` : seconds;\n\n\t\t\tlocalStorage.setItem('TimerMinutes', minutes);\n\t\t\tlocalStorage.setItem('TimerSeconds', seconds);\n\n\t\t\tconst xminutes = localStorage.getItem('TimerMinutes');\n\t\t\tconst xseconds = localStorage.getItem('TimerSeconds');\n\n\t\t\tif (xminutes && xseconds) {\n\t\t\t\t// putting timer in html\n\t\t\t\t// eslint-disable-next-line no-param-reassign\n\t\t\t\tcountdown.textContent = `${xminutes}:${xseconds}`;\n\t\t\t} else {\n\t\t\t\tcountdown.textContent = '00:00';\n\t\t\t}\n\n\t\t\t// when the timer has stopped\n\t\t\tif (--timer < 0) {\n\t\t\t\tcountdown.textContent = 'Game over';\n\t\t\t\toverlayEnd.style.display = 'flex';\n\t\t\t\tdeleteTimer();\n\t\t\t}\n\t\t}, 1000);\n\t\t// function to show progress bar\n\t\tstartBar();\n\t}", "function init (){\n\t\ttimer = 30;\n\t\t//activates game area for user click. \n\t\t$(\"#area\").on(\"click\", userPlay);\n\t\t//starts Timer countdown. \n\t\tcountdown = setInterval(updateTimer, 1000);\n\t\tflashDogs();\n\t\t$('#scoreKeeper').html(score);\t\n\t}", "function startTimer(){\n\n // ParseInt to only get whole number\n const seconds = parseInt(this.dataset.time);\n timer(seconds);\n}", "function startTimer() {\n \tif (clicks === 1) {\n \tvar sec = 0;\n \tfunction time ( val ) { return val > 9 ? val : \"0\" + val; }\n \ttimer = setInterval( function(){\n \t\t$(\".seconds\").html(time(++sec % 60));\n \t\t$(\".minutes\").html(time(parseInt(sec / 60, 10)));\n \t}, 1000);\n \t}\n}", "function onBoardClick() {\n if (!hasStarted) {\n startGame();\n } else {\n startPause();\n }\n }", "function startGame() {\n \n $(\"#start-button\").html(\"<button id='btn-style'>Start Game</button>\");\n $(\"#start-button\").on('click', function () {\n $(\"#start-button\").remove();\n startTimer();\n getQuestion();\n });\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 startGame() {\n var select = document.getElementById(\"time\");\n var value = select.options[select.selectedIndex].value;\n console.log(value); // en\n var duration = value; // 10 seconds\n hide(startBtn);\n score = -1;\n score2 = -1;\n ended = false;\n // we get start time\n startTime = new Date().getTime();\n\n // we create a timer with the setInterval method\n var timerId = setInterval(function () {\n var total = (new Date().getTime() - startTime) / (value * 100);\n // console.log(total);\n // console.log(new Date().getTime() - startTime)\n console.log(new Date().getTime() - startTime)\n\n // while total lower than duration, we update timer and the clicks by seconds\n if ((new Date().getTime() - startTime) < (duration * 1000)) {\n timerTxt.textContent = ((new Date().getTime() - startTime)/ 1000).toFixed(3);\n clicksTxt.textContent = (score / total).toFixed(2);\n clicksTxt2.textContent = (score2 / total).toFixed(2);\n } else {\n // otherwise, game is ended, we clear interval and we set game as ended\n ended = true;\n clearInterval(timerId);\n // we call the end game method\n endGame();\n }\n }, 1);\n}", "function start(){\n if(timerStarted){\n timerStarted = false;\n document.getElementById(\"start-button\").innerHTML = \"Start\";\n }\n else{\n timerStarted = true;\n if (sessionInProgress){\n startSession();\n }\n else{\n startBreak();\n }\n \n document.getElementById(\"start-button\").innerHTML = \"Stop\";\n }\n}", "function timer() {\r\n count ++;\r\n if(count === 31){ //restart Game at the 31st second\r\n context.clearRect(0, 0, canvas.width, canvas.height);\r\n end_screen();\r\n clearInterval(startCounterIntv);\r\n gameStarted = false;\r\n }\r\n }", "function startGame() {\n totalWin = 0;\n totalLoss = 0;\n totalUnans = 0;\n gameNum = 1;\n timer = 30;\n\n $(\"#finalScreen\").hide();\n $(\".startBtn\").hide();\n cycleGame();\n}", "function timer(time){\n var display = document.querySelector('#time');\n var timer = time;\n //Prevents the spamming of Start game\n clearInterval(interval)\n interval = setInterval(function() {\n minutes = parseInt(timer / 60, 10)\n seconds = parseInt(timer % 60, 10);\n minutes = minutes < 10 ? \"0\" + minutes : minutes;\n seconds = seconds < 10 ? \"0\" + seconds : seconds;\n\n display.textContent = minutes + \":\" + seconds;\n //Checks pause status every second\n if (!pause){\n --timer;\n //Game lost\n if (timer < 0) {\n var x = document.getElementsByClassName(\"time-box\");\n x[0].style.background = \"#F2403F\";\n gameStatus(\"lose\")\n disableGame();\n clearInterval(interval);\n on();\n clearInterval(interval);\n }\n }\n }, 1000);\n}", "function start() {\n startPageEl.style.display = \"none\";\n questionsPgEl.style.display = \"block\";\n \n\n //time\n timeInterval = setInterval(function () {\n timer--;\n\n timerEl.textContent = \"Timer\" + \" \" + timer;\n\n if (timer === 0) {\n clearInterval(timeInterval);\n quizEnd();\n }\n }, 1000);\n}", "function startGame() {\n hitCount = 0\n\n if (isSettingsInitialized) {\n console.log('Settings initialized')\n loadSettings()\n }\n\n togglePanel(panel.PREGAME)\n generateLayout()\n\n maxSpawns = Math.floor(maxTime / spawnRate)\n remainingSpawns = maxSpawns\n\n for (let s = 0; s < maxSpawns; s++) {\n spawnTimeouts.push(setTimeout(spawnYagoo, spawnRate * s))\n }\n\n startTimer(msToSec(maxTime), document.getElementById('timer-text'))\n}", "function startTimer() {\n\tconst seconds = parseInt(this.dataset.time); //grab data attr value\n\ttimer(seconds); //set value to timer fn\n}", "function startTimerForQA() {\n renderQuestionForUI();\n renderTimerForUI();\n renderQuestionListNavigationForUI();\n switchModeOfTimerControlButton(START);\n}" ]
[ "0.77113634", "0.75670224", "0.7457882", "0.73968923", "0.7395782", "0.7374492", "0.73582786", "0.7290571", "0.7227283", "0.70469564", "0.7036212", "0.69891083", "0.69758266", "0.6941174", "0.693677", "0.69026834", "0.6897432", "0.6844699", "0.6830083", "0.6826668", "0.6825231", "0.68239605", "0.68232566", "0.6815682", "0.68001187", "0.67844886", "0.67819554", "0.6768253", "0.6767628", "0.67656565", "0.6754701", "0.6729996", "0.67290205", "0.67275995", "0.67236876", "0.67184836", "0.6715561", "0.6698984", "0.66844195", "0.66816115", "0.66814107", "0.66772574", "0.6672312", "0.6644778", "0.66429454", "0.6638715", "0.6636781", "0.66315985", "0.66315615", "0.6628881", "0.662762", "0.6611772", "0.66090465", "0.6604351", "0.6602492", "0.6584537", "0.6580377", "0.6573162", "0.65695107", "0.65688366", "0.65686804", "0.65664786", "0.65599793", "0.65592396", "0.6547203", "0.65431833", "0.65343904", "0.6532326", "0.6531326", "0.6530208", "0.652983", "0.65284294", "0.6524951", "0.6520374", "0.6518864", "0.65150404", "0.6514651", "0.6507906", "0.6503478", "0.6501417", "0.6498121", "0.64963305", "0.6487809", "0.64866626", "0.64863145", "0.6483357", "0.6477587", "0.646817", "0.644895", "0.6448676", "0.6447647", "0.64457715", "0.64404196", "0.6434522", "0.6432543", "0.64323926", "0.64261997", "0.642459", "0.6420858", "0.64084315" ]
0.6494668
82
update the best score array
function updateBestScore(){ //select correct best score to update bestScoreArray.forEach((score,index) => { if(questionAmount == score.questions){ //return bast score as a number with one decimal const savedBestScore = Number(bestScoreArray[index].bestScore); //update new final score is less or replace zero if(savedBestScore ===0 || savedBestScore > finalTime){ bestScoreArray[index].bestScore = finalTimeDisplay; } } }); //update Splash Page bestScoreToDOM(); //saved to local storage localStorage.setItem('bestScores',JSON.stringify(bestScoreArray)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScores(){\n currentScore = currentGame.length;\n if (bestScore <= 0){\n //update best score from storage.\n var prevScore = scorestorage.getRecord(KEY_BEST_SCORE); \n if (prevScore){\n bestScore = prevScore;\n }\n scoreboard.updateBestScore(bestScore );\n }\n if (bestScore < currentScore ){\n scoreboard.updateBestScore(bestScore = currentScore );\n scorestorage.setRecord(KEY_BEST_SCORE, bestScore);\n }\n scoreboard.updateCurrentScore(currentScore);\n }", "function updateScore() {\n currentScore = ansArray.length;\n $('#currentScore').text(`Current Score = ${currentScore}`);\n\n if (parseInt(highScore) === 0) {\n highScore = currentScore;\n $('#highScore').text(`High Score = ${highScore}`);\n } else if (parseInt(currentScore) > parseInt(highScore)) {\n highScore = currentScore;\n $('#highScore').text(`High Score = ${highScore}`);\n }\n }", "function updateScores() {\n lastScore.innerText = 'Last score: ' + score;\n if (score > bestScore) {\n bestScore = score;\n displayBestScore.innerText = 'Best Score: ' + bestScore;\n }\n}", "function updateScore(){\n\n\t\tvar scoreInArr = false; //A variable to keep track if the score is already in the array\n\t\tfor(var i = 0; i<highscoreArr.length;i++){ //Check so that the a certain score isn't added twice\n\t\t\t\tif(currentScore == highscoreArr[i]){\n\t\t\t\t\tscoreInArr = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\n\t\tif(!scoreInArr && currentScore !== 0){\t//Only add score if it isn't already in the highscore Array or if its zero.\n \thighscoreArr.push(currentScore);\t//Add new score\n\t\t}\n\n \thighscoreArr.sort(function(a,b){\t//sort the highscoreArr\n\t\t return b-a;\n\t });\n\n\tif(highscoreArr.length > 10) {//Remove the last element if there are more than 10 highscores saved.\n\t\thighscoreArr.pop();\n\t}\n\n\tif(highscoreArr[0] !== undefined){\t//Check so that there even is any first element in the array.\n\t\thighscoreElt.innerHTML = highscoreArr[0];//Display the new highest highscore\n\t}\n\n\twindow.localStorage.highscores = JSON.stringify(highscoreArr);//Put a new highscore arr in the localstorage\n\n\tcurrentScore = 0;\n\tcurrentScoreElt.innerHTML = currentScore;\n}", "function updateScore(newScoreArray) {\n for (let i = 0; i < 13; i++) {\n if (!currentPlayer.selectedScores[i]) {\n currentPlayer.eachScore[i] = newScoreArray[i];\n currentPlayer.scoreDisplay[i].textContent = currentPlayer.eachScore[i];\n }\n }\n}", "updateScore() {\n\t\tthis.score++;\n\t\tthis.drawScore();\n\t\tif (this.score >= this.highestScore) {\n\t\t\tthis.highestScore = this.score;\n\t\t\tlocalStorage.setItem(STORAGE_KEY, this.highestScore);\n\t\t}\n\t}", "updateScore(points) {\n\t\tthis.points += points;\n\t\t//set max score\n\t\tif (maxScore < this.points) {\n\t\t\tmaxScore = this.points;\n\t\t}\n\t}", "function update_final_score(Strokes){\r\n\tif(Strokes > final_score)\r\n\t\tfinal_score = Strokes;\r\n}", "function updateBestScore() {\n if (gLevel.SIZE === 4) {\n var beginnerBestScore = localStorage.getItem('beginner');\n if (!beginnerBestScore) {\n localStorage.setItem('beginner', gGame.secsPassed);\n } else {\n if (gGame.secsPassed < beginnerBestScore) {\n localStorage.setItem('beginner', gGame.secsPassed);\n }\n }\n } else if (gLevel.SIZE === 8) {\n var mediumBestScore = localStorage.getItem('medium');\n if (!mediumBestScore) {\n localStorage.setItem('medium', gGame.secsPassed);\n } else {\n if (gGame.secsPassed < mediumBestScore) {\n localStorage.setItem('medium', gGame.secsPassed);\n }\n }\n } else {\n var expertBestScore = localStorage.getItem('expert');\n if (!expertBestScore) {\n localStorage.setItem('expert', gGame.secsPassed);\n } else {\n if (gGame.secsPassed < expertBestScore) {\n localStorage.setItem('expert', gGame.secsPassed);\n }\n }\n }\n}", "updateScore() {\n if(Dashboard.candyMachted.length) {\n this.score += 1;\n this.levelUp();\n this.scoreUpdateView();\n Dashboard.candyMachted.pop();\n }\n }", "updateScore() {\n const points = splitNumber(this.points);\n\n this.scoreClass(3, points[3]);\n this.scoreClass(2, points[2]);\n\n if (this.points < 0) {\n this.scoreClass(1, '-minus');\n } else {\n this.scoreClass(1, points[1]);\n }\n }", "function addScoreToHighScores()\n{\n\tif (score > 0 && score > getLowestValue(highScores))\n\t{\n\t\thighScores[(highScores.length - 1)] = score;\n\t}\n}", "setBestPlayer() {\n var max = 0;\n var maxIndex = 0;\n for (var i = 0; i < this.pop_size; i++) {\n if (this.players[i].fitness > max) {\n max = this.players[i].fitness;\n maxIndex = i;\n }\n }\n //print(maxIndex);\n this.bestPlayerNo = maxIndex;\n\n if (this.players[this.bestPlayerNo].score > this.best_score) {\n this.best_score = this.players[this.bestPlayerNo].score;\n this.allTimeHigh = this.best_score;\n this.best_player = this.players[this.bestPlayerNo].clone();\n }\n }", "function setHighScores() {\r\n highScores.push(score);\r\n highScores.sort(function(a,b){return b - a});\r\n }", "function update_score() {\n\t\t$('[id$=-score]').val(score);\n\t}", "function _updateScores(heroArray){\n for(var i = 0; i < heroArray.length; i++){\n heroArray[i].score = _calculatePoints(heroArray[i]);\n }\n}", "calcScore() {\n this.score = 0;\n this.choices.forEach(c => { this.score -= c; });\n }", "function updateScore(scores) {\n if (scores[0].score <= score) {\n scores[0].score = score;\n scores[0].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the First Place on the scoreBoard. \\n'));\n } else if (scores[1].score <= score) {\n scores[1].score = score;\n scores[1].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the Second Place on the scoreBoard. \\n'));\n } else if (scores[2].score <= score) {\n scores[2].score = score;\n scores[2].name = playerName;\n console.log(chalk.bgBlack.green.bold('Hurray!! you Got the Third Place on the scoreBoard. \\n'));\n }else {\n console.log(chalk.bgBlack.green.bold('Sorry!! you Got no place on the scoreBoard. \\n'));\n }\n\n \n}", "function updateScore(newCurrentScore) {\n currentScore = newCurrentScore;\n currentScoreTag.innerText = currentScore;\n\n if (highScore >= 0) {\n highScore = (currentScore >= highScore) ? currentScore : highScore;\n } else {\n highScore = 0;\n }\n highScoreTag.innerText = highScore;\n }", "function updateScore() {\n score += questions[currentQuestionId - 1].worth;\n scoreElement.textContent = score;\n}", "function updateScores() {\n dealerScore = getScore(dealerCards);\n playerScore = getScore(playerCards);\n}", "function updateBest(reset = false) {\n\tvar bestHTML = document.getElementById(\"best\");\n\tif(reset) {\n\t\tbestHTML.innerHTML = \"Best: Not solved yet\";\n\t} else if (hasFinishedAtLeastOnce) {\n\t\tbest = (queensUsed < best) ? queensUsed : best;\n\t\tbestHTML.innerHTML = (\"Best: \" + best);\n\t} else {\n\t\tbest = queensUsed;\n\t\tbestHTML.innerHTML = (\"Best: \" + best);\n\t}\n}", "function isBest(val){\n\tif( bestScores[0]<val){\n\t\tbestScores[0]=val;\n\t\tbestScores.sort(function(a, b){return a-b});\n\t\t$(\"#best\").html('BEST RECORDS<br>1st: '+bestScores[2]+'<br>2nd: '+bestScores[1]+'<br>3rd: '+bestScores[0]);\n\t}\n}", "function updateScores() {\n scope.$el.find('.js-score-value').text(model.prediction[team])\n }", "UpdateScore(newScore){\n this.currentScore += newScore;\n }", "function updateHighScores() {\n var isSame = false;\n highScores.map(Score => {\n if (Score.hScore === currScore) {\n isSame = true;\n return;\n }\n });\n if (isSame) {\n return;\n } else {\n highScores.unshift({ name: userName, hScore: currScore });\n }\n}", "function newBest(evt){\n evt.preventDefault();\n for(const i in arr){\n if(score > Number(arr[i].score)){\n newBestScore.style.display = \"block\"\n arr.splice(i, 0, getName())\n score = 0; \n if(arr.length > 5){arr.length = 5};\n writeHighscore()\n reset()\n newBestScore.style.display = \"none\";\n }\n }\n localStorage.setItem(nutzHS, JSON.stringify(arr))\n}", "function ifNewBest(){\n for(const i in arr){\n if(score > Number(arr[i].score)){\n newBestScore.style.display = \"block\";\n }}\n}", "function bestScoresToDOM() {\n bestScoreArray.forEach((score, index) => {\n bestScores[index].textContent = `${score.bestScore}s`; \n })\n}", "init(scores) {\n this.scores = scores.sort((p1, p2) => p2.score - p1.score);\n //this.scores\n }", "function updateScore() {\n document.querySelector('#score').innerHTML = player.score;\n if(player.score > player.highscore){\n player.highscore = player.score;\n }\n document.querySelector('#highscore').innerHTML = player.highscore;\n}", "updateTotalScore() {\n this.score =\n this.calculatedRedScore +\n this.calculatedYellowScore +\n this.calculatedGreenScore +\n this.calculatedBlueScore -\n this.penaltyScore;\n this.displayCurrentScore();\n }", "function scoreCheck() {\n for (var i=0; i<mediaInfo.length; i++) {\n mediaInfo[i][9] = getScore(mediaInfo[i][7], mediaInfo[i][8]);\n }\n}", "function updateScore(value) {\n addScore(value);\n displayScore();\n}", "function refreshTargetScore() {\n\t\t$(\"#targetScore\").text(targetScore);\n\t}", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function saveScore()\n{\n var indx = localStorage.length; \n var scoreArray = new Array();\n \n for(var i = 0; i < indx;i++){\n var retrievedObject = localStorage.getItem('flappy'+i);\n var object = JSON.parse(retrievedObject);\n scoreArray.push(object);\n }\n \n scoreArray.push(score);\n BubleSort(scoreArray); \n \n best = scoreArray[0].value;\n \n localStorage.clear();\n \n for(var i = 0; i < ((scoreArray.length - 1) === 10 ? 10 : scoreArray.length);i++){\n scoreArray[i].position = i+1;\n localStorage.setItem('flappy'+i, JSON.stringify(scoreArray[i]));\n }\n}", "resetScoreArray(score){\n\t\tthis.setState({\n\t\t\tscoreArr: score\n\t\t},()=>{\n\t\t\tthis.forceUpdate();\n\t\t});\n\t}", "function updateValues(bestMatch, bestMatchValue) {\n\t\t\tfriendSuggestion = bestMatch;\n\t\t\tcompareValue = bestMatchValue;\n\t\t}", "function highestScore() {\n var best = 0;\n for(var i = 1; i < scores.length; i += 2) {\n var current = scores[i];\n if(current > best){\n best = current;\n index = i;\n }\n }\n // console.log(index);\n return index;\n}", "addScore() {\n // copy the props in an array and add the new score\n let array = this.props.jungleClick;\n array.push({\n name: this.props.name,\n score: this.props.score,\n });\n // sort the array to display the best scores\n array.sort((a, b) => {\n if (a.score === -1) {\n return 1\n } else if (b.score === -1) {\n return -1\n } else if (a.score === b.score) {\n return 0;\n } else {\n if (a.score < b.score) {\n return -1;\n } else {\n return 1;\n }\n }\n });\n // display just top five\n if (array.length > 5) {\n array.pop();\n }\n // refill the props and upload state\n this.props.addJungle(array);\n this.handleSubmit();\n this.setState({...this.state, jungleClick: this.props.jungleClick});\n }", "function updateBestScore() {\r\n\tif(typeof(Storage) !== 'undefined') {\r\n\t\tlet bestScoreContainer = document.getElementsByClassName('score__best')[0];\r\n\t\tlet bestValue = parseInt(localStorage.bestScore);\r\n\t\tif(!isNaN(bestValue) && score > bestValue) {\r\n\t\t\tlocalStorage.bestScore = score;\r\n\t\t\talert(\"New Record:\" + score + \" points!\");\r\n\t\t}\r\n\t} else {\r\n\t\talert(\"Your browser doesn't support Web Storage.\")\r\n\t}\r\n}", "static getHighestScore() {\n //! update\n Game.scoreArr = Game.checkStorage();\n //* push current score\n Game.scoreArr.push(Game.score);\n\n // get highest number\n let max = Math.max(...Game.scoreArr);\n // set array to highest score only\n Game.scoreArr = [max];\n\n //! update storage with highest score\n localStorage.setItem('score', JSON.stringify(Game.scoreArr));\n\n // select score holder\n const p = document.getElementById('highestScore');\n\n //* append score to UI\n p.textContent = `Highest Score: ${Game.scoreArr[0]}`;\n }", "function addToIndex(index, highest, newscore, callback) {\n var ai, i, len,\n found = false;\n \n function nextBlock() {\n len = i + 1000;\n if(len >= index.scores.length) {\n len = index.scores.length;\n }\n \n if(i >= len) {\n return callback(newscore);\n }\n \n for(i=i; i<len; i++) {\n ai = index.scores[i];\n \n // update the scores after us to have one more 'before'\n if(found) {\n ai.before++;\n continue;\n }\n \n // count the number of scores higher or lower depending on setting\n found = (highest && ai.points > newscore.points) || (!highest && ai.points < newscore.points);\n \n if(!found) {\n newscore.before += ai.scores;\n continue;\n }\n \n // insert our new score\n index.scores.splice(i, 0, newscore);\n index.remove.push(newscore);\n index.removeHash[newscore.points] = newscore;\n }\n \n return setTimeout(nextBlock, 100);\n }\n \n nextBlock();\n}", "function arrangeBestScores(actualScore){\r\n \r\n if(bestScores.length < 5){\r\n \r\n bestScores.push(actualScore);\r\n }\r\n\r\n else if (bestScores[bestScores.length - 1] < actualScore){\r\n \r\n bestScores.pop();\r\n bestScores.push(actualScore);\r\n }\r\n\r\n bestScores.sort().reverse();\r\n}", "function test_score_entered_top_five_consistent(scores) {\n for (let i = 0; i < scores.length; i++) {\n scores[i]['cdr.eionet.europa.eu'].score = 1500;\n }\n return scores;\n}", "calculateScore () {\n this.allCorrectAnswers = {};\n this.allSelectedAnswers = readFromCache('selectedAnswers');\n this.quizData.map((qA) => {\n const correctAnswers = [];\n for (const [key, value] of Object.entries(qA.correct_answers)) {\n if (value == 'true') {\n const correctAnswer = helpers.splitter(key, '_', 2);\n correctAnswers.push(correctAnswer);\n }\n }\n this.allCorrectAnswers[qA.id] = correctAnswers;\n });\n for (const [key, value] of Object.entries(this.allSelectedAnswers)) {\n if (value.sort().join(',') === this.allCorrectAnswers[key].sort().join(',')) {\n this.score++;\n }\n }\n this.score = this.score / Object.keys(this.allSelectedAnswers).length * 100;\n this.score = this.score.toFixed(2);\n let allScores = readFromCache('scores');\n allScores = allScores || {};\n allScores[new Date().toLocaleString()] = this.score;\n writeToCache('scores', allScores);\n }", "function updateScore (prize, numGuess, Bankrupt) {\n\tif(Bankrupt) {\n\t}\n}", "handleScoreUpdate(index, val) {\n\t\tlet newPlayers = this.state.players.slice();\n\t\tnewPlayers[index].score += val;\n\t\t// sort the players based on score\n\t\tnewPlayers.sort((a, b) => b.score - a.score);\n\t\tthis.setState({ players: newPlayers });\n\t}", "function showMatch() {\n for (var i = 0; i < doneScoreArr.length; i++) {\n if (doneScoreArr[i] < lowestScore) {\n lowestScore = doneScoreArr[i];\n }\n }\n\n console.log(\"Lowest Score \" + lowestScore);\n\n for (var i = 0; i < doneScoreArr.length; i++) {\n if (lowestScore === doneScoreArr[i]) {\n // console.log(surveyData[i])\n bestMatch = surveyData[i];\n }\n }\n}", "function saveScore() {\n let userInitials = $userInitialsEl.val().trim();\n let savedScore = (userInitials + \" \" + userScore);\n if (userInitials === \"\") {\n return;\n }\n scores.push(savedScore);\n $userInitialsEl.val(\"\");\n showHighScores();\n storeScores();\n renderScores();\n }", "function updateRecord(score) {\n console.log(\"Updating high score\");\n if ( score == \"points\" ) {\n window.highScores[window.gameMode][score] = window.currentScore;\n }\n\n if ( score == \"words\" ) {\n window.highScores[window.gameMode][score] = window.wordsAnswered;\n }\n}", "function updateScore() {\n score++;\n}", "function bestScore(){\n if(parseInt(localStorage.getItem(\"highScore\")) < updatedScore){\n //updating 3rd score\n localStorage.setItem(\"thirdScore\", localStorage.getItem(\"secondScore\"));\n printedScores[2] = localStorage.getItem(\"thirdScore\");\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\")\n //updating 2nd score\n localStorage.setItem(\"secondScore\", localStorage.getItem(\"highScore\"));\n printedScores[1] = localStorage.getItem(\"secondScore\");\n highScore2.innerText = \"Second HighScore: \" + localStorage.getItem(\"secondScore\");\n //updating high score\n var currentHighScore = updatedScore.toString();\n localStorage.setItem(\"highScore\", currentHighScore);\n highScore1.innerText = \"Top HighScore: \" + localStorage.getItem(\"highScore\");\n printedScores[0] = currentHighScore;\n \n } else if (parseInt(localStorage.getItem(\"secondScore\")) < updatedScore){\n //updating 3rd score if high score doesn't change\n localStorage.setItem(\"thirdScore\", localStorage.getItem(\"secondScore\"));\n printedScores[2] = localStorage.getItem(\"thirdScore\");\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\");\n //updating 2nd score if high score doesn't change\n var currentSecondScore = updatedScore.toString();\n localStorage.setItem(\"secondScore\", currentSecondScore);\n highScore2.innerText = \"Second HighScore: \" + localStorage.getItem(\"secondScore\");\n printedScores[1] = currentSecondScore;\n \n } else if (parseInt(localStorage.getItem(\"thirdScore\")) < updatedScore){\n //updating 3rd score if high score and second score doesn't change\n var currentThirdScore = updatedScore.toString();\n localStorage.setItem(\"thirdScore\", currentThirdScore);\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\");\n printedScores[2] = currentThirdScore;\n \n }else{\n //if no score can be updated\n proposedQuestion.innerText = \" You did not earn a high score. Try again!\"\n }\n}", "evaluate() {\n let highest = 0.0;\n let index = 0;\n for (let i = 0; i < this.population.length; i++) {\n if (this.population[i].fitness > highest) {\n index = i;\n highest = this.population[i].fitness;\n }\n }\n\n this.best = this.population[index].getPhrase();\n if (highest === this.perfectScore) {\n this.finished = true;\n }\n }", "function addCurrentPlayerScore(name, score) {\r\n var i,\r\n playerName,\r\n playerScore,\r\n length = sortedHighScores.length;\r\n\r\n validateName(name);\r\n validateScore(score);\r\n\r\n if (length < NUMBER_OF_HIGH_SCORES_TO_SAVE) {\r\n sortedHighScores.push([name, score]);\r\n if (length > 1) {\r\n sortedHighScores.sort(function (a, b) {\r\n return b[1] - a[1];\r\n })\r\n }\r\n\r\n saveScores();\r\n } else if (score > sortedHighScores[sortedHighScores.length - 1][1]) {\r\n sortedHighScores[length - 1][0] = name;\r\n sortedHighScores[length - 1][1] = score;\r\n sortedHighScores.sort(function (a, b) {\r\n return b[1] - a[1];\r\n })\r\n\r\n saveScores();\r\n } \r\n }", "function setHighScore(newScore) {\n\t// get the high scores\n\tvar hs = getHighScores();\n\t// create a boolean\n\tvar isHighScore = false;\n\n\t// loop through highScore array\n\tfor (var i = hs.length - 1; i >= 0; i--) {\n\t\t// if hs element is less than or equal to the newScore\n\t\tif(hs[i] <= newScore) {\n\t\t\t// boolean is true\n\t\t\tisHighScore = true;\n\t\t\t// leave loop\n\t\t\tbreak;\n\t\t}\n\t}\n\t// if that value is a high score\n\tif (isHighScore) {\n\t\t// attach to array\n\t\ths.push(newScore);\n\t\t// sort array\n\t\ths.sort(function(a, b){return b-a});\n\t\t// if array is more than 5 long\n\t\tif (hs.length > 5) {\n\t\t\t// remove lowest value\n\t\t\ths.pop();\n\t\t}\n\t}\n\tlocalStorage.setItem('highScore', JSON.stringify(hs));\n}", "function sortForHigh(){ \n// set value of highestScore to the sorted array lowest to highest (b-a)\nhighestScore = scores.sort(function(a,b){return b-a})\n//console log the value of highest score at index 0\nconsole.log('the highest score is', highestScore[0]) \n}", "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function sortByScoreUp() {\n arrayLivros.sort((a, b) => fullscoreForSort(a._scores) - fullscoreForSort(b._scores));\n}", "function updateScore(){\r\n if(ffScoreBugFix>10 && currentTube.topRect.getRight() < characters[0].x){\r\n if(!isHit){\r\n score++;\r\n }\r\n isHit = false;\r\n var index = tubes.indexOf(currentTube) + 1;\r\n index %= tubes.length;\r\n currentTube = tubes[index];\r\n ffScoreBugFix = 0;\r\n }\r\n ffScoreBugFix++;\r\n }", "function getBestScore() {\n if ((gBestScoreEasy === null || gSec < gBestScoreEasy) && gSize === 4) {\n gBestScoreEasy = gSec;\n localStorage.setItem('gBestScoreEasy', gBestScoreEasy);\n } else if ((gBestScoreMedium === null || gSec < gBestScoreMedium) && gSize === 6) {\n gBestScoreMedium = gSec;\n localStorage.setItem('gBestScoreMedium', gBestScoreMedium);\n } else if (gSize === 8 && (gSec < gBestScoreHard || gBestScoreHard === null)) {\n gBestScoreHard = gSec;\n localStorage.setItem('gBestScoreHard', gBestScoreHard);\n }\n}", "function organizeHighScores() {\n highscores.push([finalScore, initialText.value]);\n highscores.sort((a, b) => b[0] - a[0]);\n\n eraseHighscores();\n\n for (var i = 0; i < highscores.length; i++) {\n addInitial(highscores[i]);\n }\n\n openHighscorePage();\n}", "set score(aValue) {\n this._score = aValue;\n }", "function add(score) {\r\n if (score > BEST_SCORE) {\r\n BEST_SCORE = score;\r\n save();\r\n GameMenu.updateHighScore(BEST_SCORE);\r\n }\r\n }", "function saveScoreToLocalStorage() { \n const questionAmountValue = Number(questionAmount);\n \n bestScoreArray.forEach((scoreObject) => {\n const scoreNumber = scoreObject.bestScore;\n if ( questionAmountValue == scoreObject.question){ \n if( scoreNumber === 0 || scoreNumber > finalTime){ \n scoreObject.bestScore = finalTime.toFixed(1); \n }\n }\n });\n \n localStorage.setItem('bestScores', JSON.stringify(bestScoreArray));\n getSavedBestScores();\n}", "function setHighScore (){\n\tif (playerCurrentScore > highScore){\n\t\thighScore = playerCurrentScore;\n\t\tdocument.getElementById('cpuScore').textContent = '';\n\t\tdocument.getElementById('cpuScore').textContent += highScore;\n\t}\n}", "function UpdateScore() {\r\n recentScore.push(math.round(currentScore));\r\n recentScore.shift();\r\n var screenRecentScore = recentScore.join('&nbsp;&nbsp;&nbsp;&nbsp;'); \r\n if (feedbackVisible) {\r\n $('#recent-score').html(screenRecentScore);\r\n $('#current-score').html(math.round(currentScore));\r\n }\r\n else {\r\n $('#recent-score').html('N/A');\r\n $('#current-score').html('N/A');\r\n }\r\n cpaLine.map(function (element) {\r\n element.visible = true; \r\n return element\r\n })\r\n cpaCircle.map(function (element) {\r\n element.visible = true;\r\n return element\r\n }) \r\n $('#play-conflict-btn').prop('disabled', false);\r\n $('#play-resolution-btn').prop('disabled', false); \r\n}", "function setBestScore(score) {\n if (typeof(Storage) !== \"undefined\") {\n // Store\n localStorage.setItem(\"best\", score);\n return true;\n }\n return false;\n}", "getActionsScore() {\n const actions_score = [];\n const nbr_of_trees = this.getNumberOfTrees();\n\n\n // COMPLETE\n if(nbr_of_trees[3] > 0 && this.sun >= 4){\n if(this.play_index === -1){\n for (let i = 0; i < this.trees.length; i += this.treeI) {\n if (this.trees[i+1] === 3 && this.trees[i+2] && !this.trees[i+3]){\n let score = this.score_of_previous_round + (Math.exp(this.cells[this.trees[i]*this.cellI+1] * this.mulA) \n + Math.exp(nbr_of_trees[3]*this.mulB) + Math.exp(this.cells[this.trees[i]*this.cellI+8]*this.mulC)) * this.complete_mul / this.iter;\n if(this.change_commplete){\n score = this.score_of_previous_round + (Math.exp(this.cells[this.trees[i]*this.cellI+1]) * 2) / this.iter;\n }\n actions_score.push([this.play_index, score, COMPLETE, this.trees[i], -1, ...this.last_action.slice(5)]);\n }\n }\n }else{\n const bestTree = {\n score:-9999,\n tree:-1,\n }\n for (let i = 0; i < this.trees.length; i += this.treeI) {\n if (this.trees[i+1] === 3 && this.trees[i+2] && !this.trees[i+3] && this.cells[this.trees[i] * this.cellI + 8] * this.cells[this.trees[i] * this.cellI + 1] > bestTree.score){\n bestTree.score = this.cells[this.trees[i] * this.cellI + 8] * this.cells[this.trees[i] * this.cellI + 1];\n bestTree.tree = this.trees.slice(i,i+this.treeI);\n }\n }\n if(bestTree.tree !== -1){\n let score = this.score_of_previous_round + (Math.exp(this.cells[bestTree.tree[0] * this.cellI + 1]*this.mulA)\n + Math.exp(nbr_of_trees[3]*this.mulB) + Math.exp(this.cells[bestTree.tree[0]*this.cellI+8] * this.mulC)) * this.complete_mul / this.iter;\n if(this.change_commplete){\n score = this.score_of_previous_round + ( Math.exp(this.cells[bestTree.tree[0]*this.cellI+1]) * 2) / this.iter;\n }\n actions_score.push([this.play_index, score, COMPLETE, bestTree.tree[0], -1, ...this.last_action.slice(5)]);\n }\n }\n }\n\n\n // SEED\n if(this.sun >= nbr_of_trees[0] && this.rday < 20){\n if(nbr_of_trees[4] - nbr_of_trees[3] < this.max_tree){\n let mul = 1;\n if(nbr_of_trees[0] === 0){\n mul = this.seed_mul;\n }else if (this.rday < this.seed_2_phase_day){\n mul = this.start_seed_mul;\n }\n const bestTree = {\n score: 9999,\n tree: -1,\n spot: -1,\n }\n\n if(bestTree.tree === -1) {\n for (let i = 0; i < this.trees.length; i += this.treeI) {\n if (this.trees[i+2] && this.trees[i+1] > 1 && !this.trees[i+3]){\n let cells_to_check = [this.trees[i]];\n for (let j = 0; j < this.trees[i+1]; j++) {\n let new_cells = [];\n cells_to_check.forEach(cell =>{\n this.cells.slice(cell * this.cellI + 2, cell * this.cellI + 8).forEach(spot => {\n if (spot !== -1 ){\n new_cells.push(spot);\n let div = this.cells[spot * this.cellI + 1];\n if(this.rday < this.seed_2_phase_day ){\n div = 1 + this.cells[spot * this.cellI + 1]/10;\n }\n if (this.cells[spot * this.cellI + 8] / div < bestTree.score && this.cells[spot * this.cellI + 1] > 0 && !this.isOccupied(spot)){\n bestTree.score = this.cells[spot * this.cellI + 8] / div;\n bestTree.tree = this.trees.slice(i, i+this.treeI);\n bestTree.spot = spot;\n }\n }\n });\n });\n cells_to_check = new_cells;\n }\n }\n }\n }\n if (bestTree.tree !== -1){\n actions_score.push([\n this.play_index,\n this.score_of_previous_round + (mul * this.cells[bestTree.spot * this.cellI + 1] / this.cells[bestTree.spot * this.cellI + 8]) / this.iter,\n SEED, bestTree.tree[0], bestTree.spot, ...this.last_action.slice(5)\n ]);\n }\n }\n }\n\n\n // GROW\n if (this.sun >= 1 && nbr_of_trees[4] > nbr_of_trees[3]){\n if(this.play_index === -1){\n for (let i = 0; i < this.trees.length; i += this.treeI) {\n if (this.rday <= 20 + this.trees[i+1] && this.trees[i+1] < 3 && this.trees[i+2] && !this.trees[i+3]){\n let needed_sun;\n switch (this.trees[i+1]) {\n case 0:\n needed_sun = 1 + nbr_of_trees[1];\n break;\n case 1:\n needed_sun = 3 + nbr_of_trees[2];\n break;\n case 2:\n needed_sun = 7 + nbr_of_trees[3];\n break;\n }\n if (this.sun >= needed_sun){\n actions_score.push([\n this.play_index,\n this.score_of_previous_round + (this.cells[this.trees[i] * this.cellI + 1] * this.grow_mul[this.trees[i+1]] / this.cells[this.trees[i] * this.cellI + 8])/this.iter,\n GROW, this.trees[i], -1, ...this.last_action.slice(5)\n ]);\n }\n }\n }\n }else{\n const bestTree = {\n score:[9999, 9999, 9999],\n tree:[-1, -1, -1],\n }\n for (let i = 0; i < this.trees.length; i += this.treeI) {\n if (this.rday <= 20 + this.trees[i+1] && this.trees[i+1] < 3 && this.trees[i+2] && !this.trees[i+3] && this.cells[this.trees[i] * this.cellI + 8] / this.cells[this.trees[i] * this.cellI + 1] < bestTree.score[this.trees[i+1]]){\n let needed_sun;\n switch (this.trees[i+1]) {\n case 0:\n needed_sun = 1 + nbr_of_trees[1];\n break;\n case 1:\n needed_sun = 3 + nbr_of_trees[2];\n break;\n case 2:\n needed_sun = 7 + nbr_of_trees[3];\n break;\n }\n if (this.sun >= needed_sun){\n bestTree.score[this.trees[i+1]] = this.cells[this.trees[i] * this.cellI + 8] / this.cells[this.trees[i] * this.cellI + 1];\n bestTree.tree[this.trees[i+1]] = this.trees.slice(i,i+this.treeI);\n }\n }\n }\n for (let i = 0 ; i< 3; i++){\n if(bestTree.tree[i] !== -1){\n actions_score.push([\n this.play_index,\n this.score_of_previous_round + (this.cells[bestTree.tree[i][0] * this.cellI + 1] * this.grow_mul[bestTree.tree[i][1]] / this.cells[bestTree.tree[i][0] * this.cellI + 8])/this.iter,\n GROW, bestTree.tree[i][0], -1, ...this.last_action.slice(5)\n ]);\n }\n }\n }\n }\n\n\n //WAIT\n actions_score.push([this.play_index, this.score_of_previous_round - (this.sun * this.wait_mul) / this.iter, WAIT, -1, -1, ...this.last_action.slice(5)]);\n\n if(this.play_index === -1){\n actions_score.map((val, i) => {\n val[0] = i;\n return val;\n });\n }\n\n return actions_score;\n }", "function load() {\r\n var score = Utilities.getObject('bejeweled_high_score');\r\n if (score !== null) {\r\n BEST_SCORE = score;\r\n }\r\n }", "findBest() {\n if (minFitness) this.parentPop.sort(compareFitnessInc);\n else this.parentPop.sort(compareFitnessDec);\n bestSong = this.parentPop[0];\n }", "function updateScore(scorelist) {\n let board = document.getElementById(\"scoreboard\")\n let top_scores = []\n //Adds anyone with a top_score attr that isn't null or empty and pushes to an array\n for(const user of scorelist.users) {\n if (user.top_score){\n top_scores.push([user.username, user.top_score])\n }\n }\n //Sorts the array by the highest score in descending order and updates the DOM\n top_scores.sort(function(a, b){return b[1]-a[1]})\n\n for(let i = 1; i < 11; i++) {\n let user_score = board.childNodes\n if (top_scores[i - 1]){\n user_score[i].innerText = `${top_scores[i - 1][0]}: ${top_scores[i -1][1]}`\n }\n }\n}", "GetBestScore() {\n\t\treturn this.SearchController.bestScore\n\t}", "function conserveScore() {\n if (counter < savedScore || savedScore === null || savedScore === '--') {\n localStorage.setItem('localScore', counter);\n bestScore.innerHTML = localStorage.getItem('localScore'); \n savedScore = localStorage.getItem('localScore');\n } else {\n bestScore.innerHTML = localStorage.getItem('localScore');\n }\n}", "_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}", "function compareScore() {\n if (localStorage.getItem(\"bestScore\") !== 0) {\n if (level > localStorage.getItem(\"bestScore\")) {\n localStorage.setItem(\"bestScore\", level);\n }\n }\n}", "function sortscores() {\r\n\tdocument.getElementById(\"img_mtch\").src = \"data/done.gif\";\r\n\tdocument.getElementById(\"img_oput\").src = \"data/progress.gif\";\r\n\tscoreranking = new Array(); x = 0; for(w=0;w<socREC.length;w++) {\r\n\t\tif (isNumeric(socREC[w][0]) && socREC[w][0] > 40) {\r\n//scoreranking[x++] = Math.round(socREC[w][0]*1000) / 1000;\r\n// adjusted score = socREC[w][0]\r\n// raw score = Math.round(socREC[w][0] * (socREC[w].length - 3))\r\n\r\n\trawscore = 0;\r\n\trawscore = Math.round(socREC[w][0] * (socREC[w].length - 3));\r\n\ttemprawscore = rawscore.toString();\r\n\tdo { temprawscore = \"0\" + temprawscore; } while (temprawscore.length<9);\r\n\ttempadjscore = 0;\r\n\ttempadjscore = Math.round(socREC[w][0]*1000);\r\n\ttempfinalscore = tempadjscore + temprawscore;\r\n\tscoreranking[x++] = (tempfinalscore*1);\r\n};\r\n\t};\r\n\tupdatePbar(\"progressbar_oput\",5);\r\n\trankedscores = new Array(); rankedscores = scoreranking.sort(function(a,b){return (b-a)});\r\n\tupdatePbar(\"progressbar_oput\",20);\r\n\tw=1; do {\r\n\t\tif (rankedscores[w] == rankedscores[w-1]) { rankedscores.splice(w,1); } else { w++; };\r\n\t} while (w<rankedscores.length);\r\n\tupdatePbar(\"progressbar_oput\",35);\r\n\tz = setTimeout(\"displayrecords(0,\"+defaultnorecords+\")\",1);\r\n}", "function update_score(value){\n playerInstance.score = Math.max(0, playerInstance.score + value);\n score_tracker.innerText = playerInstance.score;\n }", "function getTopAnswer(){\n keys_.forEach((key) => {\n // console.log(key, key == topIntent)\n if (key == data.topIntent.toLowerCase()) {\n // console.log(NEW_OBJ[key])\n data.topIntentScore = NEW_OBJ[key];\n }\n });\n }", "function CheckHighestScore(highScorers){\nfor(var i = 0;i<highScorers.length;i++){\n if(score >= highScorers[i].highScore){\n console.log(\"Congratulations.You are Among Top Scorers\\nSend me the Screenshot of your score and i will update it in High Score List\");\n break;\n }\n}\n}", "updateScoresBasic(lastRound) {\n switch (lastRound.p2) {\n case 'W':\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n case 'D':\n this.enemyDynamite--;\n this.adjustMapValueBy(this.scores, 'W', -1);\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n default:\n\n }\n if (lastRound.p1 === lastRound.p2) {this.adjustMapValueBy(this.scores, 'D', 1)};\n this.scores.forEach((value, key) => {\n if (value<0) {this.scores.set(key, 0)}\n });\n if (this.prevOpponentMove === lastRound.p2) {\n\n }\n if (this.dynamiteCount <= 0) {this.scores.set('D', 0);}\n }", "function updateScore(result) {\n\tif (result === 'won') {\n\t\t++totalWins;\n\t} else if (result === 'lose') {\n\t\t++totalLost;\n\t} else {\n\t\t++totalDraw;\n\t}\n\n\t++totalMatches;\n\n\tupdateBoard(totalMatches, totalWins, totalLost, totalDraw);\n}", "function updateScore() {\n if (board_static[pacman.i][pacman.j] === 5 ){\n score+=5;\n board_static[pacman.i][pacman.j] =0;\n playSound(eat_points_sound);\n ball_count--;\n }\n if (board_static[pacman.i][pacman.j] === 15 ){\n score+=15;\n board_static[pacman.i][pacman.j] =0;\n playSound(eat_points_sound);\n ball_count--;\n }\n if (board_static[pacman.i][pacman.j] === 25 ){\n score+=25;\n board_static[pacman.i][pacman.j] =0;\n playSound(eat_points_sound);\n ball_count--;\n }\n\n if (ball_count === 0){\n endGame(timesUp);\n }\n}", "function change_score(round_score) {\n num_correct += round_score;\n num_total += 1;\n }", "set_scores() {\r\n for (let [id, node] of Object.entries(this.nodes)) {\r\n let vcn_score = null;\r\n let sp_score = null;\r\n\r\n if (node.vcn_degree <= 0 || node.vcn_degree == null) {\r\n vcn_score = 0;\r\n }\r\n else {\r\n vcn_score = 1 / node.vcn_degree\r\n }\r\n\r\n if (node.sp_score == null) {\r\n sp_score = 0;\r\n }\r\n else {\r\n sp_score = node.sp_score\r\n }\r\n\r\n node.score = vcn_score * sp_score;\r\n }\r\n }", "function updateScore($element, points) {\n $($element).text(points);\n if (points >= endScore) {\n endGame();\n }\n }", "function show_best_match(){\n var scores = [];\n MongoClient.connect(url, function(err, db) {\n\t var dbo = db.db(\"we-eat\");\n\t var cur_profile = dbo.collection(\"profiles\").find();\n\t cur_profile.each(function(err, item) {\n\t\tif(item == null) {\n\t\t\tdb.close();\n\t\t\treturn false;\n\t\t}\n\t\tvar dist = calc_distance(latitude, longitude, cur_profile.latitude, cur_profile.longitude);\n\t\tvar cur_profile_prefs = cur_profile.Prefs.split(',');\n\t\tvar matching = matching_strings(prefs,cur_profile_prefs);//number of matching prefs\n\t\t\n\t\tif(dist <= 1609.34*distance && dist <= 1609.34*cur_profile.distance) {\n\t\t\tscores.push([matching, exportJSON(cur_profile.Name)]);\n\t\t}\n\t\t\n\t\t/*var formatted_url = 'https://api.yelp.com/v3/businesses/search?latitude=' + String(latitude) + '&longitude=' + String(longitude) + '&radius=' + String(distance*1609) + '&categories=' + matching.toString();\n\t\tget_nearby_restaurants(formatted_url);*/\n\t });\n\t});\n scores.sort(sortFunction).reverse();\nfor(var k = 0; k < scores.length; k++){\n\tnewProfile(JSON.parse(scores[k][1]));\n\twhile(!clicked){}\n\tclicked = false;\n}\n}", "resetPoint()\n {\n\n this.joueurs.forEach(element=>{\n element.score = 0;\n });\n\n }", "_setScore(score) {\n\t\tthis._score= score;\n\t\tthis._updateScore();\n\t}", "function updateScore() {\n totalScore = totalScore + 10; // add 10 points to the score\n $score.text(totalScore); // displays the new score on the screen\n console.log(totalScore); // logs the new score in the console\n }", "function Scores(){\n this.scores = [];\n }", "function clear() {\r\n BEST_SCORE = 0;\r\n save();\r\n GameMenu.updateHighScore(BEST_SCORE);\r\n }", "function updateScore() {\n store.score++;\n}", "applyQuestionGrades() {\n let grades = this.question.gradePlayers();\n for (let uid in grades) {\n this.players[uid].updateScore(grades[uid]);\n }\n }", "function addScore(answer) {\n _scores[answer[0]] = answer[1];\n}", "function updateHighscores()\n{\n\tvar element;\n\tfor (var i = 0; i < highScores.length; i++)\n\t{\n\t\telement = document.getElementById(\"highScoresBox\" + i);\n\t\tif (highScores[i] != 0)\n\t\t{\n\t\t\telement.firstChild.nodeValue = highScores[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\telement.firstChild.nodeValue = \"\";\n\t\t}\n\t}\n}", "function updateScore() {\n $score.text(score);\n}", "_updateScore () {\n this._scoreBoard.innerHTML = this._score;\n }", "setScoreArray(key, score){\n\t\tvar stringedKey = key.toString();\n\t\tthis.state.scoreArr.push({key:key, score:score});\n\t\tthis.enableCompare();\n\t}" ]
[ "0.78118235", "0.7089091", "0.7076697", "0.7059087", "0.70383704", "0.6911687", "0.6772529", "0.67457175", "0.6727227", "0.67117745", "0.66908455", "0.66661996", "0.6647496", "0.66472286", "0.6575841", "0.6544597", "0.6530948", "0.6524539", "0.65065426", "0.63613486", "0.6352018", "0.6334034", "0.63203436", "0.6319899", "0.6278251", "0.62667626", "0.6230853", "0.62183124", "0.6199847", "0.619441", "0.6183373", "0.6181202", "0.61691993", "0.61596555", "0.615201", "0.61461866", "0.61454135", "0.61451757", "0.6142648", "0.6142053", "0.6128644", "0.6114733", "0.6114584", "0.6095112", "0.60917866", "0.60903496", "0.6086608", "0.60838825", "0.6071513", "0.6063232", "0.6053019", "0.60483426", "0.60371554", "0.60286474", "0.6028556", "0.60221934", "0.6015436", "0.5993635", "0.5985105", "0.59705037", "0.59638405", "0.5959625", "0.5949235", "0.59462637", "0.59265524", "0.59193295", "0.5915828", "0.5914312", "0.5913239", "0.59127945", "0.5908207", "0.59044594", "0.5897277", "0.5891028", "0.58882415", "0.58722544", "0.5869913", "0.58679134", "0.5855503", "0.58526516", "0.5846473", "0.5835144", "0.58335716", "0.58318245", "0.5827762", "0.5826796", "0.581458", "0.580971", "0.5807257", "0.5795216", "0.5791405", "0.5780236", "0.57800055", "0.5779448", "0.5779199", "0.57737535", "0.5769562", "0.5767707", "0.5765886", "0.5761327" ]
0.7466263
1
Retrieve the user's profile
function retrieve() { // Get the user's uid let uid = $rootScope.account.authData.uid; // Get the profile $rootScope.db.users.child(uid).once('value', function (snapshot) { let profile = snapshot.val(); BroadcastService.send(EVENTS.PROFILE_LOADED, profile); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function userProfile() {\n return baseUser().get();\n }", "get userProfile() {\r\n return this.clone(ProfileLoader_1, \"getuserprofile\").postCore();\r\n }", "function getUserProfile() {\n return $http.get('/api/user-profile').then(function (response) {\n return response.data;\n });\n }", "get userProfile() {\r\n return this.profileLoader.userProfile;\r\n }", "function retrieveProfileInfo() {\n return JSON.parse(sessionStorage.getItem(\"user\"));\n}", "function getGitHubProfile() {\n return getGitHubResource('user');\n}", "function getProfileInfo() {\n\treturn TD.cache.twitterUsers.getByScreenName(TD.storage.accountController.getPreferredAccount(\"twitter\").state.username).results[0];\n}", "function getProfile() {\n const endpoint = BASE_URL + `/user-profile`;\n const token = localStorage.token;\n return fetch(endpoint, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n Authorization: `Bearer ${token}`,\n },\n }).then((res) => {\n return res.json();\n });\n}", "function getProfileData() {\n // obtener los datos del usuario al iniciar sesión\n IN.API.Raw(\"people/~:(first-name,last-name,id,num-connections,picture-url,location,positions,summary,public-profile-url)\").result(onSuccess).error(onError); \n }", "static getProfile() {\n // Retrieves the profile data from localStorage\n const profile = localStorage.getItem('profile')\n return profile ? JSON.parse(localStorage.profile) : {}\n }", "function getCurrentProfile() {\r\n var deffered = $q.defer();\r\n if (user.name !== '') {\r\n deffered.resolve(user);\r\n return deffered.promise;\r\n }\r\n var token = identity.getToken();\r\n $http({\r\n method: 'GET',\r\n headers: {\r\n 'Content-Type': CONTENT_TYPE,\r\n 'Authorization': 'Bearer ' + token\r\n },\r\n url: BASE_URL + '/profile'\r\n }).success(function(data) {\r\n user.name = data.name;\r\n user.email = data.email;\r\n user.position = data.position;\r\n deffered.resolve(user);\r\n }).error(function(err) {\r\n deffered.reject(err);\r\n });\r\n return deffered.promise;\r\n }", "loadProfile() {\n\t\tconst url = this.user.url;\n\t\treturn solid.fetch(url)\n\t\t\t.then(res => Promise.all([res.text(), res.headers.get('Content-Type')]))\n\t\t\t.then(([contents, contentType]) => loadProfile({ url, contents, contentType }))\n\t\t\t.then(profile => {\n\t\t\t\tObject.assign(this.user, profile);\n\t\t\t\tif (profile.accountName)\n\t\t\t\t\tthis.id = profile.accountName;\n\t\t\t\treturn profile;\n\t\t\t});\n\t}", "getProfile() {\n return JSON.parse(localStorage.getItem(PROFILE_KEY));\n }", "getProfile(success, failure) {\n let user = JSON.parse(localStorage.getItem(AppConstants.USER_FIREBASE_DETAILS));\n this.getCall(URI.GET_PROFILE + '/?email=' + user.email, success, failure, true);\n }", "getProfile() {\n\t\treturn decode(this.getAccess());\n\t}", "function getMyProfile(req, res, next) {\n User.findById({ _id: req.user.id })\n .then(user => res.status(HTTPStatus.OK).send(user))\n .catch(err => next(err));\n}", "async function getProfile() {\n const resp = await fetch(window.location.origin + '/profiles/me', {\n method: \"GET\",\n mode: \"cors\",\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n redirect: \"follow\",\n });\n return resp.json();\n}", "GetProfile() {\n return this.m_profile;\n }", "get ownerUserProfile() {\r\n let q = this.getParent(ProfileLoader_1, this.parentUrl, \"_api/sp.userprofiles.profileloader.getowneruserprofile\");\r\n if (this.hasBatch) {\r\n q = q.inBatch(this.batch);\r\n }\r\n return q.postCore();\r\n }", "getUserProfile(success, failure) {\n ApolloService.query({\n query: Queries.GET_USER_PROFILE\n }).then(data => { success(this.handleResponse(data.data.getUserProfile, \"user\")) }).catch(error => failure(error));\n }", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n }", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n }", "function getCurrentUserProfile() {\r\n\t \treturn self._userProfile;\r\n\t }", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"id\", \"first_name\", \"last_name\", \"num-connections\", \"email-address\", \"industry\", \"location\", \"picture-url\", \"public-profile-url\").result(onSuccess).error(onError);\n}", "async profile(_, __, { auth }) {\n try {\n await auth.check();\n const user = await auth.getUser();\n\n return user;\n } catch (error) {\n throw new Error(error);\n }\n }", "async getProfile (userName) {\n let res = await Http.get(`/api/users/${userName}?view=true`)\n return new User(res.data.user)\n }", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"firstName\", \"lastName\", \"id\").result(onSuccess).error(onError);\n}", "function loadProfile(){\n var request = gapi.client.plus.people.get( {'userId' : 'me'} );\n request.execute(loadProfileCallback);\n }", "getProfile() {\n\t\treturn decode(this.getToken());\n\t}", "function getCurrentProfile(req, res) { \n Profile.findOne({byUser: req.params.userid})\n .then(profiles => res.json(profiles))\n .catch(err => {res.json(err)})\n}", "getProfile (cb) {\n let accessToken = this.getAccessToken()\n let self = this\n this.lock.getUserInfo(accessToken, (err, profile) => {\n if (profile) {\n self.userProfile = profile\n }\n cb(err, profile)\n })\n }", "static getProfile() {\n // console.log(\"getProfile()\");\n return store.get('CURRENT_PROFILE');\n }", "function getProfile(auth, cb) {\n var gmailClass = google.gmail('v1');\n gmailClass.users.getProfile({\n auth: auth,\n userId: 'me'\n }, cb);\n}", "function getProfileData() {\n\tIN.API.Raw(\"/people/~:(email-address)\").result(onSuccess).error(onError);\n}", "function getProfile(id) {\n\treturn users.findOne({ cookie_uuid: id });\n}", "async getUser (req, res) {\n const findOneUserQuery = `\n SELECT avatar, firstname, lastname, email, username, location, bio\n FROM users\n WHERE username = $1\n `;\n\n try {\n\n // A user must be signed in to see edit information\n // Signed in user must also be requesting their own user data.\n if (!req.user || req.user.username !== req.params.username) {\n return res.status(403).send('You\\'re not allowed to edit this profile');\n }\n\n const { rows } = await db.query(findOneUserQuery, [ req.params.username ]);\n const profileUser = rows[0];\n\n // If profile user was not found in database\n if (!profileUser) {\n return res.status(404).send('User not found');\n }\n\n return res.status(200).json({ profileUser });\n } catch (error) {\n return res.status(400).send(error);\n }\n }", "getProfile() {\n return this._profile;\n }", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n}", "async function getProfie() {\n var tagline = await getTagline();\n var country = await getCountry();\n var profile = await getUrl();\n var featured = await getImages();\n res.render('pages/userProfile', {\n username: uname,\n icon: icon,\n tagline: tagline,\n country: country,\n link: profile,\n featured: featured,\n currentUser: currentUser\n });\n }", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"positions:(title)\", \"educations\", \"first-name\", \"last-name\", \"industry\", \"picture-url\", \"public-profile-url\", \"email-address\").result(displayProfileData).error(onError);\n }", "get ownerUserProfile() {\r\n return this.profileLoader.ownerUserProfile;\r\n }", "get profile() {\n const value = this.get(PROFILE_STORAGE_KEY);\n\n if (value) {\n const profile = new UserProfile();\n\n // Patch in the values\n Object.assign(profile, JSON.parse(value));\n\n return profile;\n }\n }", "getProfile() {\n return this.profile;\n }", "function pullMyProfile() {\n $http({\n method: 'GET',\n url: apiBaseUrl+\"/user/profile\",\n timeout: TIMEOUT_LIMIT\n }).then(function successCallback(response) {\n // this callback will be called asynchronously\n // when the response is available\n $scope.isLogin = true;\n angular.element('#signinModal').modal('hide');\n $scope.myProfile = response.data;\n\n console.log('myProfile udpated !!!');\n // console.log($scope.profile);\n }, function errorCallback(response) {\n angular.element('#signinModal')\n .modal({\n closable: false,\n })\n .modal('show');\n // called asynchronously if an error occurs\n // or server returns response with an error status.\n\n console.log(\"Fail to retrive current user profile, redirecting to login page\");\n });\n }", "async getProfile() {\n const url = endpoints.accounts.get_profile;\n try {\n const response = await this.apiClient.get(url);\n if (response.status !== 200) {\n return {\n error: true,\n httpStatus: response.status,\n message:\n 'Não foi possível realizar a requisição para pegar o profile do usuário',\n };\n }\n\n const responseJson = await response.data;\n return responseJson;\n } catch (error) {\n console.log(error.response);\n return {\n error: true,\n httpStatus: null,\n message:\n 'Houve um erro de rede, por favor verifique sua conexão e tente novamente',\n };\n }\n }", "function getProfile(res, callback) {\n var data = querystring.stringify({\n 'schema' : 'openid',\n\t'access_token' : access_token\n });\n\n post(PROFILE_ENDPOINT, data, function(status, body) {\n callback(status, body);\n }); \n}", "function getUserInfo() {\n\t\t\treturn User.getUser({\n\t\t\t\tid: $cookieStore.get('userId')\n\t\t\t}).$promise.then(function(response) {\n\t\t\t\tswitch(response.code) {\n\t\t\t\t\tcase 0: {\n\t\t\t\t\t\t$scope.ganbaru.username = response.data.username;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, function() {\n\t\t\t\t//Handling error\n\t\t\t});\n\t\t}", "function getProfile(uid) {\n return new Promise((resolve, reject) => {\n adminWebModel.getProfile(uid).then((data) => {\n if (data) {\n let userId = data.userID\n let token = jwt.sign({ uid: userId }, key.JWT_SECRET_KEY, {\n expiresIn: timer.TOKEN_EXPIRATION\n })\n \n resolve({ code: code.OK, message: '', data: { 'token': token, profile: data} })\n }\n }).catch((err) => {\n if (err.message === message.INTERNAL_SERVER_ERROR)\n reject({ code: code.INTERNAL_SERVER_ERROR, message: err.message, data: {} })\n else\n reject({ code: code.BAD_REQUEST, message: err.message, data: {} })\n })\n })\n}", "async _getProfile () {\n try {\n var p = await profile.getProfile();\n this.setState({ profile: p });\n } catch (e) {\n console.error(e, e.stack);\n }\n }", "function getProfileInfo() {\n var GoogleUser = gapi.auth2.getAuthInstance().currentUser.get();\n var profile = GoogleUser.getBasicProfile();\n var id_token = GoogleUser.getAuthResponse().id_token;\n\n var xhr = new XMLHttpRequest();\n var email = profile.getEmail();\n var name = profile.getName();\n xhr.open('POST', '/public/verifyIdToken');\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n xhr.onload = function() {\n signInSuccess(name);\n }\n xhr.send('idtoken=' + id_token + '&email=' + email + '&name=' + name);\n}", "function getUserProfile(context, reqBody, decoded, token, cb) {\n const options = {\n url:\n 'https://' +\n context.data.ACCOUNT_NAME +\n '.auth0.com/api/v2/users/' +\n decoded.sub,\n json: true,\n headers: {\n authorization: 'Bearer ' + token,\n },\n };\n\n request.get(options, function(error, response, user) {\n return cb(error, context, reqBody, user);\n });\n}", "function getOneProfile(req, res) { \n Profile.findOne({byUser: req.params.id})\n .then(profile => res.json(profile)\n .catch(err => res.json(err)))\n}", "function getDataProfile() {\n loader(1);\n //alert(accessToken);\n\t\tvar term = null;\n\t\t$.ajax({\n\t\t\turl: 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=' + accessToken,\n\t\t\ttype: 'GET',\n\t\t\tdata: term,\n\t\t\tdataType: 'json',\n\t\t\terror: function(jqXHR, text_status, strError) {\n //alert(JSON.stringify(jqXHR));\n //alert(JSON.stringify(text_status));\n //alert(JSON.stringify(strError));\n disconnectUser();\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tvar item;\n\t\t\t\tconsole.log(JSON.stringify(data));\n\t\t\t\t//alert(JSON.stringify(data));\n\t\t\t\t// Save the userprofile data in your localStorage.\n\t\t\t\t/* localStorage.gmailLogin = \"true\";\n\t\t\t\tlocalStorage.gmailID = data.id;\n\t\t\t\tlocalStorage.gmailEmail = data.email;\n\t\t\t\tlocalStorage.gmailFirstName = data.given_name;\n\t\t\t\tlocalStorage.gmailLastName = data.family_name;\n\t\t\t\tlocalStorage.gmailProfilePicture = data.picture;\n\t\t\t\tlocalStorage.gmailGender = data.gender; */\n\t\t\t\tdisconnectUser();\n\t\t\t\tGoogleName = data.given_name+' '+data.family_name;\n\t\t\t\tGoogleEmail = data.email;\n\t\t\t\tGoogleId = data.id;\n\t\t\t\tImgUser = data.picture;\n\t\t\t\tSignInDirect('google');\n\t\t\t}\n\t\t});\n\t}", "function profile(){\n let login = window.sessionStorage.getItem('login');\n getProfile(login);\n}", "async getProfile(req, res) {\n try {\n return res.status(200).json(req.user);\n } catch (err) {\n return res.status(500).json({\n statusCode: 500,\n message: 'Server Error',\n });\n }\n }", "async getProfileById(req, res, next) {\n try {\n const profile = await accountService.getProfileById(req.userInfo.id)\n res.send(profile)\n } catch (error) {\n next(error)\n }\n }", "fetchProfile(context) {\n return new Promise((resolve, reject) => {\n service\n .getUser()\n .then(function(user) {\n if (user == null) {\n context.dispatch('signIn');\n context.commit('setProfile', null);\n return resolve(null);\n } else {\n context.commit('setProfile', user.profile);\n return resolve(user.profile);\n }\n })\n .catch(function(err) {\n context.commit('setError', err);\n return reject(err);\n });\n });\n }", "getProfile(profile = {}) {\n return new Promise((resolve, reject) => {\n if (this.isAuthenticated()) {\n return fetch(`${Config.host}/api/users/${profile._id}`, {\n headers: {\n Authorization: `Bearer ${this.user.token}`\n }\n })\n .then(res => res.json())\n .then(json => {\n resolve(json);\n });\n }\n reject({\n error: \"You must be authenticated\"\n });\n });\n }", "function getUserProfile(username, callback) {\n db.User.findOne({username: username})\n .then(result => {\n console.log('result from find in getUserProfile:', result);\n callback(null, result);\n })\n .catch(err => {\n console.log('error in getUserProfile:', err);\n callback(err);\n })\n}", "function getProfile (username) {\n return axios.get('https://api.github.com/users/' + username + params)\n .then(function (user) {\n return user.data;\n })\n}", "static renderUserProfile() {\n fetch(`${baseURL}/profile`, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${localStorage.getItem('jwt_token')}`\n }\n })\n .then(resp => resp.json())\n .then(user => {\n // console.log(user)\n // let newUser = new User(user.user)\n //User.currentUser(newUser)\n alert(`Welcome back ${user.user.name}!`)\n })\n }", "function getUserProfile(user) {\n return {\n coords: [noise(user.longitude), noise(user.latitude)],\n name: user.name,\n location: user.city + ', ' + user.state,\n email: user.email,\n company: user.currentemployer,\n cohort: user.cohort\n };\n}", "async getInfo() {\n let userResult = await this.request(\"user\");\n return userResult.user;\n }", "show(req, res, next) {\n this.kernel.model.User.findOne({_id: req.params.ud})\n .then(user => {\n if (!user) {\n return res.status(404).end();\n }\n\n res.json(user.profile);\n })\n .catch(err => next(err));\n }", "function getDetails() {\n var user = firebase.auth().currentUser\n if (user) {\n // User is signed in.\n if (user != null) {\n name = user.displayName\n email = user.email\n photoUrl = user.photoURL\n emailVerified = user.emailVerified\n uid = user.uid\n // The user's ID, unique to the Firebase project. Do NOT use\n // this value to authenticate with your backend server, if\n // you have one. Use User.getToken() instead.\n }\n } else {\n // No user is signed in.\n }\n}", "function get(req, res) {\n res.render(\"userProfile\", {\n user: req.user\n });\n}", "async function profile (req, res) {\n if (!req.body.userId || req.body.userId == \"\") {\n res.status(400).send(resFormat.rError(\"Invalid request\"))\n } else {\n User.findOne({_id: req.body.userId}, function(err, user) {\n if (err) {\n res.status(403).send(resFormat.rError(err))\n } else {\n responseData = {\n \"name\": user.fullName,\n \"contactNumber\": user.contactNumber,\n \"email\": user.email,\n \"profession\": user.profession,\n \"referralCode\": user.referralCode,\n \"userId\": user._id\n }\n res.send(resFormat.rSuccess(responseData))\n }\n })\n }\n}", "get profile () {\n\t\treturn this._profile;\n\t}", "function fetchUserInfo(){\n\t gapi.client.load('oauth2', 'v1', function(){\n\t var userinfo = gapi.client.request('oauth2/v1/userinfo?alt=json');\n\t userinfo.execute(function(resp){\n\t window.user={\n\t \t\"email\":resp.email,\n\t \t//\"name\":resp.given_name,\n\t \t//\"id\":resp.id\n\t }\n\t loadTimeline();\n\t });\n\t });\n\t }", "function user(){\r\n uProfile(req, res);\r\n }", "function getUserProfile(callback){\n\tconsole.log('getUserProfilerunning::'+ username);\n\tconst settings = {\n\t\turl: DATABASE_URL+`userprofile/`,\n\t\tdata: {username: username},\n\t\theaders: {\n\t\t\t'Authorization': \"Bearer \"+ AUTHORIZATION_CODE,\n\t\t},\n\t\tsuccess: callback,\n\t\terror: \"Error getting userprofile info\"\n\t};\n\t$.ajax(settings);\n}", "function getProfile(username) {\n return db.query(\n `SELECT first_name, last_name, age, email, bio, img_path FROM USERS WHERE username = \"${username}\";`\n );\n}", "async getUsersProfile (userId) {\n const response = await axiosConfig.get(`profile/${userId}`)\n return response\n }", "showLoggedIn() {\n\t\tvar profile = JSON.parse(localStorage.getItem('profile'));\n\t\tconsole.log(profile)\n\t\treturn profile;\n\t}", "function loadMyProfile() {\n\t\tlet userId = sessionStorage.getItem('userId');\n\n\t\tauthorService.loadAuthorByUserId(userId)\n\t\t\t.then(author => {\n\t\t\t\tdisplayUpdateAuhtorForm(author);\n\n\t\t\t}).catch(handleError);\n\t}", "function getUserInfo(authData) {\n var fbData = authData.providerData[0];\n var fbCachedUserProfile = fbData.cachedUserProfile || {};\n return {\n name: fbData.displayName,\n email: fbData.email || null,\n avatar: fbData.photoURL || null,\n gender: fbCachedUserProfile.gender || null\n };\n }", "get profiles() {\r\n return this.create(UserProfileQuery);\r\n }", "function getUser() {\n if (promisedUser.data.success) {\n $scope.user = promisedUser.data.user;\n $window.sessionStorage.setItem('currentUser', JSON.stringify($scope.user));\n }\n }", "function getProfileFromSession(callback) {\n Common.getProfile(Common.getCellUrl(), callback);\n}", "async function getMe(req, res) {\n\ttry {\n\t\tconst me = await req.api.getMe();\n\t\tres.send({\n\t\t\tloggedIn: true,\n\t\t\tprofile: me,\n\t\t\terr: null,\n\t\t});\n\t} catch (e) {\n\t\tpino.error(\"Something went wrong with user info: \" + e);\n\t\tres.send({ user: null, err: e, loggedIn: false });\n\t}\n}", "async function getCurrentProfileData() {\n const userData = await fetch('/profile-update');\n return userData.json();\n}", "function getProfileByUserid(user,callback) {\n $.getJSON( '/users/getProfileByUserid/', {id: user}, function( data ) {\n callback(data);\n });\n}", "get profile() {\n return this._profile;\n }", "function githubProfile(){\n return $http({\n method: 'GET',\n url: '/github/user/',\n }).then(function(response) {\n console.log(response.data);\n user.data = response.data;\n });\n }", "getCurrentProfile() {\n return this.currentProfile;\n }", "function getUser () {return user;}", "function profileReq () {\n const request = apiHelper.axGet(apiUrls.profiles, authToken)\n return axios(request)\n }", "fetchUser() {\n\t\tconst user = _userFromAccessToken(_accessToken);\n\t\treturn _makeRequest('/users/' + user.id, {needsAuth: true})\n\t\t\t.then(responseData => {\n\t\t\t\tif(responseData.success){\n\t\t\t\t\treturn responseData.user;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.error(error);\n\t\t\t});\n\t}", "function getUserProfile(userId, fields, accessToken) {\n\treturn new Promise(function (resolve, reject) {\n\t\tif ( !userId ) {\n\t\t\treturn resolve({})\n\t\t}\n\t\tif (userId == process.env.WORKPLACE_GROUP_ID) {\n\t\t\treturn resolve({})\n\t\t}\n\n\t\tvar options = {\n\t\t\tmethod: \"GET\",\n\t\t\turi: FACEBOOK_GRAPH_URL + userId + \"?fields=\" + fields + \"&\"+generateProof(accessToken) ,\n\t\t\theaders: { \"Content-Type\": \"application/json\", \"Accept\": \"application/json\" },\n\t\t\tjson: true\n\t\t}\n \n\t\trpn(options)\n\t\t\t.then( json => {\n\t\t\t\treturn resolve(json)\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tconsole.error(\"facebook/utility getUserProfile caught an error: \" + err)\n\t\t\t\treturn reject(err)\n\t\t\t}) \n\t})\n}", "function findUser (profileId) {\n return db.UserModel.findOne({profileId: profileId})\n}", "async function getUser() {\n ensureScope('user.read');\n return await graphClient\n .api('/me')\n .select('id,displayName')\n .get();\n}", "async function getUser() {\n ensureScope('user.read');\n return await graphClient\n .api('/me')\n .select('id,displayName')\n .get();\n}", "async function profilePage() {\n if (getPath() === 'profile.html') {\n const params = new URLSearchParams(document.location.search.substring(1));\n let overview;\n if (params.has('user')) {\n // Hide edit button\n document.querySelector('a.edit').classList.add('hide');\n\n // Fetch user profile\n const id = params.get('user');\n const [user] = await UserAPI.fetchUser(id);\n // Fetch user records\n const baseUrl = RecordAPI.uri;\n const url = `${baseUrl}/records?user=${id}`;\n const records = await RecordAPI.fetchRecords(url);\n overview = generateOverview(records);\n renderProfile(user, overview);\n } else {\n const { user } = auth();\n overview = getOverview();\n renderProfile(user, overview);\n }\n }\n}", "profile(){\n return this.request.get(`${this.baseURL}/businesses/session`, {}, this.credentials);\n }", "function profile(authToken, apiUrl){\n\tconst array = createPopup(\"profile\", \"My Profile\");\n\tconst div = array[0];\n\tlet content = array[1];\n\tconst param = {\n\t\t method: 'GET',\n\t\t headers:{\n\t\t\t\t 'Authorization': `Token ${authToken}`,\n\t\t\t\t 'Content-Type': 'application/json',\n\t\t\t }\n\t\t }\n\tfetch(apiUrl + \"/user/\", param)//defaults to logged in if id not supplied\n\t.then(function(response) {\n \t\tif (!response.ok) throw Error(response.statusText);\n\t\treturn response.json();\n\t})\n\t.then(function(responseAsJson){\n\t\tconsole.log(responseAsJson);\n\t\t//create info on pop up\n\t\tcontent = profileContent(div, content, responseAsJson, apiUrl, authToken);\n\t})\n\t.catch(function(error){\n\t\tconsole.log('Looks like there was a problem: \\n', error);\n\t});\n\tconsole.log(div);\n\treturn div;\n}", "function getUser() {\n var userEmail = 'liz@example.com';\n var user = AdminDirectory.Users.get(userEmail);\n Logger.log('User data:\\n %s', JSON.stringify(user, null, 2));\n}", "static getUser() {\n return JSON.parse(localStorage.getItem('userInfo'));\n }", "function userProfileUrl() { return \"{{conf.reqUrl}}/api/userprofile/\"; }", "function getActualUser() {\n $http.get('/user/data/' + $scope.profileUserId)\n .success(function(data) {\n console.log(data);\n $scope.profileUser = new User(data._id, data.firstName, data.lastName, data.username,\n data.password, data.gender, data.role, data.doctors);\n })\n .error(function(err) {\n console.log(err);\n });\n }", "async function getUser(auth){\n const gmail = google.gmail({version: 'v1' , auth});\n \n let userInfo = await gmail.users.getProfile({auth: auth , userId: 'me'})\n return userInfo\n}" ]
[ "0.8579845", "0.7990188", "0.79420537", "0.78705734", "0.7765", "0.77425575", "0.7731952", "0.772613", "0.76890296", "0.76627886", "0.7590929", "0.7519263", "0.7489081", "0.7489075", "0.74612564", "0.7446453", "0.7442968", "0.73856777", "0.7366988", "0.7359126", "0.73516834", "0.73516834", "0.7339697", "0.73271704", "0.73120826", "0.7294758", "0.7293348", "0.72923857", "0.7275265", "0.72619015", "0.7251807", "0.7228839", "0.72236806", "0.72103256", "0.7209912", "0.7202335", "0.7140585", "0.7117345", "0.71169573", "0.7112904", "0.70849276", "0.70843667", "0.70674133", "0.70478797", "0.7037714", "0.7019985", "0.69894516", "0.69891953", "0.6975392", "0.692592", "0.692405", "0.6907439", "0.6902326", "0.6899469", "0.68982697", "0.6897498", "0.689106", "0.6882935", "0.6871954", "0.6858752", "0.68500704", "0.68264496", "0.68262863", "0.6817537", "0.6801477", "0.6777903", "0.6775667", "0.6755133", "0.6747784", "0.6746437", "0.6728466", "0.67185074", "0.6705537", "0.66934127", "0.66902846", "0.66876", "0.6685006", "0.6681458", "0.66627234", "0.66525924", "0.6650861", "0.66459364", "0.6639632", "0.66363585", "0.6611739", "0.6605571", "0.66028786", "0.65850633", "0.65655154", "0.656395", "0.6558226", "0.6558226", "0.6550339", "0.65287805", "0.6518421", "0.65059376", "0.65048605", "0.6502571", "0.648887", "0.6465976" ]
0.7514947
12
Initialize a new user in the database
function create(){ // PREPARE let uid = $rootScope.account.authData.uid; let profile = instance.extract($rootScope.account.authData); // INITIALIZE $rootScope.db.users.child(uid).set(profile); $rootScope.account.profile = profile; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n \n newUser()\n\n}", "function createUser(newUser){\n\n UserService\n .createUser(newUser)\n .then(\n function (doc) {\n vm.user = null;\n init();\n });\n }", "function createUser() {}", "function createNewUser(username, password, email) {\n return dbinit.then(function(initDB) {\n\t\treturn initDB.User.create({\n\t username: username,\n\t\t\tpassword: password,\n\t\t\temail: email\n\t });\n\t})\n}", "function createUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n\n userService\n .createUser(user)\n .then(findAllUsers)\n .then(emptyUserForm);\n }", "initUsers() {\n this.user = new _models_user__WEBPACK_IMPORTED_MODULE_2__[\"User\"]('', // \"_id\"\n null, // \"cuenta\"\n null, // \"contrase\"\n null, // \"correo\"\n '', // \"nombre\"\n '', // \"image\"\n '', // \"apellido\"\n '', // \"cedula\"\n '', // \"direccion\"\n '', // \"telefono\"\n '', // \"fecha_nacimiento\"\n '', // \"sexo\"\n 'Simple', // \"role_user\"\n true, // \"activa\"\n '');\n }", "function initUser(callback) {\n\n try {\n initModel.db.createCollection('system_user');\n } catch (e) {\n log.error(e);\n }\n\n let coUse = initModel.db.collection('system_user');\n let defaultAdmin = {\n user_email: systemConst.adminEmail,\n password: md5(systemConst.adminReset),\n role: 'admin',\n privilige: '*'\n };\n\n coUse.insertOne(defaultAdmin, function(err, data) {\n if (err) {\n console.log(err);\n } else if (data.result.ok !== 1) {\n console.log(\"Insert Failed.\");\n } else {\n callback(err, data);\n }\n });\n}", "constructor() { \n \n User.initialize(this);\n }", "function registerNewUser() {\n USER_NAME = buildNewName();\n USER_PWD = buildNewPassword();\n register(USER_NAME, USER_PWD);\n}", "function newUser(){\r\r\n}", "function createUser() {\n var newUser = {\n username: $usernameFld.val(),\n password: $passwordFld.val(),\n firstName: $firstNameFld.val(),\n lastName: $lastNameFld.val(),\n role: $roleFld.val()\n };\n try {\n userService\n .createUser(newUser)\n .then(function (userServerInfo) {\n users.push(userServerInfo);\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "async function initFirst(){\n const users = await User\n .find();\n if(users.length===0){\n createUser(1,'Nandor','Relentless','impenetrablefortress@gmail.com',35);\n createUser(2,'Guillermo','De La Cruz','mosquitoHR@yahoo.com',24);\n createUser(3,'Baron','Afanas','brafanas@outlook.com',75);\n }\n}", "async function initializeUsers() {\n try {\n await createUser({\n username: 'guest',\n password: 'password',\n admin: false\n });\n\n await createUser({\n username: 'admin',\n password: 'adminpassword',\n admin: true\n });\n\n await createUser({\n username: 'updateMe',\n password: 'password',\n admin: true\n });\n\n await createUser({\n username: 'brody',\n password: 'password',\n admin: true\n });\n\n await createUser({\n username: 'sam',\n password: 'password',\n admin: true\n });\n\n await createUser({\n username: 'tyler',\n password: 'password',\n admin: true\n });\n\n await createUser({\n username: 'deleteMe',\n password: 'password'\n });\n } catch (error) {\n throw error;\n }\n}", "function addUser() {\n var user = {\n primaryEmail: 'liz@example.com',\n name: {\n givenName: 'Elizabeth',\n familyName: 'Smith'\n },\n // Generate a random password string.\n password: Math.random().toString(36)\n };\n user = AdminDirectory.Users.insert(user);\n Logger.log('User %s created with ID %s.', user.primaryEmail, user.id);\n}", "function createNewUser(name, email, passwd, phone, date, zip) {\n var newUser = new UserObject();\n newUser.set(\"username\", email);\n newUser.set(\"password\", passwd);\n newUser.set(\"name\", name);\n newUser.set(\"email\", email);\n if (phone != \"\") newUser.set(\"phone\", phone);\n if (date != \"\") newUser.set(\"weddingDate\", date);\n newUser.set(\"zipCode\", zip);\n return newUser.signUp();\n}", "function createUser(userId, email, password){\n databases.users[userId] = {\n 'id': userId,\n 'email': email,\n 'password': bcrypt.hashSync(password, 5)\n }\n databases.urlDatabase[userId] = {};\n}", "init() {\n this.db.insert({\n user: 'test',\n name: 'daniel',\n password: '$2b$10$fo7VK2B.BYhkbiFgk0YlOOWg.hZ3dYBF/bdncOXhMgEiaoLNce0Fy'\n });\n \n console.log('user : Daniel Added')\n\n //console.log('user record inserted in init');\n return this;\n }", "async function newUser({ name, email, phone }) {\n const newUser = await User.create({ name, email, phone });\n return newUser.get({ plain: true });\n}", "newUser(req, res, next) {\n // EXTRACT FORM DATA\n const { username, email, password } = req.body;\n\n // INSERT USER DATA INTO AN OBJECT\n let newUser = { username, email, password };\n\n // USE MODEL TO REGISTER A NEW USER\n User.addUser(newUser)\n .then(user => {\n res.status(201).json({\n success: true,\n message: 'User registered',\n user: {\n id: user.id,\n username: user.username,\n email: user.email\n }\n });\n })\n .catch(err => console.error(err));\n }", "function criaUser() {\r\n var Usuarios = {\r\n email: formcliente.email.value,\r\n nome: formcliente.nome.value,\r\n pontos: formcliente.pontos.value,\r\n senha: formcliente.senha.value,\r\n sexo : formcliente.sexo.value\r\n };\r\n addUser(Usuarios);\r\n}", "function newUser(anrede,vorname,nachname,Strasse,Hausnummer,Plz,Ort,Email,Benutzername,Passwort){\r\n\r\n\tnewUser = new User({\r\n\t\tanrede: anrede,\r\n\t\tvorname: vorname,\r\n\t\tnachname: nachname,\r\n\t\tStrasse: Strasse,\r\n\t\tHausnummer: Hausnummer,\r\n\t\tPlz: Plz,\r\n\t\tOrt: Ort,\r\n\t\tEmail: Email,\r\n\t\tBenutzername: Benutzername,\r\n\t\tPasswort: Passwort,\r\n\t\t_id: Benutzername\r\n });\r\n\tif(!saveObjectIntoDB(newUser)){\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "function newUser(anrede,vorname,nachname,Strasse,Hausnummer,Plz,Ort,Email,Benutzername,Passwort){\r\n\r\n\tnewUser = new User({\r\n\t\tanrede: anrede,\r\n\t\tvorname: vorname,\r\n\t\tnachname: nachname,\r\n\t\tStrasse: Strasse,\r\n\t\tHausnummer: Hausnummer,\r\n\t\tPlz: Plz,\r\n\t\tOrt: Ort,\r\n\t\tEmail: Email,\r\n\t\tBenutzername: Benutzername,\r\n\t\tPasswort: Passwort,\r\n\t\t_id: Benutzername\r\n });\r\n\tif(!saveObjectIntoDB(newUser)){\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "createUser (user) {\n\t\treturn User.create(user).exec();\n\t}", "function registerUser(){\n Cloud.Users.create({\n username: \"push123x\",\n password: \"push123x\",\n password_confirmation: \"push123x\",\n first_name: \"Firstname\",\n last_name: \"Lastname\"\n }, function (e) {\n if (e.success) {\n \talert(\"User Created\");\n \tloginUser();\n } else {\n \talert(\"Error :\"+e.message);\n }\n });\n}", "function registerUser() {\n let email = $(\"#txtEmail\").val();\n let pass= $(\"#txtPassword\").val();\n let first= $('#txtFirst').val();\n let last = $('#txtLast').val();\n let age = $('#txtAge').val();\n let address = $('#txtAddress').val();\n let phone = $('#txtPhone').val();\n let payment = $('#txtPayment').val();\n let color = $('#txtColor').val();\n\n let user = new User(email, pass, first, last, age, address, phone, payment, color);\n console.log(user);\n\n saveUser(user); // This function is on the storeManager\n clearUser();\n\n}", "function CreateNewUser(isClosed){\n\tvar result = validateUserFields()\n\tif(result){\n\t\tsaveUserData(0,isClosed)\n\t}\n}", "function init(){\n UserService\n .findUserById(userId)\n .then(function (response) {\n vm.user = response.data;\n });\n }", "function create(\n username,\n email,\n full_name,\n password,\n profile_picture,\n role,\n done\n) {\n var newUser = new User({\n username,\n email,\n full_name,\n password,\n profile_picture,\n role,\n });\n newUser.save((err, doc) => {\n if (err) {\n return done(err);\n }\n const { _id, username, email, full_name, role } = doc;\n return done(false, { _id, username, email, full_name, role });\n });\n}", "init() {\n this.db.insert({\n user: 'Peter',\n password:\n '$2b$10$I82WRFuGghOMjtu3LLZW9OAMrmYOlMZjEEkh.vx.K2MM05iu5hY2C'\n });\n //console.log('user record inserted in init');\n\n this.db.insert({\n user: 'Ann',\n password: '$2b$10$bnEYkqZM.MhEF/LycycymOeVwkQONq8kuAUGx6G5tF9UtUcaYDs3S'\n });\n console.log('user record inserted in init');\n return this;\n }", "function insertNewUser({ username, firstname, lastname, email, password, admin }) {\n}", "static createUser (model, data) {\n return model.User.create(data.user);\n }", "function createUser(){\n let username = getUsername();\n let password = getPassword();\n\n if (username.length != 0){\n if (allUsers.has(username)){\n throw new Error(\"User with us\");\n }\n allUsers.set(username, password);\n console.log(\"User added: \" + username + \" \" + password);\n } else{\n throw new Error(\"Username is empty\");\n }\n}", "function createUser(req, res, next) {\n const sql = sqlString.format(`INSERT INTO users SET ?`, req.body)\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n res.send('New user added successfully')\n })\n}", "function userCreate(cb) {\n\n var user = new User({\n _projectId: projects[0],\n username: 'DinushaDJ',\n email: 'dinusha.jayashan01@gmail.com',\n password: 'dinusha123',\n userType: 'Member'\n });\n\n user.save(function (err) {\n if (err) {\n cb('user', null);\n return\n }\n console.log('New User ' + user);\n users.push(user);\n cb(null, user)\n } );\n}", "async create(userData) {\n userData.admin = false;\n let password = userData.password;\n let passwordHashed = bcrypt.hashSync(password, 10);\n userData.password = passwordHashed;\n return User.create(userData);\n }", "function registerUser(){\r\n let email=$(\"#txtEmail\").val();\r\n let pass=$(\"#txtPassword\").val();\r\n let firstName=$(\"#txtFirst\").val();\r\n let lastName=$(\"#txtLast\").val();\r\n let age=$(\"#txtAge\").val();\r\n let address=$(\"#txtAddress\").val();\r\n let phone=$(\"#txtPhone\").val();\r\n let payment=$(\"#selPayment\").val();\r\n let color=$(\"#txtColor\").val();\r\n let user = new User(email,pass,firstName,lastName,age,address,phone,payment,color);\r\n console.log(user);\r\n saveUser(user);// this function is on the storeManager\r\n clearForm();\r\n setNavInfo()\r\n\r\n}", "function registerUserInDB(username, password){\n let newUser = new User({username: username, password: password});\n return newUser.save();\n}", "createNewUser(cred){\n\t\treturn db.one(`INSERT INTO user_id(uname, password) VALUES ($[uname], $[password]) RETURNING *`, cred);\n\t}", "function signup({ email, password, city, dateOfBirth, username }) {\n // create new user\n}", "static create(user, cb) {\n let instance = userSchema.createUserInstance(user);\n\n instance.save(cb)\n }", "function onCreateUserCallback(options, user) {\n \n const schema = Users.simpleSchema()._schema;\n\n delete options.password; // we don't need to store the password digest\n delete options.username; // username is already in user object\n\n options = runCallbacks('users.new.validate.before', options);\n\n // validate options since they can't be trusted\n Users.simpleSchema().validate(options);\n\n // check that the current user has permission to insert each option field\n _.keys(options).forEach(fieldName => {\n var field = schema[fieldName];\n if (!field || !Users.canCreateField(user, field)) {\n throw new Error(Utils.encodeIntlError({ id: 'app.disallowed_property_detected', value: fieldName }));\n }\n });\n\n // extend user with options\n user = Object.assign(user, options);\n\n // run validation callbacks\n user = runCallbacks('users.new.validate', user);\n\n // run onInsert step\n _.keys(schema).forEach(fieldName => {\n if (!user[fieldName] && schema[fieldName].onInsert) {\n const autoValue = schema[fieldName].onInsert(user, options);\n if (autoValue) {\n user[fieldName] = autoValue;\n }\n }\n });\n\n if (user.username && user.services != 'password') {\n let existingUsername = Meteor.users.findOne({ 'username': user.username });\n if (existingUsername) {\n delete user.username;\n }\n }\n\n if (user.services) {\n \n const service = _.keys(user.services)[0];\n\n let email = user.services[service].email;\n if (!email) {\n if (user.emails) {\n email = user.emails.address;\n }\n }\n if (!email) {\n email = options.email;\n }\n if (!email) {\n // if email is not set, there is no way to link it with other accounts\n\n user = runCallbacks('users.new.sync', user);\n runCallbacksAsync('users.new.async', user);\n\n // check if all required fields have been filled in. If so, run profile completion callbacks\n if (Users.hasCompletedProfile(user)) {\n runCallbacksAsync('users.profileCompleted.async', user);\n }\n return user;\n }\n // see if any existing user has this email address, otherwise create new\n let existingUser = Meteor.users.findOne({ 'emails.address': email });\n if (!existingUser) {\n // check for email also in other services\n let existingTwitterUser = Meteor.users.findOne({ 'services.twitter.email': email });\n let existingGoogleUser = Meteor.users.findOne({ 'services.google.email': email });\n let existingFacebookUser = Meteor.users.findOne({ 'services.facebook.email': email });\n let doesntExist = !existingGoogleUser && !existingTwitterUser && !existingFacebookUser;\n if (doesntExist) {\n user = runCallbacks('users.new.sync', user);\n runCallbacksAsync('users.new.async', user);\n\n if(newsletter_subs.findOne({email})){\n user.newsletter_subscribeToNewsletter = true;\n newsletter_subs.remove({email});\n }\n\n // check if all required fields have been filled in. If so, run profile completion callbacks\n if (Users.hasCompletedProfile(user)) {\n runCallbacksAsync('users.profileCompleted.async', user);\n }\n return user;\n } else {\n existingUser = existingGoogleUser || existingTwitterUser || existingFacebookUser;\n if (existingUser) {\n if (user.emails) {\n existingUser.emails = user.emails;\n }\n }\n }\n }\n\n if (!existingUser.services) {\n existingUser.services = { resume: { loginTokens: [] } };\n }\n\n existingUser.services[service] = user.services[service];\n if (service === 'password') {\n existingUser.username = user.username;\n }\n\n if(newsletter_subs.findOne({email})){\n existingUser.newsletter_subscribeToNewsletter = true;\n newsletter_subs.remove({email});\n }\n\n Meteor.users.remove({ _id: existingUser._id }); // remove existing record\n\n existingUser = runCallbacks('users.new.sync', existingUser);\n runCallbacksAsync('users.new.async', existingUser);\n\n // check if all required fields have been filled in. If so, run profile completion callbacks\n if (Users.hasCompletedProfile(existingUser)) {\n runCallbacksAsync('users.profileCompleted.async', existingUser);\n }\n\n return existingUser; // record will be re-inserted\n } else {\n user = runCallbacks('users.new.sync', user);\n runCallbacksAsync('users.new.async', user);\n\n // check if all required fields have been filled in. If so, run profile completion callbacks\n if (Users.hasCompletedProfile(user)) {\n runCallbacksAsync('users.profileCompleted.async', user);\n }\n return user;\n }\n\n}", "createNewUser(userName, fullName, unhashedPassword, phone, countryCode, callback) {\n authy.register_user(userName, phone, countryCode, (err, res) => {\n if (err) {\n return callback(err);\n }\n let authyID = res.user.id;\n\n this.saveUser(unhashedPassword, userName, fullName, phone, countryCode, authyID, callback);\n });\n }", "static createUser(userid, userEmail, lastname){\n admin.database().ref('user/' + userid).set({\n name: lastname,\n email: userEmail\n }).catch((err) => console.log(err));\n }", "function CreateSuperUser(callback) {\n Modal.User.find({username: 'admin'}, function (err, data) {\n if (err) {\n log.error(err);\n } else {\n if (data.length == 0) {\n new Modal.User({\n username: \"admin\",\n password: \"admin\"\n }).save(function (err, result) {\n if (err) {\n log.error(\"Error Save Record: \" + err);\n } else {\n log.cool('Super User Created Successfully');\n }\n })\n } else {\n log.cool('Super User Already Available');\n }\n }\n callback(err, 'user saved');\n });\n }", "function create_user(userobject){\n\n}", "async newUser(name, email, password) {\n try {\n const hash = await bcrypt.hash('' + password, 10);\n await knex\n .insert({ name, email, password: hash, role: 0 })\n .table('users');\n } catch (error) {\n console.log(error);\n }\n }", "async createUser () {\n\t\t// first create the user, unregistered...\n\t\tconst { email, fullName, username, passwordHash, timeZone, preferences } = this.request.body.user;\n\t\tconst user = await new UserCreator({\n\t\t\trequest: this,\n\t\t\texistingUser: this.existingUser\n\t\t}).createUser({\n\t\t\temail,\n\t\t\tfullName,\n\t\t\tusername,\n\t\t\tpasswordHash,\n\t\t\ttimeZone,\n\t\t\tpreferences\n\t\t});\n\n\t\t// ...then confirm...\n\t\treturn this.confirmUser(user);\n\t}", "function createUserController(request, response) {\n const userData = request.body;\n delete userData.password;\n\n const newUser = model.insert(userData);\n\n response.status(httpStatus.CREATED).json(newUser);\n}", "function signup({ username, password, email, dateOfBirth, city }) {\n // TODO: create new user\n}", "function test_create_user(first, last, password, email){\r\n console.log(\"Testing user creation\");\r\n user_model.create_user(first, last, password, email);\r\n\r\n}", "function generateNewUser() {\n return {\n firstName: faker.name.firstName(),\n lastName: faker.name.lastName(),\n email: faker.internet.email(),\n password: faker.internet.password()\n }\n}", "function initUser() {\n setUserProfile(null);\n service.init();\n }", "function createUser(firstname, lastname, username, password) {\n let person = new UserSignUp(firstname, lastname, username, password);\n ajax(\"PUT\", \"/auth\", isCreateUserOk, person);\n}", "function create(username, password)\n{\n return userModel.create(\n {\n version: CURRENT_VERSION,\n username: username,\n password: password\n }\n );\n}", "constructor(email, name) {\n // 'email , name' are arguments\n this.email = email;\n this.name = name;\n\n // when ever we create a new user with different values for the properties (email , name..)\n }", "function createUser() {\n return UserDataService.signup(props.onLogin, setValidation, values);\n }", "addUser() {\r\n // Create a new user with the given email and password.\r\n firebase.auth().createUserWithEmailAndPassword(this.state.email,this.state.password)\r\n .then(() => {\r\n var username = firebase.auth().currentUser.uid;\r\n // Set the user status to active.\r\n firebase.database().ref(\"/users/\"+username+\"/settings/active\").set({\r\n value: true\r\n });\r\n // Initialize a date that will allow the user to start a new conversation.\r\n firebase.database().ref(\"/users/\"+username+\"/settings/latestConvo\").set({\r\n timestamp: \"6/20/2018, 00:00:00 AM\"\r\n });\r\n firebase.database().ref(\"/users/\"+username+\"/settings/gender\").set(\"other\")\r\n firebase.database().ref(\"/users/\"+username+\"/settings/blocked\").set(\"false\")\r\n firebase.database().ref(\"/activeUsers/\"+username).set({\r\n username: username\r\n })\r\n // Navigate to the main menu with firstLogin as true, meaning that the intro page will display.\r\n this.props.navigation.navigate('Tabs', {firstLogin: true})})\r\n .catch(error => this.setState({errorMessage: error.message}));\r\n }", "function createUser(userData) {\n\t\tuserAuth.register(userData, function(err) {\n\t\t\tif(err){ \n\t\t\t\t$rootScope.flashMessage = {data: \"Something went wrong please try again\", type: \"error\"}\n\t\t\t}else{\n\t\t\t\tif($rootScope.currentUser.role == \"Author\"){\n\t\t\t\t\t$location.path('/info');\n\t\t\t\t\t$rootScope.flashMessage = {data: \"Kindly fill your profile details\", type: \"success\"}\n\t\t\t\t\tvm.showForm = true;\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t$location.path('/');\n\t\t\t\t$rootScope.flashMessage = {data: \"Successfully Logged In\", type: \"success\"}\n\t\t\t}\n\t\t});\n\t}", "function createNewUser(req) {\n console.log(\"inside createNewUser\", req.body.username)\n const salt = bcrypt.genSaltSync();\n const hash = bcrypt.hashSync(req.body.password, salt);\n return User.create({\n username: req.body.username,\n first_name: req.body.first_name,\n last_name: req.body.last_name,\n email: req.body.email,\n password: hash,\n });\n}", "function registerUser() {\n addUser()\n }", "function register() {\n User.register(self.user, handleLogin);\n }", "async addUser(name){\n return user.create(name)\n }", "initCognitoUser() {\n \tvar userData = {\n \tUsername : this.username,\n \tPool : this.userPool\n \t};\n \tthis.cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);\n\t}", "function init() {\n\n UserService\n // .findUserById(userId)\n .findCurrentUser() //returning the current user from session which is stored in req.user on server\n .success(function (user) {\n if(user != '0') {\n vm.user = user;\n }\n })\n .error(function () {\n\n });\n }", "async function addNewUser() {\n const randomTokenVerifying = genRandomToken(32);\n const encryptedToken = await bcrypt.hash(randomTokenVerifying, 8);\n\n // 2] generate url for verification\n const url = `${frontend_link}/verifyEmail/${randomTokenVerifying}`;\n\n await new Email({ firstName, email }, url).verifyEmail();\n const user = await User.create({\n firstName,\n lastName,\n email,\n password,\n passwordConfirm,\n phone,\n photo,\n });\n\n // 4-a] save random token to database after hashing it && change expiry date\n\n //====================\n\n user.randomTokenVerifying = encryptedToken;\n await user.save({ validateBeforeSave: false });\n res.status(200).json({\n status: 'success',\n data: user,\n });\n }", "function userInitialize(username, password) {\n var key_pair = genKeys(username, password);\n var encrypted_pri_key = encryptPriKey(key_pair.pri_key, password);\n var registration = {\n \"pri_key\": key_pair.pri_key,\n \"pub_key\": key_pair.pub_key,\n \"encrypted_pri_key\": encrypted_pri_key,\n \"username\": username,\n \"completed\": false\n };\n writeLocalStorage(\"registration\", registration);\n return registration;\n}", "_registerUser(id){\n\t\tthis.idUser = id;\n\t}", "function init() {\n\t\t\tctrl.user = {};\n\t\t\t$scope.$on('$routeChangeSuccess', function (scope, next, current) {\n\t\t\t\tif ($routeParams.id != undefined && $routeParams.id !== ctrl.user.id) {\n\t\t\t\t\tctrl.user.id = $routeParams.id;\n\t\t\t\t\tuserConnectorFactory.loadUser(ctrl.user.id).then(setUser, function(){});\n\t\t\t\t}\n\t\t\t\tif ($routeParams.is == null) {\n\t\t\t\t\tctrl.user = {};\n\t\t\t\t\tctrl.user.role = \"CANDIDATE\";\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function signup(username, password, email, dateOfBirth, city) {\n // TODO: create new user\n}", "function signup(username, password, email, dateOfBirth, city) {\n // TODO: create new user\n}", "function addNewUser(name){\n var user={\n id:name,\n //new user always starts in this sector\n sector:\"000:000\",\n highscore:0,\n //user has random position\n x: randomInt(MIN_POS,MAX_POS),\n y:randomInt(MIN_POS,MAX_POS),\n };\n firebase.database().ref(\"users/\"+name).set(user);\n }", "function CreateNewUser(fname, lname, isAdmin) {\n this.fname = fname;\n this.lname = lname;\n this.isAdmin = isAdmin;\n}", "function createUser(email, userName, password) {\n this.email = email;\n this.userName = userName;\n this.password = password;\n}", "function addUser(username, password, callback) {\n\tvar instance = new MyUser();\n \tinstance.username = username;\n \tinstance.password = password;\n \tinstance.save(function (err) {\n\t if (err) {\n\t\t\tcallback(err);\n\t }\n\t else {\n\t \t callback(null, instance);\n\t }\n \t});\n}", "function create(req, res) {\n db.User.create(req.body, function(err, user) {\n if (err) { console.log('error', err); }\n res.json(user);\n });\n}", "function create(req, res) {\n db.User.create(req.body, function(err, user) {\n if (err) { console.log('error', err); }\n res.json(user);\n });\n}", "static defineUser(sequelize){\n User.init({\n id:{\n autoIncrement:true,\n primaryKey:true,\n type: Sequelize.INTEGER\n },\n name:{\n type:Sequelize.STRING,\n allowNull: false\n },\n surname:{\n type:Sequelize.STRING,\n allowNull: false\n },\n ssn:{\n type:Sequelize.STRING\n },\n email:{\n type:Sequelize.STRING,\n unique: {\n args: true,\n msg: 'The email is already used.'\n }\n },\n password:{\n type:Sequelize.STRING,\n },\n role_id:{\n type:Sequelize.INTEGER,\n allowNull: false,\n defaultValue: 2\n },\n username:{\n type:Sequelize.STRING,\n unique: {\n args: true,\n msg: 'The username is already used please try anothor one.'\n }\n }\n }, {\n sequelize,\n modelName: 'person',\n timestamps: true,\n updatedAt: false\n })\n return User;\n }", "function create_user(newUser){\n const salt = bcrypt.genSaltSync(saltRounds);\n newUser.password = bcrypt.hashSync(newUser.password, salt);\n // console.log(newUser)\n return newUser.save() \n}", "constructor() { \n UserBase.initialize(this);UserAllOf.initialize(this);\n User.initialize(this);\n }", "function UserDB() {\n\tUser.sync();\n}", "function initPassportUser(){\n var User = require('../models/userModel.js');\n\n passport.use(new LocalStrategy(User.authenticate()));\n\n passport.serializeUser(User.serializeUser());\n passport.deserializeUser(User.deserializeUser());\n\n return User;\n}", "async function CreateDummyUser() {\n return db.userbase.create({\n firstName: 'testingonly',\n lastName: 'lasttestingonly',\n username: 'testuser',\n password: 'testpassword'\n });\n}", "function Create_rcfUser(pkid, username, login, email, pass, passNew)\n\t{\n\t\t\tthis.name='user';\n\t\t\tthis.url='/fcgi/user/';\n\t\t\t\n\t\t\tif( !pkid ) {\n\t\t\t\t\tthrow \"Create_rcfUser: ERROR NO pkid provided\"; \n\t\t\t}\n\t\t\t\n\t\t\tif( !login ) {\n\t\t\t\t\tthrow \"Create_rcfUser: ERROR NO pkid provided\"; \n\t\t\t}\n\t\t\t\n\t\t\tthis.pkid=parseInt(pkid);\n\t\t\tthis.username=username;\n\t\t\tthis.login=login;\n\t\t\tthis.email=email;\n\t\t\tif(!isEmpty(pass) && !isEmpty(passNew)) {\n\t\t\t console.log('create_rcfUser SI hay password ');\t\n\t\t\t this.passmd5=hex_md5(pass);\n\t\t\t this.passmd5New=hex_md5(passNew);\n\t\t\t}else {\n\t\t\t console.log('create_rcfUser No hay password ');\t\t\n\t\t\t this.passmd5='';\n\t\t\t this.passmd5New='';\t\n\t\t\t}\n\t}", "function createUser(){\n let firstname = document.getElementById('firstname').value;\n let lastname = document.getElementById('lastname').value;\n let email = document.getElementById('email').value;\n let password = document.getElementById('password').value;\n let dateOfBirth = document.getElementById('dateOfBirth').value;\n\n // var userAge = calculteAge(dateOfBirth);\n\n // let userInfo = new User(firstname, lastname, email, dateOfBirth, password)\n // userInfo.calculateAge();\n // userInfo.createId();\n\n // localStorage.setItem('id', userInfo.userId)\n let userInfo = { firstname, lastname, email, dateOfBirth, password }; \n\n creatingUser(userInfo);\n\n\n// if (userInfo.age < 18){\n// alert(\"You must be 18 or older to create an account\");\n// return \n// } else {\n// creatingUser(userInfo);\n// // send user on to logged in page\n// }\n}", "function init() {\n let selectQuery = `SELECT * FROM users where id = ${userId}`;\n db.transaction(function (tx) {\n tx.executeSql(selectQuery, [], function (sqlTransaction, sqlResultSet) {\n row = sqlResultSet.rows;\n idEl.setAttribute('value', row[0].id);\n nameEl.setAttribute('value', row[0].name);\n passwordEl.setAttribute('value', row[0].password);\n emailEl.setAttribute('value', row[0].email);\n userTypeEl.setAttribute('value', row[0].type)\n }, function (sqlTransaction, sqlError) {\n switch (sqlError.code) {\n case sqlError.SYNTAX_ERR:\n console.error(\"Syntax error has occurred. \" + sqlError.message);\n break;\n default:\n console.error(\"Other error\");\n }\n });\n }, transError, transSuccess);\n}", "function createDefaultUsers() {\n User.find({}).exec(function(err, collection) {\n if (collection.length === 0) {\n var salt, hash;\n salt = encrypt.createSalt();\n hash = encrypt.hashPwd(salt, 'joe');\n User.create({firstName: 'Joe', lastName: 'Eames', username: 'joe', salt: salt, hashed_pwd: hash, roles: ['admin']});//joe is given the 'admin' role\n salt = encrypt.createSalt();\n hash = encrypt.hashPwd(salt, 'john');\n User.create({firstName: 'John', lastName: 'Papa', username: 'john', salt: salt, hashed_pwd: hash, roles: []});\n salt = encrypt.createSalt();\n hash = encrypt.hashPwd(salt, 'kb');\n User.create({firstName: 'Kyle', lastName: 'Bas', username: 'kb', salt: salt, hashed_pwd: hash});\n }\n });\n}", "function User() {\n Model.call(this, { // call options from Model.js\n tableName: 'users'\n })\n this.state.email = 'wild@mail.com',\n this.column = 'id'\n}", "function CreateNewUser()\n{\n return { \n name: \"unset\",\n email: \"unset\",\n phone: \"unset\",\n wheelId: \"default-wheel-id\",\n prizeWon: null,\n numSpins: 0,\n \"timestamp\" : GetTimeStampNow()\n }\n}", "async createUser(_, { username, password }) {\n const user = await new User({\n username,\n password\n }).save();\n return user;\n }", "async function newUser (email, password) {\n // TODO handle user already exists first\n console.log(\"function called\")\n console.log(email + \" \" + password)\n\n let user = new Parse.User(); \n let currentUser;\n //TODO I think here we use the outer User object this method is called from\n // in other words \"this\"\n \n user.set(\"username\", email);\n user.set(\"password\", password);\n user.set(\"email\", email);\n\n // other fields can be set just like with Parse.Object user.set(\"phone\", \"\");\n try {\n await user.signUp();\n currentUser = await Parse\n .User\n .current();\n\n console.log(\"user is signed up\")\n } catch (error) {\n // Show the error message somewhere and let the user try again.\n alert(\"Error: \" + error.code + \" \" + error.message);\n console.log(\"not signed up\")\n }\n return currentUser;\n}", "function createUser(){\n var isFilled = checkEmptynessOfDialogFields();\n \n if(isFilled == 1){\n var data = getDataOfDialogField();\n createNewUser(data.nickname, data.password, data.email);\n closeDialog();\n }\n}", "create(req, res, next) {\n const userProps = req.body\n User.create(userProps)\n .then(user => res.send(user))\n .catch(next)\n }", "function _createUsers() {\r\n var users = loadFromStorage(STORAGE_KEY);\r\n if (!users || !users.length) {\r\n users = [\r\n { name: 'Tesla', pass: 'secret', isAdmin: false },\r\n { name: 'Morph', pass: 'morphmorph', isAdmin: false },\r\n { name: 'Leaf', pass: 'admin', isAdmin: true }\r\n ].map(_createUser);\r\n }\r\n gUsers = users;\r\n _saveUsersToStorage();\r\n}", "createUser(attributes) {\n return this._db('users').insert(attributes, '*').then(results => {\n //removing the hashed_password for safety\n delete results[0].hashed_password;\n return camelizeKeys(results[0]);\n });\n }", "function registerNewUser(username, email, password) {\n\n generateID = () => {\n var generatedUserID = Math.ceil(Math.random(1000,9000)*10000);\n \n UserModel.model('User').find({ ID: generatedUserID }, (err, value) => {\n if(value != null || value.length != 4) {\n generateID();\n } else {\n return generatedUserID;\n }\n });\n return generatedUserID;\n }\n\n let newID = generateID();\n let user = new UserModel({\n ID: newID,\n username: username,\n email: email,\n password: password,\n registrationDate: Date.now(),\n usernameWithID: username + \"#\" + newID\n });\n user.save()\n .then(doc => {\n console.log('New user: ', doc);\n })\n .catch(err => {\n console.log(err);\n });\n\n}", "constructor() {\n this.idUser;\n this.emailUser;\n this.nameUser;\n this.passwordUser;\n }", "createDefaultUsers() {\n this.datastore.users.push(new UserDTO(1, 'stina', null));\n this.datastore.users.push(new UserDTO(2, 'nisse', null));\n }", "function userCreate(firstName, lastName, userName, password, email, type, company, companyUrl) {\n const job = [{ type, company, companyUrl }];\n const userDetails = { firstName, lastName, userName, password, email, job };\n const user = new User(userDetails);\n return user.save();\n}", "create(user) {\n const { firstName, lastName, email, password, role, refreshToken } = user;\n const stmt = this.db.prepare(\n \"INSERT INTO users (firstName, lastName, email, password, role, refreshToken) VALUES (?, ?, ?, ?, ?, ?)\"\n );\n return stmt.run(firstName, lastName, email, password, role, refreshToken);\n }", "function newUser(reqBody) {\n console.log('USER CONTROLLER HIT WITH : ', reqBody);\n debug('newUser');\n return new Promise((resolve, reject) => {\n if (!reqBody.username || !reqBody.password || !reqBody.email) {\n return reject(new AppError(400, `Either username : (${reqBody.username}) or password (${reqBody.password}) or email (${reqBody.email}) not provided`));\n // return reject('AWWW SNAP');\n\n }\n let userInfo = {\n username: reqBody.username,\n password: reqBody.password,\n email: reqBody.email\n };\n\n User.create(userInfo, (err, user) => {\n console.log('USER CREATE HIT');\n if (err) {\n return reject(new AppError(400, err));\n }\n return resolve(user);\n });\n });\n}" ]
[ "0.81090844", "0.71840864", "0.7165727", "0.6888099", "0.6875888", "0.6873677", "0.6802641", "0.6789374", "0.6772745", "0.6749422", "0.67420423", "0.6737575", "0.67326695", "0.67095613", "0.66683203", "0.66493297", "0.6609279", "0.65891176", "0.6581858", "0.65636426", "0.65625876", "0.65625876", "0.6557807", "0.65388143", "0.65165234", "0.64760303", "0.64722437", "0.6450534", "0.64369965", "0.64189255", "0.6415656", "0.63959324", "0.63899034", "0.63897896", "0.6384291", "0.63670367", "0.6356442", "0.635622", "0.6351499", "0.63472605", "0.63471144", "0.6342216", "0.6331506", "0.6328363", "0.63254124", "0.6319236", "0.6304881", "0.62967366", "0.62955695", "0.6284843", "0.6274329", "0.62655926", "0.6257234", "0.6250512", "0.624999", "0.6249709", "0.6245433", "0.6233352", "0.6225387", "0.62106866", "0.620929", "0.62072986", "0.6205402", "0.6205135", "0.6201076", "0.61997294", "0.6198592", "0.6194876", "0.6190765", "0.6190765", "0.6183877", "0.61836046", "0.61717486", "0.61700433", "0.61690664", "0.61690664", "0.61587405", "0.6157698", "0.61575854", "0.6156809", "0.615462", "0.6148479", "0.6144026", "0.61319095", "0.61312026", "0.61309254", "0.61260045", "0.61227626", "0.6122611", "0.611864", "0.6117306", "0.61155945", "0.6112477", "0.61110926", "0.61048776", "0.6095173", "0.60890853", "0.6083465", "0.6083304", "0.6069407" ]
0.6206654
62
Update the user profile in the database
function update() { // PREPARE let uid = $rootScope.account.authData.uid; let profile = $rootScope.account.profile; // NEW USER ACTION if (profile.newUser) { instance.addAchievement(profile, ACHIEVEMENTS.PROFILE_COMPLETED); profile.newUser = false; } // UPDATE $rootScope.db.users.child(uid).update(profile); // NOTIFY BroadcastService.send(EVENTS.PROFILE_UPDATED, profile); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateProfile(profile) {\n checkUser();\n UserId = userId;\n $.ajax({\n method: \"PUT\",\n url: \"/api/profile_data\",\n data: profile\n })\n .then(function () {\n window.location.href = \"/members\";\n });\n }", "updateProfile() {}", "function updateUserProfile(){\n if(vm.user){\n // Update user data.\n vm.user.firstName = vm.firstname;\n vm.user.lastName = vm.lastname;\n vm.user.displayName = vm.firstname + ' ' + vm.lastname;\n vm.user.program = vm.taskapplication.program;\n vm.user.email = vm.taskapplication.email;\n vm.user.phone = vm.taskapplication.phone;\n vm.user.foodpref = vm.taskapplication.foodpref;\n\n var myUser = new Users(vm.user);\n myUser.$update(successCallbackUser, errorCallback);\n } else {\n successCallbackUser();\n }\n }", "function updateProfile() {\n\tif (setUpdateErrors()) {\n\t\tvar values = setUpdateValues()\n\t\t$.ajax({\n\t\t\tmethod: \"PUT\",\n\t\t\turl: \"/api/update/user/\" + sessionStorage.getItem(\"globalUsername\"),\n\t\t\tdata: {\n\t\t\t\tpass: values[\"newPass\"],\n\t\t\t\temail: values[\"newEmail\"],\n\t\t\t\tbirthday: values[\"newBirthday\"],\n\t\t\t\tfavColor: values[\"newFavColor\"],\n\t\t\t\tyear: values[\"newYear\"],\n\t\t\t\tlecture: values[\"newLecture\"],\n\t\t\t},\n\t\t})\n\t\t\t.done(function (data, text_status, jqXHR) {\n\t\t\t\tconsole.log(JSON.stringify(data))\n\t\t\t\tconsole.log(text_status)\n\t\t\t\tconsole.log(jqXHR.status)\n\t\t\t\tunsetUpdateErrors()\n\t\t\t\tupdateToProfile()\n\t\t\t})\n\t\t\t.fail(function (err) {\n\t\t\t\tconsole.log(err.status)\n\t\t\t\tconsole.log(JSON.stringify(err.responseJSON))\n\t\t\t})\n\t}\n}", "function updateUser(){\n let user = firebase.auth().currentUser;\n user.updateProfile({\n displayName: \"Jane Q. User\",\n photoURL: \"https://example.com/jane-q-user/profile.jpg\"\n }).then(function() {\n // Update successful.\n }).catch(function(error) {\n // An error happened.\n });\n }", "function updateUserProfile(req, res) {\n if(req.body.userID === undefined){\n return res.send(\"Error: no user specified\");\n }\n User.findById(req.body.userID, function (err, user) {\n if (err) throw err;\n if(user === null) {\n return res.send(\"Error: No such User exists\");\n }\n\n user.name = req.body.name;\n user.email = req.body.email;\n user.phone = req.body.phone;\n user.address = req.body.address;\n user.password = req.body.password;\n \n user.save(function(err) {\n if (err) throw err;\n return res.send('Success');\n });\n \n });\n \n}", "function updateProfile(req, res) {\n let params = {\n fullName: req.body.name,\n contactNumber: req.body.contactNumber,\n profession: req.body.profession\n }\n User.update({ _id: req.body.userId },{ $set: params} , function(err, updatedUser) {\n if (err) {\n res.status(403).send(resFormat.rError(err))\n } else {\n responseData = {\n \"name\": req.body.name,\n \"contactNumber\": req.body.contactNumber,\n \"email\": req.body.email,\n \"profession\": req.body.profession,\n \"userId\": req.body.userId\n }\n res.send(resFormat.rSuccess(responseData))\n }\n })\n}", "function updateProfile(user) {\n return baseUser().customPUT(user);\n }", "function updateProfile(req, res) {\n\n UsersModel.findById(req.params.userId, (err, user) => {\n user.name = req.body.name || user.name,\n user.email = req.body.email || user.email,\n user.phoneNumber = req.body.phoneNumber || user.phoneNumber,\n // user.password = bcrypt.hashSync(req.body.password) || user.password \n user.accountNumber = req.body.accountNumber || user.accountNumber,\n user.bankName = req.body.bankName || user.bankName\n\n if (err) {\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n\n user.save((err, saved) => {\n if (err) {\n\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n return res.status(200).send({\n 'status': true,\n 'message': 'Successfully updated',\n 'user': saved\n });\n })\n\n\n })\n}", "function updateProfile() {\n\t\n\tif(validateInputFields(\"#hotel-profile-table\") === false) {\n\t\ttoast(\"Empty fields detected\");\n\t\treturn;\n\t}\n\t\n\taxios.post(controllerPath + \"/updateProfile\", getHotelJson())\n\t\t.then(response => {\n\t\t\t\n\t\t\tif(response.data === null || response.data === \"\") {\n\t\t\t\ttoast(\"Hotel name already exists\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tadminHotel = response.data; //update the global hotel variable\n\t\t\tfillHotelProfileInputs(response.data);\n\t\t\ttoast(\"Updated\");\n\t\t});\n\t\n\t\t\n}", "function editProfile() {\n setErrorsVisible(true);\n setCurrentPasswordServerError(\"\");\n setUsernameServerError(\"\");\n setEmailServerError(\"\");\n console.log(getProfileUsernameError(true, true, fieldsStateUser.username, currentUser.username, usernameServerError));\n if (!hasErrors(true, \"\", \"\", \"\")) {\n const newUser = createUserForUpdate(currentUser, fieldsStateUser, enableNotifications);\n updateUser(newUser)\n .then(result => {\n props.showStatusAlert(\"Данные успешно обновлены\", \"success\");\n console.log(result);\n\n //save success so current user is equal to new user\n setCurrentUser(newUser);\n props.updatePopoverUser(newUser);\n\n //slackcredentials saved, other values are \"\" by default\n //reset fields\n const newFieldStateUser = getDefaultFieldsStateUser();\n newFieldStateUser.slackCredentials = fieldsStateUser.slackCredentials;\n setFieldsStateUser(newFieldStateUser);\n setErrorsVisible(false);\n setShouldChangeLogin(false);\n setShouldChangeEmail(false);\n setShouldChangePassword(false);\n })\n .catch(err => {\n props.updateIsTokenExpired(err.message);\n if (err.message.length > HttpStatusCodeLength || err.message === ErrorInternalServerErr)\n props.showStatusAlert(\"Не удалось обновить данные\", \"error\");\n console.log(err.message);\n setCurrentPasswordServerError(parseCurrentPasswordServerError(err.message));\n setUsernameServerError(parseUsernameServerError(err.message));\n setEmailServerError(parseEmailServerError(err.message));\n });\n }\n }", "function updateProfile(user) {\n UserService\n .updateUser(user._id, user)\n .success(function (user) {\n if(user != '0'){\n $location.url(\"/user/\" + user._id);\n }\n })\n .error(function (error) {\n\n });\n\n }", "function updateUser(user) {\n UserService.updateUser(model.userId, user)\n .then(function (response) {\n // var updatedUser = response.data;\n // $rootScope.currentUser = updatedUser;\n // console.log(updatedUser);\n model.successMessage = \"Profile Updated Successfully!\";\n }, function (rejection) {\n model.errorMessage = \"Sorry an error was encountered and your profile was not updated. Please try again\";\n });\n }", "async updateProfileUser(context, { userName, userPhotoURL }) {\n await firebase\n .auth()\n .currentUser.updateProfile({\n displayName: userName,\n photoURL: userPhotoURL\n })\n .then(() => {\n context.commit(\"checkAuthState\");\n });\n }", "function updateUser() {\n try {\n selectedUser.username = $usernameFld.val();\n selectedUser.password = $passwordFld.val();\n selectedUser.firstName = $firstNameFld.val();\n selectedUser.lastName = $lastNameFld.val();\n selectedUser.role = $roleFld.val();\n userService.updateUser(selectedUserId, selectedUser)\n .then(function (userServerInfo) {\n users[editIndex] = selectedUser;\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n // In future could catch null error or could grey out checkmark icon.\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function updateCurrentUserProfile() {\n\n\n Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.platformRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT ACCOUNT roles! Role will indicate what editing capabilites are available.\n\n Debug.trace(\"Profile refreshed!\");\n Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "function updateInformation (user, newInfo) {\n if (newInfo) {\n user.updateProfile(newInfo).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n showError(errorCode, errorMessage);\n });\n }\n}", "updateUserDetails() {\n if (!activeUser()) return;\n $(conversations_area).find(`[data-user-id=\"${activeUser().id}\"] .sb-name,.sb-top > a`).html(activeUser().get('full_name'));\n $(conversations_area).find('.sb-user-details .sb-profile').setProfile();\n SBProfile.populate(activeUser(), $(conversations_area).find('.sb-profile-list'));\n }", "function updateCurrentUserProfile() {\n\n //Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.userRoles.indexOf(data.Role) //<-- use ACCOUNT roles, NOT PLATFORM roles!\n\n if (vm.currentUserProfile.Id == \"\" || vm.currentUserProfile == null)\n {\n //Log user out if empty\n window.location.replace(\"/login\");\n }\n\n //Debug.trace(\"Profile refreshed!\");\n //Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "function updateCurrentUserProfile() {\n\n //Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.userRoles.indexOf(data.Role) //<-- use ACCOUNT roles, NOT PLATFORM roles!\n\n if (vm.currentUserProfile.Id == \"\" || vm.currentUserProfile == null)\n {\n //Log user out if empty\n window.location.replace(\"/login\");\n }\n\n //Debug.trace(\"Profile refreshed!\");\n //Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "function updateUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n userService\n .updateUser(currentUserID,user)\n .then(findAllUsers)\n .then(emptyUserForm);\n\n }", "function updateCurrentUserProfile() {\n\n //Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.accountRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT platform roles!\n\n if (vm.currentUserProfile.Id == \"\" || vm.currentUserProfile == null)\n {\n //Log user out if empty\n window.location.replace(\"/login\");\n }\n\n //Debug.trace(\"Profile refreshed!\");\n //Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "update({ profile, body, params }, res) {\n\t\tconsole.log(body);\n\t\t// console.log(params.profile);\n\t\tUser.update({ '_id': params.profile }, {\n\t\t\t$set: {\n\t\t\t \tinfo: {\n\t\t\t\t\tname: body.name,\n\t\t\t\t\tavatar: body.avatar,\n\t\t\t\t\tintroduction: body.introduction\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tfunction (err, place) {\n\t\t\tconsole.log(place);\n\t\t})\n\t\tres.sendStatus(204);\n\t}", "function updateUser (req, res, next) {\n db.none(`UPDATE \"user\" SET user_name = $1, email = $2, profile_pic = $3, password = $4 WHERE user_id = $5`, [req.body.user_name, req.body.email, req.body.profile_pic, req.body.password, req.params.user_id])\n .then(next())\n .catch(err => next(err));\n}", "function updateProfile(info) {\n setProfile(info);\n }", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n user.approve = false;\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({ message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!' });\n Authentication.user = response;\n }, function (response) {\n Notification.error({ message: response.data.message, title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!' });\n });\n }", "updateProfile(details, success, failure) {\n this.postCall(URI.UPDATE_PROFILE, details, success, failure, true);\n }", "submit(data) {\n const { firstName,\n lastName,\n bio,\n instagram,\n facebook,\n interest,\n course, _id } = data;\n Users.update(_id, { $set: { firstName,\n lastName,\n bio,\n instagram,\n facebook,\n interest,\n course, } }, (error) => (error ?\n Bert.alert({ type: 'danger', message: `Could not update the user profile: ${error.message}` }) :\n Bert.alert({ type: 'success', message: 'User profile succesfully updated!' })));\n }", "function updateProfile (profileId, profile, db = connection) {\n return db('profiles')\n .where('id', profileId)\n .update({\n name: profile.name,\n description: profile.description\n })\n}", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n\n //getting users selected skills\n\n var arrSkills = [];\n if(vm.user.roles[0]=='technician') {\n for (var i in $scope.userSkills.selected) {\n if ($scope.userSkills.selected[i] == 'Y') {\n arrSkills.push(i);\n\n }\n }\n\n user.skills = arrSkills;\n }\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!'});\n Authentication.user = response;\n }, function (response) {\n Notification.error({\n message: response.data.message,\n title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!'\n });\n });\n }", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({ message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!' });\n Authentication.user = response;\n }, function (response) {\n Notification.error({ message: response.data.message, title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!' });\n });\n }", "function updateCurrentUserProfile() {\n\n Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.platformRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT ACCOUNT roles!\n\n Debug.trace(\"Profile refreshed!\");\n Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "async function updateUser(req, res) {\n try {\n let user = req.profile;\n user = (0, extend_1.default)(user, req.body);\n await user.save();\n console.log(user);\n user.hash_password = undefined;\n user.salt = undefined;\n res.json(user);\n }\n catch (err) {\n console.log(err);\n return res.status(400).json({\n error: dbErrorHandler_1.default.getErrorMessage(err),\n });\n }\n}", "function updateOneProfile(req, res) {\n console.log('updateOneProfile Route is getting hit!!!', req.body)\n db.Profile.findByIdAndUpdate(req.params.profileId, {$set: {\n name: req.body.name,\n title: req.body.title,\n workPlace: req.body.workPlace,\n quote: req.body.quote,\n image: req.body.image,\n }}, {new: true}, function(err, saveProfile) {\n if (err) {\n console.log('THERE WAS AN ERROR DURING updateOneProfile Save', err);\n }\n console.log('updateOneProfile SAVED AND JSON IS SENT BACK', saveProfile);\n res.json(saveProfile)\n })\n}", "function updateUserProfileAuth(name, email, address) {\n firebase.auth().onAuthStateChanged(function (user) {\n console.log(\"user is signed in: \" + user.uid);\n console.log(\"old display name: \" + user.displayName);\n user.updateProfile({\n displayName: name\n }).then(function () {\n console.log(\"updated authenticated user profile\");\n console.log(\"new display name: \" + user.displayName);\n }).catch(function (error) {\n console.log(\"authenticated user profile update failed\");\n })\n })\n}", "function updateProfile() {\n\t\tif (newName.value!=\"\") {\n\t\t\tname.innerHTML = newName.value;\n\t\t}\n\t\tif (newEmail.value!=\"\") {\n\t\t\temail.innerHTML = newEmail.value;\n\t\t}\n\t\tif (newPhone.value!=\"\") {\n\t\t\tphone.innerHTML = newPhone.value;\n\t\t}\n\t\tif (newZipcode.value!=\"\") {\n\t\t\tzipcode.innerHTML = newZipcode.value;\n\t\t}\n\t\tif (newPassword.value!=\"\") {\n\t\t\tpassword.innerHTML = newPassword.value;\n\t\t}\n\t\tif (newPwconfirm.value!=\"\") {\n\t\t\tpwconfirm.innerHTML = newPwconfirm.value;\n\t\t}\n\n\t\tnewName.value = \"\";\n\t\tnewEmail.value = \"\";\n\t\tnewPhone.value = \"\";\n\t\tnewZipcode.value = \"\";\n\t\tnewPassword.value = \"\";\n\t\tnewPwconfirm.value = \"\";\n\t}", "function update(req, res) {\n Profile.findByIdAndUpdate(req.params.id, req.body, {new: true})\n .then((profile) => {\n res.redirect(`/profiles/${profile._id}`)\n })\n .catch((err) => {\n console.log(err)\n res.redirect('/')\n })\n}", "updateUser (context, user) {\n context.commit('updateUser', user)\n }", "async function update(data) {\n console.debug(\"Update\");\n const user = await JoblyApi.updateUserInfo(currentUser.username, data);\n setCurrentUser(user);\n }", "function update(username,password,firstName, lastName, emailId){\n var userLoggedIn=$rootScope.currentUser;\n var LoggedInUserId=userLoggedIn._id;\n console.log(\"User Logged in ID: \");\n console.log(userLoggedIn);\n\n var user={\n \"username\":username,\n \"password\":password,\n \"firstName\":firstName,\n \"lastName\":lastName,\n \"emailId\":emailId\n };\n\n\n UserService.updateUser(LoggedInUserId,user, function (response) {\n\n\n UserService.setCurrentUser(response);\n console.log(\"Response From Service: Updated the User\");\n console.log(response);\n\n });\n\n }", "onUpdateProfile() {\n logger.info('Updating profile');\n this.polyInterface.updateProfile();\n }", "function updateUserProfile() {\n // $('#profile-name)\n $(\"#show-name\").html(` ${currentUser.name}`);\n $(\"#show-username\").html(` ${currentUser.username}`);\n $(\"#show-date\").html(` ${currentUser.createdAt.slice(0, 10)}`);\n }", "async update({ request, params, response }) {\n /*** get the user update inputs */\n let { status } = request.only([\"status\"]);\n\n /** get the target user */\n try {\n const user = await User.query().where(\"id\", params.id).first();\n if (!user) {\n return response.status(404).send({\n message: \"not found\",\n });\n }\n\n /** update the user details */\n\n user.active = status;\n await user.save();\n return response.status(200).send({\n message: \"info updated\",\n });\n } catch (error) {\n return response.status(404).send({\n message: \"fail\",\n error: error,\n });\n }\n }", "function updateUser() {\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 updateUserProfile(isValid) {\n vm.success = vm.error = null;\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new Users(vm.user);\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n vm.success = true;\n Authentication.user = response;\n }, function (response) {\n vm.error = response.data.message;\n });\n }", "static handleProfileUpdate(newUserData) {\n let data = this.currentUserValue;\n\n if (newUserData.name) {\n data.user.name = newUserData.name;\n }\n\n if (newUserData.email) {\n data.user.email = newUserData.email;\n }\n\n _currentUserSubject.next(data);\n }", "function updateprofile(req, res) {\n var today = new Date().toMysqlFormat();\n\n var keys = Object.keys(req.body);\n var values = \"\";\n keys.map(x => {\n values += x + \"='\" + req.body[x] + \"', \";\n })\n values = values.substring(0, values.length - 2);\n\n var query = `UPDATE UserProfile SET ${values} WHERE regisId = ${req.decoded.payload.id}`;\n console.log(\"QUERY: \", query)\n coinmarket_db.query(query,\n function(err, result) {\n if (err) {\n res.status(400).json({\n status: false,\n msg: err\n })\n } else if (!result.affectedRows) {\n res.status(400).json({\n status: false,\n msg: \"Rows not affected\"\n })\n } else {\n res.status(200).json({\n user: result,\n status: true,\n msg: \"user updated there profile\",\n mobile: result.mobile\n })\n }\n })\n\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 }", "updateUser(userId, newProfile) {\n\n if (!ajv.validate(updateProfileSchema, newProfile)) {\n return Promise.reject({ status: 400, error: new TypeError('Invalid Arguments.') });\n } else if (newProfile === {}) {\n // Empty update obj - just return 200 status\n return Promise.resolve({ status: 200 });\n }\n\n var client = redis.createClient();\n\n return new Promise((resolve, reject) => {\n client.hget('users', userId, (err, user) => {\n if (err) {\n client.quit();\n return reject({ status: 500, error: err });\n }\n\n return resolve(JSON.parse(user)); \n });\n }).then((user) => {\n\n // Set updated fields\n for (let field in newProfile) {\n user.profile[field] = newProfile[field];\n }\n\n // Update the user in redis\n return new Promise((resolve, reject) => {\n client.hset('users', userId, JSON.stringify(user), (err) => {\n client.quit();\n \n if (err) {\n return reject({ status: 500, error: err });\n }\n\n return resolve({ status: 200, user: user });\n });\n });\n });\n }", "async updateUser(parent, {\n updateUserInput: {\n id,\n name,\n email,\n password\n }\n }, context, info) {\n try {\n const updateUser = await context.prisma.user.update({\n where: {\n id\n },\n data: {\n name,\n email,\n password\n }\n });\n return \"user update sucessfully\";\n } catch (error) {\n return error;\n }\n }", "setUpName(displayName){\n console.log(\"got --- \"+displayName)\n var user=firebase.app.auth().currentUser;\n\n this.setState({ user:user });\n user.updateProfile({\n displayName: displayName\n }).then(function() {\n console.log(\"Updated\"),\n firebase.app.database().ref('users/'+ firebase.app.auth().currentUser.uid).update({\n displayName: displayName\n }) \n }).catch(function(error) {\n console.log(\"error \"+error.message)\n });\n }", "function updateUserInformation(){\n\tconsole.log('function: updateUserInformation');\n\t$().SPServices({\n\t\toperation: \"UpdateListItems\",\n\t\twebURL: siteUrl,\n\t\taync: false,\n\t\tbatchCmd: \"Update\",\n\t\tlistName: \"ccUsers\",\n\t\tID: userId,\n\t\tvaluepairs:[\n\t\t\t\t\t\t[\"Title\", personInformation().pseudoName ], \n\t\t\t\t\t\t[\"PERSON_EMAIL\", personInformation().personEmail], \n\t\t\t\t\t\t[\"P_LAST_NAME\", personInformation().personLastName],\t\n\t\t\t\t\t\t[\"P_FIRST_NAME\", personInformation().personFirstName], \n\t\t\t\t\t\t[\"PERSON_ROLE\", personInformation().personRole], \n\t\t\t\t\t\t[\"PERSON_RANK\", personInformation().personRank], \n\t\t\t\t\t\t[\"PERSON_DIRECTORATE\", personInformation().personDirectorate],\n\t\t\t\t\t\t[\"PERSON_ACTIVE\", personInformation().personActive], \n\t\t\t\t\t\t[\"PERSON_ATTRIBUTES\", personAttributes()],\n\t\t\t\t\t\t[\"PERSON_TRAINING\", personTraining()]\n\t\t\t\t\t],\n\t\tcompletefunc: function(xData, Status){\n\t\t\tconsole.log('update user account succesfully');\n\t\t}\n\t});\n\tsetTimeout(function(){\n\t\tsetUserInformationRedirect(userId);\n\t}, 2000);\n}", "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 }", "editUserProfile(details, success, failure) {\n ApolloService.mutate({\n mutation: Mutations.EDIT_USER_PROFILE,\n variables: details\n }).then(data => { success(this.handleResponse(data.data.editUserProfile, \"user\")) })\n .catch(error => failure(error));\n }", "static saveUserProfile(uid) {\n // Updates the values in the firebase database\n console.log(\"Here with uid: \" + uid)\n firebase.database().ref(\"users/\" + uid).update({ \n name : sessionStorage.getItem('userName'),\n favoriteMovies : [],\n isAdmin : sessionStorage.getItem('isAdmin')}, function(error) {\n if(error) {\n alert(\"There was an issue saving some of your information\")\n } else {\n window.location.replace(\"index.html\"); \n }\n })\n \n }", "function updateProfile()\r\n{\r\n // obtaining the data\r\n let name = document.getElementById(\"name\").value;\r\n let surname = document.getElementById(\"surname\").value;\r\n let dob = document.getElementById(\"dob\").value;\r\n let gender = document.getElementById(\"gender\").value;\r\n let city = document.getElementById(\"city\").value;\r\n let country = document.getElementById(\"country\").value;\r\n let educLevel = document.getElementById(\"educLevel\").value;\r\n let studyArea = document.getElementById(\"studyArea\").value;\r\n let science = document.getElementById(\"science\");\r\n let medicine = document.getElementById(\"medicine\");\r\n let travel = document.getElementById(\"travel\");\r\n let education = document.getElementById(\"education\");\r\n let sports = document.getElementById(\"sports\");\r\n let nutrition = document.getElementById(\"nutrition\");\r\n let economy = document.getElementById(\"economy\");\r\n let environment = document.getElementById(\"environment\");\r\n let interests = \"\";\r\n let password = document.getElementById(\"password\").value;\r\n\r\n // checking which interests did the user select\r\n if (science.checked == true)\r\n {\r\n interests += \"science||\";\r\n }\r\n if (medicine.checked == true)\r\n {\r\n interests += \"medicine||\";\r\n }\r\n if (travel.checked == true)\r\n {\r\n interests += \"travel||\";\r\n }\r\n if (education.checked == true)\r\n {\r\n interests += \"education||\";\r\n }\r\n if (sports.checked == true)\r\n {\r\n interests += \"sports||\";\r\n }\r\n if (nutrition.checked == true)\r\n {\r\n interests += \"nutrition||\";\r\n }\r\n if (economy.checked == true)\r\n {\r\n interests += \"economy||\";\r\n }\r\n if (environment.checked == true)\r\n {\r\n interests += \"environment||\";\r\n }\r\n\r\n // if user entered all the required data - update user to the database and update the view\r\n if ( name && surname && dob && gender && city && country && educLevel && password)\r\n {\r\n let userId = sessionStorage.getItem(\"userId\");\r\n\r\n // add user to the database\r\n // create object with user data to send to the server\r\n let editObject = {\r\n _id: userId,\r\n _name: name,\r\n _surname: surname,\r\n _dob: dob,\r\n _gender: gender,\r\n _city: city,\r\n _country: country,\r\n _studyLevel: educLevel,\r\n _studyArea: studyArea,\r\n _interests: interests,\r\n _password: password\r\n };\r\n\r\n // sending xml request\r\n let xml = new XMLHttpRequest;\r\n\r\n // function that is called when reply received from server\r\n xml.onreadystatechange = () =>\r\n {\r\n if ((xml.readyState == 4) && (xml.status == 200))\r\n {\r\n let updateResult = xml.responseText;\r\n\r\n // update the view\r\n messageOne.innerHTML = \"Successfully Updated \" + updateResult + \" User\";\r\n messageOne.style.display = \"block\";\r\n\r\n viewTitle.style.display = \"none\";\r\n textboxOne.style.display = \"none\";\r\n textboxTwo.style.display = \"none\";\r\n rightContainer.style.display = \"none\";\r\n mainContainer.style.display = \"none\";\r\n // updating the text on the button and its functionality\r\n buttonOne.innerText = \"Log Out\";\r\n buttonOne.onclick = logout; \r\n // updating the text on the link and its functionality\r\n linkOne.innerText = \"Edit My Profile\";\r\n linkOne.onclick = editProfile;\r\n\r\n //clearing the local storage\r\n localStorage.clear();\r\n }\r\n };\r\n\r\n //Send new user data to server\r\n xml.open(\"POST\", \"/amendUser\", true);\r\n xml.setRequestHeader(\"Content-type\", \"application/json\");\r\n xml.send(JSON.stringify(editObject)); \r\n }\r\n \r\n // if user did not fill in all the entries\r\n else\r\n {\r\n document.getElementById(\"editFormMsg\").innerHTML = \"Enter all fields.\";\r\n return;\r\n } \r\n}", "update(req, res) {\n\n return User\n .findById(req.params.id, {})\n .then(user => {\n\n if (!user) {\n\n return res.status(404).send({\n message: 'User Not Found',\n });\n }\n\n return user\n .update({\n id: req.body.id || user.id,\n confirmed: user.confirmed,\n first_name: req.body.first_name || user.first_name,\n last_name: req.body.last_name || user.last_name,\n organizer_alias: req.body.organizer_alias || user.organizer_alias,\n age: req.body.age || user.age,\n gender: req.body.gender || user.gender,\n password: user.password,\n profile_pic: null,\n phone_number: req.phone_number || user.phone_number\n })\n .then(() => res.status(200).send(user)) // Send back the updated user\n .catch((error) => res.status(400).send(error));\n })\n .catch((error) => res.status(400).send(error));\n }", "async function userUpdate(req, res) {\n try {\n const user = await User.findByIdAndUpdate(req.currentUser, req.body, {\n new: true,\n runValidators: true,\n });\n if (user.id !== req.params.id) {\n return res.status(401).json({ message: \"Unauthorised\" });\n }\n res.status(202).json({message: 'Your profile has been updated', user})\n } catch (err) {\n res.status(400).json(err.message);\n }\n}", "async onLoad(options) {\n console.log('profile-update', options)\n this.setData(options)\n this.initValidate()\n const user = wx.getStorageSync('current_user')\n console.log('id', user.user.id)\n this.setData({\n user: await getUserDetails(user.user.id)\n })\n }", "function updateUserInfo(id, user) {\n}", "function updateProfile(user,uid,sid,pid,supplement,amount,unit,frequency,frequency_unit,notes,img_01,img_02) {\n var updateSup = \"UPDATE `supplement` SET `name`='\" + supplement + \"' WHERE `id`=\" + sid + \";\";\n var updatePro = \"UPDATE `profile` \" +\n \"SET `amount`='\" + amount + \"', \" +\n \"`unit`='\" + unit + \"', \" +\n \"`frequency`='\" + frequency + \"', \" +\n \"`frequency_unit`='\" + frequency_unit + \"', \" +\n \"`img_01`='\" + img_01 + \"', \" +\n \"`img_02`='\" + img_02 + \"', \" +\n \"`notes`='\" + notes + \"' \" +\n \"WHERE `id`=\" + pid + \";\";\n alert(\"Profile ID: \" + pid);\n db.transaction(function(transaction) {\n transaction.executeSql(updateSup, [], null, errorHandler);\n });\n db.transaction(function(transaction) {\n transaction.executeSql(updatePro, [], null, errorHandler);\n });\n removeUserSupplementDOM();\n updateUserLists(uid,user);\n}", "function updateMe(data) {\n UserModel.me = data.id;\n UserModel.updateUser(data);\n }", "function update(property, value, account) {\r\n const ctx = SP.ClientContext.get_current();\r\n\r\n SP.SOD.executeFunc('userprofile', 'SP.UserProfiles.PeopleManager', function() {\r\n const peopleManager = new SP.UserProfiles.PeopleManager(ctx);\r\n // save the value to the profile property as a compressed UTF16 string to keep within the 3600 character limit for user profile properties\r\n peopleManager.setSingleValueProfileProperty('i:0#.f|membership|' + account, property, Compression.compressToUTF16(JSON.stringify(value)));\r\n\r\n ctx.executeQueryAsync(\r\n function() {},\r\n function(sender, args) {\r\n console.log('Goldfish.Profile.Update Error while trying to save to the folowing profile property: ' + property + '. The error details are as follows: ' + args.get_message());\r\n }\r\n );\r\n });\r\n}", "function updateUserProfileFirestore(name, phone, address) {\n firebase.auth().onAuthStateChanged(function (user) {\n console.log(\"user is signed in: \" + user.uid);\n db.collection(\"users\").doc(user.uid)\n .update({\n \"name\": name,\n \"phone\": phone,\n \"address\": address\n }).then(function () {\n console.log(\"updated users database\");\n }).catch(function (error) {\n console.log(\"cannot update users database\");\n })\n })\n}", "async updateUser(_, { id, firstName, lastName, email, password }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error('You must log in to continue!')\n }\n // fetch the user by it ID\n // Update the user\n await user.update({\n firstName,\n lastName,\n email,\n password: await bcrypt.hash(password, 10)\n });\n return user;\n }", "function update(req, res){\n console.log(req.body.local.firstName);\n User.findById(req.params._id, function(err,user){\n user.local.firstName = req.body.local.firstName\n user.local.lastName = req.body.local.lastName\n user.local.email = req.body.local.email\n user.local.password = req.body.local.password\n user.save(function(err){\n if(err) console.log(err)\n res.json({success: true, message: \"User has been updated!\"});\n });\n });\n}", "function update(req, res) {\n\tUser.findById(req.params.user_id, function(err, user) {\n\t\tif (err) return res.send(err);\n\n\t\tif (req.body.name) user.name = req.body.name;\n\t\tif (req.body.password) user.password = req.body.password;\n\n\t\tuser.blocked\t= req.body.blocked;\n\t\tuser.image \t\t= req.body.image;\n\n\t\tuser.save(function(err, user) {\n\t\t\tif (err) return res.send(err);\n\n\t\t\tres.json({ message : \"User Updated\" });\n\t\t})\n\t})\n}", "function updateUser(req, res, next) {\n const sql = sqlString.format(`UPDATE users SET ? WHERE id = ?`, [\n req.body,\n req.params.id\n ])\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n if (!result.affectedRows) return next({ message: 'User not find' })\n res.send('User updated')\n })\n}", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "updateUser (callback) {\n\t\tthis.doApiRequest(\n\t\t\t{\n\t\t\t\tmethod: 'put',\n\t\t\t\tpath: '/users/me',\n\t\t\t\tdata: this.data,\n\t\t\t\ttoken: this.token\n\t\t\t},\n\t\t\t(error, response) => {\n\t\t\t\tif (error) { return callback(error); }\n\t\t\t\tObject.assign(this.expectedUser, response.user.$set, this.data, {\n\t\t\t\t\tlastReads: {},\n\t\t\t\t\tpreferences: {\n\t\t\t\t\t\tacceptedTOS: true\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tdelete this.data;\t// don't need this anymore\n\t\t\t\tcallback();\n\t\t\t}\n\t\t);\n\t}", "function updateProfile (data){\n\tvar fullname = data.name.first + \" \" + data.name.last\n\tfullnameDisp.innerText = fullname\n\tavatar.src = data.picture.medium\n\tusername.innerText = data.login.username\n\tuseremail.innerText = data.email\n\tcity.innerText = data.location.city\n}", "update(req, res) {\n User.findOne({ where: { id: req.params.id } })\n .then((user) => {\n if (user) {\n if (req.params.id !== req.decoded.id.toString()) {\n res.status(403).send({ message: 'That action is not allowed. You can only edit your own password.' });\n } else if (!req.body.password || req.body.password === '') {\n res.send({ message: 'Please enter your new password!' });\n } else {\n user.updateAttributes({\n username: req.body.username || user.username,\n email: req.body.email || user.email,\n password: passwordHash.generate(req.body.password) || user.passsword,\n }).then(() => {\n res.status(200).send({ message: 'Your profile has been updated!' });\n });\n }\n } else {\n res.status(404).send({ message: 'User doesn\\'t exist!' });\n }\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 }", "function updateUser(req, res, next) {\r\n\tdb.none('update users set first_name=$1, last_name=$2, email=$3 where id=$5',\r\n\t [req.body.name, req.body.breed, parseInt(req.body.age),\r\n\t req.body.sex, parseInt(req.params.id)])\r\n\t.then(function () {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: 'Updated your user'\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "async function userUpdate(req, res, next) {\n const userId = req.params.id\n try {\n const userToUpdate = await User.findById(userId)\n if (!userToUpdate) throw new Error(notFound)\n\n\n if (!userToUpdate.equals(req.currentUser._id)) throw new Error(unauthorized)\n\n Object.assign(userToUpdate, req.body)\n await userToUpdate.save()\n\n res.status(202).json(userToUpdate)\n } catch (err) {\n next(err)\n }\n}", "function updateUser ( user, cb )\n{\n user.lastJoin = new Date();\n user.isNewbe = false;\n user.save( (err) => \n {\n if (err) return cb(err);\n return cb(null, user);\n }); \n\n}", "function updateUser (userData) {\n if (userData === null) {\n return false\n console.log(self.new)\n }\n var records = ref.child('records').child(userData.uid)\n records.on('value', function(snapshot) {\n if (snapshot.exists() === false) {\n records.update({\n Bench_Press: 60,\n Squat: 50,\n Barbell_Curl: 25,\n })\n console.log(\"first time records\")\n }\n });\n\n var user = ref.child('users').child(userData.uid)\n user.update({\n uid: userData.uid,\n displayName: userData.twitter.displayName,\n picture: userData.twitter.profileImageURL,\n twitterObj: userData.twitter\n })\n user = $firebaseObject(user)\n currentUser = user\n return user;\n }", "async doUserUpdate () {\n\t\tconst now = Date.now();\n\t\tconst op = {\n\t\t\t$set: {\n\t\t\t\tisRegistered: true,\n\t\t\t\tmodifiedAt: now,\n\t\t\t\tregisteredAt: now,\n\t\t\t\t\"preferences.acceptedTOS\": true\n\t\t\t}, \n\t\t\t$unset: {\n\t\t\t\tconfirmationCode: true,\n\t\t\t\tconfirmationAttempts: true,\n\t\t\t\tconfirmationCodeExpiresAt: true,\n\t\t\t\t'accessTokens.conf': true,\n\t\t\t\tinviteCode: true,\n\t\t\t\tneedsAutoReinvites: true,\n\t\t\t\tautoReinviteInfo: true\n\t\t\t}\n\t\t};\n\n\t\tif (this.passwordHash) {\n\t\t\top.$set.passwordHash = this.passwordHash;\n\t\t}\n\n\t\t['email', 'username', 'fullName', 'timeZone'].forEach(attribute => {\n\t\t\tif (this.data[attribute]) {\n\t\t\t\top.$set[attribute] = this.data[attribute];\n\t\t\t}\n\t\t});\n\t\tif (this.data.email) {\n\t\t\top.$set.searchableEmail = this.data.email.toLowerCase();\n\t\t}\n\n\t\tif ((this.user.get('teamIds') || []).length > 0) {\n\t\t\tif (!this.user.get('joinMethod')) {\n\t\t\t\top.$set.joinMethod = 'Added to Team';\t// for tracking\n\t\t\t}\n\t\t\tif (!this.user.get('primaryReferral')) {\n\t\t\t\top.$set.primaryReferral = 'internal';\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!this.user.get('originTeamId') &&\n\t\t\t\tthis.teamCreator && \n\t\t\t\tthis.teamCreator.get('originTeamId')\n\t\t\t) {\n\t\t\t\top.$set.originTeamId = this.teamCreator.get('originTeamId');\n\t\t\t}\n\t\t}\n\n\t\tthis.request.transforms.userUpdate = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.request.data.users,\n\t\t\tid: this.user.id\n\t\t}).save(op);\n\t}", "function updateUser(userName, userEmail){\nvar user = firebase.auth().currentUser;\n\t// Prompt the user to re-provide their sign-in credentials\n\tuser.updateProfile({\n\t displayName: userName,\n\t}).then(function() {\n\t // Update successful.\n\t alert(user.displayName);\n\t}).catch(function(error) {\n\t // An error happened.\n\t alert(\"did not set user name\");\n\t});\n\tuser = firebase.auth().currentUser;\n\tuser.updateEmail(userEmail).then(function() {\n\t // Update successful.\n\t \t alert(user.email);\n\t}).catch(function(error) {\n\t // An error happened.\n\t alert(\"DID not set email\");\n\t});\n\n\t\t\tsetTimeout(function() { window.location.href = 'Main1.html';}, 1000);\t\n}", "function updateAdminUser(properties, success, failure) {\n if (!self.loggedInUser) {\n failure();\n }\n apiRequest(\"PUT\", \"/management/users/\" + self.loggedInUser.uuid, null, JSON.stringify(properties), success, failure);\n }", "function updateInstagramInformation(user, profile, access_token, done) {\n var anythingChanged = false;\n\n if (user.instagram.id != profile.id) {\n user.instagram.id = profile.id;\n anythingChanged = true;\n }\n\n if (user.instagram.access_token != access_token) {\n user.instagram.access_token = access_token; \n anythingChanged = true;\n }\n \n if (user.instagram.name != profile.username) {\n user.instagram.name = profile.username;\n anythingChanged = true;\n }\n\n if (anythingChanged) {\n user.save(function(err) {\n if (err)\n return done(err);\n return done(null, user);\n });\n } else {\n return done(null, user);\n }\n}", "static async updateUser({ username, password, first_name, last_name, email }) {\n try {\n const res = await this.request(`users/${username}`, { password, first_name, last_name, email }, 'patch')\n return res;\n } catch (err) {\n return { errors: err };\n }\n }", "async function editProfile(data) {\n let profile = await getProfile();\n Object.keys(data).forEach(key => {\n profile.data[key] = data[key];\n });\n const resp = await fetch(window.location.origin + '/profiles/update', {\n method: \"PUT\",\n mode: \"cors\",\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n redirect: \"follow\",\n body: JSON.stringify(profile.data)\n });\n return resp.json();\n}", "async update({ request }) {\n /*\n const data = request.only([\n 'profile', 'unidade', 'carteira', 'rules', 'restritivo', 'posicional'\n ])\n console.log(data)\n const profile = await Profile.find(params.id)\n \n profile.merge(data)\n await profile.save()\n \n return profile */\n const data = request.body\n const profile = await Profile.find(data.id)\n\n if (!profile) {\n\n return (\n\n response.status(404),\n Message.messageNotFound('Perfil não encontrado')\n\n )\n }\n\n profile.merge(data)\n await profile.save()\n\n return (\n\n response.status(200),\n Message.messageOk('Perfil atualizado com sucesso')\n\n )\n\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}", "async function editProfile(req, res) {\n try {\n const { id } = req.auth;\n\n const { name, surnames, email, userName } = req.body;\n\n\n const schema = Joi.object({\n name: Joi.string().required().min(5).max(20),\n surnames: Joi.string().required(),\n email: Joi.string().email().required(),\n userName: Joi.string().alphanum().min(5).max(20),\n\n });\n await schema.validateAsync({ name, surnames, email, userName });\n\n const updateQuery = ('UPDATE users SET name = ?, surnames = ?, email = ?, userName = ? WHERE id = ?');\n\n\n await database.pool.query(updateQuery, [name, surnames, email, userName, id]);\n\n\n const selectQuery = 'SELECT * FROM users WHERE id = ?';\n const [selectRows] = await database.pool.query(selectQuery, id);\n\n\n res.send(selectRows[0]);\n\n\n } catch (err) {\n res.status(500);\n res.send({ error: err.message });\n }\n}", "updateUser(userId, data) {\n return this.userStore.updateUser(userId, data)\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\n\t\tthis.props.actions.updateUser(userUrl, updatedInfo);\n\t}", "function updateInstagramInformation(user, profile, access_token, done) {\n var anythingChanged = false;\n\n if (user.instagram.id != profile.id) {\n user.instagram.id = profile.id;\n anythingChanged = true;\n }\n\n if (user.instagram.access_token != access_token) {\n user.instagram.access_token = access_token; \n anythingChanged = true;\n }\n \n if (user.instagram.name != profile.username) {\n user.instagram.name = profile.username;\n anythingChanged = true;\n }\n\n var description = profile._json.data.bio;\n if (user.instagram.description != description) {\n user.instagram.description = description;\n anythingChanged = true;\n }\n\n if (anythingChanged) {\n user.save(function(err) {\n if (err)\n return done(err);\n return done(null, user);\n });\n } else {\n return done(null, user);\n }\n}", "function update(req, res, next) {\n User.findById(req.body.userId)\n .then(function(foundUser) {\n req.session.currentUser = foundUser;\n console.log(foundUser);\n next();\n });\n}", "function update(req, res) {\n // find one user by id, update it based on request body,\n // and send it back as JSON\n\n db.User.findById(req.params.id, function(err, foundUser) {\n if (err) { console.log('userController.update error', err); }\n foundUser.username = req.body.username;\n foundUser.password = req.body.password;\n foundUser.location = req.body.location;\n foundUser.contact = req.body.contact;\n foundUser.picture = req.body.picture;\n foundUser.posts = req.body.posts;\n foundUser.save(function(err, savedUser) {\n console.log(savedUser)\n if (err) { console.log('saving altered user failed'); }\n res.json(savedUser);\n });\n });\n}", "updateProfile(id, update) {\n return ProfileDoc.findByIdAndUpdate(id, update).exec()\n .then(p => this.getProfileById(id));\n }", "async updateUser(id, updatedUser) {\n id = idCheck(id);\n const userCollection = await users();\n const currentUser = await this.getUserById(id);\n const updatedUserData = { profile: {} };\n\n if (updatedUser.newPassword) {\n if (typeof updatedUser.newPassword != \"string\") throw \"The new hash must be a string.\";\n updatedUserData.hashedPassword = updatedUser.newPassword;\n } else {\n updatedUserData.hashedPassword = currentUser.hashedPassword;\n }\n\n if (updatedUser.newName) {\n if (typeof updatedUser.newName != \"string\") throw \"The new name must be a string.\";\n updatedUserData.profile._id = currentUser.profile._id;\n updatedUserData.profile.name = updatedUser.newName;\n updatedUserData.profile.prevSearches = currentUser.profile.prevSearches;\n updatedUserData.profile.likes = currentUser.profile.likes;\n updatedUserData.profile.dislikes = currentUser.profile.dislikes;\n } else {\n updatedUserData.profile._id = currentUser.profile._id;\n updatedUserData.profile.name = currentUser.profile.name;\n updatedUserData.profile.prevSearches = currentUser.profile.prevSearches;\n updatedUserData.profile.likes = currentUser.profile.likes;\n updatedUserData.profile.dislikes = currentUser.profile.dislikes;\n }\n\n let updateCommand = {\n $set: updatedUserData\n };\n const query = {\n _id: currentUser._id\n };\n\n const updatedInfo = await userCollection.updateOne(query, updateCommand);\n\n if (updatedInfo.modifiedCount === 0) {\n console.log(\"No changes were made.\");\n }\n\n return await this.getUserById(id);\n }", "function upsertUser(userData) {\n $.post(\"/api/users\", userData).then(getUsers);\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 }", "async function update(username, password, provider, familyName, givenName, middleName,\r\n gender, birthday, gravatar, displayPicture, profileCreatedAt, emails, photos) {\r\n let res = await request\r\n .post(reqURL(`${config.routes.user.update}/${username}`))\r\n .withCredentials()\r\n .send({ username, password, provider, familyName, givenName, middleName,\r\n gender, birthday, gravatar, displayPicture, profileCreatedAt, emails, photos })\r\n .set(\"Content-Type\", \"application/json\")\r\n .set(\"Accept\", \"application/json\")\r\n .auth(\"team\", \"DHKHJ98N-UHG9-K09J-7YHD-8Q7LK98DHGS7\");\r\n log(`update:${util.inspect(res.body)}`);\r\n return res.body;\r\n}", "function updateUserProfile(profileId,profileJson) {\r\n\t\t\t\r\n\t \t// ‘_category’ parameter is not supported now\r\n\t \tvar postParams = {\"@metaData\":profileJson};\r\n\t\t\t\r\n\t\t\tconsole.log(postParams);\r\n\t\t\tconsole.log(Config.WebServiceMapping.cs.patchUpdateProfile(profileId));\r\n\t\t\treturn Utils.csPatch(Config.WebServiceMapping.cs.patchUpdateProfile(profileId),postParams);\r\n\t\t\t\r\n\t\t\t\r\n\t\t}", "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(userID, options) {\n const User = require('../models/user');\n const mongoose = require('../mongoose');\n\n const updates = [];\n\n if (options.email && typeof options.email === 'string' && options.email.length > 0) {\n let q = User.update({\n 'id': userID,\n 'profiles.provider': 'local'\n }, {\n $set: {\n 'profiles.$.id': options.email\n }\n });\n\n updates.push(q);\n }\n\n if (options.name && typeof options.name === 'string' && options.name.length > 0) {\n let q = User.update({\n 'id': userID\n }, {\n $set: {\n displayName: options.name\n }\n });\n\n updates.push(q);\n }\n\n Promise\n .all(updates.map((q) => q.exec()))\n .then(() => {\n console.log(`User ${userID} updated.`);\n mongoose.disconnect();\n })\n .catch((err) => {\n console.error(err);\n mongoose.disconnect();\n });\n}" ]
[ "0.7807826", "0.7778466", "0.7765767", "0.77542657", "0.7745856", "0.7446681", "0.7410113", "0.7356065", "0.7341599", "0.7287491", "0.7237825", "0.72129244", "0.71763974", "0.7146402", "0.7118101", "0.7116507", "0.7106716", "0.7081433", "0.7080873", "0.7080873", "0.70777625", "0.70693237", "0.704765", "0.7041655", "0.7016562", "0.7011357", "0.700568", "0.7003482", "0.6998988", "0.6975085", "0.6961367", "0.69493", "0.6946227", "0.692812", "0.69234294", "0.69176596", "0.69057745", "0.68822795", "0.6870342", "0.6849078", "0.6832662", "0.68254036", "0.67890286", "0.67721444", "0.6769195", "0.6766761", "0.6757862", "0.6757196", "0.675406", "0.6744309", "0.6744277", "0.67371964", "0.6726969", "0.6720286", "0.67202675", "0.67184454", "0.66944057", "0.6648852", "0.6630953", "0.6624524", "0.6620713", "0.6600973", "0.6595309", "0.65912986", "0.65761405", "0.6563017", "0.65626204", "0.6554338", "0.6550562", "0.6550562", "0.65491766", "0.65455216", "0.6542683", "0.65407276", "0.6531727", "0.65295637", "0.65279704", "0.6513374", "0.6509774", "0.65049917", "0.65043586", "0.6502219", "0.64926594", "0.64890313", "0.6467189", "0.6461148", "0.64594895", "0.64566183", "0.6450931", "0.64455044", "0.6434235", "0.6419718", "0.64149535", "0.64135313", "0.64121854", "0.64012074", "0.6394084", "0.6391754", "0.63841426", "0.6372243" ]
0.7960154
0
Remove the user profile in the database
function remove() { // REMOVE FROM DB let uid = $rootScope.account.authData.uid; $rootScope.db.users.child(uid).remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteProfile() {}", "deleteProfile() {\n // console.log(\"deleteProfile()\");\n return store.delete('CURRENT_PROFILE');\n }", "function deleteUserProfile(){\n\tconsole.log(\"deleteUserProfile ran \" + userProfileId);\n\tconst settings = {\n\turl: DATABASE_URL + 'userprofile/' + userProfileId,\n\t\tmethod: 'DELETE',\n\t\t\tdataType: 'json',\n\t\t\theaders: {\n\t\t\t\t'Authorization': \"Bearer \"+ AUTHORIZATION_CODE,\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tsuccess: function(){\n\t\t\t\tconsole.log('success DELETE user');\n\t\t\t\treturn;\n\t\t\t},\n\t\t\terror: console.error('DELETE userprofile error')\t\t\n\t};\n\t$.ajax(settings);\n}", "deleteProfile({commit}) {\n let userid = firebase.auth().currentUser.uid\n let path = '/users/' + userid\n firebase.database().ref(path).remove()\n commit('setAccount', {\n name: null,\n age: null,\n ap: null,\n fractal: null,\n wvw: null\n })\n }", "function removeUser(){\n\tfor(i in currentProject.members){\n\t\tif(currentProject.members[i].name == savedMem){\n\t\t\tfor (j in currentProject.members[i].role) {\n\t\t\t\tdelete currentProject.members[i].name;\n\t\t\t\tdelete currentProject.members[i].role[j];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\tdocument.getElementById(\"EditUser\").style.display = \"none\";\n\tpopTable();\n}", "function deleteUser(){\n // ------------ 01. hvis brugernavn/ mail er at finde i localstorage -----------------------------------\n if(localStorage.getItem('brugernavn')){\n\n // -------- 02. Denne instans profile af klassen Profile bruges til at sende en delete request til databasen ved hjælp af HTTP req DELETE\n const option = {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json'\n }, \n body: JSON.stringify(profile), // Konvertere klassen til en json string - det er denne instans der skal fjernes fra DB\n }; \n \n // --------- 03. Her benyttes fetch til at kontakte API og dermed fjerne bruger i DB--------------\n fetch(`http://localhost:4000/profile/${mail}`, option)\n .then(function() {\n console.log(\"ok\"); // Hvis det lykkes console logges ok i browser konsol\n }).catch(function() {\n console.log(\"error\"); // Ellers vil outputtet i browser kontrol være error\n });\n \n // ---------- 04. Her fjernes den information om brugeren gemt i localstorage----------------------\n localStorage.removeItem('brugernavn');\n localStorage.removeItem('fornavn');\n localStorage.removeItem('efternavn');\n localStorage.removeItem('alder');\n localStorage.removeItem('beskrivelse');\n localStorage.removeItem('kodeord');\n \n // ----------- 05. Bruger vidersendes til forside------------------------------\n window.location.href = \"/\";\n };\n}", "static removeUser() {\n localStorage.removeItem('userInfo');\n }", "async function deleteUser(req, res) {\n try {\n let user = req.profile;\n let deletedUser = await user.remove();\n deletedUser.hash_password = undefined;\n deletedUser.salt = undefined;\n res.json(deletedUser);\n }\n catch (err) {\n return res.status(400).json({\n err: dbErrorHandler_1.default.getErrorMessage(err),\n });\n }\n}", "function deleteUser() {\n UserService.deleteUser(model.userId)\n .then(function (response) {\n console.log(response);\n if (response.status == 200) {\n $location.url('/login');\n }\n }, function (rejection) {\n model.errorMessage = \"Sorry an error was encountered and your profile was not deleted. Please try again\";\n });\n }", "function deleteUser() {\n fetch(\n `https://serene-basin-92650.herokuapp.com/delet-user/${mystorage.getItem(\n \"id\"\n )}`,\n {\n method: \"GET\",\n body: JSON.stringify(),\n headers: {\n \"Content-type\": \"application/json\",\n },\n }\n )\n .then((res) => res.json())\n .then((data) => {\n console.log(data);\n });\n if (data[\"status_code\"] == 200) {\n alert(\"profile deleted successful\");\n window.location.reload();\n } else {\n alert(\"profile not deleted\");\n }\n}", "removeIt(profileID) {\n // console.log('BaseProfileCollection.removeIt(%o)', profileID);\n const profile = this._collection.findOne({ _id: profileID });\n const { userID } = profile;\n if (!Users.isReferenced(userID)) {\n // Automatically remove references to user from other collections that are \"private\" to this user.\n _.forEach([Feeds, CourseInstances, OpportunityInstances, AcademicYearInstances, FeedbackInstances, AdvisorLogs,\n VerificationRequests], collection => collection.removeUser(userID));\n const { username } = profile;\n Meteor.users.remove({ _id: profile.userID });\n Slugs._collection.remove({ name: username });\n super.removeIt(profileID);\n }\n }", "function clearProfile(){\n\tvar num_rows = profileTable.rows.length;\n\tif (num_rows != 1){\n\t\twhile (num_rows > 1) {\n\t\t\tprofileTable.deleteRow(num_rows);\n\t\t\tnum_rows = profileTable.row.length;\n\t\t}\n\t}\n}", "deleteAccount(){\n let userId = firebase.auth().currentUser.uid;\n this.state.user.delete().then(function() {\n console.log('delete user')\n let ref = firebase.database().ref().child('users/'+userId);\n ref.remove();\n this.props.navigation.navigate('ProfilScreen')\n })\n .catch(function(error) {\n // An error happened.\n console.log(error.message)\n alert('Une erreur est apparue. Déconnectez-vous puis reconnectez-vous avant de réessayer')\n });\n }", "function removeUser() {\n UserModel.remove({ _id: '5ccc467de09f3f3b9de92446' }, function(err, user) {\n console.log('remove', err, user)\n })\n}", "function popProfile(to_delete) {\n\n document.getElementById(\"old_profile\").remove();\n\n}", "function logout() {\n deferredProfile = $q.defer();\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n authManager.unauthenticate();\n userProfile = null;\n }", "async function removeUserFromProfileTable(userName) {\n const connection = db.getConnection(); \n\n var removeStatus = {\n outcome: 500,\n message: \"\",\n\t\terrors: []\n }\n\n return new Promise(async function(resolve, reject) {\n try {\t\n const queryString = \"DELETE FROM user_profile WHERE user_name= ?;\"\t\t\t\n \n connection.query(queryString, [userName], (err, rows) => {\n if (!err) {\n removeStatus.outcome = 200\n removeStatus.message = userName + \"removed from Profile Table\"\n resolve(removeStatus); \n } else {\n removeStatus.errors.add(err)\n resolve(removeStatus);\n }\n })\n } catch(err) {\n removeStatus.errors.add(err)\n reject(removeStatus);\n } \n })\n}", "async destroy({ auth, request, response }) {\n try {\n const profile = await Profile.findBy(\"user_id\", auth.user.id);\n if (!profile) {\n return response\n .status(401)\n .send({ message: \"Nenhum registro localizado\" });\n }\n const fs = Helpers.promisify(require(\"fs\"));\n const img = Helpers.tmpPath(`uploads/${profile.image}`);\n await fs.unlink(img);\n\n await profile.delete();\n return response.status(200).send({ message: \"Perfil excluido!\" });\n } catch (error) {\n return response.status(500).send({\n message: `Ocorreu algum erro ao deletar este perfil.`,\n error: `Erro:${error.message}`\n });\n }\n }", "function destroy(req, res) {\n db.User.findOneAndRemove({_id: req.params.userId}, function(err, user) {\n console.log('sever error ', err)\n res.send(\"Successfully deleted!\")\n });\n}", "function removeUser(User, data) {\n var userName = User.get('user');\n\n if (!_.isUndefined(data[userName])) {\n delete data[userName];\n }\n\n return data;\n }", "function unregister() {\n\t\t\tUserService\n\t\t\t\t.deleteUser(vm.userId)\n\t\t\t\t.then(\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t// Take the user to login page on successful deletion\n\t\t\t\t\t\t$rootScope.currentUser = null;\n\t\t\t\t\t\t$location.url(\"/login\");\n\t\t\t\t\t},\n\t\t\t\t\tfunction(){\n\t\t\t\t\t\t// Display failure message\n\t\t\t\t\t\tvm.deleteError = \"Error! \";\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t}", "function destroy(req, res) {\n db.User.findOneAndRemove({_id: req.params.id}, function(err, user) {\n console.log('sever error ', err)\n res.send(\"Successfully deleted!\")\n });\n}", "function removeUserFromTable(userId) {\n users.delete(userId);\n refreshUserTable();\n}", "function logout() {\n deferredProfile = $q.defer();\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n authManager.unauthenticate();\n userProfile = null;\n $state.go('login');\n }", "function _delete(_id) {\n var deferred = Q.defer();\n\n db.users.findById(_id, function (err, user) {\n if (err) deferred.reject(err);\n\n //console.log(user.profilePicUrl);\n\n if(user.profilePicUrl){\n fs.unlink('profile_pictures/'+user.profilePicUrl, function (err) {\n if (err) deferred.reject(err);\n });\n }\n\n db.users.remove(\n { _id: mongo.helper.toObjectID(_id) },\n function (err) {\n if (err) deferred.reject(err);\n \n deferred.resolve();\n });\n\n });\n \n return deferred.promise;\n}", "async remove() {\n const { id } = this;\n const options = {\n TableName: process.env.userTableName,\n Key: ddb.prepare({ id })\n };\n return ddb.call('deleteItem', options);\n }", "removeUser(db, callback) {\n this.collection = db.collection(\"USERS\");\n this.collection.remove({\"username\" : this.username}, function(err, results) {\n callback(results, null);\n });\n }", "function deleteProvider(req,res){\n providers.findOneAndRemove({firstName: req.params.firstName}, (err) =>{\n if(!err) {\n res.send(\"User was deleted\");\n } \n });\n}", "deleteProfile() {\n let user = localStorage.getItem('user')\n\n // axios.delete(`https://cors-anywhere.herokuapp.com/bond-movie-api.herokuapp.com/users/${user}`,\n axios.delete(`/users/${user}`,\n {\n headers: { Authorization: `Bearer ${localStorage.getItem('token')}` }\n })\n .then(res => {\n prompt('Type \"Yes\" to confirm deletion')\n })\n .then(res => {\n alert('Account was successfully deleted')\n setUserProf({}); // Change 5 (not 'setState')\n localStorage.removeItem('token');\n localStorage.removeItem('user');\n window.open('/', '_self');\n })\n .catch(e => {\n alert('Account could not be deleted ' + e)\n });\n }", "function deleteUser() {\n userService\n .deleteUser(model.userId)\n .then(function() {\n $location.url(\"\");\n });\n }", "function unlink(service, req, res) {\n var user = req.user;\n user[service].token = undefined;\n user.save(function(err) {\n res.redirect('/profile');\n })\n}", "function delete_user() {\n\tvar uri = \"http://localhost:8081/\" + user.accountType + \"s/\" + user.id;\n\tvar xhr = createRequest(\"DELETE\", uri);\n\txhr.onload = function() {\n\t\tif(xhr.status == 400) alert(\"Format Error\");\n\t\telse if(xhr.status != 200) alert(\"Something went wrong :/\");\n\t\telse {\n\t\t\tlocalStorage.removeItem(\"user\");\n\t\t\twindow.location.href = \"/\";\n\t\t}\n\t}\n\txhr.send();\n}", "function deleteProfile(pid) {\n $.ajax({\n url: _lcarsAPI + \"profiles/\" + pid,\n type: 'DELETE',\n success: function() { populateProfiles(); populateOrchestration(); }\n });\n}", "remove() {\n const user = this.attrs.user;\n\n this.loading = true;\n m.redraw();\n\n app\n .request({\n method: 'DELETE',\n url: `${app.forum.attribute('apiUrl')}/users/${user.id()}/avatar`,\n })\n .then(this.success.bind(this), this.failure.bind(this));\n }", "function removeOneProfile(req, res) {\n console.log('removeOneProfile IS GETTING HITTT!!!!!', req.body)\n db.Profile.findByIdAndUpdate(req.params.profileId, {$set: {\n markedForDeletion: req.body.markedForDeletion}}, {new: true}, function(err, removedProfile) {\n if (err) {\n console.log ('THERE WAS AN ERROR DURING removeOneProfile', err);\n }\n console.log('removeOneProfile SAVED and removed profile JSON sent back', removedProfile);\n res.json(removedProfile);\n });\n\n}", "function deleteUser(userData) {\n // Makes sure that currentUser is set before getting messages from the server\n AuthFactory.auth.$onAuthStateChanged(function(currentUser) {\n\n if(currentUser){\n currentUser.getToken().then(function(idToken) {\n return $http({\n method: 'DELETE',\n url: '/profile-edit/delete-user/' + mentorId,\n headers: {\n id_token: idToken\n },\n data: {\n userData: userData\n }\n })\n .then(function(response) {\n getProfiles();\n }),\n function(error) {\n console.log('Error with user DELETE request: ', error);\n };\n });\n }\n });\n }", "function elimina_account(){\r\n var users = JSON.parse(localStorage.getItem(\"users\") || \"[]\");\r\n var user=JSON.parse(sessionStorage.user);\r\n\r\n for(var i=0;i<users.length;i++){\r\n if(users[i].username == user.username){\r\n users.splice(i, 1);\r\n localStorage.setItem(\"users\", JSON.stringify(users));\r\n elimina_all_prenotazioni();\r\n }\r\n }\r\n}", "function unfollow(req, res) {\n Profile.findById(req.user.profile)\n .then(followerProfile => {\n followerProfile.following.remove({_id:req.params.id})\n followerProfile.save()\n .then(()=> {\n Profile.findById(req.params.id)\n .then(followingProfile=>{\n followingProfile.followers.remove({_id: req.user.profile._id})\n followingProfile.save()\n })\n res.redirect(`/profiles/${req.params.id}`)\n })\n })\n .catch((err) => {\n console.log(err)\n res.redirect('/')\n })\n}", "async function deleteProfile() {\n const resp = await fetch(window.location.origin + '/profiles/delete', {\n method: \"DELETE\",\n mode: \"cors\",\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n redirect: \"follow\"\n });\n return resp.json();\n}", "function removeAccount(user, cb) {\n pg.connect(conn, function (err, client) {\n\tif (err) {\n\t throw err;\n\t}\n\tclient.query('DELETE FROM users WHERE name=$1;', [user]);\n\tclient.query('DELETE FROM dests WHERE name=$1;', [user],\n\t\t function (err, result) {\n\t\t\t cb (err, result);\n\t\t });\n });\n}", "function deleteUserData() {\r\n\tlocalStorage.clear();\r\n}", "async destroy() {\n const { ctx, service } = this;\n const params = getParams(ctx, 'body');\n const condition = Object.assign({}, params);\n const res = await service.user.crud({\n type: 'deleteOne',\n condition,\n });\n ctx.body = res;\n }", "async function removeExpUser(name) {\n isCon = await init_connection();\n if(!isCon) return null;\n\n var id = await getIdUser(name);\n var sql = `DELETE FROM \\`experience\\` WHERE \\`user_id\\` = '${id}'`;\n const result = await query_db(sql);\n close_connection();\n return result;\n}", "removeUser(req, res){\n \n }", "static remove(user, cb) {\n let instance = userSchema.createUserInstance(user);\n\n instance.remove(cb);\n }", "function removeUserSite() {\n\t$(this).parent().remove();\n}", "async destroy({ request }) {\n\n const data = request.body\n const profile = await Profile.find(data.id)\n\n if (profile) {\n\n await profile.delete()\n\n return (\n\n response.status(200),\n Message.messageOk('Perfil deletado')\n\n )\n\n } else {\n\n return (\n\n response.status(404),\n Message.messageNotFound('Perfil não encontrado')\n\n )\n\n }\n\n /*\n const profile = await Profile.find(params.id)\n \n if (profile) {\n await profile.delete()\n return Message.messageOk('deleted')\n \n } else {\n return Message.messageNotFound(`Not Found profile ${params.id}`)\n }\n */\n\n }", "function remover(user){\n\t\t\t\tUser.getByID(user.userID, function(callback, userModel){\n\t\t\t\t\tuserModel.removeCourse(course._id);\n\t\t\t\t\tuserModel.save()\n\t\t\t\t})\n\t\t\t}", "function deleteUser(event) {\n var removeBtn = $(event.target);\n var removeIndex = removeBtn.attr(\"id\").split('-')[1];\n var removeUserId = users[removeIndex]._id;\n try {\n userService\n .deleteUser(removeUserId)\n .then(function () {\n users.splice(removeIndex, 1);\n renderUsers(users);\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function erase_users(options, completed, failed) {\n db.users.erase_db(function(removed_data){\n // console.log(removed_data);\n completed(removed_data);\n });\n}", "removeProfileFromInterviewer(event){\n\t\tevent.preventDefault();\n\t\tconst basicString = this.props.userCredentials.email + ':' + this.props.userCredentials.password;\n\t\tlet profileNameToQuery = event.target.value;\n\t\tlet idToQuery = this.state.interviewerId;\n\t\t//console.log(\"profile_name: \" + profileNameToQuery + \" / people_id: \" + idToQuery);\n\n\t\t// Perform the fetch\n\t\tfetch(`${process.env.API_URL}/removeProfile`, {\n\t\t\tmethod: 'DELETE',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t'Authorization': 'Basic ' + btoa(basicString)\n\t\t\t},\n\t\t\tbody: JSON.stringify({ // I always forget the JSON.stringify\n\t\t\t\t\"profile_name\": profileNameToQuery,\n\t\t\t\t\"people_id\": idToQuery\n\t\t\t})\n\t\t})\n\t\t.then(response => this.handleHTTPErrors(response))\n\t\t.then(response => response.json())\n\t\t.then(result => {\n\t\t\t// A temporary set which will be the current set of interviewerProfiles, MINUS the new one\n\t\t\tlet temporarySet = this.state.interviewerProfiles;\n\t\t\ttemporarySet.delete(profileNameToQuery);\n\t\t\tthis.setState({\n\t\t\t\tinterviewerProfiles: temporarySet\n\t\t\t})\n\t\t})\n\t\t.catch(error => {\n\t\t\tconsole.log(error);\n\t\t});\n\t}", "function deleteUser(userKey) {\n\t//\n\tvar firebaseRemoveRef = firebase.database().ref(\"Users/\"+userKey);\n\tfirebaseRemoveRef.remove().then(function(){\n\t\tconsole.log(\"ok\");\n\t}).catch(function(error){\n\t\tconsole.log(\"Falha: \"+error.message)\n\t});\n\tshowData();\n}", "function deleteUser() {\n UserService\n .deleteUser(userId)\n .success(function () {\n $location.url(\"/login\");\n })\n .error(function (error) {\n \n });\n }", "function deleteUserDataFromSessionStorage() {\n localStorage.removeItem('userData');\n}", "function removeUser (id) {\n return knex('users').where('id', `${id}`).del()\n}", "function removeUser(id) {\n if(id === -1) {\n showSnackbar(\"You cannot remove the Guest user!\", ERROR);\n return;\n }\n if (confirm(\"Are you sure you want to remove all data linked to this user?\")) {\n var url = \"remove_user.php?id=\" + id;\n\n executeStatement(url, \"Successfully removed\", \"[Remove user] Error \", getData);\n }\n}", "function removeUserInfo() {\n ssoClient.removeUserInfo();\n}", "function eliminarPersona(user,res){\n tb_persona.connection.query(\"DELETE FROM persona WHERE id=\" + user.id);\n res.send();\n}", "function removeOldSkills() {\n elgg.action('b_extended_profile/edit_profile', {\n data: {\n 'guid': elgg.get_logged_in_user_guid(),\n 'section': 'old-skills'\n },\n success: function() {\n $('.gcconnex-old-skills').remove();\n }\n });\n\n}", "removeUser(user) {\n this.active_list = this.active_list.filter((a_user) => a_user.email !== user.email);\n this.setValue(this.active_list);\n }", "static removeFromLocalStorage(id) {\n const profiles = Store.getProfilesFromLocalStorage();\n profiles.forEach((profile, index) => {\n\n // console.log('profile -id:', typeof profile.id, 'current-id:', typeof id)\n if (profile.id === id) {\n profiles.splice(index, 1);\n }\n });\n localStorage.setItem('profiles', JSON.stringify(profiles));\n }", "function removeUser(req, res, next) {\r\n\tvar userID = parseInt(req.params.id);\r\n\tdb.result('delete from users where id = $1', userID)\r\n\t.then(function (result) {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: `Removed ${result.rowCount} users`\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "function deleteProfile(api, id) {\n return api_1.DELETE(api, `/profiles/${id}`)\n}", "async remove() {\n // this function is really just a wrapper around axios\n await axios({\n url: `${BASE_URL}/users/${this.username}`,\n method: \"DELETE\",\n data: {\n token: this.loginToken\n }\n });\n }", "function remove (u) {\n return users.remove(u)\n}", "removeUser(id){\n var user = this.getUser(id);\n if(user){\n this.users = this.users.filter((user)=> user.id!==id); /* USER LIST WILL BE UPDATED */\n }\n\n return user;\n }", "removeUser(username) {\n for (let i = this.chatUsersDB.length - 1; i >= 0; --i) {\n if (chatUsersDB[i].username === username) {\n chatUsersDB.splice(i, 1);\n }\n }\n }", "function removeFollowing(req, res) {\n var username = req.user;\n var toBeRemovedFollowing = req.params.user ? req.params.user.split(',')[0] : null;\n if (!toBeRemovedFollowing) {\n res.send(400)\n }\n Profile.find({username: username}, function (err, result) {\n if (err) return res.json({error: \"Error finding \" + username + Profile.toString()});\n var user = result[0];\n var index = user.following.findIndex(function (following) {\n return following === toBeRemovedFollowing\n });\n user.following.splice(index, 1);\n user.save(function (err, user) {\n if (err) return res.json({error: \"Error saving \" + user.username + Profile.toString()});\n res.send({\"username\": user.username, \"following\": user.following})\n })\n });\n}", "async function removeUser() {\n let result = await User.deleteOne({login: 'Peter'});\n console.log(result);\n}", "function delete_user() {\r\n alertBox.hide();\r\n const username = Utils.getInput();\r\n if(Utils.isEmpty(username))\r\n return;\r\n\r\n fetch('./delete', Utils.postUserParam(username)).then(function(response) {\r\n if(response.status !== 200) {\r\n alertBox.show('No such username!', true);\r\n return;\r\n }\r\n\r\n response.json().then(function(data) {\r\n alertBox.show(data.msg, false);\r\n init_saved(); //updates saved list\r\n });\r\n });\r\n }", "static removeUserInfoFromStorage() {\n localStorage.removeItem(this.KEY_USER_INFO);\n }", "function deleteProfile(event) {\n prop.deleteSelectedProfile(); //call searchResults.js\n // document.getElementById(\"table-responsive\").style.display=\"none\"\n }", "deleteProfile(target) {\n if (target.id === 'delete') {\n // Getting id from target hidden input\n const id = target.parentElement.previousElementSibling.dataset.id;\n\n // Converting string 'id' into number for future comparing\n // Removing profiles from local storage\n Store.removeFromLocalStorage(parseInt(id));\n\n // Removing tr from UI\n target.parentElement.parentElement.remove();\n }\n }", "function resendConfirmation() {\n vm.resendConfirmationLoading = true;\n new Users(Authentication.user).$delete()\n .then(function (response) {\n vm.removeProfileInitialized = response.message || 'Success.';\n })\n .catch(function (response) {\n vm.removeProfileLoading = false;\n messageCenterService.add(\n 'danger',\n response.message || 'Something went wrong while initializing profile removal, try again.',\n { timeout: 10000 }\n );\n });\n }", "function deleteActiveUser(delActiveUser) {\n alert(\"User \" + activeUser.nome + \" (\" + activeUser.numero + \") successfully logged out.\");\n localStorage.removeItem(\"ActiveUser\");\n resetVariables();\n}", "function deleteProfilePic(req, res){\n var deferred = Q.defer();\n\n //update db\n db.users.findOne({ email: req.body.email }, function (err, user) {\n if (err) deferred.reject(err);\n \n if (user) {\n db.users.update({email: req.body.email}, {$set: { profilePicUrl: ''}}, function(err){\n if(err) deferred.reject(err);\n //If no errors, send it back to the client\n fs.unlink('profile_pictures/'+user.profilePicUrl, function (err) {\n if (err) deferred.reject(err);\n });\n deferred.resolve();\n });\n } else {\n // authentication failed\n deferred.resolve();\n }\n });\n deferred.resolve();\n\n return deferred.promise;\n}", "function remove_profile(){\n $('.active').hide();\n}", "deleteUser(userId) {\n this.data[userId] = null;\n this.store.del(userId);\n }", "DeleteUserDatabase() {\n let database = firebase.database();\n let dbRef = database.ref();\n // Get Node with all users\n let usersRef = dbRef.child(\"users\");\n // Get Unique Key for New User\n let newUserkey = this.UserId;\n let userObject = {};\n // Construct JSON Object for User\n userObject[\"/users/\" + newUserkey] = null;\n // Call Update on Object\n dbRef.update(userObject, function() {\n console.log(\"User Successfully Updated\\n\"); // Optional callback for success\n });\n }", "deleteAccount() {\n // Destroy model + Creator profile\n this.model.user.destroyRecord().then(() => {\n // Delete cognito user.\n this.authentication.deleteCognitoUser();\n this.authentication.logout().then(() => this.router.transitionTo(\"index\"));\n }).catch(() => {\n // Workaround Because of the Ember error about mismatched ids.\n // Forgive me patron saint of prgoramming.\n this.authentication.deleteCognitoUser();\n this.authentication.logout().then(() => this.router.transitionTo(\"index\"));\n });\n this.set('deleteAccountConfirmationShow', false);\n }", "removeUser (id) {\n var user = this.getUser(id);\n\n if(user) {\n this.users = this.users.filter((user) => user.id !== id);\n }\n\n return user;\n }", "static deleteUser(req, res) {\n let id = +req.params.id\n User.destroy({\n where: {id}\n })\n .then(data => {\n res.redirect('/users')\n })\n .catch(err => {\n res.send(err)\n })\n }", "function cs_user_profile_picture_del(picture_class,user_id,admin_url){\r\n\t\tvar dataString='picture_class=' + picture_class + \r\n\t\t\t\t'&user_id=' + user_id +\r\n\t\t\t\t'&action=cs_admin_user_profile_picture_ajax';\r\n\t\tjQuery(\".profile-loading\").html('<i class=\"fa fa-spinner fa-spin fa-2x\"></i>');\r\n\t\tjQuery.ajax({\r\n\t\t\ttype:\"POST\",\r\n\t\t\turl: admin_url,\r\n\t\t\tdata:dataString, \r\n\t\t\tsuccess:function(response){\r\n\t\t\t\tif(response != 'error'){\r\n\t\t\t\t\tjQuery(\"article figure\").html(response);\r\n\t\t\t\t\tjQuery(\"#user_avatar_display_box\").remove();\r\n\t\t\t\t\tjQuery(\".profile-loading\").html('');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tjQuery(\".profile-loading\").html(' There is error while removing profile picture.');\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\t\treturn false;\r\n\t}", "static async remove(req, res) {\n const info = await UserModel.findByIdAndRemove(req.params.id);\n return res.send(info);\n }", "function deleteUser() {\n playersRef.child(thisIsPlayerNumberX).remove();\n // disableGamePlay();\n}", "function ProfileCardUnFollow(){\n PeopleService.UnFollow($rootScope.UserCard.id)\n .then(\n resolve => {\n $rootScope.UserCard.fav = false ;\n $rootScope.User.favs = resolve.data ;\n }\n );\n }", "function testRemove(){\n UserModel.remove({_id: '5c016964c01b2f04cc7e514d'}, function(err, result){\n console.log('remove', err, result)\n })\n}", "function removeFromDb(user){\n $.get('/removeuser',{remove : user}, function(data,status){\n console.log(\"status : \"+status);\n console.log(\"data after removing : \"+data);\n\n })\n}", "remove(req, res) {\n const name = req.body.name;\n const userId = req.session.user.id;\n\n Location.destroy({\n where: { name, userId },\n })\n .then((response) => {\n // Remove the location from session\n let newLocations = req.session.user.locations.filter((loc) => {\n return loc.name.localeCompare(name) !== 0;\n });\n\n // New user object for session\n let newUser = {\n ...req.session.user,\n locations: [...newLocations],\n };\n req.session.user = newUser;\n res.sendStatus(200);\n })\n .catch((err) => {\n console.log(`Error removing location from DB, ${err}`);\n res.send(err);\n });\n }", "function removeUser() {\n var user = $('#query-input-verwijder').val();\n var userid;\n\n databaseManager\n .query(\"SELECT ID_GEBRUIKER FROM gebruiker WHERE NAAM = (?)\", [user])\n .done(function (data) {\n\n if (data == \"\") {\n alert(\"Gebruiker is niet gevonden\");\n } else {\n userid = data[0].ID_GEBRUIKER;\n databaseManager\n .query(\"DELETE FROM gebruiker WHERE ID_GEBRUIKER = (?)\", [userid]);\n alert(\"Gebruiker is verwijderd\");\n }\n })\n }", "function deleteUser(req, res) {\n User.findByIdAndRemove(req.params.id, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem deleting the user.\");\n res.status(200).send(\"User: \" + user.name + \" was deleted.\");\n });\n}", "removeConnection(data) {\r\n userDBConnection.deleteOne({ connectionID: data.connectionID }, function (err, data) {\r\n if (err) return console.error(err);\r\n })\r\n }", "async function removeUser(name) {\n isCon = await init_connection();\n if(!isCon) return null;\n\n var id = await getIdUser(name);\n var sql = `DELETE FROM \\`user\\` WHERE \\`id\\` = '${id}'`;\n const result = await query_db(sql);\n close_connection();\n return result;\n}", "function removeUser(Email)\n{\n\tbootbox.confirm(\"<div class='text'><b>Por favor introduza o seu código.</b><br><br><br>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <div class='form-group'>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <input style='width: 300px;' type='password' class='form-control' id='Password'>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t </div>\", function(result) {\n\n\t\tif(result)\n\t\t{\n\t\t\tchrome.storage.local.get(Email, function (result) {\n\n\t\t\t\tvar pass = CryptoJS.SHA3($('#Password').val());\n\n\t\t\t\tif(_.isEqual(pass, result[Email]))\n\t\t\t\t{\n\t\t\t\t\tbootbox.confirm(\"<div class='text'><b>Utilizador prestes a ser removido. <br><br>Deseja continuar?</b></div>\", function(result) {\n\n\t\t\t\t\t\tif(result)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchrome.storage.local.remove(Email, function() {\n\n\t\t\t\t\t\t\t\tchrome.storage.local.remove('id-'+Email, function() {});\n\n\t\t\t\t\t\t\t\tbootbox.alert(\"<br><div class='text'><b>Utilizador removido com sucesso</b></div>\");\n\n\t\t\t\t\t\t\t\tgetData();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbootbox.alert(\"<br><div class='text'><b>Introduziu um código errado. <br><br>Tente de novo.</b></div>\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}", "function deleteUseraccount() {\n data = \"name=\" + String($(\".username.act\").html()) + \"^class=User\";\n dbOperations(\"user\", \"delete_operation\", data);\n $(\"li.actparent\").remove();\n $(\"#userhistorypane\").css(\"opacity\", \"0\");\n check_for_active_row(\"username\", \"acc\");\n $(\"#userhistorypane\").animate({\n opacity: 1\n });\n\n}", "function removeUserFromBar(req, res) {\n const query = { barId: req.params.id, userId: req.user.id };\n \n Going.findOneAndRemove(query, (err) => {\n if (err) {\n console.log('Error on removing user from bar');\n return res.status(500).send('We failed to remove the user for the bar');\n }\n\n return res.status(200).send('removed');\n });\n}", "function wipeUser(req, res, callback) {\n if (req.body.email === undefined) {\n callback(cbs.cbMsg(true, { error: 'Email not provided!' }));\n } else if (req.body.email === '') {\n callback(cbs.cbMsg(true, { error: 'Empty email provided!' }));\n } else {\n // Generate random string to append to the deleted username and email as they have to be unique.\n const randomString = crypto.randomBytes(20).toString('hex');\n const update = {\n username: `deleted user_${randomString}`,\n email: `0@0_${randomString}`,\n phone_number: '0',\n location: '',\n avatar_url: {\n img: '',\n thumbnail: '',\n },\n isDeleted: true,\n };\n userModel.User.findOneAndUpdate(\n { email: req.body.email },\n update,\n { new: true },\n (err, result) => {\n if (err) callback(cbs.cbMsg(true, { error: err }));\n else if (!result) callback(cbs.cbMsg(true, { error: `No user with email ${req.body.email} found!` }));\n else callback(cbs.cbMsg(false, result));\n },\n );\n }\n}", "deleteSSUser() {\n\t\treturn new Promise((resolve,reject) => {\n\t\t\tthis.cognitoUser.deleteUser((err,result) => {\n\t\t\t\tif (err) {\n\t\t\t\t\t//console.log(err);\n\t\t\t\t\treject(err);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log('User deleted');\n\t\t\t\t\tresolve(result);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function deleteUser(event){\n let id = event.currentTarget.id;\n fetch(`https://students-3d096.firebaseio.com/${id}.json`, {\n method: 'DELETE'\n })\n .then(res => res.json())\n .then(data => {\n users = users.filter(user => user.id != id);\n showUsersInfo(users);\n })\n}", "function removeUserFromStore(panelName, userId) {\n // unset user\n window['permissionStore_' + panelName][userId] = undefined;\n\n updateAclField(panelName);\n}" ]
[ "0.75565994", "0.70803505", "0.7065429", "0.70616907", "0.6964795", "0.6938524", "0.68980575", "0.6887883", "0.6860602", "0.68469507", "0.68426275", "0.6790303", "0.67643714", "0.6751246", "0.6741149", "0.6636863", "0.6632147", "0.6563877", "0.6535319", "0.65207636", "0.65140325", "0.6511277", "0.64944714", "0.6494178", "0.64859194", "0.64850324", "0.6465461", "0.6456794", "0.6456499", "0.643106", "0.6410793", "0.6387469", "0.6375904", "0.63257354", "0.63250035", "0.63117516", "0.62708455", "0.6259522", "0.62548584", "0.62537706", "0.62528765", "0.62492764", "0.6236443", "0.62357926", "0.6234", "0.62289685", "0.6225955", "0.6220421", "0.62019926", "0.6197289", "0.6193415", "0.6193107", "0.6187615", "0.6186383", "0.61763215", "0.6173331", "0.6166556", "0.616014", "0.61533695", "0.6147544", "0.6138027", "0.6136027", "0.61347085", "0.61306417", "0.6130137", "0.61090124", "0.61073303", "0.61062527", "0.60999334", "0.60846967", "0.6060174", "0.6056092", "0.6052856", "0.6051775", "0.60409164", "0.60302144", "0.6021151", "0.60173094", "0.60139775", "0.6012764", "0.60090756", "0.5998537", "0.59984463", "0.5978896", "0.5978836", "0.5970648", "0.59581745", "0.5952477", "0.5949432", "0.5946901", "0.5943356", "0.5941439", "0.5934678", "0.5932095", "0.59284186", "0.59214276", "0.59174204", "0.59173214", "0.591434", "0.5908798" ]
0.7704827
0
Extract the initial user profile from the provider authData
function extract(authData) { let name = {first: "", last: "", display: ""}; let profile = { // The private bits uid: authData.uid, provider: authData.providerData[0].providerId, newUser: true, email: authData.email, // Publicly readable info expose: { name: name, bio: "", image: "", achievements: [] } }; let provider = authData.providerData[0]; let fullName = provider.displayName; profile.expose.name.first = fullName.split(' ').slice(0, -1).join(' ') || ""; profile.expose.name.last = fullName.split(' ').slice(-1).join(' ') || ""; profile.expose.name.display = provider.displayName || ""; profile.expose.image = provider.photoURL || null; return profile; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserInfo(authData) {\n var fbData = authData.providerData[0];\n var fbCachedUserProfile = fbData.cachedUserProfile || {};\n return {\n name: fbData.displayName,\n email: fbData.email || null,\n avatar: fbData.photoURL || null,\n gender: fbCachedUserProfile.gender || null\n };\n }", "function userProfile() {\n return baseUser().get();\n }", "get userProfile() {\r\n return this.clone(ProfileLoader_1, \"getuserprofile\").postCore();\r\n }", "async profile(_, __, { auth }) {\n try {\n await auth.check();\n const user = await auth.getUser();\n\n return user;\n } catch (error) {\n throw new Error(error);\n }\n }", "function getProfileData() {\n // obtener los datos del usuario al iniciar sesión\n IN.API.Raw(\"people/~:(first-name,last-name,id,num-connections,picture-url,location,positions,summary,public-profile-url)\").result(onSuccess).error(onError); \n }", "get userProfile() {\r\n return this.profileLoader.userProfile;\r\n }", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n }", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n }", "getInitialUserInfo(DB, request, response) {\n\t\tDB.get_initial_user(request.params.auth_id).then((userData) => {\n\t\t\tif (userData[0]) response.status(200).send(userData);\n\t\t\telse response.status(404).send('User Not Found...');\n\t\t});\n\t}", "function getCurrentProfile() {\r\n var deffered = $q.defer();\r\n if (user.name !== '') {\r\n deffered.resolve(user);\r\n return deffered.promise;\r\n }\r\n var token = identity.getToken();\r\n $http({\r\n method: 'GET',\r\n headers: {\r\n 'Content-Type': CONTENT_TYPE,\r\n 'Authorization': 'Bearer ' + token\r\n },\r\n url: BASE_URL + '/profile'\r\n }).success(function(data) {\r\n user.name = data.name;\r\n user.email = data.email;\r\n user.position = data.position;\r\n deffered.resolve(user);\r\n }).error(function(err) {\r\n deffered.reject(err);\r\n });\r\n return deffered.promise;\r\n }", "static getProfile() {\n // Retrieves the profile data from localStorage\n const profile = localStorage.getItem('profile')\n return profile ? JSON.parse(localStorage.profile) : {}\n }", "function initUserProfile() {\n //get the last activity for the user logged in\n $.ajax({\n url: window.api + \"/api/\" + window.token + \"/Users/profile\",\n beforeSend: function (xhr) { xhr.setRequestHeader('Authentication', window.token); },\n success: function (profile) {\n RenderProfileDataUI(JSON.parse(profile));\n }\n });\n}", "loadProfile() {\n\t\tconst url = this.user.url;\n\t\treturn solid.fetch(url)\n\t\t\t.then(res => Promise.all([res.text(), res.headers.get('Content-Type')]))\n\t\t\t.then(([contents, contentType]) => loadProfile({ url, contents, contentType }))\n\t\t\t.then(profile => {\n\t\t\t\tObject.assign(this.user, profile);\n\t\t\t\tif (profile.accountName)\n\t\t\t\t\tthis.id = profile.accountName;\n\t\t\t\treturn profile;\n\t\t\t});\n\t}", "function getProfileData() {\n\tIN.API.Raw(\"/people/~:(email-address)\").result(onSuccess).error(onError);\n}", "getProfile() {\n\t\treturn decode(this.getToken());\n\t}", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"positions:(title)\", \"educations\", \"first-name\", \"last-name\", \"industry\", \"picture-url\", \"public-profile-url\", \"email-address\").result(displayProfileData).error(onError);\n }", "function loadProfile(){\n var request = gapi.client.plus.people.get( {'userId' : 'me'} );\n request.execute(loadProfileCallback);\n }", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"id\", \"first_name\", \"last_name\", \"num-connections\", \"email-address\", \"industry\", \"location\", \"picture-url\", \"public-profile-url\").result(onSuccess).error(onError);\n}", "function getInitialInformation(currentUser, success, err_call, userService, companyService, modelsService, $rootScope){\n console.log('..');\n userService.getUserInformation(currentUser,function(user){\n console.log('...');\n $rootScope.user = user;\n success();\n }, function(error){\n err_call(error);\n });\n }", "function initUserInfo () {\r\n\t \tvar storedUserInfo = localStorage.getItem('user'), currentUser = null;\r\n\t \tif (!!storedUserInfo) {\r\n\t \t\tcurrentUser = JSON.parse(storedUserInfo);\r\n\t \t}\r\n\t \treturn currentUser;\r\n\t }", "function getProfileData() {\n IN.API.Profile(\"me\").fields(\"firstName\", \"lastName\", \"id\").result(onSuccess).error(onError);\n}", "getProfile() {\n\t\treturn decode(this.getAccess());\n\t}", "function getProfileData() {\n IN.API.Raw(\"/people/~\").result(onSuccess).error(onError);\n}", "function processAuth() {\n\n // let the authProvider access the access token\n authToken = localStorage.token;\n\n if (localStorage.getItem('user') === null) {\n\n // Get the profile of the current user.\n GraphHelper.me().then(function (user) {\n\n // Save the user to localStorage.\n localStorage.setItem('user', angular.toJson(user));\n\n vm.displayName = user.displayName;\n vm.emailAddress = user.mail || user.userPrincipalName;\n });\n } else {\n let user = angular.fromJson(localStorage.user);\n\n vm.displayName = user.displayName;\n vm.emailAddress = user.mail || user.userPrincipalName;\n }\n\n }", "get ownerUserProfile() {\r\n return this.profileLoader.ownerUserProfile;\r\n }", "function authenticatedUser(accessToken, refreshToken, profile, done) {\n var user = users[profile.provider + \"-\" + profile.id];\n if (!user) {\n userService.findOrCreateUser(profile, function(dbUser) {\n user = dbUser;\n users[profile.provider + \"-\" + profile.id] = user;\n return done(null, user);\n });\n } else {\n return done(null, user);\n }\n }", "getProfile(success, failure) {\n let user = JSON.parse(localStorage.getItem(AppConstants.USER_FIREBASE_DETAILS));\n this.getCall(URI.GET_PROFILE + '/?email=' + user.email, success, failure, true);\n }", "function getUserName(authData) {\n switch (authData.provider) {\n // case 'password':\n // return authData.password.email.replace(/@.*/, '');\n case 'twitter':\n return authData.twitter.username;\n // case 'facebook':\n // return authData.facebook.displayName;\n }\n }", "get ownerUserProfile() {\r\n let q = this.getParent(ProfileLoader_1, this.parentUrl, \"_api/sp.userprofiles.profileloader.getowneruserprofile\");\r\n if (this.hasBatch) {\r\n q = q.inBatch(this.batch);\r\n }\r\n return q.postCore();\r\n }", "function getAuthInfo(){\n const token = localStorage.getItem('authToken');\n if (token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n const obj = JSON.parse(window.atob(base64));\n return obj.user; \n }\n}", "function getGitHubProfile() {\n return getGitHubResource('user');\n}", "function getActualUser() {\n $http.get('/user/data/' + $scope.profileUserId)\n .success(function(data) {\n console.log(data);\n $scope.profileUser = new User(data._id, data.firstName, data.lastName, data.username,\n data.password, data.gender, data.role, data.doctors);\n })\n .error(function(err) {\n console.log(err);\n });\n }", "getUserProfile(success, failure) {\n ApolloService.query({\n query: Queries.GET_USER_PROFILE\n }).then(data => { success(this.handleResponse(data.data.getUserProfile, \"user\")) }).catch(error => failure(error));\n }", "get profile() {\n const value = this.get(PROFILE_STORAGE_KEY);\n\n if (value) {\n const profile = new UserProfile();\n\n // Patch in the values\n Object.assign(profile, JSON.parse(value));\n\n return profile;\n }\n }", "getCurrentUser() {\n var data = JSON.parse(localStorage['cache_/campusm/sso/state']).data;\n\n // Actual username has a non-obvious key in local storage\n data.username = data.serviceUsername_363;\n\n return data;\n }", "function loadProfileCallback(obj) {\n profile = obj;\n\n // Filter the emails object to find the user's primary account, which might\n // not always be the first in the array. The filter() method supports IE9+.\n email = obj['emails'].filter(function(v) {\n return v.type === 'account'; // Filter out the primary email\n })[0].value; // get the email from the filtered results, should always be defined.\n displayProfile(profile);\n }", "function getProfileInfo() {\n\treturn TD.cache.twitterUsers.getByScreenName(TD.storage.accountController.getPreferredAccount(\"twitter\").state.username).results[0];\n}", "function populateProperties(data) {\r\n properties = {\r\n favourites: findPropertyInResults(PROFILE_FAVOURITES_KEY, data.d.UserProfileProperties.results),\r\n settings: findPropertyInResults(PROFILE_SETTINGS_KEY, data.d.UserProfileProperties.results),\r\n layout: findPropertyInResults(PROFILE_LAYOUT_KEY, data.d.UserProfileProperties.results),\r\n };\r\n\r\n // attempt to decompress the UTF16 encoding on the original string value to get the original value(this will through an error on purpose if the profile property does not exist)\r\n properties.favourites = decompressProfilePropertyValue(properties.favourites);\r\n properties.settings = decompressProfilePropertyValue(properties.settings);\r\n properties.layout = decompressProfilePropertyValue(properties.layout);\r\n\r\n return properties;\r\n}", "function getProfileInfo() {\n var GoogleUser = gapi.auth2.getAuthInstance().currentUser.get();\n var profile = GoogleUser.getBasicProfile();\n var id_token = GoogleUser.getAuthResponse().id_token;\n\n var xhr = new XMLHttpRequest();\n var email = profile.getEmail();\n var name = profile.getName();\n xhr.open('POST', '/public/verifyIdToken');\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n xhr.onload = function() {\n signInSuccess(name);\n }\n xhr.send('idtoken=' + id_token + '&email=' + email + '&name=' + name);\n}", "function retrieveProfileInfo() {\n return JSON.parse(sessionStorage.getItem(\"user\"));\n}", "function getUserProfile(user) {\n return {\n coords: [noise(user.longitude), noise(user.latitude)],\n name: user.name,\n location: user.city + ', ' + user.state,\n email: user.email,\n company: user.currentemployer,\n cohort: user.cohort\n };\n}", "function getCurrentUserProfile() {\r\n\t \treturn self._userProfile;\r\n\t }", "async function getProfileData(auth) {\n const service = google.people({version: 'v1', auth});\n const options = {\n resourceName: 'people/me',\n personFields: 'names,emailAddresses,photos'\n }\n return service.people.get(options);\n}", "function getUserProfile() {\n return $http.get('/api/user-profile').then(function (response) {\n return response.data;\n });\n }", "function getDetails() {\n var user = firebase.auth().currentUser\n if (user) {\n // User is signed in.\n if (user != null) {\n name = user.displayName\n email = user.email\n photoUrl = user.photoURL\n emailVerified = user.emailVerified\n uid = user.uid\n // The user's ID, unique to the Firebase project. Do NOT use\n // this value to authenticate with your backend server, if\n // you have one. Use User.getToken() instead.\n }\n } else {\n // No user is signed in.\n }\n}", "getProfile (cb) {\n let accessToken = this.getAccessToken()\n let self = this\n this.lock.getUserInfo(accessToken, (err, profile) => {\n if (profile) {\n self.userProfile = profile\n }\n cb(err, profile)\n })\n }", "function onProfileLoad() {\n const loginInfo = getLoginInfo();\n loginInfo.then(ifLoggedOutRedirectHome); \n loginInfo.then(getUserOrRedirectRegistration).then((person) => {\n autofillForm(person); \n });\n}", "function getUserProfile(context, reqBody, decoded, token, cb) {\n const options = {\n url:\n 'https://' +\n context.data.ACCOUNT_NAME +\n '.auth0.com/api/v2/users/' +\n decoded.sub,\n json: true,\n headers: {\n authorization: 'Bearer ' + token,\n },\n };\n\n request.get(options, function(error, response, user) {\n return cb(error, context, reqBody, user);\n });\n}", "function loadProfileCallback(obj) {\n profile = obj;\n window.profile = obj;\n // Filter the emails object to find the user's primary account, which might\n // not always be the first in the array. The filter() method supports IE9+.\n email = obj['emails'].filter(function(v) {\n return v.type === 'account'; // Filter out the primary email\n })[0].value; // get the email from the filtered results, should always be defined.\n var displayName = profile['displayName'];\n displayProfile(profile);\n //Create account in ubm db\n createUBMUser(email, displayName, profile);\n}", "static async loadCurUser() {\n\n var user_result = await APISocket.get(`user/me?populate=teams&extension=true`)\n\n // User is on one team: normalize values that are stored on the TeamUser object\n if (user_result.teams.length === 1) {\n\n // Properties defined on the TeamUser that need to be normalized back into actual user properties\n var team_user = await APISocket.get(`team/${user_result.teams[0].id}/users/${user_result.id}`)\n for (let [key, value] of Object.entries(team_user)) {\n user_result[key] = value;\n }\n\n }\n\n // Rename/remap fields\n user_result.extension_secret = (\" \" + user_result.extensionSecret).slice(1);\n delete user_result.extensionSecret;\n\n return user_result;\n\n }", "function getDataProfile() {\n loader(1);\n //alert(accessToken);\n\t\tvar term = null;\n\t\t$.ajax({\n\t\t\turl: 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=' + accessToken,\n\t\t\ttype: 'GET',\n\t\t\tdata: term,\n\t\t\tdataType: 'json',\n\t\t\terror: function(jqXHR, text_status, strError) {\n //alert(JSON.stringify(jqXHR));\n //alert(JSON.stringify(text_status));\n //alert(JSON.stringify(strError));\n disconnectUser();\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tvar item;\n\t\t\t\tconsole.log(JSON.stringify(data));\n\t\t\t\t//alert(JSON.stringify(data));\n\t\t\t\t// Save the userprofile data in your localStorage.\n\t\t\t\t/* localStorage.gmailLogin = \"true\";\n\t\t\t\tlocalStorage.gmailID = data.id;\n\t\t\t\tlocalStorage.gmailEmail = data.email;\n\t\t\t\tlocalStorage.gmailFirstName = data.given_name;\n\t\t\t\tlocalStorage.gmailLastName = data.family_name;\n\t\t\t\tlocalStorage.gmailProfilePicture = data.picture;\n\t\t\t\tlocalStorage.gmailGender = data.gender; */\n\t\t\t\tdisconnectUser();\n\t\t\t\tGoogleName = data.given_name+' '+data.family_name;\n\t\t\t\tGoogleEmail = data.email;\n\t\t\t\tGoogleId = data.id;\n\t\t\t\tImgUser = data.picture;\n\t\t\t\tSignInDirect('google');\n\t\t\t}\n\t\t});\n\t}", "getProfile() {\n return JSON.parse(localStorage.getItem(PROFILE_KEY));\n }", "function loadUserData() {\n firebaseFunctions.setCurrentUserData( ( user ) => {\n currentUser.innerText = user.name;\n currentUser.dataset.uid = user.id;\n currentUser.dataset.pubKey = user.chavePublica;\n } );\n}", "function getUserInfo() {\n\n // Get the people picker object from the page.\n var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;\n\n // Get information about all users.\n var users = peoplePicker.GetAllUserInfo();\n var userInfo = '';\n for (var i = 0; i < users.length; i++) {\n var user = users[i];\n for (var userProperty in user) {\n userInfo += userProperty + ': ' + user[userProperty] + '<br>';\n }\n }\n $('#resolvedUsers').html(userInfo);\n\n // Get user keys.\n var keys = peoplePicker.GetAllUserKeys();\n $('#userKeys').html(keys);\n\n // Get the first user's ID by using the login name.\n getUserId(users[0].Key);\n}", "function getDisplayName(authData) {\n switch (authData.provider) {\n case 'password':\n return authData.password.email.replace(/@.*/, '');\n case 'twitter':\n return authData.twitter.displayName;\n case 'facebook':\n return authData.facebook.displayName;\n }\n }", "tryLoadAuthData() {\n const userType = this.getUserTypeByName(this.localStorage.getItem('userType'));\n if (userType) {\n this.userType.next(userType);\n }\n this.getAuthDataFromStorage();\n if (this.activatedRoute) {\n this.getAuthDataFromParams();\n }\n // if (this.authData) {\n // this.validateToken();\n // }\n }", "function initializeUserData() {\n $.get(\"/api/user_data\").then(function(data) {\n console.log(\"User Data: \", data);\n var name = commonName;\n if (name) {\n generateName(data, name);\n } else {\n name = commonName;\n generateName(data, name);\n }\n });\n }", "function getProfile(auth, cb) {\n var gmailClass = google.gmail('v1');\n gmailClass.users.getProfile({\n auth: auth,\n userId: 'me'\n }, cb);\n}", "function loadMyProfile() {\n\t\tlet userId = sessionStorage.getItem('userId');\n\n\t\tauthorService.loadAuthorByUserId(userId)\n\t\t\t.then(author => {\n\t\t\t\tdisplayUpdateAuhtorForm(author);\n\n\t\t\t}).catch(handleError);\n\t}", "function setProfileFirstInitial(){\n\tvar nameList = [];\n\t\n\tvar theList=$('.chatList li .aHorizontal').each(function(){\n\t nameList.push($(this).html());\n\t}); \n\t\n\tvar theProfile=$('.profilePicList') \n\t \n\tfor(var i = 0; i < theProfile.length; i++){\n \t$(theProfile[i]).find(\".v-centered\").html(nameList[i].charAt(0));\n\t}\n}", "function getProfilePicUrl() {\n return getAuth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getLocalProfile(callback) {\n var profileImgSrc = localStorage.getItem(\"PROFILE_IMG_SRC\");\n var profileName = localStorage.getItem(\"PROFILE_NAME\");\n var profileReAuthEmail = localStorage.getItem(\"PROFILE_REAUTH_EMAIL\");\n\n if (profileName !== null &&\n profileReAuthEmail !== null &&\n profileImgSrc !== null) {\n callback(profileImgSrc, profileName, profileReAuthEmail);\n }\n}", "function onLinkedInAuth() {\n IN.API.Profile(\"me\").fields(\"id,firstName,lastName,emailAddress\").result(displayProfiles);\n }", "function githubProfile(){\n return $http({\n method: 'GET',\n url: '/github/user/',\n }).then(function(response) {\n console.log(response.data);\n user.data = response.data;\n });\n }", "function getCurrentUserMap() {\n // Mock - just pull the first user\n return _peopleCollection.first();\n }", "auth_user_data(state, user){\n state.auth_user = user\n }", "function loadProfile() {\n if(!supportsHTML5Storage()) { return false; }\n // we have to provide to the callback the basic\n // information to set the profile\n getLocalProfile(function(profileImgSrc, profileName, profileReAuthEmail) {\n //changes in the UI\n $(\"#profile-img\").attr(\"src\",profileImgSrc);\n $(\"#profile-name\").html(profileName);\n $(\"#reauth-email\").html(profileReAuthEmail);\n $(\"#inputEmail\").hide();\n $(\"#remember\").hide();\n });\n }", "static getProfile() {\n // console.log(\"getProfile()\");\n return store.get('CURRENT_PROFILE');\n }", "function fillAuthData() {\n var authData = localStorageService.get('authorizationData');\n if (authData) {\n authentication.isAuth = true;\n authentication.userName = authData.userName;\n authentication.roleId = authData.roleId;\n }\n }", "function getProfile(res, callback) {\n var data = querystring.stringify({\n 'schema' : 'openid',\n\t'access_token' : access_token\n });\n\n post(PROFILE_ENDPOINT, data, function(status, body) {\n callback(status, body);\n }); \n}", "function fetchUserInfo(){\n\t gapi.client.load('oauth2', 'v1', function(){\n\t var userinfo = gapi.client.request('oauth2/v1/userinfo?alt=json');\n\t userinfo.execute(function(resp){\n\t window.user={\n\t \t\"email\":resp.email,\n\t \t//\"name\":resp.given_name,\n\t \t//\"id\":resp.id\n\t }\n\t loadTimeline();\n\t });\n\t });\n\t }", "function gotProfile(accessToken, refreshToken, profile, done) {\n console.log(\"Google profile\", profile);\n // here is a good place to check if user is in DB,\n // and to store him in DB if not already there.\n const dbCheck =\n \"SELECT Google_id FROM user_data WHERE Google_id = \" + profile.id + \"\";\n console.log(\"cheking if user exist\");\n console.log(dbCheck);\n // to accces the user data user req.user. ...\n db.get(dbCheck, dataCallback);\n\n // Always use the callback for database operations and print out any\n // error messages you get.\n // This database stuff is hard to debug, give yourself a fighting chance.\n function dataCallback(err, dbData) {\n if (err) {\n console.log(\"data Selection error\", err);\n } else {\n console.log(\"data selection success\");\n\n if (dbData == undefined) {\n InsertNewUser(profile);\n }\n }\n }\n\n // Second arg to \"done\" will be passed into serializeUser,\n // should be key to get user out of database.\n // temporary! Should be the real unique\n // key for db Row for this user in DB table.\n // Note: cannot be zero, has to be something that evaluates to\n // True.\n let dbRowData = {\n id: profile.id,\n name: profile.name.givenName + \" \" + profile.name.familyName\n };\n done(null, dbRowData);\n}", "static renderUserProfile() {\n fetch(`${baseURL}/profile`, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${localStorage.getItem('jwt_token')}`\n }\n })\n .then(resp => resp.json())\n .then(user => {\n // console.log(user)\n // let newUser = new User(user.user)\n //User.currentUser(newUser)\n alert(`Welcome back ${user.user.name}!`)\n })\n }", "fetchProfile(context) {\n return new Promise((resolve, reject) => {\n service\n .getUser()\n .then(function(user) {\n if (user == null) {\n context.dispatch('signIn');\n context.commit('setProfile', null);\n return resolve(null);\n } else {\n context.commit('setProfile', user.profile);\n return resolve(user.profile);\n }\n })\n .catch(function(err) {\n context.commit('setError', err);\n return reject(err);\n });\n });\n }", "function buildUser( data, next ) {\n\tmaster.findOne( { data: 'user' }, function( findOneError, result ) {\n\t\tvar user = {}\n\t\t , field = undefined;\n\n\t\tif ( findOneError ) { \n\t\t\tnext( findOneError ); \n\t\t}\n\n\t\tfor ( var i = 0; i < result.fields.length; i++ ) {\n\t\t\tfield = result.fields[ i ];\n\t\t\tif( data[ field ] ) user[ field ] = data[ field ];\n\t\t}\n\n\t\tnext( null, user );\n\t} );\n}", "getCurrentProfile() {\n return this.currentProfile;\n }", "authDataCallback(authData) {\n if (authData) {\n console.log(\"User \" + authData.uid + \" is logged in with \" + authData.provider);\n this.presentLogin();\n \n } else {\n console.log(\"User is logged out\");\n this.presentLogin();\n }\n }", "function loadProfile() {\n if (!supportsHTML5Storage()) { return false; }\n // we have to provide to the callback the basic\n // information to set the profile\n getLocalProfile(function(profileImgSrc, profileName, profileReAuthEmail) {\n //changes in the UI\n $(\"#profile-img\").attr(\"src\", profileImgSrc);\n $(\"#profile-name\").html(profileName);\n $(\"#reauth-email\").html(profileReAuthEmail);\n $(\"#inputEmail\").hide();\n $(\"#remember\").hide();\n });\n}", "function loadAuthData() {\n // Skip if the local storage is not available.\n if (!utils.storageAvailable('localStorage')) {\n return;\n }\n\n // Load the data from the local storage.\n var data = localStorage[authDataID];\n if (!data) {\n return;\n }\n\n // Try to parse the JSON.\n try {\n data = JSON.parse(data);\n }\n catch(e) {\n console.log(\"failed to decode saved auth data JSON: \" + e);\n return;\n }\n\n // Set the values if present.\n if (data.authUserID) {\n authUserID = data.authUserID;\n }\n }", "function pullMyProfile() {\n $http({\n method: 'GET',\n url: apiBaseUrl+\"/user/profile\",\n timeout: TIMEOUT_LIMIT\n }).then(function successCallback(response) {\n // this callback will be called asynchronously\n // when the response is available\n $scope.isLogin = true;\n angular.element('#signinModal').modal('hide');\n $scope.myProfile = response.data;\n\n console.log('myProfile udpated !!!');\n // console.log($scope.profile);\n }, function errorCallback(response) {\n angular.element('#signinModal')\n .modal({\n closable: false,\n })\n .modal('show');\n // called asynchronously if an error occurs\n // or server returns response with an error status.\n\n console.log(\"Fail to retrive current user profile, redirecting to login page\");\n });\n }", "GetProfile() {\n return this.m_profile;\n }", "function authDataCallback(authData) {\n if (authData) {\n console.log(\"User \" + authData.uid + \" is logged in with \" + authData.provider);\n console.log(authData.auth.token.email);\n $scope.user.savedEmail = authData.auth.token.email;\n $scope.user.loggedIn = true;\n $scope.user.message = 'You are logged in as '+$scope.user.savedEmail;\n } else {\n console.log(\"User is logged out\");\n $scope.user.loggedIn = false;\n $scope.user.message = 'You are not logged in';\n }\n }", "function getMainUser() {\n\t \t\tvar deferred = $q.defer();\n\t \t\tdeferred.resolve(jboneData);\n\t \t\treturn deferred.promise;\n\t \t}", "function getName(authData) {\n \t\tswitch(authData.provider) {\n \t\t\tcase 'password':\n \t\t\treturn authData.password.email.replace(/@.*/, '');\n \t\t\tcase 'twitter':\n \t\t\treturn authData.twitter.displayName;\n \t\t\tcase 'facebook':\n \t\t\treturn authData.facebook.displayName;\n \t\t}\n \t}", "getProfile() {\n return this._profile;\n }", "function getCurrentUser() {\n authService.getCurrentUser()\n .then(function (data) {\n scope.userName = data.FullName;\n });\n }", "verifyCredentials(accessToken, refreshToken, profile) {\n profile.id = profile.username;\n return Promise.resolve(profile);\n }", "function onLinkedInLoad() {\n IN.Event.on(IN, \"auth\", getProfileData);\n}", "function profile(authToken, apiUrl){\n\tconst array = createPopup(\"profile\", \"My Profile\");\n\tconst div = array[0];\n\tlet content = array[1];\n\tconst param = {\n\t\t method: 'GET',\n\t\t headers:{\n\t\t\t\t 'Authorization': `Token ${authToken}`,\n\t\t\t\t 'Content-Type': 'application/json',\n\t\t\t }\n\t\t }\n\tfetch(apiUrl + \"/user/\", param)//defaults to logged in if id not supplied\n\t.then(function(response) {\n \t\tif (!response.ok) throw Error(response.statusText);\n\t\treturn response.json();\n\t})\n\t.then(function(responseAsJson){\n\t\tconsole.log(responseAsJson);\n\t\t//create info on pop up\n\t\tcontent = profileContent(div, content, responseAsJson, apiUrl, authToken);\n\t})\n\t.catch(function(error){\n\t\tconsole.log('Looks like there was a problem: \\n', error);\n\t});\n\tconsole.log(div);\n\treturn div;\n}", "function loadMyProfile() {\n\t\t$scope.myProfile = JSON.parse(localStorage.getItem('ynan-profile'));\n\t}", "getUserName() {\n const claims = this.oauthService.getIdentityClaims();\n if (!claims) {\n return null;\n }\n return claims['name'];\n }", "getData() {\n const key = `${this.props.walletProxy}-profile-data`\n const data = localStore.get(key)\n\n if (hasDataExpired(data)) {\n // Clearing out old data\n localStore.set(key, undefined)\n\n const profile = pick(this.state, [\n 'firstName',\n 'lastName',\n 'description',\n 'avatarUrl'\n ])\n\n const attestations = (this.state.verifiedAttestations || []).map(\n attestation => attestation.rawData\n )\n\n return {\n profile,\n attestations\n }\n }\n\n return pick(data, ['attestations', 'profile'])\n }", "function onLinkedInLoad() {\n IN.Event.on(IN, \"auth\", getProfileData);\n}", "function getDefaultUser(api) {\n if (DefaultUser) {\n return Promise.resolve(DefaultUser);\n }\n return api.mavenlink\n .get('/api/v1/users/me.json')\n .then(data => data.users[Object.keys(data.users)[0]])\n .then(user => DefaultUser = user);\n}", "function getUserData(){\n if(self.user !== null){\n return $q.when(self.user);\n }else{\n return $http.get('/api/auth/me')\n .then(function (result) {\n self.user = result.data;\n return $q.when(self.user);\n })\n .catch(function(error){\n return $q.reject('Unable to get remote user data. '+error.data);\n });\n }\n }", "function loadProfile(id) {\n API.getDj(id)\n .then((res) => setUserId(res.data[0]._id))\n .catch((err) => console.log(err));\n }", "function extractProfileInfo(body, accessToken) {\r\n return new Promise(function(resolve, reject) {\r\n parseXML(body, function(err, obj) {\r\n if(err) {\r\n return reject(\"parse: \" + err);\r\n } else {\r\n try {\r\n var guid = obj.UserVO.userID[0];\r\n var userName = obj.UserVO.userBaseVO[0].userName[0];\r\n var nameInfo = obj.UserVO.userBaseVO[0].userBaseIndividualVO[0];\r\n var email = \"\";\r\n obj.UserVO.userIdentificationVO.forEach(function(x) {\r\n if(x.loginIDTypeCode[0] === \"003\") {\r\n email = x.loginID[0];\r\n }\r\n });\r\n var lname = (nameInfo ? nameInfo.familyName[0] : \" \");\r\n var fname = (nameInfo ? nameInfo.givenName[0] : \" \");\r\n var profileImg = \"\";\r\n if (obj.UserVO.userBaseVO[0].photographImageFileURLText) {\r\n profileImg = obj.UserVO.userBaseVO[0].photographImageFileURLText[0];\r\n }\r\n \r\n var profileJSON = {\r\n \"guid\": guid,\r\n \"name\": userName,\r\n \"email\": email,\r\n \"token\": accessToken,\r\n \"lastName\": (lname || \" \"),\r\n \"firstName\": (fname || \" \"),\r\n \"profileImg\": profileImg\r\n };\r\n genAccessToken(res, {user: profileJSON.guid, email: profileJSON.email, \r\n firstName: profileJSON.firstName, username: profileJSON.name});\r\n res.redirect(process.env.REDIRECT);\r\n //res.status(301).redirect('http://localhost:3000');\r\n return resolve(profileJSON);\r\n } catch(ex) {\r\n return reject(\"parse: \" + ex);\r\n }\r\n } \r\n });\r\n });\r\n }", "getCurrentUserInfo () {\n return Auth.currentUserInfo()\n .then(user => user)\n .catch(err => err)\n }", "function getCurrentUserInfo() {\n var name, email, photoUrl, uid, emailVerified;\n return new Promise(function(resolve, reject) {\n firebase.auth().onAuthStateChanged(function(user) {\n if (user) {\n // User is signed in.\n name = user.displayName;\n email = user.email;\n photoUrl = user.photoURL;\n emailVerified = user.emailVerified;\n uid = user.uid; // The user's ID, unique to the Firebase project. Do NOT use\n // this value to authenticate with your backend server, if\n // you have one. Use User.getToken() instead.\n resolve(email);\n } else {\n // No user is signed in.\n //redirect to the main user page!\n console.log(\"No one is logged in!\");\n reject(\"Failed to get user information!\");\n }\n }); \n });\n }", "onSuccess() {\n let basicProfile = window.gapi.auth2\n .getAuthInstance()\n .currentUser.get()\n .getBasicProfile();\n localStorage.setItem(\"authoritySignedIn\", true);\n this.setState(\n {\n isSignedIn: true,\n err: null,\n authorityId: basicProfile.getId(),\n profileName: basicProfile.getName(),\n profileEmail: basicProfile.getEmail(),\n profilePhotoURL: basicProfile.getImageUrl()\n },\n () => {\n this.validateAndPostProfileData(basicProfile);\n }\n );\n }" ]
[ "0.7119658", "0.6738343", "0.66323805", "0.6538854", "0.65366083", "0.6403593", "0.6363583", "0.6363583", "0.63276255", "0.6311589", "0.62563896", "0.62213933", "0.6190144", "0.6171722", "0.6138962", "0.61311245", "0.61270314", "0.61220217", "0.6119551", "0.6092727", "0.60694075", "0.6050296", "0.60228646", "0.59967166", "0.5984983", "0.59670246", "0.5949945", "0.59487724", "0.59406525", "0.59046173", "0.59003127", "0.5830148", "0.58177227", "0.5815217", "0.5806875", "0.58047396", "0.5799915", "0.5785299", "0.5779524", "0.57722104", "0.5720003", "0.5698402", "0.56720936", "0.56521004", "0.5648224", "0.56362295", "0.5633641", "0.56328493", "0.5620976", "0.55983484", "0.55980426", "0.5596746", "0.5592401", "0.55921465", "0.5591665", "0.558998", "0.55821395", "0.55796725", "0.5579308", "0.5576978", "0.5555124", "0.55541766", "0.5552552", "0.5545235", "0.5545185", "0.55296975", "0.5528546", "0.5514007", "0.5512728", "0.55100316", "0.55092776", "0.55087346", "0.5499966", "0.5499575", "0.54994303", "0.5498309", "0.5492931", "0.5492851", "0.54922223", "0.5491189", "0.5485442", "0.54749364", "0.5471536", "0.54609907", "0.5458554", "0.5456293", "0.5455371", "0.54522264", "0.54502296", "0.54451907", "0.5442776", "0.544059", "0.5429649", "0.54281026", "0.5419712", "0.5418347", "0.5417124", "0.5417111", "0.5413585", "0.5412199" ]
0.72407746
0
Add an achievement to the user's profile
function addAchievement( profile, achievement ) { if (!profile.expose.achievements) profile.expose.achievements = []; profile.expose.achievements.push( achievement ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function NewAchievement( appid, achievement )\n{\n\tvar parentDiv = document.getElementById( \"appAchievementDisplay\" );\n\tvar sourceDiv = document.getElementById( \"achievementTableSource\" );\n\ttheTable = parentDiv.firstChild;\n\n\tvar newRow = theTable.tBodies[ 0 ].insertRow( -1 );\n\tnewRow.vAlign = \"top\";\n\n\tnewRow.id = \"a\" + achievement[ \"stat_id\" ] + \"_\" + achievement[ \"bit_id\" ];\n\n\tSetAchievement( appid, newRow, achievement );\n}", "function addAchievement(cheevName, cheevDesc, cheevThumb) {\n\tvar hasCheev = false;\n\t// // make sure cheevo isn't in the db\n\tfor (var i = 0; i < CheevoNames.length; i++) {\n\t\tvar tcheev = CheevoNames[i].name;\n\t\tif (tcheev == cheevName) {\n\t\t\thasCheev = true;\n\t\t}\n\t}\n\tif (!hasCheev) {\n\t\tconsole.log(\"adding achievement: \" + cheevName);\n\t\tvar newCheev = {\n\t\t\t\"name\" : cheevName,\n\t\t\t\"thumb\" : cheevThumb,\n\t\t\t\"description\" : cheevDesc\n\t\t};\n\n\t\t// / add to game stats for the particular game\n\n\t\t// / add to cheevo list\n\t\tCheevoNames.push(newCheev);\n\t\tsavePlayerData();\n\t} else {\n\n\t\tconsole.log(\"already has achievement\");\n\t}\n}", "function achievement(name,min_fame,flavor_text)\r\n{\r\n\tthis.name = name;\r\n\tthis.min_fame = min_fame;\r\n\tthis.flavor_text = flavor_text;\r\n\tthis.done = false;\r\n}", "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 }", "function addKeyAchievement()\n {\n $scope.inserted = {\n id: $scope.currentReport.CurrentDetail.KeyAchievements.length + 1,\n KeyAchievementID: 0,\n WeekNo: $scope.selectedWeekFilter.WeekNo,\n Description: '',\n PercentComplete: 0.00\n };\n\n $scope.currentReport.CurrentDetail.KeyAchievements.push($scope.inserted);\n }", "function ReplaceAchievement( appid, achievement )\n{\n\tvar achievementRow = document.getElementById( \"a\" + achievement[ \"stat_id\" ] + \"_\" + achievement[ \"bit_id\" ] );\n\tReplaceWorker( appid, achievement, achievementRow, SetAchievement );\n}", "function Achievement(name, text1, text2, reqName, reqNum, changeName, changeString) {\n\tthis.name = name;\t\t\t\t\t// name of achievement\n\tthis.text1 = text1;\t\t\t\t\t// top text\n\tthis.text2 = text2;\t\t\t\t\t// bottom text\n\tthis.reqName = reqName; \t\t\t// name of required variable\n\tthis.reqNum = reqNum; \t\t\t\t// number of required variable\n\tthis.changeName = changeName;\t\t// name of changed variable\n\tthis.changeString = changeString; \t// how to change the variable\n}", "function SetAchievements( appid, achievements )\n{\n\tSetItemsWorker( appid,\n\t\t\t\tachievements,\n\t\t\t\t\"appAchievementDisplay\",\n\t\t\t\t\"achievementTableSource\",\n\t\t\t\t\"achievementTable\",\n\t\t\t\tfunction( theItem ) { return \"a\" + theItem[ \"stat_id\" ] + \"_\" + theItem[ \"bit_id\" ]; },\n\t\t\t\tSetAchievement\n\t\t\t\t);\n}", "updateProfile() {}", "function makeAchievementList() {\n\n}", "function SetAchievement( appid, destRow, achievement )\n{\n\tvar row = $J( destRow );\n\n\tvar nameCell = $J( '<td>' );\n\tnameCell.text( achievement[ \"api_name\" ] );\n\tnameCell.append( $J( '<br>' ) );\n\n\t// Add the achievement progress stat line\n\tif ( typeof achievement[ 'progress' ] === 'object' )\n\t{\n\t\t// currently only support direct stat value mapping\n\t\tvar progressSpan = $J( '<span>' );\n\t\tprogressSpan.text( achievement.progress.value.operand1 + ' (' + achievement.progress.min_val + '-' + achievement.progress.max_val + ')' );\n\n\t\tnameCell.append( progressSpan );\n\t\tnameCell.append( $J( '<br>' ) );\n\t}\n\trow.append( nameCell );\n\n\t// TODO need to do the below shenanigans for the display name as well.\n\t// obviously some kind of helper would be handy here. maybe it could just\n\t// return the span DOM object instead of going through the parser.\n\tvar descCell = $J( '<td>' );\n\n\tvar rgLanguageDisplay = g_rgLanguages;\n\n\tvar bPrefix = false;\n\tvar languages;\n\tif ( g_language == \"all\" )\n\t{\n\t\tlanguages = g_rgEditingLanguages;\n\t\tbPrefix = true;\n\t}\n\telse\n\t{\n\t\tlanguages = {};\n\t\tlanguages[ g_language ] = 1;\n\t}\n\n\tfor ( language in languages )\n\t{\n\t\tif ( bPrefix )\n\t\t{\n\t\t\tvar prefixSpan = $J( '<span>' );\n\t\t\tprefixSpan.text( \"[\" + rgLanguageDisplay[ language ] + \"] \" );\n\t\t\tdescCell.append( prefixSpan );\n\t\t}\n\t\tdescCell.append( AchievementSpan( achievement, \"display_name\", achievement.api_name + '_NAME', language ) );\n\t\tdescCell.append( $J( '<br>' ) );\n\t}\n\n\t// TODO Commonify description and display name\n\tfor ( language in languages )\n\t{\n\t\tif ( bPrefix )\n\t\t{\n\t\t\tvar prefixSpan = $J( '<span>' ).text( \"[\" + rgLanguageDisplay[ language ] + \"] \" );\n\t\t\tdescCell.append( prefixSpan );\n\t\t}\n\t\tdescCell.append( AchievementSpan( achievement, \"description\", achievement.api_name + '_DESC', language ) );\n\t\tdescCell.append( $J( '<br>' ) );\n\t}\n\trow.append( descCell );\n\n\tswitch ( achievement[ \"permission\" ] )\n\t{\n\tcase \"1\": addCell( row, \"GS\" ); break;\n\tcase \"2\": addCell( row, \"Official GS\" ); break;\n\n\tcase \"0\":\n\tdefault:\n\t\taddCell( row, \"Client\" );\n\t}\n\n\taddCell( row, ( achievement[ \"hidden\" ] != 0 ) ? \"Yes\" : \"\" );\n\n\t// TODO jqueryize the rest here\n\tvar newImg = document.createElement( \"img\" );\n\tnewImg.src = achievement[ \"icon\" ];\n\tnewImg.height = 64;\n\tnewImg.width = 64;\n\taddCell( row, \"\" ).append( newImg );\n\n\tnewImg = document.createElement( \"img\" );\n\tnewImg.src = achievement[ \"icon_gray\" ];\n\tnewImg.height = 64;\n\tnewImg.width = 64;\n\taddCell( row, \"\" ).append( newImg );\n\n\tvar btnCell = destRow.insertCell( -1 );\n\n\tvar btn = document.createElement( \"input\" );\n\tbtn.type= \"submit\";\n \tbtn.onclick = EditAchievementClosure( appid, achievement[ \"stat_id\" ], achievement[ \"bit_id\" ] );\n\tbtn.value = \"Edit\";\n\tbtnCell.appendChild( btn );\n\n\tbtnCell.appendChild( document.createElement( \"br\" ) );\n\n\tvar btn2 = document.createElement( \"input\" );\n\tbtn2.type = \"submit\";\n \tbtn2.onclick = DeleteAchievementClosure( appid, achievement[ \"stat_id\" ], achievement[ \"bit_id\" ], achievement[ \"api_name\" ] );\n\tbtn2.value = \"Delete\";\n\tbtnCell.appendChild( btn2 );\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 }", "AppendGrade(gradeObject) {\n //if this assignment was extra credit just make the grade to be 100\n if (this.totalPts == 0) {\n this.grades[gradeObject.user_name] = 100.0;\n } else {\n var roundedGrade = parseFloat(\n ((gradeObject.current_grade / this.totalPts) * 100).toFixed(1)\n );\n\n //if this assignment contained extraCredit make the flag true\n if (roundedGrade > 100) {\n this.extraCredit = true;\n }\n\n this.grades[gradeObject.user_name] = roundedGrade;\n }\n }", "async function handleAddProfile(newProfileData) {\n const newProfile = await profileService.create(newProfileData);\n console.log(newProfile)\n history.push(\"/\");\n }", "function insertAchievements(data)\n{\n\tvar achievements=\"\";\n\n\tachievements+='<div class=\"row achievement\" id=\"'+data.achievementId+'\">';\n\n\t\tachievements+='<div class=\"row\">';\n\n\t\t\tachievements+='<div class=\"col-md-6 text-left\">';\n\n\t\t\t\tachievements+='<div style=\"font-size:18px;color:#008322;\"><i class=\"fa fa-trophy\"></i>&nbsp;<span id=\"eventName\">'+data.competition+'</span></div>';\n\n\t\t\tachievements+='</div><!-- end class col-md-6 -->';\n\n\t\t\tif(data.isOwner==1)\n\t\t\t{\n\t\t\t\tachievements+='<div class=\"col-md-3 visibleForUser text-right col-md-offset-3\">';\n\n\t\t\t\t\tachievements+='<div style=\"font-size:14px;\"><i class=\"showOnHover fa fa-pencil\" onclick=\"editAchievement(\\''+data.achievementId+'\\');\"></i>&nbsp;<i class=\"showOnHover fa fa-trash\" onclick=\"deleteAchievement(\\''+data.achievementId+'\\');\"></i></div>';\n\n\t\t\t\tachievements+='</div><!-- end classc col-md-3 -->';\n\t\t\t}\n\n\t\t\t\n\n\t\tachievements+='</div><!-- end class row -->';\n\n\t\tachievements+='<br/>';\n\n\t\tachievements+='<div class=\"row\">';\n\n\t\t\tachievements+='<div class=\"col-md-6 text-left\">';\n\n\t\t\t\tachievements+='<div style=\"font-size:15px;\"><i class=\"fa fa-map-marker\"></i>&nbsp;<span id=\"eventLocation\">'+data.location+'</span></div>';\n\n\t\t\tachievements+='</div><!-- end class col-md-6 -->';\n\n\t\t\tachievements+='<div class=\"col-md-4 text-right col-md-offset-2\">';\n\n\t\t\t\tachievements+='<div style=\"font-size:15px;\" id=\"eventPosition\">'+data.position+'</div>';\n\n\t\t\tachievements+='</div><!-- end classc col-md-3 -->';\n\n\t\tachievements+='</div><!-- end class row -->';\n\n\t\tachievements+='<br/>';\n\n\t\tachievements+='<div class=\"row\">';\n\n\t\t\tachievements+='<div class=\"col-md-12 text-left\">';\n\n\t\t\t\tachievements+='<div style=\"font-size:14px;\" id=\"eventDescription\">'+data.description+'</div>';\n\n\t\t\tachievements+='</div>';\n\n\t\tachievements+='</div>';\n\n\tachievements+='</div><!-- end class achievement -->';\n\n\tvar length=$(\"#achievements\").find('.achievement').length;\n\n\tvar position=length%2+1;\n\n\t$('#achievements').find('#achievementContainer'+position).append(achievements);\n\n\tupdateNumber('.achievement',$(\"#achievements\").find('#achievementsNumber'));\n\n\t$(\"#noachievements\").remove();\n}", "function addProfileCompletionPointsToUser(school_identifier, user_id) {\n databaseref.child('schools/' + school_identifier + '/users/' + user_id).once('value').then(snapshot => {\n const user = snapshot.val();\n if (!user) return;\n if (!user.first_name) return;\n if (!user.last_name) return;\n if (!user.email) return;\n if (!user.profile_image_url) return;\n if (!user.major) return;\n if (!user.hometown) return;\n if (!user.graduation_year) return;\n if (!user.academic_level) return;\n if (!user.description) return;\n if (!user.goal1) return;\n if (!user.goal2) return;\n if (!user.goal3) return;\n if (!user.wanna_meet) return;\n if (!user.reason_school) return;\n if (!user.signature_emoji) return;\n if (!Object.keys(user.interests).length) return;\n\n addPointsToUser('ProfileCompleted', school_identifier, user_id, 10, 'User completed profile');\n });\n}", "function addNewProfile () {\n if (profileToAdd.direction === GAME_DIRECTION.LTR) {\n profileToAdd.x = - profileToAdd.width;\n }\n else {\n profileToAdd.x = this._width + profileToAdd.width;\n }\n\n profileToAdd.y = Math.round(Math.random() * this._height * 0.8);\n this._profiles.push(profileToAdd);\n }", "function insertUser() {\n var profiledata;\n var email = document.getElementById('email'); //Email Input Field\n var id = document.getElementById('account-id'); //Account ID input Field\n\n if( email.value == '' || id.value == '' ){\n alert('Please fill out the field!!');\n return;\n }\n else {\n var request = gapi.client.analytics.management.webproperties.list({\n 'accountId': id.value\n })\n \n request.execute(function (response) {\n\n if(response.code == 400 || response.code == 403 || response.code == 500){\n alert('Invalid');\n return;\n \n } \n else {\n profiledata = response;\n if (profiledata.result.items && profiledata.result.items.length) {\n\n var propertyId = profiledata.result.items[0].id;\n var accountId = id.value;\n var profileId = profiledata.result.items[0].defaultProfileId;\n \n var request = gapi.client.analytics.management.profileUserLinks.insert({\n 'accountId': accountId,\n 'webPropertyId': propertyId,\n 'profileId': profileId,\n 'resource': {\n 'permissions': {\n 'effective': [\n 'COLLABORATE',\n 'READ_AND_ANALYZE'\n ],\n 'local': [\n 'COLLABORATE',\n 'READ_AND_ANALYZE'\n ]\n },\n 'userRef': {\n 'email': email.value\n }\n }\n });\n\n request.execute(function (response) { \n if(response.code == 400 || response.code == 403 || response.code == 500){\n console.log(response);\n alert('Invalid');\n return;\n\n }\n else {\n alert('User has been added succesfully');\n console.log(response);\n return;\n\n }\n });\n }\n }\n });\n }\n}", "function addProfile(profile) {\r\n let store = browser.storage.local.get({\r\n profiles: []\r\n });\r\n store.then(function(results) {\r\n var profiles = results.profiles;\r\n profiles.push(profile);\r\n let store = browser.storage.local.set({\r\n profiles\r\n });\r\n store.then(null, onError);\r\n displayProfiles();\r\n });\r\n}", "function createAchivementsUser(req, res, next) {\n if (validate(req, res)) {\n req.body.achievement_id = parseInt(req.body.achievement_id);\n db.none('insert into achievements_x_user(user_mail, achievement_id)' +\n 'values(${mail},${achievement_id})',\n req.body)\n .then(function() {\n res.status(200)\n .json({\n status: 'success',\n message: 'Inserted one Achivement per User'\n });\n })\n .catch(function(err) {\n res.status(500)\n .json({\n status: 'error',\n err: err\n });\n });\n }\n}", "function SetAchievementsDiv( appid, achievements )\n{\n\tvar parentDiv = $('appAchievementDisplay');\n\tvar theItem;\n\tvar index;\n\tvar items = achievements;\n\tvar elt;\n\tvar eltSub;\n\tvar eltRow;\n\tvar text;\n\tvar newImg;\n\n\tparentDiv.update('');\n\n\t// crack parameter and iterate achievements/stats\n\tfor ( index = 0; index < items.length; index++ )\n\t{\n\t\ttheItem = items[ index ];\n\n\t\t// make a new container \"row\" div for the whole item\n\t\teltRow = new Element( 'div' );\n\t\tparentDiv.insert( eltRow );\n\n\t\tvar achievement = theItem;\n\n\t\t// achievement specific:\n\t\t// jam a bunch of floated-left divs in there to hold the item's fields\n\t\telt = new Element( 'div', { 'style' : 'float: left; width: 6em' } );\n\t\telt.update( achievement[ \"stat_id\" ] + \"/\" + achievement[ \"bit_id\" ] );\n\t\teltRow.insert( elt );\n\n\t\telt = new Element( 'div', { 'style' : 'float: left; width: 24em' } );\n\t\telt.update( achievement[ 'api_name' ] );\n\t\telt.insert( new Element( 'br' ) );\n\t\t// Add the achievement progress stat line\n\t\tif ( typeof achievement[ 'progress' ] === 'object' )\n\t\t{\n\t\t\t// currently only support direct stat value mapping\n\t\t\tprogressSpan = new Element( 'span' );\n\t\t\tprogressSpan.innerHTML = achievement.progress.value.operand1 + ' (' + achievement.progress.min_val + '-' + achievement.progress.max_val + ')';\n\n\t\t\telt.insert( progressSpan );\n\t\t}\n\t\teltRow.insert( elt );\n\n\n\t\telt = new Element( 'div', { 'style' : 'float: left; width: 36em' } );\n\t\tvar rgLanguageDisplay = g_rgLanguages;\n\t\tvar bPrefix = false;\n\t\tvar languages;\n\t\tif ( g_language == \"all\" )\n\t\t{\n\t\t\tlanguages = g_rgEditingLanguages;\n\t\t\tbPrefix = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlanguages = {};\n\t\t\tlanguages[ g_language ] = 1;\n\t\t}\n\n\t\tfor ( language in languages )\n\t\t{\n\t\t\teltSub = AchievementSpan( achievement, \"display_name\", achievement.api_name + '_NAME', language );\n\t\t\tif ( bPrefix )\n\t\t\t{\n\t\t\t\teltSub.insert( { 'top' : new Element( 'span' ).update( \"[\" + rgLanguageDisplay[ language ] + \"] \") } );\n\t\t\t}\n\t\t\telt.insert( eltSub );\n\t\t}\n\n\t\t// TODO Commonify description and display name\n\t\tfor ( language in languages )\n\t\t{\n\t\t\teltSub = AchievementSpan( achievement, \"description\", achievement.api_name + '_DESC', language );\n\t\t\tif ( bPrefix )\n\t\t\t{\n\t\t\t\teltSub.insert( { 'top' : new Element( 'span' ).update( \"[\" + rgLanguageDisplay[ language ] + \"] \") } );\n\t\t\t}\n\t\t\telt.insert( eltSub );\n\t\t}\n\t\teltRow.insert( elt );\n\n\t\telt = new Element( 'div', { 'style': 'float: left; width: 5em' } );\n\t\tswitch ( achievement[ \"permission\" ] )\n\t\t{\n\t\tcase \"1\": elt.update( \"GS\" ); break;\n\t\tcase \"2\": elt.update( \"Official GS\" ); break;\n\n\t\tcase \"0\":\n\t\tdefault:\n\t\t\telt.update( \"Client\" );\n\t\t}\n\t\teltRow.insert( elt );\n\n\t\t// give this element a minimum height, since it is often empty of content and\n\t\t// would snap to zero height\n\t\telt = new Element( 'div', { 'style': 'float: left; width: 4em; height: 1em' } );\n\t\tif ( achievement[ \"hidden\" ] != 0 )\n\t\t{\n\t\t\telt.update( \"<b>\"+\"Yes\"+\"</b>\" );\n\t\t}\n\t\teltRow.insert( elt );\n\n\t\tnewImg = new Element( 'img', { 'style': 'float: left' } );\n\t\tnewImg.src = achievement[ \"icon\" ];\n\t\tnewImg.height = 64;\n\t\tnewImg.width = 64;\n\t\teltRow.insert( newImg );\n\n\t\tnewImg = new Element( 'img' );\n\t\tnewImg.src = achievement[ \"icon_gray\" ];\n\t\tnewImg.height = 64;\n\t\tnewImg.width = 64;\n\t\teltRow.insert( newImg );\n//\t\tvar btnCell = destRow.insertCell( -1 );\n//\n//\t\tvar btn = document.createElement( \"input\" );\n//\t\tbtn.type= \"submit\";\n//\t \tbtn.onclick = EditAchievementClosure( appid, achievement[ \"stat_id\" ], achievement[ \"bit_id\" ] );\n//\t\tbtn.value = \"Edit\";\n//\t\tbtnCell.appendChild( btn );\n//\n//\t\tbtnCell.appendChild( document.createElement( \"br\" ) );\n//\n//\t\tvar btn2 = document.createElement( \"input\" );\n//\t\tbtn2.type = \"submit\";\n//\t \tbtn2.onclick = DeleteAchievementClosure( appid, achievement[ \"stat_id\" ], achievement[ \"bit_id\" ] );\n//\t\tbtn2.value = \"Delete\";\n//\t\tbtnCell.appendChild( btn2 );\n//\n\t\t// all done with this row\n\t\teltRow.insert( new Element( 'div', { 'style' : 'clear: both' } ) );\n\t}\n}", "function addUserBonus() {\n\tincreaseDailyLimit();\n\tupdateAnnotationStats();\n\tvar form = new FormData();\n\tform.append(\"user_id\", user_id);\n\tform.append(\"daily_limit_counter\", getDailyLimit());\n\tform.append(\"task\", 4);\n\tvar xhttp = new XMLHttpRequest();\n\txhttp.onreadystatechange = function () {\n\t\tif (this.readyState == 4 && this.status == 200) {\n\t\t\tvar response = this.responseText;\n\t\t\tif (response != \"!010\") {\n\t\t\t\tvar obj = JSON.parse(response);\n\t\t\t\tpercent = 1.0 - getDailyLimit() / MAX_DAILY_LIMIT;\n\t\t\t\tif (obj.bonus != 0) {\n\t\t\t\t\tanimateUserBonus(parseInt(obj.new_place), parseInt(obj.new_points), parseInt(obj.bonus));\n\t\t\t\t} else {\n\t\t\t\t\thideStats();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thideStats();\n\t\t\t}\n\t\t}\n\t};\n\txhttp.open(\"POST\", \"match.php\", true);\n\txhttp.send(form);\n}", "function updateAchivementsUser(req, res, next) {\n if (validate(req, res)) {\n db.none('update achievements_x_user set achievement_id=$1 where user_mail=$2', [parseInt(req.body.achievement_id), req.params.mail])\n .then(function() {\n res.status(200)\n .json({\n status: 'success',\n message: 'Updated Achievement per User'\n });\n })\n .catch(function(err) {\n res.status(500)\n .json({\n status: 'error',\n err: err\n });\n });\n }\n}", "function updateProfile(user) {\n return baseUser().customPUT(user);\n }", "addHealthcareProfessional(userId) {\n // To do\n }", "achievementsOnScoreUpdate(username, leaderboard, oldScore, newScore){\n\t\tlet triviaRoom = RoomManager.getRoom(this.room);\n\t\tlet callback = (err, username, achievement)=>{\n\t\t\tif(err){\n\t\t\t\terror(err);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(triviaRoom) triviaRoom.send(`${username} has earned the achievement '${achievement}'!`);\n\t\t}\n\t\tif(leaderboard === 'main'){\n\t\t\tif(oldScore < 250 && newScore >= 250){\n\t\t\t\tthis.awardAchievement(username, 'Super', callback);\n\t\t\t}\n\t\t\tif(oldScore < 500 && newScore >= 500){\n\t\t\t\tthis.awardAchievement(username, 'Mega', callback);\n\t\t\t}\n\t\t\tif(oldScore < 750 && newScore >= 750){\n\t\t\t\tthis.awardAchievement(username, 'Ultra', callback);\n\t\t\t}\n\t\t\tif(oldScore < 1000 && newScore >= 1000){\n\t\t\t\tthis.awardAchievement(username, 'Hyper', callback);\n\t\t\t}\n\t\t}\n\t}", "function LoadAchievements( appid )\n{\n\t// issue ajax request to fetch achievements,\n\t// then when they come back, poke them into the document\n\n\t$('appAchievementDisplay').innerHTML = \"Loading achievements...\";\n\n\tAppsAjaxRequest( g_szBaseURL + \"/apps/fetchachievements/\" + appid,\n\t\t{},\n\t\tfunction( results )\n\t\t{\n\t\t\t// this operation needs to happen before the other AJAX\n\t\t\t// requests are initiated, so the languages dropdown\n\t\t\t// and current language are populated prior to examining\n\t\t\t// or populating the achievements.\n\t\t\tPopulateAchievementLanguages( appid, results[ 'languages' ] );\n\n \t\t\tLoadAchievementCounts( appid );\n\t\t\tSetAchievements( appid, results[ 'achievements' ] );\n \t\t}, 'get'\n\t\t);\n}", "function addToScore () {\n userScore++;\n}", "function addProfileClicked ()\n{\n\tif(!project.STAProfiles){\n\t\tproject.STAProfiles=[];\n\t}\n\t//get data and add to json\n\tproject.STAProfiles.push(\n\t\t{\n\t\t\t'id':makeid(),\n\t\t\t'SSID':$('#SSIDText').val(),\n\t\t\t'SecurityKey':$('#SecurityText').val(),\n\t\t\t'SecurityType':$('#SecurityTypeSelect').val(),\n\t\t\t'ProfilePriority':$('#ProfilePriorityText').val()\n\t\t}\n\t);\n\t//reload the list\n\tloadDeviceRoleSettingsSTA();\n\t//save project\n\tsaveProjectAPI();\n}", "function addToReputation (userId, value, callback) {\r\n\texports.getReputation(userId, function(error, score) {\r\n\t\tif (error) { \r\n\t\t\tif (callback instanceof Function) callback(error, score); \r\n\t\t}\r\n\t\telse { \r\n\t\t\tvar newScore = score + value;\r\n\t\t\tsetReputation(userId, newScore, function(err, updatedScore) {\r\n\t\t\t\tif (error) { \r\n\t\t\t\t\tif (callback instanceof Function) callback(error, updatedScore);\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t\telse { \r\n\t\t\t\t\tif (callback instanceof Function) callback(null, updatedScore);\r\n\t\t\t\t}\t\t\t\t\t\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}", "addUserToNewGame(user){\n if(this.users.length < 2){\n this.users.push(user);\n if(this.users.length === 2){\n this.setGameState(START);\n }\n }\n else{\n let game = new Game();\n game.addUserToNewGame(user);\n }\n }", "function setUser(user_id) {\n Profile.setUser(user_id);\n }", "onUpdateProfile() {\n logger.info('Updating profile');\n this.polyInterface.updateProfile();\n }", "function EditAchievement( appid, achievement )\n{\n\t// TODO clone a <tr> from the static area of the template to ease the transition here;\n\t// could set it up templatized (like we do the upload forms) or we could templatize the IDs\n\t// then access it via $().\n\t//\n\t// this will, one hopes, be cleaner than all this DOM munging herein.\n\t//\n\t// Was the IE table model brokenness the reason we had to do all this in script? be sure\n\t// to test this mechanism in IE before going very far with it.\n\tvar achievementRow = document.getElementById( \"a\" + achievement[ \"stat_id\" ] + \"_\" + achievement[ \"bit_id\" ] );\n\n\tif ( typeof( achievementRow ) == \"object\" )\n\t{\n\t\tvar id = \"ach\" + achievement[ 'stat_id' ] + \"_\" + achievement[ 'bit_id' ];\n\t\tvar row = achievementRow; // less typing\n\t\tvar item;\n\t\tvar newHash;\n\n\t\tClearRow( row );\n\n\t\trow.className = \"selected\";\n\t\t\n\t\titem = document.createElement( \"input\" );\n\t\titem.id = id + \"_apiname\";\n\t\titem.style.width = \"100%\";\n\t\titem.size = 30;\n\t\titem.value = achievement[ 'api_name' ];\n\t\titem.onchange = DirtyRowClosure( row );\n\t\tvar nameCell = row.insertCell( -1 );\n\t\t// ensure nameCell is extended\n\t\tElement.extend( nameCell );\n\t\tnameCell.appendChild( item );\n\n\t\t// achievement progress\n\t\t// insert some descriptive text and a select\n\t\tnameCell.appendChild( document.createElement( 'br' ) );\n\t\ttextSpan = document.createElement( \"span\" );\n\t\ttextSpan.innerHTML = \"Progress Stat\" + ' ';\n\t\tnameCell.appendChild( textSpan );\n\n\t\tvar progressSelect = document.createElement( \"select\" );\n\t\tprogressSelect.onchange = DirtyRowClosure( row );\n\t\tprogressSelect.id = id + \"_progress\";\n\t\tvar noProgressOption = document.createElement( \"option\" );\n\t\tnoProgressOption.text = \"[\"+\"Loading\"+\"]\";\n\t\tnoProgressOption.value = \"-1\";\n\t\tAddOptionToSelect( progressSelect, noProgressOption );\n\t\tprogressSelect.selectedIndex = 0;\n\t\tnameCell.appendChild( progressSelect );\n\n\t\tvar minVal = 0;\n\t\tvar maxVal = 0;\n\t\tif ( typeof achievement.progress === 'object' )\n\t\t{\n\t\t\tminVal = achievement.progress.min_val;\n\t\t\tmaxVal = achievement.progress.max_val;\n\t\t}\n\n\t\tvar theInput;\n\t\tnameCell.insert( new Element( 'br' ) );\n\t\tnameCell.insert( { 'bottom' : \"Min value:\" + ' ' } );\n\t\ttheInput = new Element( 'input', { 'size' : '10', 'value' : minVal, 'id' : id + '_minval' } );\n\t\ttheInput.onchange = DirtyRowClosure( row );\n\t\tnameCell.insert( theInput );\n\t\tnameCell.insert( { 'bottom' : \"Max:\"+' ' } );\n\t\ttheInput = new Element( 'input', { 'size' : '10', 'value' : maxVal, 'id' : id + '_maxval' } );\n\t\tnameCell.insert( theInput );\n\n\t\t// fetch gameplay stats and feed them to a closure to jam them into the progress select\n\t\tAppsAjaxRequest(\n\t\t\t\tg_szBaseURL + '/apps/fetchstats/' + appid,\n\t\t\t\t{},\n\t\t\t\tfunction FetchProgressClosure( results )\n\t\t\t\t{\n\t\t\t\t\tvar elt = $( progressSelect.id );\n\t\t\t\t\tvar statThisOne = null;\n\t\t\t\t\tif ( typeof achievement.progress === 'object' )\n\t\t\t\t\t{\n\t\t\t\t\t\t// here we hardcode that we only support direct stat access;\n\t\t\t\t\t\t// later when we do the expression-evaluator thing we'll redo this.\n\t\t\t\t\t\tstatThisOne = achievement.progress.value.operand1;\n\t\t\t\t\t}\n\n\t\t\t\t\tresults.sort(\n\t\t\t\t\t\tfunction( statLeft, statRight )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif ( statLeft.name < statRight.name )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if ( statLeft.name > statRight.name )\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\treturn 0;\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\tfor ( i = 0; i < results.length; i++ )\n\t\t\t\t\t{\n\t\t\t\t\t\toption = document.createElement( \"option\" );\n\t\t\t\t\t\toption.text = results[i]['name'];\n\t\t\t\t\t\toption.value = results[i]['name'];\n\n\t\t\t\t\t\tAddOptionToSelect( elt, option );\n\n\t\t\t\t\t\tif ( results[i].name === statThisOne )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toption.selected = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tnoProgressOption.text = \"None\";\n\t\t\t\t},\n\t\t\t\t'get'\n\t\t\t);\n\n\t\t// we use a form to contain each localizable field;\n\t\t// this gives us a convenient json serialization path\n\t\t// through prototype.\n\t\tdoubleCell = row.insertCell( -1 );\n\n\t\titem = document.createElement( \"form\" );\n\t\titem.onchange = DirtyRowClosure( row );\n\t\titem.id = id + \"_displayname\";\n\t\tdoubleCell.appendChild( item );\n\t\tAchievementEditLocalizeHelper( doubleCell, item, achievement, 'display_name', '_NAME' );\n\n\t\titem = document.createElement( \"form\" );\n\t\titem.onchange = DirtyRowClosure( row );\n\t\titem.id = id + \"_description\";\n\t\tdoubleCell.appendChild( item );\n\t\tAchievementEditLocalizeHelper( doubleCell, item, achievement, 'description', '_DESC' );\n\n\t\titem = CreateStatPermissionSelect( id );\n\t\titem.onchange = DirtyRowClosure( row );\n\t\titem.selectedIndex = achievement[ \"permission\" ];\n\t\trow.insertCell( -1 ).appendChild( item );\n\n\t\titem = document.createElement( \"input\" );\n\t\titem.onclick = DirtyRowClosure( row );\n\t\titem.type = \"checkbox\";\n\t\titem.id = id + \"_hidden\";\n\t\tif ( achievement[ \"hidden\" ] != 0 )\n\t\t{\n\t\t\titem.checked = true;\n\t\t}\n\t\trow.insertCell( -1 ).appendChild( item );\n\n\t\tvar achievementID = \"a\" + achievement[ \"stat_id\" ] + \"_\" + achievement[ \"bit_id\" ];\n\n\t\t// image upload forms\n\t\tformText = $('stock_upload_form').innerHTML;\n\t\tformText = formText.replace( /APPID/g, appid );\n\t\tformText = formText.replace( /STATID/g, achievement[ 'stat_id' ] );\n\t\tformText = formText.replace( /ACHIEVEMENTID/g, achievement[ 'bit_id' ] );\n\t\tformText = formText.replace( /REQUEST_TYPE/g, \"achievement\" );\n\t\tformText = formText.replace( /sxxxrc/g, \"src\" );\n\t\tformText = formText.replace( /IMAGE_SOURCE/g, achievement[ \"icon\" ] );\n\t\tformText = formText.replace( /IMAGE_ID/g, achievementID + \"_icon\" );\n\t\tformText = formText.replace( /GRAY/g, false );\n\n\t\trow.insertCell( -1 ).innerHTML = formText;\n\n\t\tformText = $('stock_upload_form').innerHTML;\n\t\tformText = formText.replace( /APPID/g, appid );\n\t\tformText = formText.replace( /STATID/g, achievement[ 'stat_id' ] );\n\t\tformText = formText.replace( /ACHIEVEMENTID/g, achievement[ 'bit_id' ] );\n\t\tformText = formText.replace( /REQUEST_TYPE/g, \"achievement_gray\" );\n\t\tformText = formText.replace( /sxxxrc/g, \"src\" );\n\t\tformText = formText.replace( /IMAGE_SOURCE/g, achievement[ \"icon_gray\" ] );\n\t\tformText = formText.replace( /IMAGE_ID/g, achievementID + \"_icon_gray\" );\n\t\tformText = formText.replace( /GRAY/g, true );\n\n\t\trow.insertCell( -1 ).innerHTML = formText;\n\n\t\tvar btnCell = row.insertCell( -1 );\n\n\t\tvar btn = document.createElement( \"input\" );\n\t\tbtn.type= \"submit\";\n\t\tbtn.onclick = RevertAchievementClosure( appid, achievement[ \"stat_id\" ], achievement[ \"bit_id\" ] );\n\t\tbtn.value = \"Cancel\";\n\t\tbtnCell.appendChild( btn );\n\n\t\tbtnCell.appendChild( document.createElement( \"br\" ) );\n\n\t\tbtn = document.createElement( \"input\" );\n\t\tbtn.type= \"submit\";\n\t\tbtn.onclick = SaveAchievementClosure( appid,\n\t\t\t\t\t\t\t\t achievement[ \"stat_id\" ],\n\t\t\t\t\t\t\t\t achievement[ \"bit_id\" ] );\n\t\tbtn.value = \"Save\";\n\t\tbtnCell.appendChild( btn );\n\t\treturn id;\n\t}\n}", "function updateProfile(profile) {\n checkUser();\n UserId = userId;\n $.ajax({\n method: \"PUT\",\n url: \"/api/profile_data\",\n data: profile\n })\n .then(function () {\n window.location.href = \"/members\";\n });\n }", "addUserToGameLoad(user){\n this.users.push(user);\n }", "function addRoomUser(info) {\n\tvar dude = new PalaceUser(info);\n\tif (theRoom.lastUserLogOnID == dude.id && ticks()-theRoom.lastUserLogOnTime < 900) { // if under 15 seconds\n\t\ttheRoom.lastUserLogOnID = 0;\n\t\ttheRoom.lastUserLogOnTime = 0;\n\t\tif (!getGeneralPref('disableSounds')) systemAudio.signon.play();\n\t}\n\tif (theUserID == dude.id) {\n\t\ttheUser = dude;\n\t\tfullyLoggedOn();\n\t}\n\n\ttheRoom.users.push(dude);\n\tloadProps(dude.props);\n\tdude.animator();\n\tdude.grow(10);\n\tPalaceUser.setUserCount();\n}", "_enrichAchievementDefinitionForUser(achName, achDefinition, userDomain) {\n\t\tconst _notTriggeredBefore = function (achName) {\n\t\t\tconst ach = __guard__(userDomain != null ? userDomain.achievements : undefined, x => x[achName]);\n\t\t\treturn !(ach != null ? ach.status : undefined);\n\t\t};\n\n\t\t// Enrich achievement with the progress\n\t\tachDefinition.progress = _notTriggeredBefore(achName) ? this._getProgress(achDefinition, userDomain != null ? userDomain.balance : undefined) : 1;\n\t\tachDefinition.gamerData = __guard__(__guard__(userDomain != null ? userDomain.achievements : undefined, x1 => x1[achName]), x => x.gamerData);\n\t\treturn achDefinition;\n\t}", "addUser(addr, Intro_json, callback) {\n\t\tftContract.deployed().then((instance) => {\n\t\t\tthis.saveHash(Intro_json, hash => {\n\t\t\t\tinstance.createCharacter.call(hash, {from: addr})\n\t\t\t\t.then((id) => {\n\t\t\t\t\tconsole.log(\"add newUser successfully,addr = \", addr);\n\t\t\t\t\tcallback(id);\n\t\t\t\t\t//console.log(\"add newUser successfully,addr = \", addr, \", Info = \", result)\n\t\t\t\t});\n\t\t\t});\n\t\t\t//return get_user(addr) //return json\n\t\t});\n\t}", "function addNewScore(userName, score){\n firebase.database().ref('/scores/userName').set({\n userName: userName,\n score: score\n });\n }", "function saveProfile (user) {\n userService.saveProfile(user);\n toastService.showToast(user.displayName + 'profile saved!');\n }", "function addClaim(){\n\teditClaim();\n}", "function addScorePoint() {\n oxo.player.addToScore(5);\n}", "function AddToProfile (container, options) {\n /**\n * Options reference\n */\n this.options = options;\n\n /**\n * jQuery reference to Add to profile button\n */\n this.addButton = container.find(options[\"add-to-profile-button\"]);\n\n /**\n * jQuery reference to completeness tip value\n */\n this.tip = container.find(options[\"completness-tip\"]).val();\n\n }", "async function Profile(evt) {\n evt.preventDefault();\n if (localStorage.userId !== undefined) {\n hidePageComponents();\n $profileInfo.show();\n $userProfile.show();\n $links.show();\n $logoutBtn.show();\n $userBtn.show();\n\n if (localStorage.favTeamId == \"None\") {\n $favTeam.text(\"You have not selected a favorite team\");\n } else {\n $favTeam.text(\n `Your currently selected favorite team is the ${localStorage.favTeamName}`\n );\n }\n } else {\n $welcome.show();\n $loginBtn.show();\n $signupBtn.show();\n }\n}", "function addUserToBar(req, res) {\n\n var newGoing = new Going();\n newGoing.userId = req.user.id;\n newGoing.barId = req.params.id;\n\n newGoing.save(function(err, going) {\n if (err) {\n console.log(err);\n return res.status(400).send(err);\n }\n\n return res.status(200).send('added');\n });\n}", "function add_user() {\n\tif (typeof(Storage) !== \"undefined\") {\n\t\t// get info from html and make profile object\n\t\tvar profile = {\n\t\t\tname: $(\"#firstname\")[0].value + \" \" +\n\t\t\t $(\"#middlename\")[0].value + \" \" + \n\t\t\t $(\"#lastname\")[0].value, \n\t\t\tbday: $(\"#birth\")[0].value,\n\t\t\tinterests: []\n\t\t};\n\t\t// update local storage\n\t\tlocalStorage.setItem(\"profile\", JSON.stringify(profile));\n\t}\n\telse {\n\t\tconsole.log(\"Local Storage Unsupported\")\n\t}\n\n}", "addNewProfile(player) {\n const response = {\n status: false,\n message: 'Error',\n };\n\n if (this.isCorrectUserData(player)) {\n const isSuccess = this.store.addNewProfile(player);\n\n if (isSuccess) {\n response.status = true;\n response.message = \"Profile successfully added\";\n return response;\n } else {\n response.message = `Profile with email ${player.email} exist!`;\n return response;\n }\n\n } else {\n response.message = \"Incorrect profile data\";\n return response;\n }\n }", "function SubmitScore()\n {\n firebase.auth().signInWithPopup(provider).then(function(result) {\n // This gives you a Google Access Token. You can use it to access the Google API.\n var token = result.credential.accessToken;\n // The signed-in user info.\n var user = result.user;\n addNewScore(user.displayName, endgame_screen.score.toFixed(2));\n }).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n // The email of the user's account used.\n var email = error.email;\n // The firebase.auth.AuthCredential type that was used.\n var credential = error.credential;\n // ...\n });\n }", "function addUser() {\n }", "function getMyAchievements() {\n return new Promise((resolve, reject) => {\n unirest.get(env.BONUSLY_BASE_API + '/achievements')\n .headers(\n { \"Authorization\": \"Bearer \" + env.BONUSLY_API_KEY })\n .end(response => {\n if (!response.ok) {\n reject(`error`);\n } else {\n let my_achievements = [];\n response.body.result && response.body.result.forEach(element => {\n if(element.user.email.toLowerCase() === env.MY_COMPANY_EMAIL){\n var temp = {\n created_at : element.created_at,\n end_date : element.deactivated_at,\n total_days_held : date_diff_indays(element.created_at,element.deactivated_at),\n reason : element.headline,\n title:element.title,\n achievement_type : element.achievement_type_key\n }\n my_achievements.push(temp);\n } \n });\n resolve(my_achievements);\n }\n });\n });\n}", "function addHealthBonus(){\n\tplayer1.maxHealth = 20 + player1.healthBonusArmor + player1.healthBonusSkill;\n\tplayer1MaxHp.innerHTML = player1.maxHealth;\n\tplayer1CurrentHp.innerHTML = player1.currentHealth;\n\tif (player1.currentHealth > player1.maxHealth) {\n\t\tplayer1.currentHealth = player1.maxHealth;\n\t\tplayer1CurrentHp.innerHTML = player1.currentHealth;\n\t};\n}", "function profile(){\nthis.name = \"Zahid Hasan\";\nthis.score = 0;\nthis.credits =0;\nthis.awards =0;\nthis.alerts=0;\n}", "async function markGameAsFavorite(user_id, game_id) {\r\n await DButils.execQuery(\r\n `INSERT INTO dbo.myGames (user_id, game_id) values (${user_id},${game_id})`\r\n );\r\n}", "function submitProfile(newProfile) {\n }", "addAccount(peerAddr, plugin) {\n let accts = this.getAccounts();\n accts[peerAddr] = plugin;\n globalState.set('000-reputation-accounts', accts);\n this._tryRegisterAcct(peerAddr, plugin);\n }", "addToCurrentGold (addedScore) {\n this._player.currentGold += addedScore;\n }", "function addGold(){\n user.gold += user.villagerCount * villager.goldPerSec;\n}", "function addNewUser(name){\n var user={\n id:name,\n //new user always starts in this sector\n sector:\"000:000\",\n highscore:0,\n //user has random position\n x: randomInt(MIN_POS,MAX_POS),\n y:randomInt(MIN_POS,MAX_POS),\n };\n firebase.database().ref(\"users/\"+name).set(user);\n }", "function updateUserProfileAuth(name, email, address) {\n firebase.auth().onAuthStateChanged(function (user) {\n console.log(\"user is signed in: \" + user.uid);\n console.log(\"old display name: \" + user.displayName);\n user.updateProfile({\n displayName: name\n }).then(function () {\n console.log(\"updated authenticated user profile\");\n console.log(\"new display name: \" + user.displayName);\n }).catch(function (error) {\n console.log(\"authenticated user profile update failed\");\n })\n })\n}", "function addUser(name, ineff, eff, isRange, high, low){\n\t\tvar w = new waterUser(name, ineff, eff, isRange, high, low);\n\t\twaterUses.push(w);\n\t}", "function addCurrentUserProfile() {\n let currentuser = users[myprofileid];\n document.getElementById('profile-main-infos').innerHTML = `\n<div class=\"portrait-big\">\n<img\n src=\"./uploads/${currentuser['userimage']}\">\n</div>\n<div style=\"font-size: 16px\" class=\"blue\">${currentuser['username']}</div> `\n}", "function updateUser(){\n let user = firebase.auth().currentUser;\n user.updateProfile({\n displayName: \"Jane Q. User\",\n photoURL: \"https://example.com/jane-q-user/profile.jpg\"\n }).then(function() {\n // Update successful.\n }).catch(function(error) {\n // An error happened.\n });\n }", "async function submitAccountInformation(event) {\n event.preventDefault();\n const { data } = await axios.put(\"me\", {\n firstName: firstName,\n lastName: lastName,\n email: email,\n image: image,\n roleId: 1 // TODO: Add DropDownlist to select a role\n });\n props.setUser(new User(\n data.id,\n data.firstName,\n data.lastName,\n data.email,\n data.role,\n data.image\n )); // Dispatch the chage event\n }", "function addUserToGamePlayerList(username) {\n console.log(\"adding \" + username);\n var thisPlayer = document.createElement('li');\n thisPlayer.classList.add('list-group-item','justify-content-between');\n thisPlayer.appendChild(document.createTextNode(username));\n if(gamePlayerList.children().length === 0) {\n var leaderBadge = document.createElement('span');\n leaderBadge.classList.add('badge','badge-success','badge-pill');\n leaderBadge.appendChild(document.createTextNode('Leader'));\n thisPlayer.appendChild(leaderBadge);\n }\n\n gamePlayerList.append(thisPlayer);\n}", "function createAVUser( openId, pubAccountId, followerId, moreInfo){ // follower\n\t//default user name would be 000000\n\tvar username=pubAccountId+'___'+openId;\n\tvar password='000000';\n\tvar user = new AV.User(); \n\n\tuser.set(\"username\", username);\n\tuser.set(\"password\", password);\n\tuser.set(\"followerId\", followerId);\n\tuser.set(\"wechatAccInfo\", moreInfo);\n\t\t\n\tuser.signUp(null, {\n \t\t\t success: function(user) {\n \t\t\t\tconsole.log('AVuser created');\t// 注册成功,可以使用了.\n \t\t\t},\n \t\t \terror: function(user, error) {\n \t\t\t// 失败了\n \t\t\t\tconsole.log(\"Error: \" + error.code + \" \" + error.message);\n \t\t\t}\n\t});\n\n\n}", "function saveProfile(profile) {\n }", "function add(_name, _permission, _address) {\n return new Promise((resolve, reject) => {\n contract.add(_name, _permission, _address, (error, result) => {\n if (error) {\n reject(error);\n } else {\n resolve('User \"' + _name + '\" was successfully added!');\n }\n });\n });\n}", "function update(property, value, account) {\r\n const ctx = SP.ClientContext.get_current();\r\n\r\n SP.SOD.executeFunc('userprofile', 'SP.UserProfiles.PeopleManager', function() {\r\n const peopleManager = new SP.UserProfiles.PeopleManager(ctx);\r\n // save the value to the profile property as a compressed UTF16 string to keep within the 3600 character limit for user profile properties\r\n peopleManager.setSingleValueProfileProperty('i:0#.f|membership|' + account, property, Compression.compressToUTF16(JSON.stringify(value)));\r\n\r\n ctx.executeQueryAsync(\r\n function() {},\r\n function(sender, args) {\r\n console.log('Goldfish.Profile.Update Error while trying to save to the folowing profile property: ' + property + '. The error details are as follows: ' + args.get_message());\r\n }\r\n );\r\n });\r\n}", "function GrantItem(name) {\r\n for (var i = 0; i < GameState.Items.length; i++) {\r\n if (GameState.Items[i][0] == name) {GameState.Items[i][1]++;return;}\r\n }\r\n GameState.Items.push([name,1]);\r\n}", "signUp(email, password, fullName) {\n /* Create a new user and save their information */\n firebase.auth().createUserWithEmailAndPassword(email, password)\n .then(function (firebaseUser) {\n //include information (for app-level content)\n var profilePromise = firebaseUser.updateProfile({\n displayName: fullName,\n points: 0\n }); //return promise for chaining\n\n //create new entry in the Cloud DB (for others to reference)\n var userRef = firebase.database().ref('users/' + firebaseUser.uid);\n var userData = {\n fullName: fullName,\n points: 0\n }\n var userPromise = userRef.set(userData); //update entry in JOITC, return promise for chaining\n return Promise.all([profilePromise, userPromise]); //do both at once!\n })\n .then(function () {\n console.log('Logged in!');\n hashHistory.push('/main');\n })\n // .then(() => this.forceUpdate()) //bad, but helps demo\n .catch((err) => console.log(err));\n }", "function C999_Common_Achievements_Load() {\n\tLeaveIcon = \"\";\n LeaveScreen = \"\";\n C999_Common_Achievements_PrepareAchievements();\n\tLoadInteractions();\n\tStopTimer(7.6666667 * 60 * 60 * 1000);\n}", "function bush(fn, ln, un, cpa) {\n var user = Parse.User.current();\n user.set(\"firstName\", fn);\n user.set(\"lastName\", ln);\n user.setUsername(un);\n user.setEmail(un);\n user.setPassword(cpa);\n user.save(null, {\n success: function (user) {\n console.log(\"Success changing account information...\");\n //This is so that the new information is displayed as a confirmation that it has happened\n window.location.reload();\n },\n error: function (user, error) {\n console.log(\"ERROR occured in bush()\");\n }\n });\n }", "function appendUser(user) {\n var username = user.username;\n /*\n * A new feature to Pepper, which is a permission value,\n * may be 1-5 afaik.\n *\n * 1: normal (or 0)\n * 2: bouncer\n * 3: manager\n * 4/5: (co-)host\n */\n var permission = user.permission;\n\n /*\n * If they're an admin, set them as a fake permission,\n * makes it easier.\n */\n if (user.admin) {\n permission = 99;\n }\n\n /*\n * For special users, we put a picture of their rank\n * (the star) before their name, and colour it based\n * on their vote.\n */\n var imagePrefix;\n switch (permission) {\n case 0:\n imagePrefix = 'normal';\n break;\n // Normal user\n case 1:\n // Featured DJ\n imagePrefix = 'featured';\n break;\n case 2:\n // Bouncer\n imagePrefix = 'bouncer';\n break;\n case 3:\n // Manager\n imagePrefix = 'manager';\n break;\n case 4:\n case 5:\n // Co-host\n imagePrefix = 'host';\n break;\n case 99:\n // Admin\n imagePrefix = 'admin';\n break;\n }\n\n /*\n * If they're the current DJ, override their rank\n * and show a different colour, a shade of blue,\n * to denote that they're playing right now (since\n * they can't vote their own song.)\n */\n if (API.getDJs()[0].username == username) {\n if (imagePrefix === 'normal') {\n drawUserlistItem('void', '#42A5DC', username);\n } else {\n drawUserlistItem(imagePrefix + '_current.png', '#42A5DC', username);\n }\n } else if (imagePrefix === 'normal') {\n /*\n * If they're a normal user, they have no special icon.\n */\n drawUserlistItem('void', colorByVote(user.vote), username);\n } else {\n /*\n * Otherwise, they're ranked and they aren't playing,\n * so draw the image next to them.\n */\n drawUserlistItem(imagePrefix + imagePrefixByVote(user.vote), colorByVote(user.vote), username);\n }\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}", "async joinGame ({ request, auth, response }) {\n // get currently authenticated user\n const user = auth.current.user\n const game = await Game.query()\n .where('id', request.input('game_id'))\n .firstOrFail()\n game.merge({\n avg_level: (((game.avg_level * game.curr_num) + user.level) / (game.curr_num + 1)),\n curr_num: game.curr_num + 1\n })\n await game.save()\n await user.games().attach(request.input('game_id'))\n return response.json({\n status: 'success',\n data: game\n })\n }", "function UserGoal(data) {\n \n if (!data) {\n throw 'Invalid data for User';\n }\n \n this.id = data.Id;\n this.selectedGoal = new Goal(data.SelectedGoal);\n this.selectedUnit = new Unit(data.SelectedUnit);\n this.targetValue = data.TargetValue;\n this.customName = data.CustomGoal;\n this.latestEntryValue = data.LatestValue;\n \n }", "addUser() {\r\n // Create a new user with the given email and password.\r\n firebase.auth().createUserWithEmailAndPassword(this.state.email,this.state.password)\r\n .then(() => {\r\n var username = firebase.auth().currentUser.uid;\r\n // Set the user status to active.\r\n firebase.database().ref(\"/users/\"+username+\"/settings/active\").set({\r\n value: true\r\n });\r\n // Initialize a date that will allow the user to start a new conversation.\r\n firebase.database().ref(\"/users/\"+username+\"/settings/latestConvo\").set({\r\n timestamp: \"6/20/2018, 00:00:00 AM\"\r\n });\r\n firebase.database().ref(\"/users/\"+username+\"/settings/gender\").set(\"other\")\r\n firebase.database().ref(\"/users/\"+username+\"/settings/blocked\").set(\"false\")\r\n firebase.database().ref(\"/activeUsers/\"+username).set({\r\n username: username\r\n })\r\n // Navigate to the main menu with firstLogin as true, meaning that the intro page will display.\r\n this.props.navigation.navigate('Tabs', {firstLogin: true})})\r\n .catch(error => this.setState({errorMessage: error.message}));\r\n }", "function award(memberObj, amount){\n let shopUser = getShopUser(memberObj);\n\n shopUser.balance += amount;\n data.budget -= amount;\n\n fs.writeFileSync(\"./data/shop/data.json\", JSON.stringify(data), (err) => console.log(err));\n\n return `:confetti_ball: ${memberObj} has earned ${amount} Simbits! :confetti_ball: `\n}", "function user_update_lobby(user) {\n // Agent logs in or updates\n agent.add(user);\n update_interface();\n }", "function AchievementUnlock(AchievementName) {\n if (C999_Common_Achievements_List.indexOf(AchievementName) < 0) return;\n if (!C999_Common_Achievements_Unlocked.length) C999_Common_Achievements_PrepareAchievements(); // If the list of unlocked achievements is empty, it might just not be loaded yet (it's only loaded when the achievement menu is visited before playing), which would lead to the player's progress being overwritten\n if (C999_Common_Achievements_Unlocked.indexOf(AchievementName) < 0) {\n window[\"C999_Common_Achievements_\" + AchievementName] = true;\n C999_Common_Achievements_Unlocked.push(AchievementName);\n localStorage.setItem(\"Achievements\", JSON.stringify(C999_Common_Achievements_Unlocked));\n }\n}", "updateUserDetails() {\n if (!activeUser()) return;\n $(conversations_area).find(`[data-user-id=\"${activeUser().id}\"] .sb-name,.sb-top > a`).html(activeUser().get('full_name'));\n $(conversations_area).find('.sb-user-details .sb-profile').setProfile();\n SBProfile.populate(activeUser(), $(conversations_area).find('.sb-profile-list'));\n }", "addItem() {\r\n const d = new Date();\r\n const time = d.getTime();\r\n this.props.navigation.navigate('Reward',{time:time});\r\n db.ref('users').push({\r\n posthought: this.state.posthought,\r\n mood: this.state.mood,\r\n number: this.state.number,\r\n thing: this.state.thing,\r\n place: this.state.place,\r\n negthought: this.state.negthought,\r\n label: this.state.label, \r\n month: (d.getMonth()+1),\r\n day: (d.getDate()),\r\n time: time\r\n });\r\n }", "function joinQuest(user_id, quest_id) {\n Issues.addMember(quest_id, user_id);\n $state.go('questFeed');\n }", "function onSignIn(googleUser) {\n console.log('User signed in!');\n var profile = googleUser.getBasicProfile();\n //change userName text, img source, & email text based on profile\n $(\"h1\").text(\"Welcome, \" + profile.getName());\n // $(\"img\").attr(\"src\", profile.getImageUrl());\n // $(\".email\").text(profile.getEmail());\n}", "async function addAchievement(gname, cheevos)\n{\n const newAchievement = {\n game: gname,\n steamAchievements: cheevos\n };\n\n try\n {\n await client.connect();\n\n const db = client.db(dbname);\n const achievements = db.collection('achievements');\n await achievements.insertOne(newAchievement, function (err, result)\n {\n\n console.log(result)\n });\n } finally\n {\n await client.close();\n }\n}", "function attachNewUserToIncident() {\n attachNewUser = true;\n $(\"#user_add_username\").val($(\"#user_name\").val());\n openAddUser();\n }", "function onSignIn(googleUser) {\n console.log('User signed in!');\n var profile = googleUser.getBasicProfile();\n //change userName text, img source, & email text based on profile\n $(\".userName\").text(profile.getName());\n $(\"img\").attr(\"src\", profile.getImageUrl());\n $(\".email\").text(profile.getEmail());\n}", "function updateProfileBasics(userData) {\n $('.name').text(userData['name']);\n $('#email').text(userData['email']);\n buildAsLabels(`#interests`, userData['interests'], 'interests');\n buildAsLabels(`#skills`, userData['skills'], 'skills');\n populateExistingImage('profile', '#profile-picture-main');\n}", "function C999_Common_Achievements_Run() {\n BuildInteraction(C999_Common_Achievements_CurrentStage);\n if ((C999_Common_Achievements_Image !== undefined) && (C999_Common_Achievements_Image.trim() != \"\")) {\n DrawImage(C999_Common_Achievements_Image, 600, 0);\n }\n}", "function updateProfile(user) {\n UserService\n .updateUser(user._id, user)\n .success(function (user) {\n if(user != '0'){\n $location.url(\"/user/\" + user._id);\n }\n })\n .error(function (error) {\n\n });\n\n }", "addUserToDB(username, userData, success=()=>{}, error=()=>{}) {\n const ref = this.firebase.database().ref('users');\n\n ref.update({\n [username]: {\n ...userData\n }\n })\n .then(() => {\n // console.log(`DB ${username} successfully added to database`);\n success();\n })\n .catch(e => {\n console.error(`DB error adding ${username} to database`);\n error(e);\n });\n }", "function populateUserInfo(user) {\n getUserFriends();\n document.querySelector(\".profile_user-name\").textContent = user.username;\n document.querySelector(\"#friends > div > div.profile_user > h2\").textContent =\n user.username;\n document.querySelector(\".profile_user-points\").textContent =\n \"$ \" + user.coins;\n document.querySelector(\"#friends > div > div.profile_user > p\").textContent =\n \"$ \" + user.coins;\n document.querySelector(\".app_player-name\").textContent = user.username;\n document.querySelector(\".app_player-coins span\").textContent = user.coins;\n document.querySelector(\"div.app_player\").style.display = \"block\";\n document\n .querySelector(\".modal_start_body-logged-input\")\n .setAttribute(\"max\", user.coins);\n document.querySelector(\"div.highscore_sorting\").style.display = \"block\";\n if (user.username == \"admin\") {\n document.querySelector(\"#admin_list\").style.display = \"inline-block\";\n document.querySelector(\".admin_panel\").style.display = \"inline-block\";\n } else {\n document.querySelector(\"#admin_list\").style.display = \"none\";\n document.querySelector(\".admin_panel\").style.display = \"none\";\n }\n}", "function Achievement(data) {\n var self = this;\n self.ID = data.ID;\n self.image = cleanImageURL(data.Image, 'm');\n self.pointsCreate = data.PointsCreate;\n self.pointsExplore = data.PointsExplore;\n self.pointsLearn = data.PointsLearn;\n self.pointsSocialize = data.PointsSocialize;\n self.title = data.Title;\n self.tokenizedTitle = self.title.toLowerCase().match(/\\S+/g);\n self.visible = ko.observable(true);\n}", "static addProfileToStorage(profile) {\n let profiles;\n // When first profile is added or if there is no profiles key in local storage, assign empty array to profiles\n if (localStorage.getItem('profiles') === null) {\n profiles = [];\n } else {\n // Get the existing profiles to the array\n profiles = JSON.parse(localStorage.getItem('profiles'));\n }\n // Adding new profile\n profiles.push(profile);\n console.log(profiles)\n localStorage.setItem('profiles', JSON.stringify(profiles));\n }", "async postSave () {\n\t\t// save an invite code as a signup token for this user\n\t\tawait this.saveSignupToken();\n\n\t\t// grant the user access to their own me-channel, strictly for testing purposes\n\t\t// (since they are not confirmed yet)\n\t\tawait this.grantMeChannel();\n\t}", "function addUser() {\r\n user_name = document.getElementById(\"user_name\").value;\r\n firebase.database().ref(\"/\").child(user_name).child(user_name).update({\r\n purpose: \"adding user\"\r\n })\r\n }", "async updateProfileUser(context, { userName, userPhotoURL }) {\n await firebase\n .auth()\n .currentUser.updateProfile({\n displayName: userName,\n photoURL: userPhotoURL\n })\n .then(() => {\n context.commit(\"checkAuthState\");\n });\n }", "function updateProfile(info) {\n setProfile(info);\n }" ]
[ "0.6708486", "0.66089743", "0.6458496", "0.60735923", "0.60678715", "0.6029028", "0.60103714", "0.58658814", "0.5839668", "0.58071905", "0.5729417", "0.5568488", "0.5523191", "0.551997", "0.55024505", "0.54988754", "0.5480935", "0.5477365", "0.5455532", "0.5448211", "0.54244053", "0.538421", "0.53659534", "0.5359812", "0.53566426", "0.53522354", "0.5341309", "0.5298385", "0.5280461", "0.52554184", "0.5250526", "0.5236905", "0.52366626", "0.523516", "0.5229514", "0.51971895", "0.51837", "0.5181486", "0.5169652", "0.516302", "0.51600224", "0.5153713", "0.5153439", "0.5142109", "0.51379097", "0.51341885", "0.5133236", "0.51315105", "0.5121514", "0.5118978", "0.5115028", "0.51132494", "0.5110419", "0.51080084", "0.5107038", "0.50996614", "0.5093947", "0.5090438", "0.50815964", "0.5072116", "0.5061199", "0.5061004", "0.50501066", "0.5043989", "0.50394374", "0.5036801", "0.503357", "0.50217247", "0.50151867", "0.49993417", "0.49969065", "0.49955004", "0.49937567", "0.49924892", "0.4991155", "0.4991155", "0.49880153", "0.49778327", "0.4977187", "0.4968968", "0.49683744", "0.49578682", "0.49562767", "0.49543267", "0.49495664", "0.49484167", "0.4944484", "0.4936206", "0.49325678", "0.49300826", "0.4929209", "0.49237907", "0.49130017", "0.49100998", "0.4906165", "0.49050188", "0.49049798", "0.4901194", "0.4900522", "0.4898115" ]
0.81612325
0
create the data source of the list of techniologies
componentWillMount() { const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); this.dataSource = ds.cloneWithRows(this.props.dataToShow); //ends }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "dataSource(data, widgetConfig) {\n let config = widgetConfig.split(' ')[1],\n random = config.split('_')[1],\n source = {\n id: widgetConfig,\n type: 'Componentsmdx_mondrianJndi',\n typeDesc: 'mondrianJndi',\n parent: 'UnIqEiD',\n properties: [],\n meta: 'CDA',\n meta_conntype: 'mondrian.jndi',\n meta_datype: 'mdx'\n },\n sourceName = $('.' + config + ' .sourceName')[0].value,\n jndi = $('.' + config + ' .sourceConnect')[0].value,\n cubes = $('.' + config + ' .dataCubes')[0].value,\n query = $('.' + config + ' .sqlStatement')[0].value,\n queryType = $('.' + config + ' .queryType')[0].value,\n stringCubes = 'mondrian:/',\n catalog = (queryType === 'mdx') ? stringCubes + cubes : cubes;\n let dataRows = {\n name: sourceName,\n jndi: jndi,\n access: 'pubilc',\n catalog: catalog,\n query: query,\n bandedMode: 'compact',\n parameters: [],\n cdacalculatedcolumns: [],\n cdacolumns: [],\n output: [],\n outputMode: 'include',\n cacheKeys: [],\n cacheDuration: 3600,\n cache: true\n };\n\n d3.entries(dataRows).map(d=>{\n let row = {\n 'name': d.key,\n 'value': d.value\n };\n\n source.properties.push(row);\n });\n data.push(source);\n this.chartDataSource(data, sourceName, random);\n this.dataSourceNames.push(sourceName);\n this.selectDataSource(data, sourceName, random);\n return source;\n }", "initialize() {\n for (const ds of this.dataSources) {\n ds.visit((node) => node.initialize());\n }\n }", "function createDatasourcesList(queriesDatasources) {\n var exploreDatasources = Object(_features_explore_state_selectors__WEBPACK_IMPORTED_MODULE_4__[\"getExploreDatasources\"])();\n var datasources = [];\n queriesDatasources.forEach(function (queryDsName) {\n var index = exploreDatasources.findIndex(function (exploreDs) {\n return exploreDs.name === queryDsName;\n });\n\n if (index !== -1) {\n datasources.push({\n label: queryDsName,\n value: queryDsName,\n imgUrl: exploreDatasources[index].meta.info.logos.small,\n isRemoved: false\n });\n } else {\n datasources.push({\n label: queryDsName,\n value: queryDsName,\n imgUrl: 'public/img/icn-datasource.svg',\n isRemoved: true\n });\n }\n });\n return datasources;\n}", "static createTerritoriesFromDB(data) {\n data.forEach(ter => new Territory(ter))\n }", "createDataListForRefreshInformation() {\n let citiesData = this.state.cities;\n if (citiesData.length === 0) {\n return\n }\n let yandex = this.state.source.yandexFlag;\n let gismeteo = this.state.source.gismeteoFlag;\n let weather = this.state.source.weatherFlag;\n let source = [];\n let cities = [];\n let citiesAndSource = {};\n for (let i = 0; i < citiesData.length; i++) {\n let cityAndData = citiesData[i];\n cities.push(cityAndData.city);\n }\n if (yandex) {\n source.push(\"yandex\")\n }\n if (gismeteo) {\n source.push(\"gismeteo\")\n }\n if (weather) {\n source.push(\"weatherCom\")\n }\n citiesAndSource[\"cities\"] = cities;\n citiesAndSource[\"source\"] = source;\n return citiesAndSource\n }", "getHierarchicalDataSource(displayMode) {\n const that = this,\n dataSource = that.dataSource,\n mapping = {},\n treeSource = [];\n let blanks;\n\n if (displayMode === 'timePicker') {\n return;\n }\n\n if (dataSource[dataSource.length - 1].value === '') {\n blanks = dataSource[dataSource.length - 1];\n dataSource.pop();\n }\n\n dataSource.forEach(function (item) {\n const date = item.value,\n year = date.getFullYear(),\n month = new Intl.DateTimeFormat(that.context.locale, { month: 'long' }).format(date),\n day = date.getDate();\n\n if (!mapping[year]) {\n mapping[year] = {};\n }\n\n if (!mapping[year][month]) {\n mapping[year][month] = {};\n }\n\n if (!mapping[year][month][day]) {\n if (displayMode === 'calendar') {\n mapping[year][month][day] = date;\n return;\n }\n else {\n mapping[year][month][day] = {};\n }\n }\n\n if (displayMode === 'calendar') {\n return;\n }\n\n const hours = date.getHours(),\n minutes = date.getMinutes(),\n seconds = date.getSeconds();\n\n if (!mapping[year][month][day][hours]) {\n mapping[year][month][day][hours] = {};\n }\n\n if (!mapping[year][month][day][hours][minutes]) {\n mapping[year][month][day][hours][minutes] = {};\n }\n\n if (!mapping[year][month][day][hours][minutes][seconds]) {\n mapping[year][month][day][hours][minutes][seconds] = date;\n }\n });\n\n for (let year in mapping) {\n const yearLevelItem = { label: year, items: [], customAttribute: 'default-item' };\n\n treeSource.push(yearLevelItem);\n\n for (let month in mapping[year]) {\n const monthLevelItem = { label: month, items: [], customAttribute: 'default-item' };\n\n yearLevelItem.items.push(monthLevelItem);\n\n for (let day in mapping[year][month]) {\n const dayLeveItem = { label: day, customAttribute: 'default-item' };\n\n monthLevelItem.items.push(dayLeveItem);\n\n if (displayMode === 'calendar') {\n dayLeveItem.value = mapping[year][month][day];\n continue;\n }\n\n dayLeveItem.items = [];\n\n for (let hours in mapping[year][month][day]) {\n const hoursLevelItem = { label: '0'.repeat(2 - hours.length) + hours, items: [], customAttribute: 'default-item' };\n\n dayLeveItem.items.push(hoursLevelItem);\n\n for (let minutes in mapping[year][month][day][hours]) {\n const minutesLevelItem = { label: ':' + '0'.repeat(2 - minutes.length) + minutes, items: [], customAttribute: 'default-item' };\n\n hoursLevelItem.items.push(minutesLevelItem);\n\n for (let seconds in mapping[year][month][day][hours][minutes]) {\n const secondsLevelItem = {\n label: ':' + '0'.repeat(2 - seconds.length) + seconds,\n value: mapping[year][month][day][hours][minutes][seconds],\n customAttribute: 'default-item'\n };\n\n minutesLevelItem.items.push(secondsLevelItem);\n }\n }\n }\n }\n }\n }\n\n if (blanks) {\n treeSource.push(blanks);\n }\n\n that.dataSource = treeSource;\n }", "getHierarchicalDataSource(displayMode) {\n const that = this,\n dataSource = that.dataSource,\n mapping = {},\n treeSource = [];\n let blanks;\n\n if (displayMode === 'timePicker') {\n return;\n }\n\n if (dataSource[dataSource.length - 1].value === '') {\n blanks = dataSource[dataSource.length - 1];\n dataSource.pop();\n }\n\n dataSource.forEach(function (item) {\n const date = item.value,\n year = date.getFullYear(),\n month = new Intl.DateTimeFormat(that.context.locale, { month: 'long' }).format(date),\n day = date.getDate();\n\n if (!mapping[year]) {\n mapping[year] = {};\n }\n\n if (!mapping[year][month]) {\n mapping[year][month] = {};\n }\n\n if (!mapping[year][month][day]) {\n if (displayMode === 'calendar') {\n mapping[year][month][day] = date;\n return;\n }\n else {\n mapping[year][month][day] = {};\n }\n }\n\n if (displayMode === 'calendar') {\n return;\n }\n\n const hours = date.getHours(),\n minutes = date.getMinutes(),\n seconds = date.getSeconds();\n\n if (!mapping[year][month][day][hours]) {\n mapping[year][month][day][hours] = {};\n }\n\n if (!mapping[year][month][day][hours][minutes]) {\n mapping[year][month][day][hours][minutes] = {};\n }\n\n if (!mapping[year][month][day][hours][minutes][seconds]) {\n mapping[year][month][day][hours][minutes][seconds] = date;\n }\n });\n\n for (let year in mapping) {\n const yearLevelItem = { label: year, items: [], customAttribute: 'default-item' };\n\n treeSource.push(yearLevelItem);\n\n for (let month in mapping[year]) {\n const monthLevelItem = { label: month, items: [], customAttribute: 'default-item' };\n\n yearLevelItem.items.push(monthLevelItem);\n\n for (let day in mapping[year][month]) {\n const dayLeveItem = { label: day, customAttribute: 'default-item' };\n\n monthLevelItem.items.push(dayLeveItem);\n\n if (displayMode === 'calendar') {\n dayLeveItem.value = mapping[year][month][day];\n continue;\n }\n\n dayLeveItem.items = [];\n\n for (let hours in mapping[year][month][day]) {\n const hoursLevelItem = { label: '0'.repeat(2 - hours.length) + hours, items: [], customAttribute: 'default-item' };\n\n dayLeveItem.items.push(hoursLevelItem);\n\n for (let minutes in mapping[year][month][day][hours]) {\n const minutesLevelItem = { label: ':' + '0'.repeat(2 - minutes.length) + minutes, items: [], customAttribute: 'default-item' };\n\n hoursLevelItem.items.push(minutesLevelItem);\n\n for (let seconds in mapping[year][month][day][hours][minutes]) {\n const secondsLevelItem = {\n label: ':' + '0'.repeat(2 - seconds.length) + seconds,\n value: mapping[year][month][day][hours][minutes][seconds],\n customAttribute: 'default-item'\n };\n\n minutesLevelItem.items.push(secondsLevelItem);\n }\n }\n }\n }\n }\n }\n\n if (blanks) {\n treeSource.push(blanks);\n }\n\n that.dataSource = treeSource;\n }", "getDatasource(competences){\n let {dataBlob, sectionIDs, rowIDs} = this.competencesToView(competences);\n return this.state.dataSource.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs);\n }", "function createDataCollections() {\n _dataCreator.initialize();\n\n _peopleSourceData = JSON.parse(getLocalStorageObject('mockTTData.people'));\n _projectsSourceData = JSON.parse(getLocalStorageObject('mockTTData.projects'));\n _assignmentsSourceData = JSON.parse(getLocalStorageObject('mockTTData.assignments'));\n\n _peopleCollection = _this.createMapCollection({id: 'peopleCollection'});\n _projectsCollection = _this.createMapCollection({id: 'projectsCollection'});\n _assignmentsCollection = _this.createMapCollection({id: 'assignmentsCollection'});\n\n _peopleCollection.addFromObjArray(_peopleSourceData, 'id', false);\n _projectsCollection.addFromObjArray(_projectsSourceData, 'id', false);\n _assignmentsCollection.addFromObjArray(_assignmentsSourceData, 'id', false);\n\n _currentUserMap = getCurrentUserMap();\n }", "function setData() {\t\n\t\n\tvar db = Ti.Database.install('../products.sqlite','products');\n\n\tvar rows = db.execute('SELECT DISTINCT category FROM products');\n\n\t// create the array\n\tvar dataArray = [];\n\t\t\t\n\twhile (rows.isValidRow())\n\t{\n\t dataArray.push({title:'' + rows.fieldByName('category') + '', hasChild:true, path:'../products/products.js'});\n\t rows.next();\t\n\t};\n\t\n\t// set the array to the tableView\n\ttableview.setData(dataArray);\n}", "function AbstractDataSource() {}", "function createTableTemplates() {\n\t/*\n\t * Initialize the codes (from the xml in templates, the names in xml, and the transcription to cover all information)\n\t */\n\tvar done = {};\n\tif (trjs.data.codesxml) {\n\t\t/*\n\t\t * if template exists\n\t\t */\n\t\tfor (var i=0 ; i < trjs.data.codesxml.length; i++) {\n\t\t\tdone[trjs.data.codesxml[i][\"code\"]] = true;\n\t\t}\n\t} else {\n trjs.data.codesxml = {}; // creates it\n }\n\n\t/*\n\t * Initialize now codesxml with data from transcription if missing information.\n\t */\n\tfor (var i in trjs.data.codesdata) {\n\t\tif (done[i] !== true)\n trjs.data.codesxml.push({\n\t\t\t\t'code': i,\n\t\t\t\t'type': '-',\n\t\t\t\t'parent': 'none',\n\t\t\t\t'description': '',\n\t\t\t});\n\t}\n\n\t/*\n\t * Initialize the tiers (from the xml in templates, and the transcription to cover all information)\n\t */\n\tdone = {};\n\n\tif (trjs.data.tiersxml) {\n\t\t/*\n\t\t * if template exists\n\t\t */\n\t\tfor (var i=0 ; i < trjs.data.tiersxml.length; i++) {\n\t\t\tvar code = trjs.data.tiersxml[i][\"code\"];\n\t\t\tdone[code] = true;\n\t\t}\n\t} else {\n trjs.data.tiersxml = {};\n }\n\t/*\n\t * Initialize now pdata with data from transcription if missing information.\n\t */\n\tfor (var i in trjs.data.tiersdata) {\n\t\tif (done[i] !== true)\n trjs.data.tiersxml.push({\n\t\t\t\t'code': i,\n\t\t\t\t'type': trjs.data.ASSOC,\n\t\t\t\t'parent': 'main',\n\t\t\t\t'description': '',\n\t\t\t});\n\t}\n}", "_getDataSource() {\n const that = this,\n dataSource = [];\n\n function recursion(children, itemsArray) {\n for (let i = 0; i < children.length; i++) {\n const currentChild = children[i],\n dataSourceItem = { label: currentChild.label };\n\n if (currentChild.disabled) {\n dataSourceItem.disabled = true;\n }\n\n if (currentChild.selected) {\n dataSourceItem.selected = true;\n }\n\n if (currentChild.separator) {\n dataSourceItem.separator = true;\n }\n\n if (currentChild.value !== null) {\n dataSourceItem.value = currentChild.value;\n }\n\n if (currentChild instanceof JQX.TreeItem) {\n if (currentChild.shortcut) {\n dataSourceItem.shortcut = currentChild.shortcut;\n }\n }\n else {\n if (currentChild.expanded) {\n dataSourceItem.expanded = true;\n }\n\n dataSourceItem.items = [];\n recursion(currentChild.itemContainer.children, dataSourceItem.items);\n }\n\n itemsArray.push(dataSourceItem);\n }\n }\n\n recursion(that.$.mainContainer.children, dataSource);\n\n return dataSource;\n }", "function mapSource() {\n\t\n\tlet dataSelect = selectedSSP;\n\tconsole.log('New scenario: ' + selectedSSP.toLowerCase());\n\n\t// Fly to interesting location according to the selected model\n\tmap.flyTo({\n center: [85, 20],\n\t\tzoom: 4\n });\n\t\n\n\t// Add source\n\tmap.addSource(\"earthquakes\", {\n\t\ttype: \"geojson\",\n\t\tdata: \"data_\" + dataSelect.toLowerCase() + \".geojson\",\n\t\t//data: _data,\n\t\tcluster: false, // Set to true to sow clusters of points\n\t\tclusterMaxZoom: 6, // Max zoom to cluster points on\n\t\tclusterRadius: 10 // Radius of each cluster when clustering points (defaults to 50)\n\t});\n\n\tconsole.log('Data file ==> ' + \"data_\" + dataSelect.toLowerCase() + \".geojson\");\n}", "function init(){\n var selector = d3.select(\"#selDataset\");\n d3.json(\"data/samples.json\").then(incomingData => {\n var nameId = incomingData.names;\n\n //filling the dropdown list of ID's \n nameId.forEach(id => {selector.append(\"option\").text(id).property(\"value\", id);});\n \n //default ID to generate the graphs\n var defaultId = nameId[0];\n demographicInfo(defaultId);\n barChart(defaultId);\n bubbleChart(defaultId);\n });\n}", "function init(){\n d3.json(\"samples.json\").then((d) => {\n var sampleName = d.names;\n var dataset = d3.select(\"#selDataset\");\n sampleName.forEach((sample) =>{\n dataset.append(\"option\")\n .text(sample)\n .property(\"value\", sample);\n });\n \n var resultSample = sampleName[0];\n getData(resultSample);\n getDemoData(resultSample);\n });\n \n}", "setupDataSourceSelector() {\n $('.data-source').on('change', e => {\n this.resetView();\n\n if (e.target.value === 'category') {\n this.setupCategoryInterface();\n } else {\n this.setupFileInterface();\n }\n });\n }", "function createDataSourceTile(datasource) {\n var name = datasource.Name;\n var description = datasource.Description;\n\n var $datasource = $(_datasourceTileTemplate).clone(true, true);\n var $datasourceName = $datasource.find(\".data-source-name\");\n var $datasourceDescription = $datasource.find(\".data-source-description\");\n var $datasourceInfo = $datasource.find(\".data-source-info\");\n\n $datasourceName.text(name)\n .attr(\"title\", name);\n $datasourceDescription.text(description);\n $datasource.data(\"datasource\", datasource);\n\n // TODO: update when variables will be in FC.ClientState\n if (-1 !== _selectedVariable.selectedDataSources.indexOf(datasource.ID)) {\n $datasource.addClass(\"selected\");\n }\n\n $datasourceDescription.dotdotdot({\n watch: window\n });\n\n $datasource.on(\"click\", function () {\n var _datasource = $(this).data(\"datasource\");\n\n // add or remove datasource from variable selected datasources\n // TODO: find a better solution\n var index;\n if (-1 !== (index = _selectedVariable.selectedDataSources.indexOf(_datasource.ID))) {\n _selectedVariable.selectedDataSources.splice(index, 1);\n }\n else {\n _selectedVariable.selectedDataSources.push(_datasource.ID);\n }\n\n if (_selectedVariable.selected) {\n FC.state.toggleDataSource(_selectedVariable.Name, _datasource.ID);\n updateSelectedList();\n }\n\n $(this).toggleClass(\"selected\");\n });\n\n $datasourceInfo.on(\"click\", function (event) {\n event.stopPropagation();\n \n _datasourceInfoPanel.initialize(datasource);\n _datasourceInfoPanel.show();\n // TODO: show panel with data source info\n });\n\n return $datasource;\n }", "function setup() {\n // http://datamx.io/dataset/salario-minimo-historico-1877-2019\n loadTable('../../data/mx_salariominimo_1877-2019.csv', 'csv', 'header', gotData);\n createCanvas(windowWidth, windowHeight);\n}", "function initialize() {\n var dropdown = d3.select(\"#selDataset\"); \n d3.json(\"samples.json\").then((data) => {\n var sampleList = data.names; \n sampleList.forEach((sample) => {\n dropdown.append(\"option\").text(sample).property(\"value\", sample); \n \n });\n //capture sample metadata from the list\n var firstSample = sampleList[0];\n chartBuilder(firstSample); \n metadataBuilder(firstSample);\n \n }); \n }", "function initDataSourceEdit(){\n\n\tDataSourceDwr.initDataSourceTypes(function(response){\n\t\tif (response.data.types) {\n\t\t dwr.util.addOptions(\"dataSourceTypes\", response.data.types, \"key\", \"value\");\n\t\t}\n\t});\n}", "function init() {\n \n var selector = d3.select(\"#selDataset\");\n \n // Sample names to populate charts and table\n d3.json(\"samples.json\").then((data) => {\n var sampleNames = data.names;\n \n sampleNames.forEach((sample) => {\n selector\n .append(\"option\")\n .text(sample)\n .property(\"value\", sample);\n });\n \n // Default sample on opening page\n var firstSample = sampleNames[0];\n buildCharts(firstSample);\n buildMetadata(firstSample);\n });\n }", "function buildTeacherDataList() {\n let dataList = '<datalist id=\"Teachers\">';\n let dataListOptions = '';\n let teacherList = database_data.getTeachers();\n for (let name of teacherList) {\n dataListOptions += \"<option value='\"+name+\"'>\";\n }\n dataList += dataListOptions;\n dataList += '</datalist>';\n return dataList;\n}", "function buildTeacherDataList() {\n let dataList = '<datalist id=\"Teachers\">';\n let dataListOptions = '';\n let teacherList = databaseData.getTeachers();\n for (let name of teacherList) {\n dataListOptions += \"<option value='\" + name + \"'>\";\n }\n dataList += dataListOptions;\n dataList += '</datalist>';\n return dataList;\n}", "function init() {\n var selector = d3.select(\"#selDataset\");\n d3.json(\"samples.json\").then((data) => {\n var Samp_ID = data.names;\n Samp_ID.forEach((sample) => {\n selector.append(\"option\").text(sample).property(\"value\");\n });\n\n var original = Samp_ID[0];\n charts(original);\n metadata(original);\n \n });\n}", "function createInternalItemsSource() {\n internalItemsSource = options.itemsSource;\n internalItemsSource = setupSorting(internalItemsSource);\n internalItemsSource = setupFilters(internalItemsSource);\n internalItemsSource = setupIndex(internalItemsSource);\n }", "function createInternalItemsSource() {\n internalItemsSource = options.itemsSource;\n internalItemsSource = setupSorting(internalItemsSource);\n internalItemsSource = setupFilters(internalItemsSource);\n internalItemsSource = setupIndex(internalItemsSource);\n }", "function setUpDataSet(){\n \t var DS = [];\n \t for(var i = 0 ; i < 5;i++){DS.push([{Priority:''}])}\t\n \t return DS;\n }", "setDataSource() { // OK\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < this.totalAds; i++) {\n\t\t\tresult.push(i);\n\t\t}\n\t\tthis.dataSource = result;\n\t}", "function buildDemographics(id_idx) {\n let meta = samples_data.metadata[id_idx];\n let demo = [];\n // Capitalize the first letter of the label text\n // becaue it displays ugly if you don't.\n for (let key in meta) {\n let label = key[0].toUpperCase() + key.slice(1);\n let value = meta[key];\n let lbl = `${label}: ${value}`;\n demo.push(lbl);\n };\n console.log(demo);\n\n // Use d3 to create the table dynamically.\n d3.select('#sample-metadata').selectAll('*').remove();\n let ul = d3.select('#sample-metadata').append(\"ul\");\n ul.style('marginLeft' , '0px')\n ul.selectAll('li')\n .data(demo)\n .enter()\n .append('li')\n .text(d => d)\n .style('list-style', 'none')\n .style('marginLeft' , '0px')\n}", "function GraphDataSource(implementation) {\n this.getVertices = implementation.getVertices;\n this.getEdges = implementation.getEdges;\n}", "function prepareData(dataSource) {\n for (i = 0, l = dataSource.length; i < l; i++) {\n datum = dataSource[i];\n time = datum.createdAt.split('/');\n time = time.map(arrayMapStrToInt);\n time = Date.UTC(time[0],time[1]-1,time[2], time[3], time[4]);\n property = datum.testName.split('_')[1];\n\n for (j = 0; j < jl; j++) {\n renderData[j].series[property] = renderData[j].series[property] || {name: property, data : []};\n }\n for (j = 0; j < jl; j++) {\n try{\n renderData[j].series[property].data.push({\n x: time,\n y: datum.data[renderData[j].percentile][renderData[j].field],\n name: datum.taskId\n });\n } catch (e) {\n console.log(e);\n }\n\n }\n\n }\n\n updateFields(true);\n console.log(renderData);\n }", "function init() {\n\n var dropdown = d3.select('#selDataset');\n d3.json (\"data/samples.json\").then (function(data){\n data.names.forEach(function(name) {\n dropdown.append('option').text(name).property('value');\n });\n });\n // pulls the main data\n graph_charts('940');\n graph_metadata('940');\n}", "function prepareTypedata(mytypedata) {\n typelabels = [];\n $.each(mytypedata.types, function (i, types) {\n typelabels.push(types.type)\n });\n typelabels = Array.from(new Set(typelabels));\n typedata = {\n 'labels': typelabels,\n 'datasets': []\n };\n datalabels = [];\n $.each(mytypedata.types, function (i, types) {\n datalabels.push(types.site)\n });\n datalabels = Array.from(new Set(datalabels));\n $.each(datalabels, function (i, label) {\n var typedatasets = {\n \"data\": [],\n \"label\": label\n };\n typedata.datasets.push(typedatasets);\n });\n $.each(typedata.datasets, function (i, dataset) {\n $.each(typedata.labels, function (i, label) {\n dataset.data.push(0)\n });\n });\n $.each(mytypedata.types, function (i, type) {\n mysite = type.site;\n mytype = type.type;\n mycount = type.count;\n $.each(typedata.labels, function (i, label) {\n if (mytype == label) {\n myindex = i;\n $.each(typedata.datasets, function (i, dataset) {\n if (dataset.label == mysite) {\n $.each(dataset.data, function (e, data) {\n if (e == myindex) {\n dataset.data[myindex] = mycount;\n }\n });\n }\n });\n }\n })\n });\n return typedata;\n}", "function loadUdt() { \n\n window.UniversalDataTool.open({\n container: document.getElementById(\"udt\"),\n\n udt: {\n namn: document.getElementById('project-name').value,\n interface: {\n type: document.querySelector('input[name=\"rdoAnnotation\"]:checked').value,\n labels: getLabels()\n },\n samples: samples\n },\n\n // Called when sample is saved\n onSaveSample: (index, sample) => {\n samples[sample].annotation = index.annotation\n console.log(index, sample);\n\n //postToPostgreSql(index.annotation)\n }\n\n }); \n}", "function init() {\n var selector = d3.select(\"#selDataset\")\n d3.json(\"samples.json\").then((data) => {\n // console.log(importedData);\n // var data = importedData.samples;\n\n // Select the dropdown element\n var subjectIds = data.names;\n subjectIds.forEach((id) => {\n selector\n .append(\"option\")\n .text(id)\n .property(\"value\", id);\n });\n var firstSample = subjectIds[0];\n buildCharts(firstSample);\n buildMetadata(firstSample);\n });\n }", "_newDataSet(...params){\n const Type = this.options.DataSetType || DataSet;\n return new Type(...params); \n }", "static DataSource( params ) {\n return new ListViewDataSource(params);\n }", "chartDataSource(data, name, random) {\n data.map(d=>{\n if (d.canvas) {\n let number = d.canvas.className.split('_')[1];\n\n if (number === random) {\n let properties = d.components.properties;\n\n for (let i = 0; i < properties.length; i++) {\n properties[i].name === 'dataSource' ? properties[i].value = name : null;\n }\n }\n }\n });\n this.props.saveData(data);\n }", "function onCreateSpryDataSet()\n{\n\t//launch the spry xml data set\n\tvar cmdArgs = new Array();\n\tvar resArray = dwscripts.callCommand(\"SpryDataSetWizard\",cmdArgs);\n\t//refresh the data bindings \n\tdw.dbi.refresh();\n}", "function initDataSources() {\n vm.init = true;\n\n try {\n var type = REST_URI.TEIID_SERVICE;\n\n RepoRestService.getConnections(type).then(\n function (newDataSources) {\n RepoRestService.copy(newDataSources, vm.datasources);\n vm.init = false;\n },\n function (response) {\n // Some kind of error has occurred\n vm.datasources = [];\n vm.init = false;\n DialogService.basicInfoMsg(\"Failed to initialse connections from teiid.\\n\" + RepoRestService.responseMessage(response),\n \"Failure to retrieve connections\");\n });\n } catch (error) {\n vm.datasources = [];\n vm.init = false;\n DialogService.basicInfoMsg(\"Failed to initialse connections from teiid.\\n\" + RepoRestService.responseMessage(error),\n \"Failure to retrieve connections\");\n }\n\n // Removes any outdated datasource\n vm.datasource = null;\n }", "function makeGraphs(error, tourismData) {\n // first create a crossfilter, one per site\n // load the data in to the crossfilter\n var ndx = crossfilter(tourismData);\n \n // pass the crossfilter variable (ndx)\n // to the function that's going to draw the graph\n select_destination(ndx);\n show_paris_tourism(ndx);\n show_santorini_tourism(ndx);\n show_rome_tourism(ndx);\n \n // render graphs\n dc.renderAll();\n}", "async function dataFlowsCreate() {\n const subscriptionId =\n process.env[\"DATAFACTORY_SUBSCRIPTION_ID\"] || \"12345678-1234-1234-1234-12345678abc\";\n const resourceGroupName = process.env[\"DATAFACTORY_RESOURCE_GROUP\"] || \"exampleResourceGroup\";\n const factoryName = \"exampleFactoryName\";\n const dataFlowName = \"exampleDataFlow\";\n const dataFlow = {\n properties: {\n type: \"MappingDataFlow\",\n description:\n \"Sample demo data flow to convert currencies showing usage of union, derive and conditional split transformation.\",\n scriptLines: [\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: false,\",\n \"validateSchema: false) ~> USDCurrency\",\n \"source(output(\",\n \"PreviousConversionRate as double,\",\n \"Country as string,\",\n \"DateTime1 as string,\",\n \"CurrentConversionRate as double\",\n \"),\",\n \"allowSchemaDrift: true,\",\n \"validateSchema: false) ~> CADSource\",\n \"USDCurrency, CADSource union(byName: true)~> Union\",\n \"Union derive(NewCurrencyRate = round(CurrentConversionRate*1.25)) ~> NewCurrencyColumn\",\n \"NewCurrencyColumn split(Country == 'USD',\",\n \"Country == 'CAD',disjoint: false) ~> ConditionalSplit1@(USD, CAD)\",\n \"ConditionalSplit1@USD sink(saveMode:'overwrite' ) ~> USDSink\",\n \"ConditionalSplit1@CAD sink(saveMode:'overwrite' ) ~> CADSink\",\n ],\n sinks: [\n {\n name: \"USDSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"USDOutput\" },\n },\n {\n name: \"CADSink\",\n dataset: { type: \"DatasetReference\", referenceName: \"CADOutput\" },\n },\n ],\n sources: [\n {\n name: \"USDCurrency\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetUSD\",\n },\n },\n {\n name: \"CADSource\",\n dataset: {\n type: \"DatasetReference\",\n referenceName: \"CurrencyDatasetCAD\",\n },\n },\n ],\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new DataFactoryManagementClient(credential, subscriptionId);\n const result = await client.dataFlows.createOrUpdate(\n resourceGroupName,\n factoryName,\n dataFlowName,\n dataFlow\n );\n console.log(result);\n}", "function init(){\r\n \r\n buildplot(940);\r\n var testId = d3.select(\"#selDataset\");\r\n d3.json(\"js/samples.json\").then((importedData)=>{\r\n console.log(importedData);\r\n var data = importedData;\r\n var names = data.names;\r\n console.log(names);\r\n names.forEach(name=>{\r\n testId.append(\"option\").property(\"value\",name).text(name);\r\n \r\n })\r\n \r\n }); \r\n \r\n }", "function buildPlot() {\n // Use d3 to connect to the json. There will be many variation or copy and pating this specific line of code\n d3.json(sdata).then(function(sampledata){\n var mDataset = d3.select(\"#selDataset\");\n var sname= sampledata.names;\n \n // For each name in names, capture it and put it in the drop down menu\n sname.forEach((sample) => {\n mDataset\n .append(\"option\")\n .text(sample)\n .property(\"value\", sample)\n });\n})}", "_getDataSource(data: any) {\n\n let dataBlob = [];\n let sectionIDs = [];\n let rowIDs = [];\n\n // handle sections\n for (let i = 0; i < data.length; ++i) {\n sectionIDs.push(data[i].section);\n\n // handle row data\n rowIDs[i] = [];\n for (let j = 0; j < data[i].rows.length; ++j) {\n // add an unique row id\n rowIDs[i].push(dataBlob.length + j);\n }\n // append row data to dataBlob\n dataBlob.push(...data[i].rows);\n }\n\n if (!this.dataSource) {\n // initialize dataSource\n this.dataSource = new ListView.DataSource({\n getRowData: (dataBlob, sectionID, rowID) => dataBlob[rowID],\n getSectionHeaderData: (dataBlob, sectionID, rowID) => dataBlob[rowID],\n rowHasChanged: (r1, r2) => r1 !== r2,\n sectionHeaderHasChanged: (s1, s2) => s1 !== s2\n });\n }\n\n // return dataSource with generated data\n return this.dataSource.cloneWithRowsAndSections(dataBlob, sectionIDs, rowIDs);\n }", "function getDataSets (mapSource, dataSource) {\n queue()\n .defer(d3.json, mapSource)\n .defer(d3.csv, dataSource)\n .await(ready);\n }", "function init(){\n var dropDown = d3.select(\"#selDataset\");\n d3.json(\"data/samples.json\").then(data =>{\n var names = data.names;\n // console.log(names)\n names.forEach(sample => {\n dropDown.append(\"option\")\n .text(sample)\n .property(\"value\",sample);\n });\n var firstSample = names[0];\n console.log(firstSample);\n buildTable(firstSample);\n buildCharts(firstSample);\n });\n}", "function generateIdeaData()\n{\n createGraph();\n \n}", "function init() {\n d3.json(\"JS/data/samples.json\").then(d => {\n data = d;\n var selectNames = d.names;\n\n var selectData = d3.select(\"#selDataset\");\n\n selectNames.forEach(value => {\n selectData\n .append(\"option\")\n .text(value)\n .attr(\"value\", function() {\n return value;\n });\n });\n });\n}", "function setup() {\n d3.json(\"samples.json\").then((importedData) => {\n\n var data = importedData;\n var names = importedData.names;\n var metadata = importedData.metadata;\n var samples = importedData.samples;\n // var sampleData = utoData.samples;\n // console.log(dataObjects);\n console.log(data);\n console.log(names);\n console.log(metadata);\n console.log(samples);\n\n\n var innerContainer = document.querySelector('.well'),\n // plotEl = innerContainer.querySelector('#bar'),\n userSelector = innerContainer.querySelector('#selDataset');\n demoInfo = innerContainer.querySelector('#sample-metadata')\n\n function assignOptions(names, selector) {\n for (var i = 0; i < names.length; i++) {\n var currentOption = document.createElement('option');\n currentOption.text = names[i];\n selector.appendChild(currentOption);\n }\n }\n\n assignOptions(names, userSelector);\n initPlot(samples, metadata);\n });\n}", "function lsDataSources() {\n var ext = constants.DB_EXTENSION;\n var chosen = getDataSource();\n lsPretty(ext, chosen, \"database\");\n}", "function addIndividuals(){\n\n //Create temperature objects with identity arrows\n\n //Kelvin\n writer.addQuad(\n namedNode('http://ptolemy.berkeley.edu/adapters#Kelvin'),\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryObject')\n );\n\n //Celsius\n writer.addQuad(\n namedNode('http://ptolemy.berkeley.edu/adapters#Celsius'),\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryObject')\n );\n\n //Fahrenheit\n writer.addQuad(\n namedNode('http://ptolemy.berkeley.edu/adapters#Fahrenheit'),\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryObject')\n );\n\n //TODO replace this loop with inference in the repository.\n var categoryObjects = [\"Kelvin\", \"Celsius\", \"Fahrenheit\"];\n for(var i = 0; i < categoryObjects.length; i++){\n var identityArrow = store.createBlankNode('CategoryArrow');\n writer.addQuad(\n identityArrow,\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryArrow')\n );\n\n writer.addQuad(\n identityArrow,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesFrom'),\n namedNode('http://ptolemy.berkeley.edu/adapters#' + categoryObjects[i])\n );\n\n writer.addQuad(\n identityArrow,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesTo'),\n namedNode('http://ptolemy.berkeley.edu/adapters#' + categoryObjects[i])\n );\n\n writer.addQuad(\n namedNode('https://ptolemy.berkeley.edu/accessors/adapters/Identity.js'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Implements'),\n identityArrow\n );\n }\n\n //Celsius to Fahrenheit\n var cToF = store.createBlankNode('CelsiusToFahrenheit');\n writer.addQuad(\n cToF,\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryArrow')\n );\n\n writer.addQuad(\n cToF,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesFrom'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Celsius')\n );\n\n writer.addQuad(\n cToF,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesTo'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Fahrenheit')\n );\n\n writer.addQuad(\n namedNode('https://ptolemy.berkeley.edu/accessors/adapters/CelsiusToFahrenheit.js'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Implements'),\n cToF\n );\n\n //Kelvin to Fahrenheit\n var kToF = store.createBlankNode('KelvinToFahrenheit');\n writer.addQuad(\n kToF,\n namedNode('a'),\n namedNode('http://ptolemy.berkeley.edu/adapters#CategoryArrow')\n );\n\n writer.addQuad(\n kToF,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesFrom'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Kelvin')\n );\n\n writer.addQuad(\n kToF,\n namedNode('http://ptolemy.berkeley.edu/adapters#MatchesTo'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Fahrenheit')\n );\n\n writer.addQuad(\n namedNode('https://ptolemy.berkeley.edu/accessors/adapters/KelvinToFahrenheit.js'),\n namedNode('http://ptolemy.berkeley.edu/adapters#Implements'),\n kToF\n );\n\n writer.end(function (error, result){\n if(error){\n console.log(\"Error serializing output ontology: \" + error);\n }\n fs.writeFileSync(outputPath, result);\n //console.log(result)\n });\n}", "function addMapSources() {\n\tmap.addSource('coastalCounties', {\n\t\t'type': 'geojson',\n\t\t'data': 'data/counties.geojson'\n\t});\n\t\n\tmap.addSource('single-point', {\n\t\t'type': 'geojson',\n\t\t'data': {\n\t\t\t'type': 'FeatureCollection',\n\t\t\t'features': []\n\t\t}\n\t});\n}", "function init() {\n // Grab a reference to the dropdown select element\n var selector = d3.select(\"#selDataset\");\n // Use the list of sample names to populate the select options\n d3.json(\"/names\").then((sampleNames) => {\n sampleNames.forEach((sample) => {\n selector\n .append(\"option\")\n .text(sample)\n .property(\"value\", sample);\n });\n // Use the first sample from the list to build the initial plots\n const firstSample = sampleNames[0];\n buildCharts(firstSample);\n buildMetadata(firstSample);\n });\n}", "function init() {\n\n // Add dropdown option for each sample\n var dropdown = d3.select(\"#selDataset\");\n\n // Read json data\n d3.json(\"\\samples.json\").then((data)=> {\n console.log(data)\n\n // Parse and filter data to get sample names\n data.names.forEach(function(name) {\n dropdown.append(\"option\").text(name).property(\"value\");\n });\n\n // Use first sample to build metadata and initial plots\n buildCharts(data.names[0]);\n buildMetadata(data.names[0]);\n });\n\n}", "function init() {\n \n var selector = d3.select(\"#selDataset\");\n d3.json(\"samples.json\").then(function(data){\n var IDNames = data.names;\n IDNames.forEach(function(userchoice){\n selector\n .append(\"option\")\n .text(userchoice)\n .property(\"value\", userchoice);\n });\n var beginning = IDNames[0];\n ChartInfo(beginning);\n AllData(beginning);\n });\n }", "function setup() {\n var dat = new Dat(common.dat1tmp, { serve: false }, function ready(err) {\n t.notOk(err, 'no open err')\n dat.backend('leveldown-hyper', function(err) {\n t.notOk(err, 'backend should not err')\n dat.close(function(err) {\n t.notOk(err, 'no close err')\n clone()\n })\n })\n })\n }", "function init() {\n d3.json(\"samples.json\").then(function(data){\n buildPlots(data.names[0]);\n buildDemo(data.names[0]);\n })}", "function init() {\n // Select dropdown element\n let selector = d3.select(\"#selDataset\");\n // load data from sample.json\n d3.json(\"samples.json\").then(function(data) {\n console.log(data);\n\n let namesData = data.names;\n namesData.forEach(function(names) {\n selector.append(\"option\")\n .text(names)\n .property(\"value\", names)\n });\n\n let firstSample = namesData[0];\n\n // call functions to build charts and demographic info\n createChart(firstSample);\n createMetaData(firstSample);\n // createGauge(firstSample);\n });\n}", "function buildDataset() {\n\tconst datasets = [];\n\tfor (let i = 0; i < datasetLabels.length; i++) {\n\t\tconst datasetObject = {};\n\t\tdatasetObject.label = datasetLabels[i].toUpperCase();\n\t\tdatasetObject.data = datasetByLabel[datasetLabels[i]];\n\t\tdatasetObject.borderColor = colors[i];\n\t\tdatasetObject.backgroundColor = \"rgba(0,0,0,0)\";\n\t\tdatasetObject.lineTension = 0.3;\n\t\tdatasets.push(datasetObject);\n\t}\n\treturn datasets;\n}", "function buildFlowChart(data) {\n\n raw_data = data\n setupDirectorSelector(data);\n\n // create tooltip ref\n ttip = d3.select(\"#runtime-graph\") \n .append(\"div\")\n .attr(\"class\", \"tooltip\")\n .attr(\"id\", \"network-tt\")\n .style(\"opacity\", 0); // initially invisible\n \n updateFlowChart(data)\n}", "function init() {\n //Creating instances for each visualization\n \n d3.csv(\"data/timesMergedData.csv\", function (error, schoolData) {\n \n var filterChart = new FilterChart(schoolData);\n });\n }", "function createDataSet(dataRecieved){\n\n\n}", "function dataPreparation() {\n ///////////////////// COUNTRY MAPPING ////////////////////\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\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 //Attach a list of countries to the ICH elements\n\n nodes.filter(function (d) {\n return d.type === 'element';\n }).forEach(function (d) {\n d.countries = linked_to_id[d.id].filter(function (l) {\n return l.type === 'country';\n }).map(function (l) {\n return l.label;\n });\n }); //////////////////// INITIAL FILTERING ///////////////////\n\n nodes = nodes.filter(function (d) {\n //Filter out any elements that are not on the urgent list\n if (d.type === 'element') return d.meta.list === 'USL' ? true : false; //Filter out any node that is a concept that isn't of group: threat\n else if (d.type === 'concept') return d.group === 'threat' ? true : false;else return false;\n }); //filter\n //Create a node -> node id mapping: 52 ICH elements, 9 categories & 54 threats\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 }); //Second filtering based on connections\n\n nodes = nodes.filter(function (d) {\n d.degree = edges.filter(function (l) {\n return l.source == d.id || l.target == d.id;\n }).length; //Filter out any element that has 0 degrees\n\n if (d.type === 'element') return d.degree >= 1 ? true : false; //Keep all threat categories\n else if (threat_ids.indexOf(d.id) >= 0) return true;else {\n //Only keep threats that have a connection to a remaining ICH element\n var connections = edges.filter(function (l) {\n return l.source === d.id && node_by_id[l.target].type === 'element' || l.target === d.id && node_by_id[l.source].type === 'element';\n });\n return connections.length >= 1 ? true : false;\n } //else\n }); //forEach\n //Create a node -> node id mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\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 //////////////////// THREAT CATEGORIES ///////////////////\n //Connect the translations to the threat_metadata\n\n var data_translations = _translationsThreat__WEBPACK_IMPORTED_MODULE_6__[\"default\"][language].categories;\n threat_metadata.forEach(function (d) {\n return d.label = data_translations[data_translations.map(function (b) {\n return b.id;\n }).indexOf(d.id)].label;\n }); //Find the threat categories - ones that are not connected to a ICH element\n\n threats = nodes.filter(function (d) {\n //Is this id in the predefined list\n return threat_ids.indexOf(d.id) >= 0;\n }); //filter\n\n Object(_data__WEBPACK_IMPORTED_MODULE_8__[\"makeThreats\"])(threats);\n threats.forEach(function (d) {\n d.meta = threat_metadata[threat_ids.indexOf(d.id)];\n d.meta.label = d.label;\n d.title = d.meta.label;\n d.group = 'threat category';\n d.degree = 0;\n threat_by_id[d.id] = d;\n }); //forEach\n //Sort them by the id defined above\n\n threats = threats.sort(function (a, b) {\n return threat_ids.indexOf(a.id) - threat_ids.indexOf(b.id);\n }); // console.log(threats.map(d => d.label))\n // //Between 3 - 9 & 15 for weakened practice\n ///////////////////////// THREATS ////////////////////////\n\n var threat_def_ids = threat_definitions.map(function (d) {\n return d.id;\n }); //The remaining concepts are threats\n\n concepts = nodes.filter(function (d) {\n return d.type === 'element' || threat_ids.indexOf(d.id) >= 0 ? false : true;\n });\n concepts.forEach(function (d) {\n //Get this node's threat category\n var threats_connected = linked_to_id[d.id].filter(function (n) {\n return n.group === 'threat category';\n });\n if (threats_connected.length !== 1) console.log('not 1 threat category', d.id, d.label, threats_connected);\n d.threat_category = threats_connected[0].id;\n d.opacity = 1;\n d.fill = color_threat_scale(d.threat_category);\n concept_by_id[d.id] = d;\n var def = threat_def_ids.indexOf(d.id);\n d.definition = def >= 0 ? threat_definitions[def].definition : 'definition to be added';\n }); //forEach\n //Sort by the threat category and then alphabetically\n\n concepts = concepts.sort(function (a, b) {\n if (threat_ids.indexOf(a.threat_category) < threat_ids.indexOf(b.threat_category)) return -1;\n if (threat_ids.indexOf(a.threat_category) > threat_ids.indexOf(b.threat_category)) return 1;\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n }); //sort\n\n Object(_data__WEBPACK_IMPORTED_MODULE_8__[\"makeConcepts\"])(concepts);\n var concepts_other = concepts.filter(function (d) {\n return d.threat_category !== 'vocabulary_ich_1286';\n }); //Those threats connected to \"Weakened practice and transmission (categ)\"\n\n var concepts_weak = concepts.filter(function (d) {\n return d.threat_category === 'vocabulary_ich_1286';\n }); /////////////////////// ICH ELEMENTS /////////////////////\n\n elements = nodes.filter(function (d) {\n return d.type === 'element';\n });\n elements.forEach(function (d) {\n //Get the threats an element is mapped to (all of weight 2)\n var threats_connected = linked_to_id[d.id].filter(function (n) {\n return n.group === 'threat';\n });\n d.threats = threats_connected.map(function (n) {\n return n.id;\n });\n d.threats = d.threats.sort(function (a, b) {\n var a_threat = threat_ids.indexOf(concept_by_id[a].threat_category);\n var b_threat = threat_ids.indexOf(concept_by_id[b].threat_category);\n if (a_threat < b_threat) return -1;\n if (a_threat > b_threat) return 1;\n return 0;\n }); //sort\n\n d.threat_categories = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a(d.threats.map(function (l) {\n return concept_by_id[l].threat_category;\n })));\n }); //forEach\n\n ICH_num_all = elements.length; //Sort alphabetically\n\n elements = elements.sort(function (a, b) {\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n });\n } //function dataPreparation", "function dataPreparation() {\n ///////////////////// COUNTRY MAPPING ////////////////////\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\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 //Attach a list of countries to the ICH elements\n\n nodes.filter(function (d) {\n return d.type === 'element';\n }).forEach(function (d) {\n d.countries = linked_to_id[d.id].filter(function (l) {\n return l.type === 'country';\n }).map(function (l) {\n return l.label;\n });\n }); //////////////////// INITIAL FILTERING ///////////////////\n\n nodes = nodes.filter(function (d) {\n //Filter out any elements that are not on the urgent list\n if (d.type === 'element') return d.meta.list === 'USL' ? true : false; //Filter out any node that is a concept that isn't of group: threat\n else if (d.type === 'concept') return d.group === 'threat' ? true : false;else return false;\n }); //filter\n //Create a node -> node id mapping: 52 ICH elements, 9 categories & 54 threats\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 }); //Second filtering based on connections\n\n nodes = nodes.filter(function (d) {\n d.degree = edges.filter(function (l) {\n return l.source == d.id || l.target == d.id;\n }).length; //Filter out any element that has 0 degrees\n\n if (d.type === 'element') return d.degree >= 1 ? true : false; //Keep all threat categories\n else if (threat_ids.indexOf(d.id) >= 0) return true;else {\n //Only keep threats that have a connection to a remaining ICH element\n var connections = edges.filter(function (l) {\n return l.source === d.id && node_by_id[l.target].type === 'element' || l.target === d.id && node_by_id[l.source].type === 'element';\n });\n return connections.length >= 1 ? true : false;\n } //else\n }); //forEach\n //Create a node -> node id mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\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 //////////////////// THREAT CATEGORIES ///////////////////\n //Connect the translations to the threat_metadata\n\n var data_translations = _translationsThreat__WEBPACK_IMPORTED_MODULE_6__[\"default\"][language].categories;\n threat_metadata.forEach(function (d) {\n return d.label = data_translations[data_translations.map(function (b) {\n return b.id;\n }).indexOf(d.id)].label;\n }); //Find the threat categories - ones that are not connected to a ICH element\n\n threats = nodes.filter(function (d) {\n //Is this id in the predefined list\n return threat_ids.indexOf(d.id) >= 0;\n }); //filter\n\n Object(_data__WEBPACK_IMPORTED_MODULE_8__[\"makeThreats\"])(threats);\n threats.forEach(function (d) {\n d.meta = threat_metadata[threat_ids.indexOf(d.id)];\n d.meta.label = d.label;\n d.title = d.meta.label;\n d.group = 'threat category';\n d.degree = 0;\n threat_by_id[d.id] = d;\n }); //forEach\n //Sort them by the id defined above\n\n threats = threats.sort(function (a, b) {\n return threat_ids.indexOf(a.id) - threat_ids.indexOf(b.id);\n }); // console.log(threats.map(d => d.label))\n // //Between 3 - 9 & 15 for weakened practice\n ///////////////////////// THREATS ////////////////////////\n\n var threat_def_ids = threat_definitions.map(function (d) {\n return d.id;\n }); //The remaining concepts are threats\n\n concepts = nodes.filter(function (d) {\n return d.type === 'element' || threat_ids.indexOf(d.id) >= 0 ? false : true;\n });\n concepts.forEach(function (d) {\n //Get this node's threat category\n var threats_connected = linked_to_id[d.id].filter(function (n) {\n return n.group === 'threat category';\n });\n if (threats_connected.length !== 1) console.log('not 1 threat category', d.id, d.label, threats_connected);\n d.threat_category = threats_connected[0].id;\n d.opacity = 1;\n d.fill = color_threat_scale(d.threat_category);\n concept_by_id[d.id] = d;\n var def = threat_def_ids.indexOf(d.id);\n d.definition = def >= 0 ? threat_definitions[def].definition : 'definition to be added';\n }); //forEach\n //Sort by the threat category and then alphabetically\n\n concepts = concepts.sort(function (a, b) {\n if (threat_ids.indexOf(a.threat_category) < threat_ids.indexOf(b.threat_category)) return -1;\n if (threat_ids.indexOf(a.threat_category) > threat_ids.indexOf(b.threat_category)) return 1;\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n }); //sort\n\n Object(_data__WEBPACK_IMPORTED_MODULE_8__[\"makeConcepts\"])(concepts);\n var concepts_other = concepts.filter(function (d) {\n return d.threat_category !== 'vocabulary_ich_1286';\n }); //Those threats connected to \"Weakened practice and transmission (categ)\"\n\n var concepts_weak = concepts.filter(function (d) {\n return d.threat_category === 'vocabulary_ich_1286';\n }); /////////////////////// ICH ELEMENTS /////////////////////\n\n elements = nodes.filter(function (d) {\n return d.type === 'element';\n });\n elements.forEach(function (d) {\n //Get the threats an element is mapped to (all of weight 2)\n var threats_connected = linked_to_id[d.id].filter(function (n) {\n return n.group === 'threat';\n });\n d.threats = threats_connected.map(function (n) {\n return n.id;\n });\n d.threats = d.threats.sort(function (a, b) {\n var a_threat = threat_ids.indexOf(concept_by_id[a].threat_category);\n var b_threat = threat_ids.indexOf(concept_by_id[b].threat_category);\n if (a_threat < b_threat) return -1;\n if (a_threat > b_threat) return 1;\n return 0;\n }); //sort\n\n d.threat_categories = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a(d.threats.map(function (l) {\n return concept_by_id[l].threat_category;\n })));\n }); //forEach\n\n ICH_num_all = elements.length; //Sort alphabetically\n\n elements = elements.sort(function (a, b) {\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n });\n } //function dataPreparation", "function makeDataList(externalIds) {\n var dl = $('<dl>').addClass('usa-text-small')\n for (var i = 0; i < externalIds.length; i++) {\n var dt = $('<dt>').text(externalIds[i].externalIdType.name + ':')\n var dd = $('<dd>').text(externalIds[i].value)\n dl.append(dt, dd)\n }\n\n return dl\n }", "function init() {\n let dropdownMenu = d3.select(\"#selDataset\");\n // Read json data\n d3.json(\"samples.json\").then(function (response) {\n // Parse and filter data to get sample names\n let names = response.names;\n // Add dropdown option for each sample\n for (i = 0; i < names.length; i++) {\n dropdownMenu.append(\"option\").text(names[i]).property(\"value\", names[i])\n }\n let sample = names[0];\n buildMetadata(sample);\n buildCharts(sample);\n\n });\n\n}", "function init() {\n // Select dropdown menu\n var dropdown = d3.select(\"#selDataset\");\n\n // Read data\n d3.json(\"samples.json\").then((data)=> {\n // console.log(data)\n\n data.names.forEach(function(name){\n dropdown.append(\"option\").text(name).property(\"value\");\n })\n\n getPlots(data.names[0]);\n getDemoInfo(data.names[0]);\n \n })\n}", "function createData(category, sun, mon, tue, wed, thu, fri, sat) {\n return {category, sun, mon, tue, wed, thu, fri, sat}\n }", "function init() {\n var dropDownMenu = d3.select(\"#selDataset\");\n\n d3.json(\"samples.json\").then((data) => {\n \n var idNames = data.names;\n idNames.forEach((sample) => {\n dropDownMenu\n .append(\"option\")\n .text(sample)\n .property(\"value\", sample); \n });\n\n\n const firstName = idNames[0];\n horizontalBarChart(firstName);\n bubbleChart(firstName);\n getMetadata(firstName);\n });\n}", "function dataPreparation() {\n ///////////////////// COUNTRY MAPPING ////////////////////\n\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(d => {\n node_by_id[d.id] = d;\n });\n\n //What connections remain per node\n linked_to_id = {};\n edges.forEach(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\n //Attach a list of countries to the ICH elements\n nodes\n .filter(d => d.type === 'element')\n .forEach(d => {\n d.countries = linked_to_id[d.id]\n .filter(l => l.type === 'country')\n .map(l => l.label);\n });\n\n //////////////////// INITIAL FILTERING ///////////////////\n\n nodes = nodes.filter(d => {\n //Filter out any elements that are not on the urgent list\n if (d.type === 'element') return d.meta.list === 'USL' ? true : false;\n //Filter out any node that is a concept that isn't of group: threat\n else if (d.type === 'concept') return d.group === 'threat' ? true : false;\n else return false;\n }); //filter\n\n //Create a node -> node id mapping: 52 ICH elements, 9 categories & 54 threats\n node_by_id = {};\n nodes.forEach(d => {\n node_by_id[d.id] = d;\n });\n //Filter out any edges that were associated to the nodes filtered above\n edges = edges.filter(d => {\n return node_by_id[d.source] && node_by_id[d.target];\n });\n\n //Second filtering based on connections\n nodes = nodes.filter(d => {\n d.degree = edges.filter(l => l.source == d.id || l.target == d.id).length;\n //Filter out any element that has 0 degrees\n if (d.type === 'element') return d.degree >= 1 ? true : false;\n //Keep all threat categories\n else if (threat_ids.indexOf(d.id) >= 0) return true;\n else {\n //Only keep threats that have a connection to a remaining ICH element\n let connections = edges.filter(\n l =>\n (l.source === d.id && node_by_id[l.target].type === 'element') ||\n (l.target === d.id && node_by_id[l.source].type === 'element')\n );\n return connections.length >= 1 ? true : false;\n } //else\n }); //forEach\n\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(d => {\n node_by_id[d.id] = d;\n });\n\n //What connections remain per node\n linked_to_id = {};\n edges.forEach(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\n //////////////////// THREAT CATEGORIES ///////////////////\n\n //Connect the translations to the threat_metadata\n let data_translations = translations[language].categories;\n threat_metadata.forEach(\n d =>\n (d.label =\n data_translations[\n data_translations.map(b => b.id).indexOf(d.id)\n ].label)\n );\n\n //Find the threat categories - ones that are not connected to a ICH element\n threats = nodes.filter(d => {\n //Is this id in the predefined list\n return threat_ids.indexOf(d.id) >= 0;\n }); //filter\n\n makeThreats(threats);\n\n threats.forEach(d => {\n d.meta = threat_metadata[threat_ids.indexOf(d.id)];\n d.meta.label = d.label;\n d.title = d.meta.label;\n d.group = 'threat category';\n d.degree = 0;\n threat_by_id[d.id] = d;\n }); //forEach\n //Sort them by the id defined above\n threats = threats.sort(\n (a, b) => threat_ids.indexOf(a.id) - threat_ids.indexOf(b.id)\n );\n\n // console.log(threats.map(d => d.label))\n // //Between 3 - 9 & 15 for weakened practice\n\n ///////////////////////// THREATS ////////////////////////\n\n let threat_def_ids = threat_definitions.map(d => d.id);\n\n //The remaining concepts are threats\n concepts = nodes.filter(d =>\n d.type === 'element' || threat_ids.indexOf(d.id) >= 0 ? false : true\n );\n concepts.forEach(d => {\n //Get this node's threat category\n let threats_connected = linked_to_id[d.id].filter(\n n => n.group === 'threat category'\n );\n if (threats_connected.length !== 1)\n console.log('not 1 threat category', d.id, d.label, threats_connected);\n d.threat_category = threats_connected[0].id;\n\n d.opacity = 1;\n d.fill = color_threat_scale(d.threat_category);\n concept_by_id[d.id] = d;\n\n let def = threat_def_ids.indexOf(d.id);\n d.definition =\n def >= 0\n ? threat_definitions[def].definition\n : 'definition to be added';\n }); //forEach\n\n //Sort by the threat category and then alphabetically\n concepts = concepts.sort((a, b) => {\n if (\n threat_ids.indexOf(a.threat_category) <\n threat_ids.indexOf(b.threat_category)\n )\n return -1;\n if (\n threat_ids.indexOf(a.threat_category) >\n threat_ids.indexOf(b.threat_category)\n )\n return 1;\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n }); //sort\n\n makeConcepts(concepts);\n let concepts_other = concepts.filter(\n d => d.threat_category !== 'vocabulary_ich_1286'\n );\n //Those threats connected to \"Weakened practice and transmission (categ)\"\n let concepts_weak = concepts.filter(\n d => d.threat_category === 'vocabulary_ich_1286'\n );\n\n /////////////////////// ICH ELEMENTS /////////////////////\n\n elements = nodes.filter(d => d.type === 'element');\n\n elements.forEach(d => {\n //Get the threats an element is mapped to (all of weight 2)\n let threats_connected = linked_to_id[d.id].filter(\n n => n.group === 'threat'\n );\n d.threats = threats_connected.map(n => n.id);\n d.threats = d.threats.sort((a, b) => {\n let a_threat = threat_ids.indexOf(concept_by_id[a].threat_category);\n let b_threat = threat_ids.indexOf(concept_by_id[b].threat_category);\n if (a_threat < b_threat) return -1;\n if (a_threat > b_threat) return 1;\n return 0;\n }); //sort\n d.threat_categories = [\n ...new Set(d.threats.map(l => concept_by_id[l].threat_category)),\n ];\n }); //forEach\n ICH_num_all = elements.length;\n\n //Sort alphabetically\n elements = elements.sort((a, b) => {\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n });\n } //function dataPreparation", "function setup() {\n // Cache jquery selectors\n select_region_input = $( \"#select-region-input\" );\n select_type_input = $( \"#select-type-input\" );\n select_date_input = $('#select-date-input');\n select_time_input = $('#select-time-input');\n market_history_graph = $(\"#market-history-graph\");\n // Prepare auto complete\n select_region_input.autocomplete({ source: regionCompleter });\n select_type_input.autocomplete({ source: typeCompleter });\n // Prepare date and time pickers\n select_date_input.datepicker({dateFormat: 'yy-mm-dd', minDate: '2015-04-01'});\n select_time_input.timepicker({show2400: true, timeFormat: 'H:i', step: 5, useSelect: true, className: 'form-control'});\n // Prepare market history graph area\n redrawMarketHistory();\n // Redraw on resizes\n $( window ).resize(function() {\n redrawMarketHistory();\n });\n // Set defaults for selectors unless these are set in the url:\n // region = forge\n // type = tritanium\n // date = today (UTC)\n // time = now (UTC)\n var search = ekGetSearchParams();\n var sample = new Date();\n var now = new Date(search['time'] || Date.now() + sample.getTimezoneOffset() * 60 * 1000);\n select_date_input.datepicker('setDate', now);\n select_time_input.timepicker('setTime', now);\n select_region_input.val(search['region'] || 'The Forge');\n select_type_input.val(search['type'] || 'Tritanium');\n $scope.loadData();\n }", "function createSources(){\n \n var chartBackground = sources.append(\"rect3\")\n .attr(\"class\", \"chart2Background\")\n .attr(\"width\", ((width * 2)+ 34))\n .attr(\"height\", chartHeight/4)\n .attr(\"transform\", translate);\n var sourcesheadline = sources.append(\"text\")\n .attr(\"x\", 10)\n .attr(\"y\", 20)\n .attr(\"class\", \"sourceTitle\")\n .style('fill', 'white')\n .text(\"Sources and Info\");\n var sourcestext1 = sources.append(\"text\")\n .attr(\"x\", 20)\n .attr(\"y\", 60)\n .attr(\"class\", \"sourceTitle\")\n .style('fill', 'white')\n .style(\"font-size\", \".75em\" )\n .text(\"Data sources: www.nu3.de, FAO/FAOStat\");\n var sourcestext1 = sources.append(\"text\")\n .attr(\"x\", 20)\n .attr(\"y\", 80)\n .attr(\"class\", \"sourceTitle\")\n .style('fill', 'white')\n .style(\"font-size\", \".75em\" )\n .text(\"Emissions data included only concerns emissions within the fences for production of a given food source. No upstream or downstream emissions are included. \");\n var sourcestext1 = sources.append(\"text\")\n .attr(\"x\", 20)\n .attr(\"y\", 100)\n .attr(\"class\", \"sourceTitle\")\n .style('fill', 'white')\n .style(\"font-size\", \".75em\" )\n .text(\"Supplied resource data only concerns resources supplied for human food consumption. This data does not account for imports and exports.\");\n \n }", "function init(){\n\n d3.json(\"static/data/year.json\").then(function(raw) { \n console.log(\"raw data from first pull down selection\")\n console.log(raw)\n\n \n // Identifies unique years to populate pull down menu\n var teamList = raw.map(raw => raw.team);\n teamList = uniqueArray4(teamList); \n console.log(teamList);\n\n\n // populates pull down list with team names/// IT WORKS!!!! YES!!!!!!!!!\n teamList.forEach(i =>\n d3.select(\"select\")\n .append(\"option\")\n .text(i)\n .property(\"value\", i)\n );\n \n // Use the first sample from the list to build the initial plots\n var firstSample = \"ARI\";\n drawChart(firstSample);\n\n\n });\n\n\n}", "function genData() {\n var type = ['Relief Measures'];\n var unit = [' B'];\n var cat = ['Unity', 'Resilience', 'Solidarity', 'Fortitude'];\n var amt = [6.4,48.4,5.1,33];\n var desc = [\n '<h3>Unity Budget</h3><p>Delivered on 18 February 2020</p><p>The <a href=\"https://www.mti.gov.sg/COS-2020/Stabilisation-and-Support-Package\" target=\"_blank\">Stabilisation and Support Package</a> was rolled out, including S$4 billion set aside to help workers and companies weather near-term economic uncertainties due to Covid-19. The new package will include job and cash-flow support to help firms retain and retrain workers.</p>',\n '<h3>Resilience Budget</h3><p>Delivered on 26 March 2020</p><p>A slew of measures were rolled out to support businesses, sectors most affected by Covid-19 – including aviation, tourism, food services and arts & cultural sector – and help workers stay employed. For instance, qualifying commercial properties badly affected by the virus outbreak, such as hotels and serviced apartments, will pay no property tax for 2020. Various financing schemes for companies such as the <a href=\"https://www.enterprisesg.gov.sg/financial-assistance/loans-and-insurance/loans-and-insurance/enterprise-financing-scheme/overview\" target=\"_blank\">Enterprise Financing Scheme</a> and the <a href=\"https://www.enterprisesg.gov.sg/financial-assistance/loans-and-insurance/loans-and-insurance/temporary-bridging-loan-programme/overview\" target=\"_blank\">Temporary Bridging Loan Programme</a>, will also be enhanced to ensure access to credit.</p>',\n '<h3>Solidarity Budget</h3><p>Delivered on 6 April 2020</p><p>Another S$5.1 billion was earmarked to help cushion the impact of Covid-19 on Singapore. This also marked the first time the Singapore Government has released three budgets in less than two months. Additional measures, such as enhancing the <a href=\"https://www.singaporebudget.gov.sg/docs/default-source/budget_2020/download/pdf/resilience-budget-enhanced-jobs-support-scheme.pdf\" target=\"_blank\">Job Support Scheme</a> to subsidise wages and help companies keep their employees, and increasing rental waivers, were introduced.</p>',\n '<h3>Fortitude Budget</h3><p>Delivered on 26 May 2020</p><p>The central focus of this Budget, announced as Singapore prepares to open its economy after a “circuit breaker” period of almost two months, is jobs. The Government launched a new <a href=\"https://www.wsg.gov.sg/SGUnited.html\" target=\"_blank\">SGUnited Jobs and Skills Package</a> that will create more than 40,000 jobs in the public and private sectors, 25,000 traineeships and 30,000 skills training opportunities. Support for businesses were also strengthened on three fronts: cash flow, costs and credit.</p>' \n ];\n \n var dataset = new Array();\n\n for (var i = 0; i < type.length; i++) {\n var data = new Array();\n var total = 0;\n\n for (var j = 0; j < cat.length; j++) {\n var value = amt[j];\n total += value;\n data.push({\n \"cat\": cat[j],\n \"val\": value,\n \"desc\": desc[j]\n });\n }\n\n dataset.push({\n \"type\": type[i],\n \"unit\": unit[i],\n \"data\": data,\n \"total\": total\n });\n }\n return dataset;\n }", "function init() {\n // Grab a reference to the dropdown select element\n var selector = d3.select(\"#sel_dataset\");\n\n // Use the list of sample names to populate the select options\n d3.json(\"/names\").then((sampleNames) => {\n sampleNames.forEach((sample) => {\n selector\n .append(\"option\")\n .text(sample)\n .property(\"value\", sample);\n });\n // console.log(sampleNames)\n // Use the first sample from the list to build the initial plots\n const firstSample = sampleNames[0];\n buildCharts(firstSample);\n buildMetadata(firstSample);\n });\n\n changeLayout();\n}", "get data() {\n\n let result = null;\n\n // verify valid source provided\n if (this.dataSource && this.dataSource.length > 0) {\n\n // build hierarchy from flat data\n let hierarchy = stratify()\n .parentId(d => d.id.substring(0, d.id.lastIndexOf(this.delimeter)));\n\n // build nest\n let nestedData = hierarchy(this.dataSource)\n .sort((a,b) => a.id.toLowerCase().localeCompare(b.id.toLowerCase()));\n\n // calculate layout leaves\n let hierarchyData = nestedData\n .sum(d => d.value)\n .sort((a,b) => a.id.toLowerCase().localeCompare(b.id.toLowerCase()));\n\n // process for layout\n result = this.layout(hierarchyData);\n\n }\n\n return result;\n\n }", "function generateStationList() {\n database.readCurrentStations(extractionCallbackStations);\n }", "function initData() {\n var k, ki;\n for (k in availableKitInfos) {\n ki = availableKitInfos[k];\n data.kits.push({\n name: ki.name,\n url: ki.url\n });\n }\n }", "function init(){\n source = converterData.getNodeTags();\n\n $(\"#txtStart\").typeahead({ source: source });\n $(\"#txtEnd\").typeahead({ source: source });\n $(\"#ownStart\").typeahead({ source: source });\n\n\n }", "function generateCPData() {\n\n\n /* ===============================================\n FAKE TESTING LISTS\n =============================================== */\n var categories = [\n { key: \"recent\", title: \"Recently Downloaded\" },\n { key: \"dvd\", title: \"Soon on DVD\" },\n { key: \"theatre\", title: \"Soon at the Theatre\" },\n ];\n\n /*\n var movies = [\n { group: categories[1], title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" },\n { group: categories[1], title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" },\n { group: categories[1], title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" },\n ];\n */\n // var movies = [];\n\n //var newmovie = { group: \"dvd\", title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" };\n //movies.push(newmovie);\n\n /* ===============================================\n COUCH POTATO SETTINGS\n =============================================== */\n var settings = new Array();\n settings['ip'] = \"192.168.0.9\";\n\n // Couchpotato\n settings['cp_port'] = \"5050\";\n settings['cp_api'] = \"489ff22b167540a88eb65b915ff93449\";\n\n\n // Building URLS\n var cpurl = \"http://\" + settings['ip'] + \":\" + settings['cp_port'];\n var cp_list = cpurl + \"/api/489ff22b167540a88eb65b915ff93449/movie.list/\"\n\n //function getCPList() {\n var mymovies = [];\n WinJS.xhr({\n url: cp_list,\n headers: { \"Cache-Control\": \"no-cache\", \"If-Modified-Since\": \"Mon, 27 Mar 1972 00:00:00 GMT\" }\n }).done(function completed(response) {\n var json = JSON.parse(response.responseText);\n\n /*\n $.each(json.movies, function (i, movie) {\n var thetitle = movie.library.info.titles[0];\n var year = movie.library.info.year;\n var poster = movie.library.info.images.poster_original;\n // yukky dates\n var gettheatre = movie.library.info.released;\n var getdvd = movie.library.info.release_date.dvd;\n // nice dates :)\n var theatre = new Date(gettheatre);\n var dvd = new Date(getdvd);\n // convert unknown dates\n if (gettheatre == \"\") {\n theatre = \"unknown\";\n } else {\n // add theatre array\n //var output = { group: cpGroups[1], title: title, image: poster, date: theatre};\n var output = { group: \"dvd\", title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" };\n mymovies.push(output);\n }\n if (getdvd == \"\" || getdvd == \"0\") {\n dvd = \"unknown\";\n } else {\n // add dvd array\n //var output = { group: cpGroups[2], title: thetitle, image: poster, date: theatre };\n var output = { group: \"dvd\", title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" };\n mymovies.push(output);\n }\n });\n */\n\n // push to movies\n //movies = mymovies;\n //console.log(\"test: \"+mymovies);\n\n //var movies = [];\n var output = { group: \"dvd\", title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" };\n mymovies.push(output);\n console.log(mymovies);\n //return movies;\n\n }, function (error) {\n // log errors\n console.log(error);\n });\n\n //var movies = [];\n //var output = { group: \"dvd\", title: \"example 1\", year: \"2012\", poster: \"http://cf2.imgobject.com/t/p/w185/mG2lDhS7MktB4v5OkQZqrU0SBM2.jpg\", date: \"1/2/3\" };\n //movies.push(output);\n //return movies;\n\n //console.log(movies);\n //return getmovies;\n \n //}\n\n //console.log(cpRecentList[1].title);\n //return cpRecentList;\n return mymovies;\n }", "function addSourcesToPage(sources) {\n const list = document.getElementById('WaterSources');\n\n for (let i = 0; i < sources.length; i++) {\n let li = createListItem(sources[i]);\n list.appendChild(li);\n }\n}", "function init() {\n\n // read in data from json file using d3\n d3.json(\"samples.json\").then(function(data) {\n var names = Object.values(data.names);\n \n // add test samples to dropdown menu\n names.forEach((item) => {\n var row = dropdown.append(\"option\").attr(\"value\", item);\n row.text(item);\n });\n });\n \n // run plot data function\n plotData();\n\n}", "InitClass() {\n this.tpClass = 'tp.DataSource';\n }", "constructor(props){\n super(props);\n this.datatypes = ['ieq.co2','weather_station.wind.direction'];\n var uris = [];\n this.datatypes.forEach(function(element) {\n uris.push('http://35.167.180.46:8080/data/mean/' + element + '/2017-07-06T12:12:12Z/now/6h');\n });\n this.data = [];\n dataservice.multipromise(uris).then(data => {\n var self = this;\n data.forEach(function(item) {\n if (self.data.length === 0) {\n var series = item['results'][0].series;\n \t var results = series[0].values;\n var name = series[0].name;\n \t\t\tvar tempdata = [];\n \t\t\tfor (var i = 0; i < results.length; i++) {\n \t\t\t var current = results[i];\n var temppoint = { date:moment(current[0]).format(\"MMMM Do h:mm a\") };\n temppoint[name] = current[1];\n \t\t\t self.data.push(temppoint);\n \t\t\t}\n } else {\n var series = item['results'][0].series;\n \t var results = series[0].values;\n var name = series[0].name;\n for (var i = 0; i < results.length; i++) {\n var current = results[i];\n self.data[i][name] = current[1];\n }\n }\n });\n this.setState();\n });\n }", "function chart(data, d3) {\n \n // DECLARE CONTAINERS\n var lists = {\n population: [],\n emission: [],\n capita: []\n }\n\n // FETCH THE YEARS FOR TOOLTIPS\n var years = Object.keys(data.overview);\n\n // LOOP THROUGH & FILL THE LISTS\n years.forEach(year => {\n lists.population.push(data.overview[year].population);\n lists.emission.push(data.overview[year].emission);\n lists.capita.push(data.overview[year].emission / data.overview[year].population);\n });\n\n // CONVERT ARRAY DATA TO CHARTS\n generate_charts(lists, years, d3);\n}", "function initTableTiers(data) {\n\tvar s = '<thead><td class=\"textcell1\">Tiers</td><td class=\"textcell2\">Type</td><td class=\"textcell3\">Parent</td><td class=\"textcell4\"><span id=\"pmetaname\">Name</span></td><td class=\"textcell6\">Content</td><td class=\"textcell5\">Description</td></thead>';\n\ts += '<tbody>';\n if (data.length<1) {\n s += stringLineTiers('---', '', '', '', '', '');\n } else\n for (var i = 0; i < data.length; i++) {\n var c = data[i]['code'];\n var name = codeToName(c);\n s += stringLineTiers( c, data[i]['type'], data[i]['parent'], name, data[i]['contentType'], data[i]['description'] );\n }\n\ts += '</tbody>';\n\t$('#template-tier').html(s);\n}", "constructor (){\n this.templates = this.loadData((err, data) => {\n if(err){\n console.log(\"Data not loaded: \\n \" + err)\n }\n else{\n this.templates = data\n }\n })\n }", "_initRepos() {\n this._repos = {\n meal: new MealRepository(),\n meal_type: new MealTypeRepository(),\n sport: new SportRepository(),\n user: new UserRepository(),\n };\n\n this._repos.meal.addDataSource(new SQLiteMealDataSource(this._db));\n this._repos.meal_type.addDataSource(new SQLiteMealTypeDataSource(this._db));\n this._repos.sport.addDataSource(new SQLiteSportDataSource(this._db));\n this._repos.user.addDataSource(new SQLiteUserDataSource(this._db));\n }", "function init() {\n var selector = d3.select('#selDataset')\n\n //use sample names to poplate the select options\n var names = d3.json('/names').then((sampleNames) => {\n console.log(sampleNames)\n\n sampleNames.forEach((sample) => {\n selector.append(\"option\").text(sample).property(\"value\");\n });\n\n buildCharts(sampleNames[0]);\n getMetaData(sampleNames[0]);\n console.log(sampleNames[0]);\n });\n\n}", "function buildWebsiteOnStartup() {\n populateDropdown();\n d3.json(\"samples.json\").then(data => {\n buildCharts(data.names[0]);\n populateDemographicInfo(data.names[0]);\n })\n}", "function init() {\n // select dropdown menu \n var dropdown = d3.select(\"#selDataset\");\n \n // read the data \n d3.json(\"data/samples.json\").then((data)=> {\n //console.log(data)\n \n // get the id data to the dropdwown menu\n data.names.forEach(function(name) {\n dropdown\n .append(\"option\")\n .attr(\"class\",\"testSubject\")\n .text(name)\n .property(\"value\");\n });\n \n // call the functions to display the data and the plots to the page\n //updatePlotly(data.names[0]);\n getDemoData(data.names[0]);\n getPlots(data.names[0]);\n });\n }", "function buildTable(data) {\r\n // first we want to clear table (i.e. remove filters) each time the function is called \r\n // tbody.html references the table from the html file, then (\"\") is a blank string \r\n tbody.html(\"\");\r\n\r\n //forEach function takes a function and applies it to each item in the loop\r\n //we are passing 'data' (our data.js file) as the item to loop through\r\n data.forEach((dataRow) => {\r\n // in our loop, we will append the item of the loop into the <tbody> html tag and add a table row (tr)\r\n let row = tbody.append(\"tr\");\r\n // Object.values tells JavaScript to reference one object from the array of ufo sightings in data\r\n // datarow means we want those objects to go into datarow \r\n // forEach((val) specifies that we want one object per row \r\n Object.values(dataRow).forEach((val) => {\r\n // then append the object into the table using the table data <td> tag\r\n let cell = row.append(\"td\");\r\n // extract just the text from the object, so that it is stored in the table as text \r\n cell.text(val);\r\n // this is essentially looping through each value in the table row from our data file\r\n // then storing/appending it to the table\r\n });\r\n });\r\n }", "function initDashboard() {\n var dropdown = d3.select(\"#selDataset\")\n d3.json(\"samples.json\").then((data) => {\n var patientIDs = data.names;\n patientIDs.forEach((patientID) => {\n dropdown.append(\"option\").text(patientID).property(\"value\", patientID)\n })\n buildCharts(patientIDs[0]);\n populateDemoInfo(patientIDs[0]);\n });\n}", "function init () {\n var dropdownMenu = d3.select(\"#selDataset\");\n d3.json(\"samples.json\").then((data) => {\n var names = data.names;\n names.forEach(function(id) { //exercise 14.1\n dropdownMenu.append(\"option\").text(id).property(\"value\",id); \n });\n updatecharts(data.samples[0]);\n getDemoInfo(data.names[0]);\n });\n\n}", "function getData() {\n d3.json(\"samples.json\").then(data => {\n\n // retrieve data\n let samples = data.samples.map(samples => { return samples })\n let metaData = data.metadata.map(metadata => { return metadata })\n\n // filter data\n let filteredData = samples.filter(idFilter)\n let filteredMetaData = metaData.filter(idFilter)\n\n // update charts and demo info panel\n updateCharts(filteredData, filteredMetaData[0].wfreq)\n updateDemoInfo(filteredMetaData[0])\n })\n}", "function configureDataset() {\n angular.forEach(scope.config.calendar, function (month, index) {\n dataset[index] = []; // Add empty array at current month index\n configureSegments(month, index);\n });\n\n addMarkers();\n }", "function getDataSetTitles(dataChoice) {\n document.getElementById(\"title\").innerHTML = dataset[dataChoice].title;\n document.getElementById(\"description\").innerHTML = dataset[dataChoice].description;\n renderTreemap(dataset[dataChoice].url); //send json url to renderTreemap\n }", "get data() {\n\n // verify valid source provided\n if (this.dataSource && Object.keys(this.dataSource).length > 0) {\n\n let activityTypesMerged = [];\n\n // loop through keys\n for (const key in this.dataSource) {\n\n // push all activity objects into single array\n activityTypesMerged = activityTypesMerged.concat(this.dataSource[key]);\n\n }\n\n // aggregate collab/push days\n this.dataAggregateDays = rollup(activityTypesMerged,\n v => v.length,\n d => moment(d.date).format(\"YYYY-MM-DD\"),\n d => d.type\n );\n\n let dateEnd = moment(this.dateEnd);\n let dateStart = moment(this.dateStart);\n\n let weeks = [];\n\n // get list of first date of months\n while (dateStart < dateEnd) {\n\n // capture actual date iso string since moment mutates values\n let dateWeek = dateStart.format(\"YYYY-W\");\n\n // update list\n weeks.push(dateWeek);\n\n // iterate the date value\n dateStart.add(1, \"week\");\n\n }\n\n // because the time range may/may not be an entire year\n // we need to map index to iso week so we can reference the position later\n this.weekIndicies = weeks;\n\n // extract years\n this.years = [...new Set(this.weekIndicies.map(d => d.split(\"-\")[0]))];\n\n // get weekday values\n let weekdays = moment.weekdays();\n\n // shift so monday is the first day of the week\n weekdays.push(weekdays.shift());\n\n // update self\n this.weekdays = weekdays;\n\n let months = [];\n\n dateEnd = moment(this.dateEnd);\n dateStart = moment(this.dateStart);\n\n // get list of first date of months\n while (dateStart < dateEnd) {\n months.push(dateStart.format(\"YYYY-MM-DD\"))\n dateStart.add(1, \"month\")\n }\n\n // update self\n this.months = months;\n this.dataCells = this.activityTypes.map(d => this.extractActivity(d)).flat();\n\n }\n\n }", "function widgetCreated_handler(event, widget) {\n\t\t\tif (widget === vm.mainGrid) {\n\t\t\t\tvm.mainGrid.dataSource.data(vm.Studies);\n\t\t\t}\n\t\t}" ]
[ "0.6194345", "0.56481934", "0.56305754", "0.55950165", "0.55836886", "0.55239123", "0.55239123", "0.55233616", "0.55027115", "0.54727805", "0.5444461", "0.54188615", "0.5408274", "0.5348297", "0.5304993", "0.52904654", "0.5282035", "0.52758574", "0.52586293", "0.5255935", "0.5244226", "0.52432126", "0.5222755", "0.5208798", "0.5205559", "0.5200166", "0.5200166", "0.5195211", "0.5191519", "0.51792634", "0.51718867", "0.51567775", "0.5151547", "0.51504296", "0.5148599", "0.51422614", "0.51393574", "0.5136349", "0.51121914", "0.5109163", "0.51066536", "0.5105242", "0.5099909", "0.50848997", "0.507839", "0.50753427", "0.507486", "0.50621825", "0.5050769", "0.50285757", "0.50176823", "0.5016521", "0.49879065", "0.49687666", "0.49576968", "0.4951105", "0.4947672", "0.49442297", "0.4943527", "0.49433574", "0.4943135", "0.49415532", "0.4941384", "0.49372935", "0.49323112", "0.49323112", "0.4931892", "0.49315655", "0.492721", "0.49186563", "0.4917123", "0.49042964", "0.48978204", "0.48966295", "0.48914573", "0.48876062", "0.48859045", "0.48844695", "0.48837858", "0.48786637", "0.4877215", "0.48768154", "0.48744616", "0.4873259", "0.48614955", "0.4855263", "0.48549786", "0.4849059", "0.4848613", "0.48426086", "0.4840258", "0.4837709", "0.4825301", "0.48201504", "0.4820071", "0.4812862", "0.48111847", "0.48064804", "0.48034868", "0.48019162", "0.48018146" ]
0.0
-1
render each item of the list
renderRow(library) { return <ListItem library={library} />; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render(){\n\tvar src = \"\"\n\tfor(i in TodoList.items) src += ItemTemplate(TodoList.items[i]);\n\tel.innerHTML = src;\n}", "function RENDER_items(items) {\n\n }", "render() {\n this.list.innerHTML = '';\n\n startingData.forEach(item => {\n this.createDomElements(item.id);\n this.li.insertAdjacentHTML('afterbegin', item.authorLast+\", \"+item.authorFirst+\". \"+\"<i>\"+item.title+\". \"+\"</i>\"+item.publisher+\": \"+item.year+\".\");\n this.list.appendChild(this.li);\n });\n }", "function renderList( list ){\n const listPlace = document.querySelector('.container');\n \n let HTML = '';\n\n for (let i = 0; i < list.length; i++) {\n const todoItem = list[i];\n \n HTML += `\n <div class=\"item\">\n <div class=\"status ${todoItem.status}\"></div>\n <p class=\"desciption\">${todoItem.description}</p>\n <div class=\"deadline\">${todoItem.deadline}</div>\n <div class=\"actions\">\n <div class=\"action remove\">Remove</div>\n </div>\n </div>`;\n }\n return listPlace.innerHTML += HTML;;\n}", "function render(){\n todoListContent.innerHTML = \"\";\n\n if(items.length <= 0){\n todoListContent.innerHTML = \"No items in this list\";\n return;\n }\n\n //todoListContent.append(`${items.length} items`)\n\n items.forEach((item, index) => {\n const wrapper = document.createElement('template');\n wrapper.innerHTML = itemHtml(index, item);\n todoListContent.appendChild(wrapper.content.cloneNode(true));\n });\n\n}", "renderList() {\n return this.props.posts.map((post) => { // return a JSX full result\n return( // returns one piece of JSX for each iteration\n <div className=\"item\" key={post.id}>\n <i className=\"large middle aligned icon user\"></i>\n <div className=\"content\">\n <div className=\"description\">\n <h2>{post.title}</h2>\n <p>{post.body}</p>\n </div>\n </div>\n </div>\n );\n });\n }", "renderActualList( ) {\n let listItemElements = [ ];\n\n for(let listItemsId in this.state.listItems) {\n let list = this.state.listItems[listItemsId]\n\n // adding structure to ui\n listItemElements.push(\n <div className=\"item\" key={listItemsId}>\n <div className=\"item\" onClick={ ( ) => this.selectList(listItemsId) }>\n <div class=\"pull-left\"> All the things\n <div class=\"item\">\n <div class=\"itemtext\">\n I am grateful for...\n\n <h4>{list.title}</h4>\n </div>\n <button\n className=\"item\"\n onClick={ () => { this.removeListItem(listItemsId) } }\n >\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"item\">\n <div className=\"item\">\n <div className=\"item\">\n <div className=\"item\">\n\n { listItemElements }\n\n </div>\n </div>\n </div>\n </div>\n );\n }", "render() {\n return html`\n <h1 class=\"title__list\">${this.title}</h1>\n ${this.items.length === 0\n ? html`<p class=\"list__state\">${this.loading}</p>`\n : this.showList(this.items)}\n `;\n }", "render() {\n const sandwichUl = document.querySelector('.sandwich-list');\n\n // Empty the sandwichUl before adding any content to it.\n sandwichUl.innerHTML = '';\n\n this.items.forEach((sandwich) => {\n const sandwichDiv = this.createSandwichCard(sandwich);\n sandwichUl.append(sandwichDiv)\n })\n }", "function renderItems(arr) {\n return arr.map((item) => {\n const {id} = item;\n const label = props.renderItem(item);\n return (\n <li\n key={id}\n className=\"list-group-item\"\n onClick={() => props.onItemSelected(id)}\n >\n {label}\n </li>\n )\n })\n }", "render() {\n\t\tthis.$dom.empty()\n\t\tif (this.isEmpty()) {\n\t\t\tlet $label = $('<label>')\n\t\t\t$label.text('empty')\n\t\t\t$label.addClass('text-muted')\n\t\t\tthis.$dom.append($label)\n\t\t} else {\n\t\t\tfor (var sku in this.items) {\n\t\t\t\tvar li = this.items[sku]\n\t\t\t\tvar $p = this.createLineItem(li)\n\t\t\t\tthis.$dom.append($p)\n\t\t\t}\n\t\t}\n\t}", "function renderShoppingList() {\n // loop through store using map to generate html to be placed on page\n const items = STORE.map(listItemToHTML);\n // place html on page\n $('ul.shopping-list').html(items.join(''));\n}", "function renderList() {\n viewSection.innerHTML = \"\";\n counter.innerText = todoList.length;\n for(const todo of todoList) {\n const todoElement = createTodoElement(todo);\n viewSection.appendChild(todoElement);\n }\n}", "render(){\n\t\t/* Creates variables to hold properties */\n\t\tconst todoEntries = this.props.entries\n\t\tconst listItems = todoEntries.map(this.createItems)\n\n\t\treturn(\n\t\t\t/* Creates an unordered list that holds the information entered by user */\n\t\t\t<ul id = \"theList\">{listItems}</ul>\n\n\t\t)\n\t}", "function renderList(list) {\n\t\t_images = list;\n\t\tvar dom = document.getElementById(domIds.list);\n\n\t\t// Clear any previous data\n\t\tdom.innerHTML = \"\";\n\n\t\t// Build out the new DOM\n\t\tvar item, listDom = document.createElement(\"div\");\n\t\tfor (var i=0; i < list.length; i++) {\n\t\t\titem = list[i];\n\t\t\tif (item && item.id) {\n\t\t\t\tlistDom.appendChild(renderListItem(item, i));\n\t\t\t}\n\t\t}\n\n\t\tdom.appendChild(listDom);\n\t}", "render(listProducts) {\n for (const product of listProducts) {\n const divProduct = document.createElement('div');\n divProduct.classList.add('product');\n divProduct.setAttribute('id', product.id);\n\n const image = document.createElement('img');\n image.classList.add('product-image');\n image.src = product.image;\n image.setAttribute('alt', product.name);\n divProduct.append(image);\n\n const title = document.createElement('span');\n title.classList.add('product-title');\n title.innerText = product.name;\n divProduct.append(title);\n\n const price = document.createElement('span');\n price.classList.add('product-price');\n price.innerText = `$ ${product.price}`;\n divProduct.append(price);\n\n this.containerProducts.append(divProduct);\n }\n }", "renderItem(item) { return item; }", "function renderTodos () {\n for (i=0; i < todos.length; i++) {\n var todoItem = todos [i];\n var liElement = document.createElement (\"li\");\n liElement.textContent = todoItem;\n todoList.appendChild(liElement);\n }\n}", "render(){\n let {songs} = this.props;\n\n let songList = songs.map(item=>{\n return <li>Title: {item.title} <br />\n Album: {item.album} <br />\n Preview: <img src={`${item.preview_link}`} /> <br />\n ArtWork: <img src={`${item.artwork}`} /> <br />\n </li>\n })\n\n return (\n <html>\n <body>\n <div>\n <ol>\n <h3>Songs List:</h3>\n {songList}\n </ol>\n </div>\n </body>\n </html>\n )\n }", "renderItems() {\n\t\tconst requiredPlayers = this.getRequiredPlayers();\n\t\tconst items = [];\n\t\tfor(let i = 0; i < requiredPlayers; i++) {\n\t\t\titems.push(\n\t\t\t\t<li className=\"list-group-item\" key={i} style={this.itemStyle}>\n\t\t\t\t\tWaiting on player...\n\t\t\t\t</li>\n\t\t\t);\n\t\t}\n\t\treturn items;\n\t}", "renderNewList() {}", "function _drawLists() {\n let template = ''\n let lists = _store.State.lists\n let listId = ''\n\n\n lists.forEach(list => template += list.Template)\n\n document.getElementById(\"lists\").innerHTML = template\n}", "produce() {\n var listElem = [],\n uniqueKey = [];\n this.list.forEach(item => {\n var elem = <RenderElement elemkey={item.key} text={item.text} type={item.type} inlineStyleRanges={item.inlineStyleRanges}/>\n uniqueKey.push(item.key)\n listElem.push(elem)\n })\n return (this.list[0].type == \"unordered-list-item\" ? <ul key={uniqueKey.join(\"|\")}>{listElem}</ul> : <ol key={uniqueKey.join(\"|\")}>{listElem}</ol>)\n }", "function _drawLists() {\n let lists = store.State.lists;\n let template = '';\n lists.forEach(list => {\n template += list.Template;\n })\n \n document.getElementById('lists').innerHTML = template;\n}", "function _drawLists() {\n store.saveState();\n let template = \"\";\n store.State.lists.forEach((list) => (template += list.Template));\n\n document.getElementById(\"list\").innerHTML = template;\n}", "function _draw() {\n let template = \"\"\n let lists = _listService.list\n lists.forEach((list, index) => {\n template += list.getTemplate(index)\n\n })\n document.querySelector('#list').innerHTML = template\n\n}", "function render() {\n // Clean the list\n list.innerHTML = '';\n var filteredTodo = getFilteredTodos();\n var todoEls = filteredTodo.map(createTodoNode);\n todoEls.forEach(function (t) { return list.appendChild(t); });\n count.innerHTML = todoEls.length + \" items \" + (filter === FILTER.COMPLETED ? 'completed' : 'left');\n}", "function allItems() {\n JsontoHTML()\n itemtoHTML()\n }", "function render(todoItems) {\n // const sortedData = todoItems.sortby(['id'])\n const container = document.querySelector('.js-todolist');\n container.innerHTML = '';\n const todoItemsReverse = todoItems.reverse();\n // for (const todoItem of sortedData) {\n for (const todoItem of todoItemsReverse) {\n const div = document.createElement('div');\n div.innerHTML = `\n <article class=\"container box style1 right todoinput\">\n \t\t\t\t<img class=\"image fit\"src=\"images/${todoItem.data.image}\" alt=\"\" />\n \t\t\t\t<div class=\"inner\">\n \t\t\t\t\t<header>\n \t\t\t\t\t\t<h2><a href=\"#/post/${todoItem.id}\">${todoItem.data.title}</a></h2>\n \t\t\t\t\t</header>\n \t\t\t\t\t<p>${todoItem.data.todo}</p>\n \t\t\t\t</div>\n \t\t\t</article>\n\t\t\t `;\n container.appendChild(div);\n };\n }", "function renderTodoList () {\n if (!data.todo.length && !data.done.length) return;\n for (var i=0;i<data.todo.length;i++){\n addItemList(data.todo[i], 'todo');\n }\n for (var j=0;j<data.done.length;j++){\n addItemList(data.done[j], 'done');\n }\n\n}", "render() {\n let props = this.props,\n listItems = [];\n \n this.props.recipes.each((recipe, node) => {\n listItems.push(\n <RecipeListItem\n key={recipe.id}\n id={recipe.id}\n name={recipe.name}\n selected={props.selected === recipe.id}\n />\n );\n });\n \n return (\n <ol className=\"recipe-list\">\n {listItems}\n </ol>\n );\n }", "function render(leads) {\n let listItems = \"\"\n for (let i = 0; i < leads.length; i++) { //for loop goes throgh all the elememnts in the array\n // and create a new list with a tag for each item with different name and link to it \n listItems += `\n <li>\n <a target='_blank' href='${leads[i]}'> \n ${leads[i]}\n </a>\n </li>\n `\n }\n ulEl.innerHTML = listItems //in the end after loop is executed it display it all the informaton in the HTML thanks to innerHTML method\n}", "renderList() {\n let final = [];\n for (let d of this.state.data) {\n final.push(<li>{d.title}</li>)\n }\n return final;\n }", "async function render() {\n var toDoList = await axios.get(url).then(res => res.data);\n if (toDoList)\n for (let item of toDoList) {\n document.getElementById('list-item').appendChild(generatingItem(item.id, item.content));\n if (itemIndex < item.id)\n itemIndex = Number.parseInt(item.id);\n }\n else\n toDoList = [];\n}", "function renderList(items, list, cat) {\n if (list === 'noneList') {\n let output = `<div id=\"noneTitle\" class=\"container list-title-bar\"><h2>To Decide</h2><ul id='noneList' class=\"list-of-items\"></ul></div>`;\n $('#noneHolder').prepend(output);\n } else {\n let output = `<div id=\"catdTitle\" class=\"container list-title-bar\"><h2>${titles[cat]}</h2><ul id='catdList' class=\"list-of-items\"></ul></div>`;\n $('#catdHolder').prepend(output);\n }\n items.forEach(function (item) {\n createItem(item, list, cat);\n });\n}", "renderList() {\n if (this.props.items.length === 0) {\n return <li key=\"default\">No people match your search.</li>\n }\n\n const items = this.props.items.map(item => {\n return <li key={item.name}>\n <div className=\"card-list\">\n <Card className=\"card-wics\" style={{ width: '18rem' }}>\n <Card.Img variant=\"top\" src={imgs[item.imgIndex]} />\n <Card.Body>\n <Card.Title className=\"card-wics-title\">{item.name}</Card.Title>\n <Card.Text>{item.year}-{item.death}</Card.Text>\n <div>\n <Badge className=\"card-wics-badge\" id=\"badge-left\">\n {item.field}\n </Badge>\n <Badge className=\"card-wics-badge\">{item.country}</Badge>\n </div>\n </Card.Body>\n </Card>\n </div>\n </li>\n });\n\n return items;\n }", "render(){\n \n return (\n <ul>\n {this.props.list} \n </ul>\n );\n }", "onRender() {\n super.onRender();\n this.clearList();\n this.renderList();\n }", "function _drawLists() {\n let template = \"\";\n let lists = _store.Lists;\n console.log(lists);\n lists.forEach(list => {\n template += list.template;\n });\n document.querySelector(\"#lists\").innerHTML = template;\n}", "render() {\n this.$listBody = this.getBody();\n\n this._renderItems();\n this.trigger('rendered');\n\n return this;\n }", "render() {\n this.listEl.innerHTML = \"\";\n\n // Criacao de todos os elementos que serao exibidos\n this.repositories.forEach((repo) => {\n let imgEl = document.createElement(\"img\");\n imgEl.setAttribute(\"src\", repo.avatar_url);\n\n let titleEl = document.createElement(\"strong\");\n titleEl.appendChild(document.createTextNode(repo.name));\n\n let descriptionEl = document.createElement(\"p\");\n descriptionEl.appendChild(document.createTextNode(repo.description));\n\n let linkEl = document.createElement(\"a\");\n linkEl.setAttribute(\"target\", \"_blank\");\n linkEl.setAttribute(\"href\", repo.html_url);\n linkEl.appendChild(document.createTextNode(\"Acessar\"));\n\n let listItemEl = document.createElement(\"li\");\n listItemEl.appendChild(imgEl);\n listItemEl.appendChild(titleEl);\n listItemEl.appendChild(descriptionEl);\n listItemEl.appendChild(linkEl);\n\n this.listEl.appendChild(listItemEl);\n });\n }", "renderList(list, asteroid) {\n\t\tlist.innerHTML += `\n\t\t<li class=\"list-group-item d-flex justify-content-between align-items-center\">\n\t\t\t<span>${asteroid}</span>\n\t\t\t<i class=\"delete\">X</i>\n\t\t</li>`;\n\t}", "function renderList() {\n var folders = sortItems(currentFolders);\n var files = sortItems(currentFiles);\n\n $folderContents.empty();\n\n folders.forEach(function(folder) {\n renderItem(folder, true);\n });\n\n files.forEach(function(file) {\n renderItem(file, false);\n });\n\n $('[data-toggle=\"tooltip\"]').tooltip();\n $selectAllCheckbox.addClass('active');\n}", "renderItems2() {\n return this.state.data .map((item) => (\n <NewsList key={item.url} item={item} />\n ));\n }", "render(){\n\t\treturn(\n\n \n <ul className='list-group col-sm-4'>\n {this.renderList()}\n </ul>\n )\n\t }", "function displayItems(items) {\r\n const container=document.querySelector('.items');\r\n container.innerHTML=items.map(item=>createHTMLString(item)).join('');\r\n}", "renderItems() {\n let items = [];\n this.state.cartItems.map((item, i) => {\n items.push(\n <ListItem key={i} style={{ marginLeft: 0 }}>\n <Body style={{ paddingLeft: 10 }}>\n <Text style={{ fontSize: 18 }}>\n {item.Cantidad > 1 ? item.Cantidad + \"x\" : null}\n {item.item.nombreProducto}\n </Text>\n </Body>\n <Right>\n <Text\n style={{\n fontSize: 16,\n fontWeight: \"bold\",\n marginBottom: 10\n }}\n >\n $ {item.item.precioUnidadProducto}\n </Text>\n </Right>\n </ListItem>\n );\n });\n return items;\n }", "function render(){\n ulElement.innerHTML = ''\n for (i =0; i<LIST.length; i++){\n // console.log(LIST[i].name)\n if (LIST[i].status == 'false'){\n innerHTML = \n `<li>\n <i class=\"far fa-circle\" id='circle${i}'></i>\n <span id ='item${i}'>${LIST[i].name}</span>\n <i class=\"fa fa-trash\" id='${i}'></i>\n </li>`\n } else {\n innerHTML = \n `<li>\n <i class=\"far fa-dot-circle\" id='circle${i}'></i>\n <span id ='item${i}' class='done'>${LIST[i].name}</span>\n <i class=\"fa fa-trash\" id='${i}' ></i>\n </li>`\n }\n ulElement.insertAdjacentHTML('beforeend', innerHTML)\n }\n}", "function renderList(arr = listData) {\n\n list.innerHTML = '<h2 class=\"header\"><strong>Person</strong> Wealth</h2>';\n\n arr.forEach(el => {\n const markup = `\n <div class=\"person\">\n <strong>${el.name}</strong> $${formatWealth(el.wealth)}\n </div>`;\n list.insertAdjacentHTML('beforeend', markup);\n }); \n}", "function render() {\n $videogameList.empty();\n // pass allVideogames into the template function\n let videogameHtml = getAllVideogamesHtml(allVideogames);\n $videogameList.append(videogameHtml);\n }", "listBuilder(){\n for (let listItems of this.state.items){\n return <li> {this.state.items[listItems]} </li>\n }\n}", "set list(list){\n this._list = list;\n this.render()\n }", "render() {\n console.log('--Rendering First List--');\n const name = 'First list';\n const listItems = render(ListItem, this.props.listClass, name);\n return (\n <div className=\"list\">\n <h2>{name}</h2>\n { listItems }\n </div>\n );\n }", "render(){\n const { items } = this.state; \n \n return(\n <View>\n {\n items.items && items.items.map(this.renderItem)\n }\n </View>\n )\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}", "renderList() { \n \n return this.props.products.map(product => { \n \n return (\n <div className=\"item\" key = {product.id}> \n<div className=\"image\"><img src={product.product_image} /> </div> \n<div className=\"header\" >{product.product_name}</div>\n<div className=\"description\">{product.description}</div>\n <div className=\"price\">{product.price}</div>\n\n<div className=\"content\" >\n\n </div> \n \n </div>\n )\n\n }); \n \n }", "function _drawLists() {\n let template = ''\n _listService.List.forEach((list, index) => {\n template += list.getTemplate(index)\n });\n document.querySelector(\"#lists\").innerHTML = template\n}", "_renderItem(item,index)\n {\n \treturn(\n \t\t<ListItem item={item.item}/>\n \t\t)\n }", "function renderTodoList() {\n if (!data.todo.length && !data.completed.length) return;\n\n for (i = 0; i < data.todo.length; i++) {\n var value = data.todo[i];\n addItemToDOM(value);\n }\n for (j = 0; j < data.completed.length; j++) {\n var value = data.completed[j];\n addItemToDOM(value, true);\n }\n}", "function displayItems(items) {\n const contents = document.getElementById('contents');\n const html = items.map(item => createHTMLString(item));\n contents.innerHTML = items.map(item => createHTMLString(item)).join('');\n}", "render() {\n let items = [];\n for (let item of this.props.shoppingListItems) {\n items.push(\n <div>\n <div className=\"row shoppinglistitem\" key={'listitem_' + item._id} style={{ margin: '0.5rem 0 0.5rem 0' }}>\n <div className=\"col s1\">\n <input type=\"checkbox\" id={'cb_' + item._id}\n onChange={() => this.props.toggleItemCheckFunc(item._id)}\n defaultChecked={item.checked}\n />\n <label for={'cb_' + item._id} >&nbsp;</label>\n </div>\n\n {this.state.editingName && this.state.activeItemId === item._id ?\n this.renderEditNameUI() :\n <div className=\"col s7\"><span className={item.checked ? 'checkeditem' : 'uci'}>{item.title}</span></div>}\n\n <div className=\"col s4 right-align\">\n <a class=\"btn-flat itemactionbutton\" onClick={() => this.handleEditingStart(item._id, item.title)}>\n <i className=\"material-icons\">mode_edit</i>\n </a>\n <a class=\"btn-flat itemactionbutton\" onClick={() => this.props.deleteFunc(item._id)}>\n <i className=\"material-icons\">delete_forever</i>\n </a>\n </div>\n </div>\n\n <div className=\"divider\" />\n </div>);\n }\n\n return (\n <div>\n <div>{items}</div>\n </div>\n );\n }", "function render() {\n\t$(\"#content\").empty();\n\n\tfor (let i = 0; i < employeeList.length; i++) {\n\t\tlet info = employeeList[i];\n\n\t\tlet nameData = info.name;\n\t\tlet officeData = info.office;\n\t\tlet phoneData = info.phone;\n\n\t\tlet objectDiv = `<div class=\"objectDiv\"><p>Employee: ${nameData}</p><p>Office: ${officeData}</p><p>Phone Number: ${phoneData}</p></div>`\n\t\t$(\"#content\").append(objectDiv);\n\t}\n}", "function render(data) {\n\tvar lis = data.map(function(item) {\n\t\treturn html('li', item);\n\t});\n\n\tlis.push(html('li', [\n\t\thtml('button', {\n\t\t\tstyle: {\n\t\t\t\tcolor: 'red'\n\t\t\t},\n\t\t\tonclick: function(e) { //use delegator => 'ev-click:'\n\t\t\t\tdata.push('new item');\n\t\t\t\tupdateDOM();\n\t\t\t}\n\t\t}, 'Add Item')\n\t]))\n\n\treturn html('ul', lis);\n}", "function render(){\n\t\t// console.log(obj2);\n\t\t// console.log(curpage);\n\t\tvar fanye = \"\";\n\t\tobj3 = obj2.slice((curpage-1)*qty,qty*curpage);\n\t\tconsole.log(obj3);\n\t\tfor(var g=0;g<obj3.length;g++){\n\t\tfanye += '<li class=\"\">'\n\t\t+'<a href=\"\" class=\"img\" rel=\"nofollow\" target=\"_blank\">'\n\t\t+'<i class=\"today-new\"></i> '\n\t\t+'<img src=\"'+obj3[g].imgurl+'\"width=\"260px\" height=\"260px\">'\n\t\t+'</a>'\n\t\t+'<div class=\"goods-padding\">'\n\t\t+'<div class=\"coupon-wrap clearfix\">'\n\t\t+'<span class=\"price\"><b><i>¥</i>'+obj3[g].nowprice+'</b>券后</span>'\n\t\t+'<span class=\"old-price\"><i>¥</i>'+obj3[g].passprice+'</span>'\n\t\t+'<span class=\"coupon\"><em class=\"quan-left\"></em>券<b><i>¥</i>10</b><em class=\"quan-right\"></em></span>'\n\t\t+'</div>'\n\t\t+'<div class=\"title\">'\n\t\t+'<a target=\"_blank\" href=\"detail.html\">'+obj3[g].tittle\n\t\t+'</a>'\n\t\t+'</div>'\n\t\t+'<div class=\"goods-num-type\">'\n\t\t+'<div class=\"goods-type\">'\n\t\t+'<i class=\"tmall\" title=\"天猫\"></i>'\n\t\t+'</div>'\n\t\t+'</div>'\n\t\t+'</div>'\n\t\t+'</li>'\n\t\t}\n\t\t$(\".list2\").append(fanye);\n\t}", "function render (todoList) {\n renderTodoList(todoList);\n}", "render() {\n\t\treturn (\n\t\t\t<div className=\"lista-comments\" id={s.list}>\n\t\t\t\t{this.props.comments.map((comment, i) => {\n\t\t\t\t\treturn(\n\t\t\t\t\t\t<CommentsItemList {...this.props} key={()=> Math.floor(Math.random()*i*100) } i={i} comment={comment} /> \n\t\t\t\t\t); }\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}", "render (h) {\n return h(ItemList, { props: {title}})\n }", "renderItems(){\n\t\tconst props = _.omit(this.props,'todos');\n\t\treturn _.map(this.props.todos,\n\t\t\t\t\t(todo,index) => <TodosListItems key={index} {...todo} {...props}/> \n\t\t); \n\t}", "render() {\n var rows = [];\n this.props.results.forEach(function(result) {\n rows.push(<li key={result.asin}><a href={result.url}>{result.title}</a></li>);\n });\n return (\n <Container>\n <ol>\n {rows}\n </ol>\n </Container>\n );\n }", "render(){\r\n var item = document.createElement('li')\r\n var a = document.createElement('a')\r\n a.href = this.url\r\n a.innerText = this.text\r\n item.appendChild(a)\r\n // realizati aici structura HTML:\r\n /**\r\n * <li>\r\n * <a href=\"url\">text</a>\r\n * </li>\r\n */\r\n return item;\r\n }", "function List(props) {\n const items = props.items;\n const listItems = items.map(item => {\n return <div className=\"list\" key={item.key} >\n <p>\n {item.text}\n <span> <button id=\"delete\" onClick={() => props.deleteItem(item.key)}>-</button>\n </span></p>\n </div>\n })\n return (\n <div>{listItems}</div>\n )\n}", "function renderWithKeys(list) {\n return h('ul', [ list.map(item => h('li', { key: item }, item)) ])\n}", "render() {\n\t//map is a build-in for-each loop for an array\n\t//but lets you selectively add/edit/remove\n\t//on the fly while building a new array\n const listItems = this.props.names.map((friend) => {\n return <li> {friend} </li>;\n });\n\t//pass in our new <li> listItems array to our JSX\n return (\n <div>\n <h3> Friends </h3>\n <ul>\n {listItems}\n </ul>\n </div>\n );\n }", "itemList() {\n return this.state.items.map(currentitem => {\n return <Item item={currentitem} deleteItem={this.deleteItem}\n key={currentitem._id} />\n })\n }", "function renderResults(){\n resultsContent.innerHTML = '';\n viewResultsButton.innerHTML = '';\n for(let i =0; i < allItems.length; i++){\n let p = document.createElement('p');\n p.textContent = `${allItems[i].name} : ${allItems[i].clicked} / ${allItems[i].viewed}`;\n viewResultsButton.appendChild(p);\n }\n}", "function renderList(response) {\n const result = response;\n const { prev, next, data } = result;\n\n if (prev) {\n prevButton.style.display = 'initial';\n prevButton.setAttribute('data-url', prev);\n } else {\n prevButton.style.display = 'none';\n }\n if (next) {\n nextButton.style.display = 'initial';\n nextButton.setAttribute('data-url', next);\n } else {\n nextButton.style.display = 'none';\n }\n\n let str = '';\n for (let i = 0; i < data.length; i += 1) {\n str += `<p><span class=\"artistTitle\"><strong> ${data[i].artist.name} </strong> - ${data[i].title} </span><span artist=\"${data[i].artist.name}\" title=\"${data[i].title}\" id=\"${data[i].id}\" class=\"showLyrics\">Show Lyrics</span></p>`;\n }\n resultBlock.innerHTML = str;\n loadingBlock.style.display = 'none';\n}", "render() {\n\t\treturn (\n\t\t\t<div className='container' id='resume'>\n\t\t\t\t{this.state.resumeItems.map(function(item, i) {\n\t\t\t\t\t\treturn <ResumeItem key={'item-' + i} title={item.title} position={item.position} description={item.description} date={item.date} />\n\t\t\t\t\t})}\n\t\t\t</div>\n\t\t);\n\t}", "function renderLists(lists) {\n // clear everything inside <ul> with class=class-items\n classItemsList.innerHTML = '';\n\n // run through each item inside lists\n lists.forEach(function(item) {\n // check if the item is completed\n\n // make a <li> element and fill it\n // <li> </li>\n const li = document.createElement('li');\n // <li class=\"item\"> </li>\n li.setAttribute('class', 'item');\n // <li class=\"item\" data-key=\"20200708\"> </li>\n li.setAttribute('data-key', item.id);\n \n li.innerHTML = `\n ${item.name}\n <span class=\"delete-button\">x</span>\n <span class=\"delete-button \"> \n <i class=\"fa fa-edit\" id=\"icon\"></i>\n </span>\n `;\n // finally add the <li> to the <ul>\n classItemsList.append(li);\n });\n\n}", "function render(leads) {\n let listItems = \"\"\n for (let i = 0; i < leads.length; i++) {\n listItems += `\n <li>\n <a target='_blank' href='${leads[i]}'>\n ${leads[i]}\n </a>\n </li>\n `\n }\n ulEl.innerHTML = listItems\n}", "showItems() {\r\n this.generateItems();\r\n this.shuffleItems();\r\n this.items.forEach((item) => {\r\n screenDiv.appendChild(item.div);\r\n });\r\n }", "render() {\n let alarmsHtmlList = [];\n for(let i = 0; i < this.alarms.length; i++) {\n const currentAlarm = this.alarms[i];\n const alarmHtml = createAlarmHtml(currentAlarm.id, currentAlarm.alarmTime);\n alarmsHtmlList.push(alarmHtml);\n };\n const alarmsHtml = alarmsHtmlList.join(\"\\n\");\n const alarmList = document.querySelector(\"#alarmList\");\n alarmList.innerHTML = alarmsHtml;\n return true;\n }", "function _drawLists() {\n console.log(\"we made it to try and draw\")\n let template = \"\";\n store.Lists.forEach(list => (template += list.template));\n document.querySelector(\"#listArea\").innerHTML = template;\n}", "render() {\n // Filter by items that pass filtering\n let activeItems = this.props.items\n .filter( this.props.filterFunction.bind( this ) )\n\n // create items from ListItem template\n let items = activeItems.map( ( item, index ) => {\n // Pass all object properties to the template component\n return <this.props.ItemTemplate key={ 'item' + index } {...item} />\n })\n\n // Call the callback to let listeners know a filter event has taken place\n this.props.onFilter( activeItems )\n\n return (\n <ul className=\"DLR-List-container\">\n { items }\n </ul>\n )\n }", "render(){\n let posts = this.posts\n .map( posts => \n `<li data-post-id=\"${posts.id}\">\n <h3>${posts.id} - ${posts.title}</h3>\n <p>${posts.body}</hp>\n </li>`)\n\n return $(`<section>\n <hr>\n <ul>${posts.join(\"\")}</ul>\n </section>`);\n }", "function render(callback) {\n itemlist.forEach(function(value, key) {\n if(value.length != 0) {\n $('.inventar_div .no_items').fadeOut('fast').promise().done(function() {\n $(this).remove();\n if($('.inventar_div').find('.inventar_item.' + key).length === 0) {\n $('<div class=\"inventar_item '+key+'\" draggable=\"true\" ondragstart=\"drag(event)\"><span class=\"item_number strokeme\">'+value.length+'</span></div>').appendTo('.inventar_div').show('slow');\n } else {\n $('.inventar_item.'+key+' .item_number').html(value.length);\n }\n });\n } else {\n $('.inventar_item.'+key).hide('slow', function() { $(this).remove(); });\n }\n });\n\n return callback();\n }", "function renderList() {\n //use a for loop to render the list items\n var html = \"\"\n for (let i = 0; i < arr.length; i++) {\n\n if (arr[i].isCompleted) {\n html += `<li class=\"todo-list-item completed\" id=${i}>${arr[i].task}</li>`\n } else {\n html += `<li class=\"todo-list-item\" id=${i}>${arr[i].task}</li>`\n }\n }\n todoList.innerHTML = html\n}", "function _renderList(caseSensitive){\n\t\t\t_clear();\n\n\t\t\tlet rerenderOnEachItem = false;\n\t\t\tlet $listItems = $([]);\n\t\t\tconst textFilter = _formatText(caseSensitive, _$filter.val())\n\n\t\t\t_items.forEach( item => {\n\t\t\t\tconst text = _formatText(caseSensitive, item.text)\n\t\t\t\tif(text.indexOf(textFilter) != -1){\n\t\t\t\t\tlet $listItem = _addItem(item, rerenderOnEachItem);\n\t\t\t\t\t$listItems = $listItems.add( $listItem );\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t_$content.append( $listItems );\n\t\t\t_$content.one('click', function (event) {\n\t\t\t\tconst item = $(event.target).data('item')\n\t\t\t\t_properties.onSelect(item, event);\n\t\t\t\t_onSelectCallback( item );\n\t\t\t\thide(event);\n\t\t\t});\n\t\t\tlet popupHeight = _calculatePopupHeight();\n\t\t\tlet titleHeight = _$title.outerHeight();\n\t\t\t_$content.outerHeight( (popupHeight - titleHeight) );\n\t\t}", "function render(leads) {\n let listItem = \"\"; \n\n for(let i = 0; i < leads.length; i++) {\n // console.log(myLeads[i]);\n \n // 1) == Primera forma == \n /* ulEl.textContent += myLeads[i]; */\n /* ulEl.innerHTML += `<li>${myLeads[i]}</li>`; */\n /* ulEl.style.fontSize = `20px`; */\n /* ulEl.style.fontWeight = \"700\"; */\n \n // 2) ===== forma de hacer / CREAR UN ELEMENTO ==== :\n /* const li = document.createElement(`li`); */\n /* li.textContent = myLeads[i]; */\n /* // == Method / element == */\n /* ulEl.append(li); */\n\n // 3 ) == extra forma ==\n // < ==== Se llama TEMPLATE STRING = `${}` === >\n listItem += `<li><a href=\"${leads[i]}\" target=\"_blank\">${leads[i]}</a></li>`; \n //listItem += \"<li><a target='_blank' href='\" + myLeads[i] + \"'>\" + myLeads[i] + \"</a></li>\"\n console.log(listItem); \n ulEl.innerHTML = listItem; \n ulEl.style.fontSize = `20px`; \n ulEl.style.fontWeight = \"700\"; \n ulEl.style.margin = `20px 0`; \n } \n\n}", "function renderizado() {\n listaNombres.innerHTML=''\n nombres.forEach( ( item ) => {\n const html = `<li>${item}</li>`;\n listaNombres.innerHTML += html;\n })\n}", "render() {\n let tiles = [];\n for (let i = 0; i < this.props.products.length; i++) {\n const current_item = this.props.products[i];\n tiles.push(this.renderTile(current_item));\n }\n return tiles;\n }", "function render(){\n var contenL1 = document.getElementById('todo-list-map');\n var arrTodoHtml =todo.map(function(item,i){\n return '<li class =\"list-group-item\" id =\"li-map-'+i+'\">' + item + ' ' \n + '<button class =\"btn btn-outline-secondary _btn-delete\" onclick=\"deleteTodo('+i+')\">Delete</button></li>';\n });\n var content = arrTodoHtml.join('');\n contenL1.innerHTML=content;\n }", "renderList() {\n const lineDistance = this.opts.get('lineDistance');\n const itemCount = this.innerHeight / lineDistance;\n\n for (let i = 1; i <= itemCount; i += 1) {\n const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n text.setAttribute('class', 'list-item');\n text.setAttribute('font-size', this.opts.get('listFontSize'));\n text.setAttribute('text-anchor', 'start');\n text.setAttribute('dominant-baseline', 'central');\n text.setAttribute('mask', `url(#${this.id}_clip)`);\n text.setAttribute('x', this.xOffset + lineDistance / 8);\n text.setAttribute('y', lineDistance * i + this.yContentOffset - lineDistance * 0.5);\n text.textContent = this.getListChars(i);\n this.root.appendChild(text);\n }\n }", "renderListItems(items) {\n if (!items) return null;\n return items.map(item => (\n <ListItemInfo\n key={item.id}\n item={item}\n itemsNumber={items.length}\n campaignId={this.props.campaignId}\n redirectToItemPage={this.redirectToItemPage}\n />\n ));\n }", "function renderUserList(data) {\n let rawHTML = ''\n data.forEach((item) => {\n // title, image\n // title, image, id\n rawHTML += `\n <div class=\"col-sm-3\">\n <div class=\"mb-2\">\n <div class=\"card\">\n <img src=\"${item.avatar}\" class=\"card-img-top\" alt=\"Movie Poster\">\n <div class=\"card-body\">\n <h4 class=\"card-title text-center\">${item.name} ${item.surname}</h4>\n </div>\n <div class=\"card-footer text-center\">\n <button class=\"btn btn-primary btn-show-user\" data-toggle=\"modal\" data-target=\"#user-modal\" data-id=\"${item.id}\">了解更多</button>\n <button class=\"btn btn-info btn-favorite-user\" data-id=\"${item.id}\">+\n </button>\n </div>\n </div>\n </div>\n </div>`\n })\n dataPanel.innerHTML = rawHTML\n}", "_renderStorage() {\n this._messageChecker();\n this.listCollection.forEach((list) => this._renderListPreviewMarkup(list));\n }", "function renderTodos() { //fução de renderização de 'to do'\n for (todo of todos) { //apliquei o 'for...of' para percorrer o array acima, criando a variável todo \n var todoElement = document.createElement('li'); //criei var todoElement que cria elementos dentro da ul\n var todoText = document.createTextNode(todo);//todos os elementos todo(criados na lista) serão armazenados em todoText\n \n todoElement.appendChild(todoText);\n listElement.appendChild(todoElement);\n }\n}", "function refreshUI(list) {\n var lis = '';\n for (var i = 0; i < list.length; i++) {\n lis += '<p data-key=\"' + list[i].key + '\">' + list[i].name + ' ' + genLinks(list[i].key, list[i].name) + '</p>';\n };\n document.getElementById('itemList').innerHTML = lis;\n}", "function viewTodoListDom() {\n //clear list of items before render\n list.innerHTML = \"\";\n for (let i = 0; todoItemsOjb.todoItemsRender.length > i; i++) {\n addToDoItemDom(todoItemsOjb.todoItemsRender[i]);\n }\n}", "render1(lectLst) {\n var rootNode = this.rootNode;\n document.getElementById(rootNode.id + \"_childs\").innerHTML = \"\";\n rootNode.visible = true;\n\n for (var i in lectLst) {\n this.addLectItem(rootNode, lectLst[i]);\n }\n }", "function renderList(item1, item2, item3) {\n const newList = document.createElement('ul')\n newList.appendChild(renderListItem(\"Name\", item1))\n newList.appendChild(renderListItem(\"Age\", item2))\n newList.appendChild(renderListItem(\"Favorite Color\", item3))\n\n return newList\n}", "render() {\n return (\n <ul className=\"list-group col-sm-4\">\n {this.renderList()}\n </ul>\n )\n }" ]
[ "0.7597431", "0.7404374", "0.7206154", "0.7074272", "0.6993032", "0.686644", "0.6822903", "0.6785409", "0.67713", "0.67653006", "0.6751877", "0.6747998", "0.6741834", "0.67129725", "0.6702518", "0.6686796", "0.6661745", "0.66526586", "0.6647235", "0.66272837", "0.6626742", "0.661607", "0.6613258", "0.66105455", "0.6603985", "0.65919805", "0.6591677", "0.65863246", "0.6575574", "0.65703183", "0.6560367", "0.655413", "0.6540656", "0.65384275", "0.6526946", "0.6507987", "0.65057164", "0.64944834", "0.6482509", "0.64695287", "0.6461242", "0.64439565", "0.64392895", "0.643841", "0.6423332", "0.6419502", "0.6417908", "0.64164853", "0.64087707", "0.6406372", "0.6405048", "0.640366", "0.64015037", "0.63924253", "0.6391375", "0.6381259", "0.63788855", "0.63786423", "0.6372769", "0.63663906", "0.63609326", "0.63582873", "0.63568497", "0.6355603", "0.63544744", "0.63541937", "0.6352992", "0.63482326", "0.6346977", "0.6344396", "0.6335448", "0.6334576", "0.6330328", "0.6326525", "0.6323543", "0.6320475", "0.6316889", "0.6316667", "0.6301414", "0.6300222", "0.6299848", "0.6297641", "0.6280058", "0.6277711", "0.62772846", "0.6272951", "0.6261603", "0.62589335", "0.62569803", "0.6254008", "0.6252333", "0.62483704", "0.6247314", "0.62373936", "0.6234881", "0.6234439", "0.6233986", "0.6230916", "0.62307245", "0.62286377", "0.62235487" ]
0.0
-1
heart of the code detects slider clicks and mouseovers, and updates the map accordingly
function brushed() { // get click location var value = brush.extent()[0]; if (d3.event.sourceEvent) { // not a programmatic event value = x.invert(d3.mouse(this)[0]); brush.extent([value, value]); } // set slider location handle.attr("cx", x(value)); // update the date in the legend svg.selectAll(".date-label").text(dateLabel(value)); // get the north and south totals var north=svg .selectAll(".unit") .data(states.features) .filter(function(d) { return d.properties.ID=="ak_state";})[0][0].__data__; var south=svg .selectAll(".unit") .data(states.features) .filter(function(d) { return d.properties.ID=="hi_state";})[0][0].__data__; var snorth=students(north,value); var ssouth=students(south,value); // do the update svg.selectAll(".n-label").text("North: "+snorth+" ("+(snorth/(snorth+ssouth)*100).toFixed(2)+"%)"); svg.selectAll(".s-label").text("South: "+ssouth+" ("+(ssouth/(snorth+ssouth)*100).toFixed(2)+"%)"); // connect svg elements to their data svg.selectAll(".unit") .data(states.features) // determine if state should be active now .classed("active", function(d) { return (new Date(d.properties.START_DATE)) <= value && value <= (new Date(d.properties.END_DATE)); }) // determine the color to make a state based on the number of students // only adds and removes the legend colors .attr("class",function(d) { var ns=students(d,value); var curheat=Math.ceil(students(d,value)*legendScaleStep); if (ns==0) { curheat=0; } var curclasses=d3.select(this).attr("class").replace(/heatLevel[0-9]*/g,''); var newclasses=curclasses+" heatLevel"+curheat; return newclasses; }) // shows and hides tooltip based on mouse movement .on("mousemove", function(d, i) { var mouse = d3.mouse(d3.select("body").node()); tooltip.classed("hidden", false) .attr("style", "left:" + (mouse[0] + 10) +"px; top:" + (mouse[1] - 100) + "px") .html( "<h4>" + d.properties.FULL_NAME + "</h4><p><strong>Students:</strong> " + students(d,value) + "</p><p><strong>Cumulative:</strong> " + cstudents(d,value)+"</p>" ); }) .on("mouseout", function(d, i) { tooltip.classed("hidden", true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function placeMapButtons() {\n var baseLayerDiv = $(\"#\" + mapTools.baseLayer.div);\n var baseLayerImg = $(\"#\" + mapTools.baseLayer.idimg);\n var regionsDiv = $(\"#\" + mapTools.regions.div);\n var uploadedmapDiv = $(\"#\" + mapTools.uploadedmap.div);\n baseLayerDiv.click(function () {\n if (baseLayerImg[0].getAttribute(\"src\") == mapTools.baseLayer.srcSat) {\n baseLayerImg[0].setAttribute(\"src\", mapTools.baseLayer.srcPhys)\n espMap.setVisibleId(1, true);\n espMap.setVisibleId(0, false);\n } else {\n baseLayerImg[0].setAttribute(\"src\", mapTools.baseLayer.srcSat);\n espMap.setVisibleId(1, false);\n espMap.setVisibleId(0, true);\n }\n });\n baseLayerDiv.mouseover(function () {\n baseLayerDiv.css({ \"opacity\":1,\"filter\":\"alpha(opacity=100)\" });\n });\n baseLayerDiv.mouseout(function () {\n baseLayerDiv.css({ \"opacity\": 0.75, \"filter\": \"alpha(opacity = 75)\" });\n });\n regionsDiv.click(function () {\n espMap.setVisible(ogclinks.region.name, !espMap.isVisible(ogclinks.region.name));\n });\n regionsDiv.mouseover(function () {\n regionsDiv.css({ \"opacity\": 1, \"filter\": \"alpha(opacity=100)\" });\n });\n regionsDiv.mouseout(function () {\n regionsDiv.css({ \"opacity\": 0.75, \"filter\": \"alpha(opacity = 75)\" });\n });\n uploadedmapDiv.mouseover(function () {\n uploadedmapDiv.css({ \"opacity\": 1, \"filter\": \"alpha(opacity=100)\" });\n });\n uploadedmapDiv.mouseout(function () {\n uploadedmapDiv.css({ \"opacity\": 0.95, \"filter\": \"alpha(opacity = 95)\" });\n });\n uploadedmapDiv.hide();\n var sliderDiv = $(\"#div_slider\");\n sliderDiv.slider({\n value: 0\n , min: 0\n , max: 1\n , step: 0.1\n , change: function (event, ui) {\n espMap.setOpacity(\"esp\", 1 - ui.value);\n }\n , slide: function (event, ui) {\n $(\"#divopacity\").html(Math.round((1 - ui.value)*10)/10);\n }\n });\n}", "static onMapMousedown() {\n store.dispatch(mapMousedown())\n }", "function _mapClick() {\n infoBoxManager.turnOffInfoBoxStates();\n infoBoxManager.updateInfoBoxState(_overMarker, 0);\n}", "function processClick(event){\n\n\tvar x = event.x;\n\tvar y = event.y;\n\tvar canvas = document.getElementById(\"US-Map\");\n\tvar rect = canvas.getBoundingClientRect();\n\tx -= rect.left;\n\ty -= rect.top\n\ty = rect.height - y;\n\t// console.log(x + \", \" + y);\n\tvar longInterval = rect.width / USAHorizonScale;\n\tvar latInterval = rect.height / USAVerticalScale;\n\tvar xCoord = Math.floor(x / longInterval);\n\tvar yCoord = Math.floor(y / latInterval);\n\t// console.log(xCoord + \", \" + yCoord);\n\t\n\n\tif(autoFeedPosition){\n\t\tconsole.log(\"AUTO FEEDING\");\n\t\txCoord = event.x;\n\t\tyCoord = event.y;\n\t\tautoFeedPosition = false;\n\t}\n\n\n\tvar finalPos = xCoord + yCoord * USAHorizonScale;\n\n\n\n\n\n\tt_lastClickPosition = finalPos;\n\tconsole.log(xCoord + \", \" + yCoord);\n\tif(tempMapGrid === null){\n\t\treturn;\n\t}\n\tdrawMap(tempMapGrid, finalPos);\n\tpauseChronoAnimation();\n\tlocation.href = \"#\";\n\tlocation.href = \"#selectedAreaInfo\";\n\t// console.log(finalPos);\n\t// console.log(tempMapGrid[finalPos]);\n\tupdateTableValueDisplay();\n\n\n\tif(tempMapGrid[finalPos].length === 0){\n\t\t//No entries in region\n\t\talert(\"No entries in the selected region\");\n\t\tdocument.getElementById(\"selectedAreaInfo\").style.display = \"none\";\n\t\tdocument.getElementById(\"massCategoryLineChart\").style.display = \"none\";\n\t\treturn;\n\t}\n\n\tvar nextPredictedForArea =parseFloat(getNewestMeteorite(tempMapGrid[finalPos])[year].getFullYear()) + parseFloat((1 / getAverageMeteoritesPerYear(tempMapGrid[finalPos])).toFixed(0));\n\tvar nextPredictedForUSA = parseFloat(getNewestMeteorite(getAmericanMeteorites())[year].getFullYear()) + parseFloat((1 / getAverageMeteoritesPerYear(getAmericanMeteorites())).toFixed(0));\n\tupdate(\"SubsetLabel\", getRegionLabel(xCoord, yCoord) + \" (\" + convertAreaLabelToReference(getRegionLabel(xCoord, yCoord)) + \")\");\n\tupdate(\"SubsetNewest\", getNewestMeteorite(tempMapGrid[finalPos])[name] + \" (\" + getNewestMeteorite(tempMapGrid[finalPos])[year].getFullYear() + \")\");\n\tupdate(\"SubsetOldest\", getOldestMeteorite(tempMapGrid[finalPos])[name] + \" (\" + getOldestMeteorite(tempMapGrid[finalPos])[year].getFullYear() + \")\");\n\tupdate(\"SubsetIQR\", getInterquartileRange(tempMapGrid[finalPos]).lower + \"g to \" + getInterquartileRange(tempMapGrid[finalPos]).upper + \"g\");\n\tupdate(\"SubsetAverageMass\", getAverageMass(tempMapGrid[finalPos]).toFixed(3) + \"g\");\n\tupdate(\"USAverageMass\", getAverageMass(getAmericanMeteorites()).toFixed(3) + \"g\");\n\tupdate(\"SubsetMassRangeExpectation\", getMassGroupLabel(getMassRangeExpectation(categorizeByMass(tempMapGrid[finalPos]), tempMapGrid[finalPos].length)));\n\tupdate(\"USMassRangeExpectation\", getMassGroupLabel(getMassRangeExpectation(categorizeByMass(getAmericanMeteorites()), getAmericanMeteorites().length)));\n\tupdate(\"SubsetStandardDeviation\", getStandardDeviation(tempMapGrid[finalPos]).toFixed(3) + \"g\");\n\tupdate(\"USStandardDeviation\", getStandardDeviation(getAmericanMeteorites()).toFixed(3) + \"g\");\n\tupdate(\"SubsetMeteoritesPerYear\", getAverageMeteoritesPerYear(tempMapGrid[finalPos]).toFixed(3));\n\tupdate(\"USMeteoritesPerYear\", getAverageMeteoritesPerYear(getAmericanMeteorites()).toFixed(3));\n\tupdate(\"SubsetAmpyPercentile\", getPercentileAMPY(tempMapGrid, finalPos) + getOrdinalEnding(getPercentileAMPY(tempMapGrid, finalPos)));\n\tupdate(\"SubsetEntries\", tempMapGrid[finalPos].length);\n\tupdate(\"USEntries\", getAmericanMeteorites().length);\n\tupdate(\"SubsetPredictedTime\", nextPredictedForArea);\n\tupdate(\"SubsetChanceNextYear\", getChanceOfNextInXYears(tempMapGrid[finalPos], 1.0).toFixed(4));\n\tupdate(\"SubsetChanceNext5Years\", getChanceOfNextInXYears(tempMapGrid[finalPos], 5.0).toFixed(4));\n\tupdate(\"SubsetDangerRank\", findRankOfDangerousnessOfArea(finalPos) + getOrdinalEnding(findRankOfDangerousnessOfArea(finalPos)) + \" out of \" + (USAHorizonScale * USAVerticalScale));\n\t\n\tupdate(\"USAOldest\", getOldestMeteorite(getAmericanMeteorites())[name] + \"(\" + getOldestMeteorite(getAmericanMeteorites())[year].getFullYear() + \")\");\n\tupdate(\"USANewest\", getNewestMeteorite(getAmericanMeteorites())[name] + \"(\" + getNewestMeteorite(getAmericanMeteorites())[year].getFullYear() + \")\");\n\tupdate(\"USAIQR\", getInterquartileRange(getAmericanMeteorites()).lower + \"g to \" + getInterquartileRange(getAmericanMeteorites()).upper + \"g\");\n\tupdate(\"USAPredictedTime\", nextPredictedForUSA);\n\tupdate(\"USAChanceNextYear\", getChanceOfNextInXYears(getAmericanMeteorites(), 1.0).toFixed(4));\n\tupdate(\"USAChanceNext5Years\", getChanceOfNextInXYears(getAmericanMeteorites(), 5.0).toFixed(4));\n\tdocument.getElementById(\"selectedAreaInfo\").style.display = \"block\";\n\tupdateMassDistributionGraph(document.getElementById(\"distributionMode\").value, tempMapGrid[finalPos], \"massDistributionChartSubset\", getRegionLabel(xCoord, yCoord));\n\tupdateMassDistributionGraph(document.getElementById(\"distributionMode\").value, getAmericanMeteorites(), \"massDistributionChartUSA\", \"USA\");\n\tcreateMultiLineMassChart(tempMapGrid[finalPos]);\n\t\n\thighlightDangerRankInListing(getRegionLabel(xCoord, yCoord));\n\t// console.log(finalPos + \" FAIL: \" + translateIndexToCoords(finalPos, USAHorizonScale, USAVerticalScale))\n\n}", "function mapLayerChanged(e) {\n\t // console.log(e.type + \" \" + e.layer.name + \" \" + e.property);\n\t if (vectors) vectors.removeAllFeatures();\n\t if (e.layer && document.getElementById('overlayRadio' + e.layer.name))\n\t document.getElementById('overlayRadio' + e.layer.name).checked = true;\n\t setResults();\n\t }", "handleMapClick(event) {\n //this.toggleHover(-1);\n }", "function redrawMap(slider) {\r\n var lateYear = $(\".lateYear\").first().val();\r\n var earlyYear = $(\".earlyYear\").first().val();\r\n if (slider === 'late' || slider === 'both') {\r\n ['map', 'flickerMap', 'map2'].forEach(function (key) {\r\n var lateLayer = getDataTileLyr(lateYear);\r\n lateLayer.addTo(lyrGroups[key].data);\r\n });\r\n }\r\n if (slider === 'early' || slider === 'both') {\r\n ['flickerMap', 'map1'].forEach(function (key) {\r\n var earlyLayer = getDataTileLyr(earlyYear);\r\n earlyLayer.addTo(lyrGroups[key].data);\r\n });\r\n }\r\n\r\n ['map3'].forEach(function (key) {\r\n var earlyLayer = getDataTileLyr(earlyYear);\r\n var lateLayer = getDataTileLyr(lateYear);\r\n earlyLayer.addTo(lyrGroups[key].data);\r\n lateLayer.addTo(lyrGroups[key].data);\r\n });\r\n\r\n removeOldTiles();\r\n updateOpacity();\r\n\r\n var dataLayers = lyrGroups.map3.data.getLayers();\r\n var leftSwipe = dataLayers[0];\r\n var rightSwipe = dataLayers[1];\r\n sideBySide.setLeftLayers(leftSwipe);\r\n sideBySide.setRightLayers(rightSwipe);\r\n}", "function eventClick(calEvent, jsEvent, view) {\n var item = getItem(calEvent.itId);\n map.SetCenter(new VELatLong(item.data.location.lat, item.data.location.long));\n map.SetCenter(new VELatLong(item.data.location.lat, item.data.location.long));\n var index = itinerary.indexOf(calEvent.itId) + 1;\n var pins = $(\".pinpos\");\n for (var i = 0; i < pins.length; i++) {\n \tif ($(pins[i]).text() == index) {\n \t\t$(pins[i]).mouseover();\n \t}\n }\n}", "function updateMap(year) {\n\n /* TASK 1 */\n // FILTER THE DATA\n // Filter shootingsData to only select data from the year\n // passed through the parameter named 'year' in updateMap(year)\n\n\n\n\n\n\n\n /* TASK 2 */\n // UPDATE THE DATA\n // Use the enter/update/exit pattern to redraw the points\n // on the map, using the filtered data from Step 1 above\n // Note: use the 'id' property for your key accessor function (why?)\n\n\n\n\n\n\n\n\n // Update the year label\n // (You don't need to do anything here)\n yearLabel.text(year);\n \n /* TASK 3 */\n // BIND TOOLTIP\n // Create a tooltip mouseover event for all the circles now drawn\n // in the map after you complete the enter/update/exit pattern;\n // the tooltip should display the location of the incident ('d.location').\n // Note: var 'tooltip' has already been defined elsewhere in the code,\n // so you only need to create the mouseover/mouseout event here\n\n\n\n \n\n\n\n\n }", "_onMapClicked() {\n if(this._listener) {\n this._listener.mapClicked();\n }\n }", "function onMapClick(e) { \n\thidePopupsAndOpenDivs();\n\tclassListAdd(document.getElementById('crosshair1'),'hidden');\n\tclassListAdd(document.getElementById('crosshair2'),'hidden');\n\tif(document.documentElement.clientWidth<900){hideUpperIslands();}\n\tmapObj.postLatLng = mapObj.map.getCenter();\n\tmapObj.recenterLatLng = mapObj.map.getCenter();\n\tmapObj.popup.options.maxWidth=setPopupWidth(.84);\n\tmapObj.popup.options.minWidth=setPopupWidth(.84);\n\tmapObj.popup\n\t\t.setLatLng(mapObj.map.getCenter())\n\t\t.setContent(postInputDiv())\n\t\t.openOn(mapObj.map);\n\thideConfirmDel();\n\tclassListRemove(document.querySelectorAll('.leaflet-popup-close-button')[0],'hidden');\n\tif(document.documentElement.clientHeight < 600){hideLowerIslands();}\n}", "function initImageMap() {\r\n $('#imageMap>area').each((_, area) => {\r\n let map = $(area).attr('title');\r\n $(area).off('click').on('click', (_) => {\r\n selectMap(map);\r\n })\r\n });\r\n}", "function setEventListeners() {\n var checkboxSmallLayers = [[$(\"[name='FWS']\"), 'fws'],\n [$(\"[name='NPS']\"), 'nps'],\n [$(\"[name='FS']\"), 'fs'],\n [$(\"[name='BLM']\"), 'blm'],\n [$(\"[name='wilderness-checkbox']\"), 'wilderness']];\n\n var checkboxLargeLayers = [[$(\"[name='climate-checkbox']\"), 'climate'],\n [$(\"[name='wildness-checkbox']\"), 'wildness'],\n [$(\"[name='amphib-checkbox'\"), 'amphibian-layer'],\n [$(\"[name='fish-checkbox']\"), 'fish-layer'],\n [$(\"[name='priority-checkbox']\"), 'priority_index'],\n [$(\"[name='bird-checkbox']\"),'bird-layer']];\n\n var sliderArray = [[$('#wildnessSlider'), 'wildness', 'raster-opacity', 'wildnessSlider'],\n [$('#amphibSlider'), 'amphibian-layer', 'fill-opacity', 'amphibSlider'],\n [$('#fishSlider'), 'fish-layer', 'fill-opacity', 'fishSlider'],\n [$('#climateSlider'), 'climate', 'raster-opacity', 'climateSlider'],\n [$('#prioritySlider'), 'priority_index', 'fill-opacity', 'prioritySlider'],\n [$('#birdSlider'), 'bird-layer', 'fill-opacity', 'birdSlider']];\n\n //This variable ensures that the small layers will always be above the large layers in draw order\n var smallLayerPartition = lineLayerArray[lineLayerArray.length-1][3];\n\n checkboxSmallLayers.forEach(function(layer) {\n layer[0].on('switchChange.bootstrapSwitch', function() {\n if (layer[0].bootstrapSwitch('state')) {\n map.setLayoutProperty(layer[1]+'-layer', 'visibility', 'visible');\n map.setLayoutProperty(layer[1]+'-line', 'visibility','visible');\n map.moveLayer(layer[1]+'-layer');\n map.moveLayer(layer[1]+'-line');\n\n } else {\n map.setLayoutProperty(layer[1]+'-layer', 'visibility', 'none');\n map.setLayoutProperty(layer[1]+'-line', 'visibility','none');\n\n }\n });\n });\n\n checkboxLargeLayers.forEach(function(layer) {\n if (layer[1] == 'wildness') {\n layer[0].on('switchChange.bootstrapSwitch', function() {\n if ( layer[0].bootstrapSwitch('state')) {\n map.setLayoutProperty(layer[1], 'visibility', 'visible');\n for (i=0;i<polyArray.length;i++) {\n map.setLayoutProperty('vector'+i, 'visibility', 'visible');\n map.moveLayer('vector'+i);\n }\n map.moveLayer(layer[1], smallLayerPartition);\n\n lineLayerArray.forEach(function(layer) {\n if (map.getLayoutProperty(layer[2], 'visibility') == 'visible') {\n map.moveLayer(layer[2],smallLayerPartition);\n map.moveLayer(layer[3],smallLayerPartition);\n }\n });\n } else {\n map.setLayoutProperty(layer[1], 'visibility', 'none');\n for (i=0;i<polyArray.length;i++) {\n map.setLayoutProperty('vector'+i, 'visibility', 'none');\n }\n }\n });\n } else {\n layer[0].on('switchChange.bootstrapSwitch', function() {\n if (layer[0].bootstrapSwitch('state')) {\n\n map.setLayoutProperty(layer[1], 'visibility', 'visible');\n\n map.moveLayer(layer[1], smallLayerPartition);\n\n\n lineLayerArray.forEach(function(layer) {\n if (map.getLayoutProperty(layer[2], 'visibility') == 'visible') {\n map.moveLayer(layer[2],smallLayerPartition);\n map.moveLayer(layer[3],smallLayerPartition);\n }\n });\n } else {\n map.setLayoutProperty(layer[1], 'visibility', 'none');\n }\n\n });\n }\n });\n\n //Add wilderness info popup\n map.on('click', 'wilderness-layer', function(e) {\n new mapboxgl.Popup()\n .setLngLat(e.lngLat)\n .setHTML('<h5> <a href=' + e.features[0].properties.URL + '>' + e.features[0].properties.NAME + '</a> </h5>' + '<p class=popup>' + e.features[0].properties.Descriptio + '</p>')\n .addTo(map);\n });\n}", "function mapDataChanged(){\r\n //force an update\r\n onMapMoved();\r\n}", "function ChangeMapByClick(evt){\n\t\n\t// First, to detect if the event if a change of image map, and detect if the image is already loaded\n\tif ((GetAction(evt) == \"AHEAD\" || GetAction(evt) == \"BACK\" ) && imageLoaded == 1) {\n\t\n\t\t// Detect an action to move ahead\n\t\tif (GetAction(evt) == \"AHEAD\"){\n\t\t\t\n\t\t\t// Set the event action to global \n\t\t\tmovePageAction = \"AHEAD\";\n\t\t\t\n\t\t\t// See if the limit of page\n\t\t\tif(currentMapNumber < currentEpisode.Pages[currentPage].Maps.length - 1){\n\t\t\t//When its possible to change to next map, increment counter and set the map to image\n\t\t\t\tcurrentMapNumber++;\n\t\t\t\tSetImageViewByMap(currentEpisode.Pages[currentPage].Maps[currentMapNumber]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t// Trying to move to another page, to the first map\n\t\t\t\tif(currentPage < currentEpisode.Pages.length - 1){\n\t\t\t\t\tcurrentPage++;\n\t\t\t\t\tLoadPageToSVG(currentEpisode.Pages[currentPage].Path);\t\t\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t// If in the limit of the pages, load the next episode\n\t\t\t\t\tepisodeNumber++;\n\t\t\t\t\tLoadEpisode(episodeNumber);\n\n\t\t\t\t\t// Watch and return the episode minus 1, when it detect error\n\t\t\t\t\tif (ReturnIfImageError() == true)\n\t\t\t\t\t\tepisodeNumber = 0; \n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse if (GetAction(evt) == \"BACK\"){\n\t\t\t\n\t\t\t// Set the event action to global \n\t\t\tmovePageAction = \"BACK\";\n\t\t\t\n\t\t\t// See if the limit of page\n\t\t\tif(currentMapNumber >= 1){\n\t\t\t//When its possible to change to last map, decrement counter and set the map to image\n\t\t\t\tcurrentMapNumber--;\n\t\t\t\tSetImageViewByMap(currentEpisode.Pages[currentPage].Maps[currentMapNumber]);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t// Trying to move to another page, to the last map\n\t\t\t\tif(currentPage >= 1){\n\t\t\t\t\tcurrentPage--;\n\t\t\t\t\tLoadPageToSVG(currentEpisode.Pages[currentPage].Path);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t// If in the start of the pages, load the last episode\n\t\t\t\t\tepisodeNumber--;\n\t\t\t\t\tLoadEpisode(episodeNumber);\n\n\t\t\t\t\t// Watch and return the episode plus 1, when it detect error\n\t\t\t\t\tif (ReturnIfImageError() == true)\n\t\t\t\t\t\tepisodeNumber = 0; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\n\t\t// Detecting event to exit the SubPages tutorial\n\t\tif (GetAction(evt) == \"ESC\"){\n\t\t\tClosePageElement();\n\t\t}\n\t\t//In case of Context Menu, return false to do not allow to show the submenu\n\t\telse{\n\t\t\tif (evt.type == \"contextmenu\") \n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\treturn true;\n\t\t}\n\t}\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 updateClimateMap(){\n $('.climate-variables-map, .timescale-selector-map').change(function(){\n $('.climate-variables-button').click();\n });\n }", "function onEachFeature(feature, layer) {\r\n layer.on({\r\n\t\t'mouseover': function (e) {\r\n\t\t\thighlight(e.target);\r\n\t\t },\r\n\t\t 'mouseout': function (e) {\r\n\t\t\tdehighlight(e.target);\r\n\t\t }, \r\n\t\t'click': function(e)\r\n\t\t\t{\r\n\t\t\t\t// enlever les interaction avec la carte sur une div \r\n\t\t\t\t$('#mySidepanel.sidepanel').mousedown( function() {\r\n\t\t\t\t\tmap2.dragging.disable();\r\n\t\t\t\t });\r\n\t\t\t\t $('html').mouseup( function() {\r\n\t\t\t\t\tmap2.dragging.enable();\r\n\t\t\t\t});\r\n\t\t\t\t// ouverture du panel \r\n\t\t\topenNav(e.target),\r\n\t\t\t// affichage des graphiques \r\n\t\t\tdocument.getElementById(\"myChart\").style.display='block';\r\n\t\t\tdocument.getElementById(\"myChart3\").style.display='none';\r\n\t\t\t// fermeture de la comparaison \r\n\t\t\t// selection des toits \r\n\t\t\tselect(e.target), \r\n\t\t\t// information dans le panel sur le toit sélectionné \r\n\t\t\tdocument.getElementById(\"5\").innerHTML = \"<strong>Adresse : </strong>\" + feature.properties.addr_numer + feature.properties.addr_nom_1 + \"<br>\" + \"<strong>Type : </strong>\" + feature.properties.prop + \"<br>\" + \"<strong>Usage : </strong>\" + feature.properties.usage1 + \"<br>\" + \"<strong>Pluviométrie : </strong>\" + feature.properties.pluvio_max.toFixed(2) + \" mm/an\"+\"<br>\" + \"<strong>Surface : </strong>\" + feature.properties.shape_area.toFixed(2) + \" m²\" + \"<br>\" + \"<strong>Ensoleillement : </strong>\" + feature.properties.sr_mwh.toFixed(2) + \" KWh/m²\" + \"<hr>\"\r\n// graphique sur l'influence des critères dans le roofpotentiel \r\n\t\t\tvar ctx1 = document.getElementById('myChart2').getContext('2d');\r\nvar chart1 = new Chart(ctx1, { \r\n // The type of chart we want to create\r\n type: 'horizontalBar',\r\n\r\n // The data for our dataset\r\n data: {\r\n labels: ['Pluviométrie', 'Surface', 'Ensoleillement', 'Solidité'],\r\n datasets: [{\r\n\t\t\tbackgroundColor: ['rgb(26, 196, 179)', \r\n\t\t\t'rgb(26, 196, 179)', \r\n\t\t\t'rgb(26, 196, 179)', 'rgb(26, 196, 179)'], \r\n borderColor: 'rgb(255, 99, 132)',\r\n data: [e.target.feature.properties.pluviok, e.target.feature.properties.surfacek, e.target.feature.properties.expok, e.target.feature.properties.solidek]\r\n }]\r\n },\r\n\r\n // Configuration options go here\r\n\toptions: {\r\n\t\t// animation: {\r\n // duration: 0 // general animation time\r\n // },\r\n\t\tevents: [], \r\n\t\tlegend: {\r\n\t\t\tdisplay: false}, \r\n\t\t\tscales: {\r\n\t\t\t\txAxes: [{\r\n\t\t\t\t\tticks: {\r\n\t\t\t\t\t\tmax: 5,\r\n\t\t\t\t\t\tmin: 0,\r\n\t\t\t\t\t\tstepSize: 1, \r\n\t\t\t\t\t\tdisplay: false\r\n\t\t\t\t\t}\r\n\t\t\t\t}]\r\n\t\t\t}\r\n\t}\r\n}); \r\n// graphique du roofpotentiel \r\nvar ctx2 = document.getElementById('myChart').getContext('2d');\r\n$('#PluvioInputId').val(1)\r\n$('#PluvioOutputId').val(1)\r\n$('#SurfaceInputId').val(1)\r\n$('#SurfaceOutputId').val(1)\r\n$('#ExpoInputId').val(1)\r\n$('#ExpoOutputId').val(1)\r\n$('#SoliInputId').val(1)\r\n$('#SoliOutputId').val(1)\r\n\tvar chart2 =new Chart(ctx2, {\r\n\t\t// The type of chart we want to create\r\n\t\ttype: 'horizontalBar',\r\n\t\r\n\t\t// The data for our dataset\r\n\t\tdata: {\r\n\t\t\tdatasets: [{\r\n\t\t\t\tbackgroundColor: function(feature){\r\n\t\r\n\t\t\t\t\tvar score = e.target.feature.properties.scoring;\r\n\t\t\t\t\tif (score > 90) {\r\n\t\t\t\t\t\treturn '#008080'; \r\n\t\t\t\t\t } \r\n\t\t\t\t\t else if (score > 80) {\r\n\t\t\t\t\t\treturn '#6EC6BA';\r\n\t\t\t\t\t } \r\n\t\t\t\t\t else if (score > 75) {\r\n\t\t\t\t\t\treturn '#A8E1CE';\r\n\t\t\t\t\t }\r\n\t\t\t\t\t else if (score > 70) {\r\n\t\t\t\t\t\treturn ' #CCF1D2';\r\n\t\t\t\t\t }\r\n\t\t\t\t\t else if (score >= 0) {\r\n\t\t\t\t\t\treturn '#EBF9ED';\r\n\t\t\t\t\t };\r\n\r\n\t\t\t\t},\r\n\t\t\t\tdata: [e.target.feature.properties.scoring],\r\n\t\t\t\tbarThickness: 2,\r\n\t\t\t}]\r\n\t\t},\r\n\t\t// Configuration options go here\r\n\t\toptions: {\r\n\t\t\tevents: [], \r\n\t\t\tlegend: {\r\n\t\t\t\tdisplay: false}, \r\n\t\t\t\tscales: {\r\n\t\t\t\t\txAxes: [{\r\n\t\t\t\t\t\tticks: {\r\n\t\t\t\t\t\t\tmax: 100,\r\n\t\t\t\t\t\t\tmin: 0,\r\n\t\t\t\t\t\t\tstepSize: 20\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}\r\n\t});\r\n\r\n//Fonction pour faire varier le poids des critéres et calculer à nouveau le scoring\r\n$('#valideform').click(function(event) {\r\n\tdocument.getElementById(\"myChart3\").style.display='block';\r\n\tdocument.getElementById(\"myChart\").style.display='none';\r\n\tvar ctx3 = document.getElementById('myChart3').getContext('2d');\r\n\tdocument.getElementById('mySidepanel').scroll({top:0,behavior:'smooth'});\r\n\tvar pluvio = $('#PluvioInputId').val()\r\n\tvar surface = $('#SurfaceInputId').val()\r\n\tvar ensoleillement = $('#ExpoInputId').val()\r\n\tvar solidite = $('#SoliInputId').val()\r\n\tvar somme = (100/((5*pluvio)+(5*surface)+(5*ensoleillement)+(5*solidite)))*(e.target.feature.properties.pluviok * pluvio + e.target.feature.properties.expok * ensoleillement + e.target.feature.properties.surfacek * surface + e.target.feature.properties.solidek * solidite)\r\n\t\tvar chart3 =new Chart(ctx3, {\r\n\t\t\t// The type of chart we want to create\r\n\t\t\ttype: 'horizontalBar',\r\n\t\t\r\n\t\t\t// The data for our dataset\r\n\t\t\tdata: {\r\n\t\t\t\tdatasets: [{\r\n\t\t\t\t\tbackgroundColor: function(feature){\r\n\t\t\r\n\t\t\t\t\t\tvar score = somme;\r\n\t\t\t\t\t\tif (score > 90) {\r\n\t\t\t\t\t\t\treturn '#008080'; \r\n\t\t\t\t\t\t } \r\n\t\t\t\t\t\t else if (score > 80) {\r\n\t\t\t\t\t\t\treturn '#6EC6BA';\r\n\t\t\t\t\t\t } \r\n\t\t\t\t\t\t else if (score > 75) {\r\n\t\t\t\t\t\t\treturn '#A8E1CE';\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if (score > 70) {\r\n\t\t\t\t\t\t\treturn ' #CCF1D2';\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t else if (score >= 0) {\r\n\t\t\t\t\t\t\treturn '#EBF9ED';\r\n\t\t\t\t\t\t };\r\n\t\t\t\t\t},\r\n\t\t\t\t\tdata: [somme],\r\n\t\t\t\t\tbarThickness: 2,\r\n\t\t\t\t}]\r\n\t\t\t},\r\n\t\t\r\n\t\t\r\n\t\t\t// Configuration options go here\r\n\t\t\toptions: {\r\n\t\t\t\tevents: [], \r\n\t\t\t\tlegend: {\r\n\t\t\t\t\tdisplay: false}, \r\n\t\t\t\t\tscales: {\r\n\t\t\t\t\t\txAxes: [{\r\n\t\t\t\t\t\t\tticks: {\r\n\t\t\t\t\t\t\t\tmax: 100,\r\n\t\t\t\t\t\t\t\tmin: 0,\r\n\t\t\t\t\t\t\t\tstepSize: 20\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}]\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n});\r\n\r\n//Fonction pour réinitialiser les critères par un bouton \r\n$('#renitform').click(function(event) {\r\n\tdocument.getElementById(\"myChart3\").style.display='none';\r\n\tdocument.getElementById(\"myChart\").style.display='block';\r\n\tdocument.getElementById('mySidepanel').scroll({top:0,behavior:'smooth'});\r\n\t$('#PluvioInputId').val(1)\t//replace le slider sur la valeur 1\r\n\t$('#PluvioOutputId').val(1)\r\n\t$('#SurfaceInputId').val(1)\r\n\t$('#SurfaceOutputId').val(1)\r\n\t$('#ExpoInputId').val(1)\r\n\t$('#ExpoOutputId').val(1)\r\n\t$('#SoliInputId').val(1)\r\n\t$('#SoliOutputId').val(1)\r\n})\r\n\r\n\r\n//Fonction pour ouvrir les fiches en fonction du scoring \r\nfunction showButton(){\r\n\tvar type = e.target.feature.properties.scoring\r\n\t if (type >= 90) {\r\n\t\treturn document.getElementById(\"fiche1\").style.display='block',\r\n\t\tdocument.getElementById(\"fiche1body\").innerHTML = \"<strong>Adresse : </strong>\" + feature.properties.addr_numer + feature.properties.addr_nom_1 + \"<br>\" + \"<strong>Type : </strong>\" + feature.properties.prop + \"<br>\" + \"<strong>Usage : </strong>\" + feature.properties.usage1 + \"<br>\" + \"<strong>Pluviométrie : </strong>\" + feature.properties.pluvio_max.toFixed(2) + \" mm/an\"+\"<br>\" + \"<strong>Surface : </strong>\" + feature.properties.shape_area.toFixed(2) + \" m²\" + \"<br>\" + \"<strong>Ensoleillement : </strong>\" + feature.properties.sr_mwh.toFixed(2) + \" KWh/m²\", \r\n\t\tdocument.getElementById(\"fiche2\").style.display='none', \r\n\t\tdocument.getElementById(\"fiche3\").style.display='none',\r\n\t\tdocument.getElementById(\"nbpersonne1\").innerHTML = ((feature.properties.shape_area)*3.5/127).toFixed(0); \r\n\t } \r\n\t else if (type >= 70) {\r\n\t\treturn document.getElementById(\"fiche2\").style.display='block',\r\n\t\tdocument.getElementById(\"fiche2body\").innerHTML = \"<strong>Adresse : </strong>\" + feature.properties.addr_numer + feature.properties.addr_nom_1 + \"<br>\" + \"<strong>Type : </strong>\" + feature.properties.prop + \"<br>\" + \"<strong>Usage : </strong>\" + feature.properties.usage1 + \"<br>\" + \"<strong>Pluviométrie : </strong>\" + feature.properties.pluvio_max.toFixed(2) + \" mm/an\"+\"<br>\" + \"<strong>Surface : </strong>\" + feature.properties.shape_area.toFixed(2) + \" m²\" + \"<br>\" + \"<strong>Ensoleillement : </strong>\" + feature.properties.sr_mwh.toFixed(2) + \" KWh/m²\", \r\n\t\tdocument.getElementById(\"fiche1\").style.display='none', \r\n\t\tdocument.getElementById(\"fiche3\").style.display='none',\r\n\t\tdocument.getElementById(\"nbpersonne2\").innerHTML = ((feature.properties.shape_area)*2.5/127).toFixed(0); \r\n\t } \r\n\t else {\r\n\t\treturn document.getElementById(\"fiche3\").style.display='block',\r\n\t\tdocument.getElementById(\"fiche3body\").innerHTML = \"<strong>Adresse : </strong>\" + feature.properties.addr_numer + feature.properties.addr_nom_1 + \"<br>\" + \"<strong>Type : </strong>\" + feature.properties.prop + \"<br>\" + \"<strong>Usage : </strong>\" + feature.properties.usage1 + \"<br>\" + \"<strong>Pluviométrie : </strong>\" + feature.properties.pluvio_max.toFixed(2) + \" mm/an\"+\"<br>\" + \"<strong>Surface : </strong>\" + feature.properties.shape_area.toFixed(2) + \" m²\" + \"<br>\" + \"<strong>Ensoleillement : </strong>\" + feature.properties.sr_mwh.toFixed(2) + \" KWh/m²\", \r\n\t\tdocument.getElementById(\"fiche1\").style.display='none', \r\n\t\tdocument.getElementById(\"fiche2\").style.display='none',\r\n\t\tdocument.getElementById(\"nbpersonne3\").innerHTML = ((feature.properties.shape_area)*1.5/127).toFixed(0); \r\n\t }\r\n }; \r\nshowButton(e.target); \r\n\r\n// destruction des graphiques a la fermeture du panel \r\n(function() { // self calling function replaces document.ready()\r\n\t//adding event listenr to button\r\ndocument.querySelector('#closesidepanel').addEventListener('click',function(){\r\n\t\tchart1.destroy();\r\n\t\tchart2.destroy(); \r\n\t\t});\r\n\t})();\r\n}\r\n})\r\n}", "function IMapXtremeEventHandler()\n{\n}", "function makeMap() {\n\n tjb.slideCounter=0;\n\n d3.selectAll( \".masks\" ).remove();\n d3.selectAll( \".histo\" ).remove();\n\n $( \".scroll\" ).addClass( \"disabled\" ).removeClass( \"enabled\" );\n $( \".scroll.counter\" ).css( \"opacity\" , 0.0 );\n\n d3.select(\"#highlight\").style(\"visibility\" , \"visible\");\n\n // hide depth axis and profile\n g.selectAll(\".depth.axis\").style(\"opacity\" , 0.0);\n\n g.selectAll(\".barcode.annotations\")\n .transition()\n .duration(1000)\n .style(\"opacity\" , 0.0)\n .style('pointer-events', \"none\");\n\n g.selectAll(\".barcode.axis\")\n .transition()\n .duration(1000)\n .style(\"opacity\" , 0.0)\n .style('pointer-events', \"none\");\n\n g.selectAll(\".eventInfo\")\n .transition()\n .duration(1000)\n .style(\"opacity\" , 0.0)\n .style('pointer-events', \"none\");\n\n if( ti>li ){\n\n tjb.resize = false;\n\n d3.selectAll( \".histo\" ).remove();\n d3.selectAll( \".world.country\" ).remove();\n d3.selectAll( \".boundaries\" ).remove();\n redraw();\n\n setTimeout(function(){\n\n faultLegend\n .transition()\n .duration(2500)\n .style(\"opacity\" , 1.0);\n\n g.selectAll( \".barcode.g\" )\n .transition()\n .duration(2500)\n .attr(\"transform\" , function(){\n if( tjb.mediaType==\"mobile\" ){ return \"translate(\" + (0) + \",\" + (((tjb.height*0.25))) + \")\"; }\n if( tjb.mediaType==\"tablet\" ){ return \"translate(\" + (margin.left) + \",\" + (0) + \")\"; }\n if( tjb.mediaType==\"desktop\" ){ return \"translate(\" + (margin.left) + \",\" + (0) + \")\"; }\n })\n .style('pointer-events', \"auto\");\n\n }, 1000);\n\n setTimeout(function(){\n\n d3.selectAll(\".country\")\n .transition()\n .duration(2500)\n .style(\"opacity\", 0.33);\n\n d3.selectAll(\".boundaries\")\n .transition()\n .duration(3000)\n .style(\"opacity\",1.0);\n\n magnitudeLegend\n .transition()\n .duration(2500)\n .style(\"opacity\" , 1.0);\n\n }, 4000);\n }\n if( ti<li ){\n\n g.selectAll(\".eventInformation\").style(\"opacity\" , 0.0)\n\n setTimeout(function(){\n\n earthquakes.forEach(function(d,i){\n\n g.selectAll(\".epicentres.b\" + d.FID)\n .transition()\n .duration(2500)\n .attr(\"cx\", function(d,i){ return projection([+d.longitude,+d.latitude])[0]-margin.left; })\n .attr(\"cy\", function(d,i){ return projection([+d.longitude,+d.latitude])[1]; })\n .style(\"stroke-opacity\", function(d,i){\n if( tjb.highlight==false ){ return 1.00; }\n else{\n if( d.mag<8.0 ){ return 0.0; }\n else{ return 1.00; }\n }\n })\n .style(\"fill-opacity\", function(d,i){\n if( tjb.highlight==false ){ return 0.66; }\n else{\n if( d.mag<8.0 ){ return 0.0; }\n else{ return 0.66; }\n }\n })\n .style(\"opacity\", 1.00 )\n .style(\"stroke-width\" , \"1.5px\")\n .style('pointer-events', \"auto\");\n })\n }, 1500);\n\n setTimeout(function(){\n\n d3.selectAll(\".country\")\n .transition()\n .duration(2500)\n .attr( \"transform\" , \"translate(0,0) scale(1)\")\n .style(\"opacity\", 0.33);\n\n d3.selectAll(\".boundaries\")\n .transition()\n .duration(3000)\n .attr( \"transform\" , \"translate(0,0) scale(1)\")\n .style(\"opacity\",0.5);\n\n d3.selectAll(\".plates\")\n .transition()\n .duration(3000)\n .attr( \"transform\" , \"translate(0,0) scale(1)\")\n .style(\"opacity\",0.5);\n\n }, 3500);\n\n }\n\n setTimeout(function(){\n \n $( \".scroll\" ).addClass( \"disabled\" ).removeClass( \"enabled\" );\n $( \".scroll.up\" ).addClass( \"enabled\" ).removeClass( \"disabled\" );\n $( \".scroll.down\" ).addClass( \"enabled\" ).removeClass( \"disabled\" );\n $( \".scroll.counter\" ).css( \"opacity\" , 0.0 );\n\n },6500);\n\n return;\n\n }", "function updateMap(mapData, soilData, year){\n\n\t// Remove old coloring\n\tvar svg = d3.select(\"#containerMap\")\n\t\t.selectAll(\"path\")\n\t\t.style(\"fill\", \"empty\");\n\n\n\t// Initialize tooltips\n\tvar tooltip = d3.select(\"#containerMap\")\n\t\t.append(\"div\")\n\t\t.attr(\"class\", \"tooltip hidden\");\n\n\t// Color region again\n\tsvg\n\t\t.data(mapData.features)\n\t\t.style(\"stroke\", \"black\")\n\t\t.style(\"fill\", function(d) { \n\t\t\treturn colorMap(d.properties.name, soilData, year)[0]; \n\t\t})\n\t\t.on(\"mousemove\", function (d) { \n\t\t\treturn showTooltip(d.properties.name, soilData, year); \n\t\t})\n \t\t.on(\"mouseout\", function(d,i) {\n \ttooltip.classed(\"hidden\", true);\n \t\t});\n\n}", "function fnMainMapEventListener() {\n\tdojo.connect(basemap, \"onUpdateStart\", function() {\n\t\tshowLoadingMap(); //로딩바 보이기\n\t\t\n\t\t//화살표 표시\n\t\tfnDispArrow();\n\t\t\n\t\t/*if ($(\"#map_graphics_layer\").find(\"text\").length != m_UserGraphicFontSize.length) {\n\t\t\tm_UserGraphicFontSize = [];\n\t\t\t$(\"#map_graphics_layer\").find(\"text\").each(function() {\n\t\t\t\tm_UserGraphicFontSize.push(Number($(this).attr(\"font-size\")));\n\t\t\t});\t\n\t\t}*/\n\t});\n\tdojo.connect(basemap, \"onUpdateEnd\", function() {\n\t\thideLoadingMap(); //로딩바 숨기기\n\t\t\n\t\t/*$(\"#map_graphics_layer\").find(\"text\").each(function(i, data) {\n\t\t\t$(this).attr(\"font-size\", 1 / m_MainMap.getScale() * m_UserGraphicFontSize[i]);\n\t\t});*/\n\t});\n\n\tm_MainMap.on(\"mouse-wheel\", function (res) {\n\t\tindexMapMoveYn = false;\n\t\tmainMapMoveYn = true;\n\t});\n\n\tm_MainMap.on(\"mouse-down\", function (res) {\n\t\tindexMapMoveYn = false;\n\t\tmainMapMoveYn = true;\n\t});\n\tm_MainMap.on(\"mouse-move\", function (res) {\n\t\tvar mapPt = res.mapPoint;\n\t\tvar curCoordX = formatLocalizedDecimal(mapPt.x, 4);\n\t\tvar curCoordY = formatLocalizedDecimal(mapPt.y, 4);\n\n\t\t$(\"#coord\").text(\"X:\" + curCoordX + \" Y:\" + curCoordY);\n\t});\n\n\t//축척변경 이벤트 - 축척View 변경/인덱스맵 변경/분할지도 변경\n\tm_MainMap.on(\"extent-change\", function (res) {\n\t\t//축척View변경\n\t\t$(\"#txt_Scale\").val(parseInt(m_MainMap.getScale()));\n\n\t\tif (indexMap.graphics == null)\n\t\t\treturn;\n\t\tindexMap.graphics.clear();\n\n\t\tvar xmax = m_MainMap.extent.xmax;\n\t\tvar xmin = m_MainMap.extent.xmin;\n\t\tvar ymax = m_MainMap.extent.ymax;\n\t\tvar ymin = m_MainMap.extent.ymin;\n\t\tvar extPolygon = new esri.geometry.Polygon([\n\t\t\t\t\t[xmin, ymin],\n\t\t\t\t\t[xmax, ymin],\n\t\t\t\t\t[xmax, ymax],\n\t\t\t\t\t[xmin, ymax],\n\t\t\t\t\t[xmin, ymin]]);\n\t\tvar indexGraphic = new esri.Graphic(extPolygon, new esri.symbol.SimpleFillSymbol(\n\t\t\t\t\tesri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(\n\t\t\t\t\t\tesri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 0, 0, 0])));\n\t\tindexMap.graphics.add(indexGraphic);\n\t});\n\n\t//범례 생성\n\tm_MainMap.on(\"layers-add-result\", function (evt) {\n\t\t$(\"#mapCtrl1\").click();\n\n\t\tesri.request({\n\t\t\turl : urlBasemap + \"/layers\",\n\t\t\tcontent : {\n\t\t\t\tf : \"json\"\n\t\t\t},\n\t\t\thandleAs : \"json\"\n\t\t}).then(function (res) {\n\t\t\tm_LayersInfo = res; //published map with noscale\n\n\t\t\tesri.request({\n\t\t\t\turl : urlBasemap_scale + \"/layers\",\n\t\t\t\tcontent : {\n\t\t\t\t\tf : \"json\"\n\t\t\t\t},\n\t\t\t\thandleAs : \"json\"\n\t\t\t}).then(function (res) {\n\t\t\t\tm_LayersInfo_scale = res; //published map with scale\n\n\t\t\t\t//drawing legend with user_config\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType : \"json\",\n\t\t\t\t\tdata : {\n\t\t\t\t\t\tUSER_ID : $(\"#USER_ID\").val(),\n\t\t\t\t\t\tSYS_ID : $(\"#SYS_ID\").val()\n\t\t\t\t\t},\n\t\t\t\t\turl : \"/etc/etcMapUserConfigList.do\",\n\t\t\t\t\tsuccess : function (data) {\n\t\t\t\t\t\tif (data.list.length > 0) {\n\t\t\t\t\t\t\tm_IsSavedMap = true;\n\t\t\t\t\t\t\tm_UserConfigExtent = data.list[0].EXTENT;\n\t\t\t\t\t\t\tm_UserConfigLayers = data.list[0].LAYERS;\n\t\t\t\t\t\t\tm_UserConfigVisibles = data.list[0].VISIBLES;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (xhr, status, error) {\n\t\t\t\t\t\talert(status);\n\t\t\t\t\t\talert(error);\n\t\t\t\t\t},\n\t\t\t\t\tcomplete : function (data) {\n\t\t\t\t\t\tif (m_IsSavedMap)\n\t\t\t\t\t\t\tm_MainMap.setExtent(new esri.geometry.fromJson(JSON.parse(m_UserConfigExtent)));\n\t\t\t\t\t\t// In aMapToc.js\n\t\t\t\t\t\tfnSetTocList();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}, function (error) {\n\t\t\t\talert(\"failed get m_LayersInfo_scale\\ncause :\" + error);\n\t\t\t});\n\t\t}, function (error) {\n\t\t\talert(\"failed get m_LayersInfo\\ncause :\" + error);\n\t\t});\n\t});\n}", "function mapClick4() {\r\n\tlet map = document.querySelectorAll('.wrap-map .map');\r\n\tlet wrap = document.getElementById('map');\r\n\r\n\tfor(let i = 0; i < map.length; i++) {\r\n\r\n\t\tmap[i].onclick = function() {\r\n\t\t\tfor(let j = 0; j < map.length; j++) {\r\n\t\t\t\tmap[j].classList.remove('yellow');\r\n\t\t\t}\r\n\t\t\tthis.classList.add('yellow');\r\n\t\t}\r\n\t}\r\n}", "function slideUpdateMap(map, choro, color, slider, isos) {\n\n\tslider.on('input', function() {\n\n\t\t// build a new mapData dict and update map\n\t\tvar season = this.value,\n\t\t\tmapData = mapDataBuilder(season, color, choro, isos);\n\t\tmap.updateChoropleth(mapData);\n\t\tupdateTitle('season1', 'Races per country in ' + season);\n\t});\n}", "function mapClick5() {\r\n\tlet map = document.querySelectorAll('.wrap-map .map');\r\n\tlet wrap = document.getElementById('map');\r\n\r\n\tfor(let i = 0; i < map.length; i++) {\r\n\r\n\t\tmap[i].onclick = function() {\r\n\t\t\tfor(let j = 0; j < map.length; j++) {\r\n\t\t\t\tmap[j].classList.remove('blue');\r\n\t\t\t}\r\n\t\t\tthis.classList.add('blue');\r\n\t\t}\r\n\t}\r\n}", "function mapClick() {\r\n\tlet map = document.querySelectorAll('.wrap-map .map');\r\n\tlet wrap = document.getElementById('map');\r\n\r\n\tfor(let i = 0; i < map.length; i++) {\r\n\r\n\t\tmap[i].onclick = function() {\r\n\t\t\tfor(let j = 0; j < map.length; j++) {\r\n\t\t\t\tmap[j].classList.remove('yellow');\r\n\t\t\t}\r\n\t\t\tthis.classList.add('yellow');\r\n\t\t}\r\n\t}\r\n}", "function step2() {\t \t\r\n \tdocument.getElementById(\"gm-bubble-content\").onmouseover=step3;\r\n}", "function showOverlays()\n{\n setAllMap(map);\n}", "setMapClickable(){\n\t\tthis.mainChart.mapClickable();\n\t}", "handleMapClick(event) {\n }", "function chooseMap(ilmakuva) {\n // Set the label to the aerial imagery name\n map.setLayoutProperty(currentLayer, 'visibility', 'none');\n currentLayer = toggleableLayers[0]['layers'][ilmakuva];\n map.setLayoutProperty(currentLayer, 'visibility', 'visible');\n document.getElementById('slider-label').textContent = currentLayer;\n }", "function changeLayersDraw() {\n \tshowloading();\n var mapurl = PM_XAJAX_LOCATION + 'x_load.php?'+SID+'&zoom_type=zoompoint';\n updateMap(mapurl);\n}", "function onMapClick() {\n // releaseClick();\n}", "function clickInfoForMapControlMenu() {\n // updatePermaLink(permaLink);\n // outMapControl();\n }", "function mouseover() {\n //convert the slider value to the correct index of time in mapData\n spot = d3.select(this);\n if (!spot.classed('hidden-spot')) {\n index = rangeslider.value - 5\n let occupant = mapData[spot.attr(\"id\")][index];\n tooltip\n .html(mapData[spot.attr(\"id\")][0] + ': ' + (occupant === \"\" ? \"Unoccupied\" : occupant))\n .style(\"opacity\", 1);\n }\n}", "function InitializeMap() {\n\n //Initialize the Pushpin array\n this.pushPinArray = new Array();\n\n //Clear the map\n this.map.entities.clear();\n\n //Need to set the ID of the last event in the current view\n this.currentViewLastEventId = this.item.eventsList.length - 1;\n\n //Position the day buttons\n var borderWidth = 20;\n var buttonSide = 75;\n\n var left = (window.innerWidth - borderWidth - buttonSide).toString() + \"px\";\n var suntop = window.innerHeight - borderWidth - buttonSide;\n var sattop = suntop - borderWidth - buttonSide;\n var fritop = sattop - borderWidth - buttonSide;\n var alltop = fritop - borderWidth - buttonSide;\n\n document.getElementById(\"ONEUPGRID_mapnav_all\").style.left = left;\n document.getElementById(\"ONEUPGRID_mapnav_all\").style.top = alltop.toString() + \"px\";\n this.AttachOnClick(document.getElementById(\"ONEUPGRID_mapnav_all\"), \"ONEUPGRID_mapnav_click\");\n\n document.getElementById(\"ONEUPGRID_mapnav_fri\").style.left = left;\n document.getElementById(\"ONEUPGRID_mapnav_fri\").style.top = fritop.toString() + \"px\";\n this.AttachOnClick(document.getElementById(\"ONEUPGRID_mapnav_fri\"), \"ONEUPGRID_mapnav_click\");\n\n document.getElementById(\"ONEUPGRID_mapnav_sat\").style.left = left;\n document.getElementById(\"ONEUPGRID_mapnav_sat\").style.top = sattop.toString() + \"px\";\n this.AttachOnClick(document.getElementById(\"ONEUPGRID_mapnav_sat\"), \"ONEUPGRID_mapnav_click\");\n\n document.getElementById(\"ONEUPGRID_mapnav_sun\").style.left = left;\n document.getElementById(\"ONEUPGRID_mapnav_sun\").style.top = suntop.toString() + \"px\";\n this.AttachOnClick(document.getElementById(\"ONEUPGRID_mapnav_sun\"), \"ONEUPGRID_mapnav_click\");\n\n //Position the dots\n var north = null;\n var south = null;\n var east = null;\n var west = null;\n for (var i = 0; i < this.item.eventsList.length; i++) {\n //Create and config the map dot\n var pushpinOptions = this.createPushPinOptions(this.item.eventsList[i].id, this.item.eventsList[i].day, false, true);\n var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(this.item.eventsList[i].lat, this.item.eventsList[i].long), pushpinOptions);\n var self = this; //A little closure magic to ensure that the scoping is correct on the click\n Microsoft.Maps.Events.addHandler(pushpin, 'click', self.mapDotClick);\n this.map.entities.push(pushpin);\n this.pushPinArray.push(pushpin);\n this.item.eventsList[i].mappushpinindex = this.map.entities.getLength() - 1;\n\n //Determine the impact on the bounding box\n if (north == null) {\n north = this.item.eventsList[i].lat;\n } else if (this.item.eventsList[i].lat > north) {\n north = this.item.eventsList[i].lat;\n }\n\n if (south == null) {\n south = this.item.eventsList[i].lat;\n } else if (this.item.eventsList[i].lat < south) {\n south = this.item.eventsList[i].lat;\n }\n\n if (east == null) {\n east = this.item.eventsList[i].long;\n } else if (this.item.eventsList[i].long > east) {\n east = this.item.eventsList[i].long;\n }\n\n if (west == null) {\n west = this.item.eventsList[i].long;\n } else if (this.item.eventsList[i].long < west) {\n west = this.item.eventsList[i].long;\n }\n }\n\n //Set default bounding box\n this.northWestBoundingBoxPoint = new Microsoft.Maps.Location(north+.01, west-.01);\n this.southEastBoundingBoxPoint = new Microsoft.Maps.Location(south-.01, east+.01);\n this.centerPoint = new Microsoft.Maps.Location((north+south)/2, (east+west)/2);\n\n //Set the map view based on the events in the itinerary\n this.map.setView({\n bounds:\n Microsoft.Maps.LocationRect.fromCorners\n (this.northWestBoundingBoxPoint,\n this.southEastBoundingBoxPoint),\n center:\n this.centerPoint\n });\n\n //Add the handler for map move\n var self = this;\n Microsoft.Maps.Events.addHandler(this.map, 'viewchangeend', function () { self.MapViewChangeEndEventHandler() });\n }", "function _mapIdle() {\n _setAllIcons();\n google.maps.event.addListener(_mapDOM.map, 'zoom_changed', _mapZoomed);\n // Remove idle listeners as they aren't needed after the spiderfied markers\n // are styled for the first time.\n google.maps.event.clearListeners(_mapDOM.map, 'idle');\n}", "function showOverlays() {\n setAllMap(map);\n}", "function mapClick3() {\r\n\tlet map = document.querySelectorAll('.wrap-map .map');\r\n\tlet wrap = document.getElementById('map');\r\n\r\n\tfor(let i = 0; i < map.length; i++) {\r\n\r\n\t\tmap[i].onclick = function() {\r\n\t\t\tfor(let j = 0; j < map.length; j++) {\r\n\t\t\t\tmap[j].classList.remove('blue');\r\n\t\t\t}\r\n\t\t\tthis.classList.add('blue');\r\n\t\t}\r\n\t}\r\n}", "function click_show_map(){\n $('#a_show_map').addClass(\"active\");\n $('#a_show_detail').removeClass(\"active\");\n $('#a_show_highlights').removeClass(\"active\");\n\n $('#grand_map_container').removeClass(\"hidden\");\n $('#details_container').addClass(\"hidden\");\n $('#highlights_container').addClass(\"hidden\");\n}", "function firstTimeInitializeMap() {\n \"use strict\";\n\n var options,\n div,\n buttons,\n i,\n checkbox,\n dayboxes,\n popover_cfg,\n zoomfunc,\n redraw;\n\n // Create control panel.\n $(\"#control-panel\").controlPanel();\n\n twitter_geomap.timeslider = $(\"#time-slider\");\n\n // Enable the popover help items.\n //\n // First create a config object with the common options preset.\n popover_cfg = {\n html: true,\n container: \"body\",\n placement: \"top\",\n trigger: \"hover\",\n title: null,\n content: null,\n delay: {\n show: 100,\n hide: 100\n }\n };\n\n // Time slider help.\n popover_cfg.title = \"Time Filtering\";\n popover_cfg.content = \"Display tweets generated between two particular dates/times.<br><br>\" +\n \"The 'zoom to range' button will make the slider represent the currently selected time slice, \" +\n \"while the 'unzoom' button undoes one zoom.\";\n $(\"#time-filter-help\").popover(popover_cfg);\n\n // Hashtag help.\n popover_cfg.title = \"Username Filtering\";\n popover_cfg.content = \"Display tweets generated by the user specified.\";\n $(\"#username-filter-help\").popover(popover_cfg);\n\n // TODO(choudhury): Probably the GMap prototype extension stuff should all\n // go in its own .js file.\n //\n // Equip ourselves with the overlay prototype.\n GMap.prototype = new google.maps.OverlayView();\n\n // Implement the callbacks for controlling the overlay.\n //\n // onAdd() signals that the map's panes are ready to receive the overlaid\n // DOM element.\n GMap.prototype.onAdd = function () {\n console.log(\"onAdd()!\");\n\n // Grab the overlay mouse target element (because it can accept, e.g.,\n // mouse hover events to show SVG tooltips), wrap it in a D3 selection,\n // and add the SVG element to it.\n this.overlayLayer = this.getPanes().overlayMouseTarget;\n\n var svg = d3.select(this.overlayLayer).append(\"div\")\n .attr(\"id\", \"svgcontainer\")\n .style(\"position\", \"relative\")\n .style(\"left\", \"0px\")\n .style(\"top\", \"0px\")\n .append(\"svg\");\n\n // Add a debugging rectangle.\n //svg.append(\"rect\")\n //.attr(\"id\", \"debugrect\")\n //.style(\"fill-opacity\", 0.4)\n //.style(\"fill\", \"white\")\n //.style(\"stroke\", \"black\")\n //.attr(\"width\", svg.attr(\"width\"))\n //.attr(\"height\", svg.attr(\"height\"));\n\n svg.append(\"g\")\n .attr(\"id\", \"markers\");\n\n // Record the SVG element in the object for later use.\n this.overlay = svg.node();\n\n // Add an SVG element to the map's div to serve as a color legend.\n svg = d3.select(this.map.getDiv())\n .append(\"svg\")\n .style(\"position\", \"fixed\")\n .style(\"top\", \"100px\")\n .style(\"right\", \"0px\")\n .attr(\"width\", 100)\n .attr(\"height\", 570);\n\n\n // Add an SVG group whose contents will change or disappear based on the\n // active colormap.\n this.legend = svg.append(\"g\").node();\n };\n\n // draw() sizes and places the overlaid SVG element.\n GMap.prototype.draw = function () {\n var proj,\n w,\n h,\n containerLatLng,\n divPixels,\n div,\n newLeft,\n newTop,\n svg,\n data,\n days,\n N,\n that,\n color,\n radius,\n opacity,\n markers;\n\n\n // Get the transformation from lat/long to pixel coordinates - the\n // lat/long data will be \"pushed through\" it just prior to being drawn.\n // It is deferred this way to deal with changes in the window size,\n // etc., that can occur without warning.\n proj = this.getProjection();\n //console.log(\"projection: \",proj);\n\n // If proj is undefined, the map has not yet been initialized, so return\n // right away.\n if (proj === undefined) {\n return;\n }\n\n // Shift the container div to cover the \"whole world\".\n //\n // First, compute the pixel coordinates of the bounds of the \"whole\n // world\".\n proj = this.getProjection();\n w = this.container.offsetWidth;\n h = this.container.offsetHeight;\n containerLatLng = proj.fromContainerPixelToLatLng({x: 0, y: 0});\n divPixels = proj.fromLatLngToDivPixel(containerLatLng);\n\n\n // Move and resize the div element.\n div = d3.select(this.overlayLayer).select(\"#svgcontainer\");\n newLeft = divPixels.x + \"px\";\n newTop = divPixels.y + \"px\";\n div.style(\"left\", newLeft)\n .style(\"top\", newTop)\n .style(\"width\", w + \"px\")\n .style(\"height\", h + \"px\");\n\n // Resize the SVG element to fit the viewport.\n svg = d3.select(this.overlayLayer).select(\"svg\");\n svg.attr(\"width\", w)\n .attr(\"height\", h);\n\n\n // Process the data by adjoining pixel locations to each entry.\n data = this.locationData.map(function (d) {\n d.pixelLocation = proj.fromLatLngToDivPixel(new google.maps.LatLng(d.location[1], d.location[0]));\n d.pixelLocation.x -= divPixels.x;\n d.pixelLocation.y -= divPixels.y;\n //console.log(d.pixelLocation);\n return d;\n });\n\n // Filter the results by day (if any of the boxes is checked).\n days = twitter_geomap.dayNames.filter(function (d) {\n return document.getElementById(d).checked;\n });\n if (days.length > 0) {\n data = data.filter(function (d) {\n return days.indexOf(d.day) !== -1;\n });\n }\n\n // Grab the total number of data items.\n N = data.length;\n\n // Select a colormapping function based on the radio buttons.\n that = this;\n color = (function () {\n var which,\n colormap,\n legend,\n retval,\n invert,\n range,\n scale;\n\n // Determine which radio button is currently selected.\n which = $(\"input[name=colormap]:radio:checked\").attr(\"id\");\n\n // Generate a colormap function to return, and place a color legend\n // based on it.\n if (which === 'month') {\n colormap = function (d) {\n return twitter_geomap.monthColor(d.month);\n };\n\n $(that.legend).svgColorLegend({\n cmap_func: twitter_geomap.monthColor,\n xoffset: 10,\n yoffset: 10,\n categories: twitter_geomap.monthNames,\n height_padding: 5,\n width_padding: 7,\n text_spacing: 19,\n legend_margins: {\n top: 5,\n left: 5,\n bottom: 5,\n right: 5\n },\n clear: true\n });\n\n retval = colormap;\n } else if (which === 'day') {\n colormap = function (d) {\n return twitter_geomap.dayColor(d.day);\n };\n\n $(that.legend).svgColorLegend({\n cmap_func: twitter_geomap.dayColor,\n xoffset: 10,\n yoffset: 10,\n categories: twitter_geomap.dayNames,\n height_padding: 5,\n width_padding: 7,\n text_spacing: 19,\n legend_margins: {top: 5, left: 5, bottom: 5, right: 5},\n clear: true\n });\n\n retval = colormap;\n } else if (which === 'rb') {\n d3.select(that.legend).selectAll(\"*\").remove();\n range = ['white', 'red'] ;\n scale = d3.scale.linear()\n .domain([0, N - 1])\n .range(range);\n\n retval = function (d, i) {\n return scale(i);\n };\n } else if (which === 'invert') {\n d3.select(that.legend).selectAll(\"*\").remove();\n\n range = ['red', 'white'];\n scale = d3.scale.linear()\n .domain([0, N - 1])\n .range(range);\n\n retval = function (d, i) {\n return scale(i);\n };\n } else if (which === \"user_color\") {\n colormap = function (d) {\n return twitter_geomap.userColor(d.user);\n };\n\n retval = colormap;\n } else {\n d3.select(that.legend).selectAll(\"*\").remove();\n retval = \"pink\";\n }\n\n return retval;\n }());\n\n // Select a radius function as well.\n radius = (function () {\n var which,\n retval,\n size;\n\n // Determine which radio button is selected.\n which = $(\"input[name=size]:radio:checked\").attr(\"id\");\n\n // Generate a radius function to return.\n if (which === 'recency') {\n retval = function (d, i) {\n return 5 + 15 * (N - 1 - i) / (N - 1);\n };\n } else {\n // Get the size value.\n size = parseFloat(d3.select(\"#size\").node().value);\n if (isNaN(size) || size <= 0.0) {\n size = 5.0;\n }\n\n retval = size;\n }\n\n return retval;\n }());\n\n // Get the opacity value.\n opacity = twitter_geomap.opacityslider.slider(\"value\") / 100;\n //opacity = 0.5\n\n // Compute a data join with the current list of marker locations, using\n // the MongoDB unique id value as the key function.\n //\n /*jslint nomen: true */\n markers = d3.select(this.overlay)\n .select(\"#markers\")\n .selectAll(\"circle\")\n .data(data, function (d) {\n\n // CRL - this was a deep bug. The d3 data join was messed up. It turns out the twitter ingest \n // script in the twitter app from year1 mapped tweet IDs to mongo IDs, which is dangerous.\n // Later processing scripts allow mongo to assign IDs, so use mongo IDs if they exist, \n // otherwise look for the original dataset with long numbers (and no $oid field):\n\n if (typeof d._id.$oid != 'undefined') {\n return d._id.$oid;\n } else {\n return d._id;\n }\n });\n /*jslint nomen: false */\n\n // For the enter selection, create new circle elements, and attach a\n // title element to each one. In the update selection (which includes\n // the newly added circles), set the proper location and fade in new\n // elements. Fade out circles in the exit selection.\n //\n // TODO(choudhury): the radius of the marker should depend on the zoom\n // level - smaller circles at lower zoom levels.\n markers.enter()\n .append(\"circle\")\n .style(\"opacity\", 0.0)\n .style(\"cursor\", \"crosshair\")\n .attr(\"r\", 0)\n .each(function (d) {\n var cfg,\n msg,\n date;\n\n date = new Date(d.date.$date);\n\n msg = \"\";\n msg += \"<b>Date:</b> \" + d.dateShortString + \"<br>\\n\";\n msg += \"<b>Location:</b> (\" + d.location[1] + \", \" + d.location[0] + \")<br>\\n\";\n msg += \"<b>Author:</b> \" + d.user + \"<br>\\n\";\n msg += \"<b>Content:</b> \" + d.contents + \"<br>\\n\";\n\n cfg = {\n html: true,\n container: \"body\",\n placement: \"top\",\n trigger: \"hover\",\n content: msg,\n delay: {\n show: 0,\n hide: 0\n }\n };\n $(this).popover(cfg);\n })\n .on(\"mouseover\", function(d) {\n loggedVisitToEntry(d)\n })\n \t.on(\"click\", function(d) {\n selectEntryToExamine(d);\n var userSelector = document.getElementById(\"user\");\n\t\t userSelector.value = d.user;\n\t\t retrieveData();\t\t \n })\n .each( function (d) {\n twitter_geomap.markerCount = twitter_geomap.markerCount+1\n });\n\n // This is to prevent division by zero if there is only one data\n // element.\n if (N === 1) {\n N = 2;\n }\n markers\n .attr(\"cx\", function (d) {\n return d.pixelLocation.x;\n })\n .attr(\"cy\", function (d) {\n return d.pixelLocation.y;\n })\n .style(\"fill\", color)\n //.style(\"fill-opacity\", 0.6)\n .style(\"fill-opacity\", 1.0)\n .style(\"stroke\", \"black\")\n .transition()\n .duration(500)\n //.attr(\"r\", function(d, i) { return 5 + 15*(N-1-i)/(N-1); })\n .attr(\"r\", radius)\n //.style(\"opacity\", 1.0);\n .style(\"opacity\", opacity);\n //.style(\"opacity\", function(d, i){ return 0.3 + 0.7*i/(N-1); });\n\n markers.exit()\n .transition()\n .duration(500)\n .style(\"opacity\", 0.0)\n .each( function (d) {\n twitter_geomap.markerCount = twitter_geomap.markerCount-1\n })\n .remove();\n\n }; // end of GMap.prototype.draw()\n\n // onRemove() destroys the overlay when it is no longer needed.\n GMap.prototype.onRemove = function () {\n // TODO(choudhury): implement this function by removing the SVG element\n // from the pane.\n console.log(\"onRemove()!\");\n\n };\n\n GMap.prototype.locations = function (locationData) {\n // TODO(choudhury): it might be better to actually copy the values here.\n //\n this.locationData = locationData;\n //this.locationData = []\n //this.locationData.length = 0;\n //for(var i=0; i<locationData.length; i++){\n //this.locationData.push(locationData[i]);\n //}\n };\n\n // This function is used to display the current state of the time slider.\n twitter_geomap.displayFunc = (function () {\n var lowdiv,\n highdiv;\n\n lowdiv = d3.select(\"#low\");\n highdiv = d3.select(\"#high\");\n\n return function (low, high) {\n lowdiv.html(twitter_geomap.dateformat(new Date(low)));\n highdiv.html(twitter_geomap.dateformat(new Date(high)));\n };\n }());\n\n // Create a range slider for slicing by time. Whenever the slider changes\n // or moves, update the display showing the current time range. Eventually,\n // the \"onchange\" callback (which fires when the user releases the mouse\n // button when making a change to the slider position) will also trigger a\n // database lookup, but at the moment we omit that functionality to avoid\n // spurious database lookups as the engine puts the slider together and sets\n // the positions of the sliders programmatically.\n twitter_geomap.timeslider.slider({\n range: true,\n\n change: function (evt, ui) {\n var low,\n high;\n\n low = ui.values[0];\n high = ui.values[1];\n\n twitter_geomap.displayFunc(low, high);\n },\n\n slide: function (evt, ui) {\n var low,\n high;\n\n low = ui.values[0];\n high = ui.values[1];\n\n twitter_geomap.displayFunc(low, high);\n }\n });\n\n // Some options for initializing the google map.\n //\n // Set to Middle East\n options = {\n zoom: 6,\n //center: new google.maps.LatLng(8.86, 30.33),\n center: new google.maps.LatLng(8,-68),\n //mapTypeId: google.maps.MapTypeId.ROADMAP\n mapTypeId: google.maps.MapTypeId.TERRAIN\n\n };\n div = d3.select(\"#map\").node();\n twitter_geomap.map = new GMap(div, options);\n\n // Direct the colormap selector radio buttons to redraw the map when they\n // are clicked.\n buttons = document.getElementsByName(\"colormap\");\n redraw = function () {\n twitter_geomap.map.draw();\n twitter_geomap.ac.logUserActivity(\"changed colormap selection\", \"redrawing\", twitter_geomap.ac.WF_EXPLORE);\n };\n\n for (i = 0; i < buttons.length; i += 1) {\n buttons[i].onclick = redraw;\n }\n checkbox = document.getElementById(\"invert\");\n checkbox.onclick = function () {\n twitter_geomap.map.draw();\n twitter_geomap.ac.logUserActivity(\"color map inverted\", \"color map change\", twitter_geomap.ac.WF_EXPLORE);\n };\n\n var dayboxesredraw = function () {\n twitter_geomap.map.draw();\n twitter_geomap.ac.logUserActivity(\"changed day name selection\", \"day selection change\", twitter_geomap.ac.WF_EXPLORE);\n };\n\n // Direct the day filter checkboxes to redraw the map when clicked.\n dayboxes = twitter_geomap.dayNames.map(function (d) {\n return document.getElementById(d);\n });\n\n for (i = 0; i < dayboxes.length; i += 1) {\n dayboxes[i].onclick = dayboxesredraw;\n }\n\n var glyphsizeredraw = function () {\n twitter_geomap.map.draw();\n twitter_geomap.ac.logUserActivity(\"changed glyph size\", \"glyphsize change redraw\", twitter_geomap.ac.WF_EXPLORE);\n };\n\n\n // Direct the glyph size radio buttons to redraw.\n buttons = document.getElementsByName(\"size\");\n for (i = 0; i < buttons.length; i += 1) {\n buttons[i].onclick = glyphsizeredraw;\n }\n\n // Direct the size control to redraw.\n document.getElementById(\"size\").onchange = glyphsizeredraw;\n\n var opacityredraw = function () {\n twitter_geomap.map.draw();\n twitter_geomap.ac.logUserActivity(\"changed glyph opacity\", \"opacity change redraw\", twitter_geomap.ac.WF_EXPLORE);\n };\n\n\n // Create a regular slider for setting the opacity and direct it to redraw\n // when it changes (but not on every slide action - that would be bulky and\n // too slow; the UI doesn't demand that level of responsivity).\n twitter_geomap.opacityslider = $(\"#opacity\");\n twitter_geomap.opacityslider.slider({\n min: 0,\n max: 100,\n value: 100,\n change: opacityredraw\n });\n\n // event handlers to log the action and then cause a screen redraw.\n\n var onUserNameChange = function () {\n var userSelector = document.getElementById(\"user\")\n console.log(\"user filter change:\",userSelector.value)\n // if we are sending OWF messages for user changes (enabled in config file), then send a message\n if (twitter_geomap.config.userEnteredMessagesEnabled) {\n console.log(\"condition true - sending\")\n sendUserEnteredMessage()\n }\n twitter_geomap.ac.logUserActivity(\"user changed to: \"+userSelector.value, \"userChange\", twitter_geomap.ac.WF_EXPLORE);\n retrieveData();//;userSelector !== '');\n };\n\n var onRecordLimitChange = function () {\n var limitSelector = document.getElementById(\"record-limit\")\n console.log(\"new record limit:\",limitSelector.value)\n twitter_geomap.ac.logUserActivity(\"record limit changed to: \"+limitSelector.value, \"recordLimit\", twitter_geomap.ac.WF_EXPLORE);\n retrieveData();\n };\n\n // The database lookup should happen again when the hashtag list or record\n // count limit field changes.\n $('#user').autocomplete({\n change: onUserNameChange,\n minLength: 0\n }).keyup(function (evt) {\n // respond to enter by starting a query\n if (evt.which === 13) {\n onUserNameChange();\n }\n });\n d3.select(\"#record-limit\").node().onchange = onRecordLimitChange;\n\n // Attach actions to the zoom and unzoom buttons.\n zoomfunc = (function () {\n var unzoom,\n stack;\n\n unzoom = d3.select(\"#unzoom\");\n\n stack = [];\n\n return {\n zoomer: function (slider) {\n var value,\n bounds;\n\n twitter_geomap.ac.logUserActivity(\"zoom timescale in - time slider\", \"zoom-time-in\", twitter_geomap.ac.WF_CREATE);\n\n // Return immediately if the handles are already at the bounds.\n //value = slider.getValue();\n value = slider.slider(\"values\");\n //bounds = [slider.getMin(), slider.getMax()];\n bounds = [slider.slider(\"option\", \"min\"), slider.slider(\"option\", \"max\")];\n if (value[0] === bounds[0] && value[1] === bounds[1]) {\n return;\n }\n\n // Save the current bounds on the stack.\n stack.push(bounds);\n\n // Set the bounds of the slider to be its current value range.\n //slider.setMin(value[0]);\n slider.slider(\"option\", \"min\", value[0]);\n slider.slider(\"option\", \"max\", value[1]);\n bounds = [slider.slider(\"option\", \"min\"), slider.slider(\"option\", \"max\")];\n\n // OWF messaging\n console.log(\"about to send time msg\")\n if (twitter_geomap.config.timeChangeMessagesEnabled) {\n sendTimeChangeMessage(bounds)\n }\n\n\n // Activate the unzoom button if this is the first entry in the\n // stack.\n if (stack.length === 1) {\n unzoom.classed(\"disabled\", false);\n }\n },\n\n unzoomer: function (slider) {\n var bounds;\n\n twitter_geomap.ac.logUserActivity(\"zoom timescale out - time slider\", \"zoom-time-out\", twitter_geomap.ac.WF_CREATE);\n\n // Make sure this function is not being called when there are no\n // entries in the stack.\n if (stack.length === 0) {\n throw \"Logic error: Unzoom button was clicked even though there is nothing to unzoom to.\";\n }\n\n // Pop a bounds value from the stack, and set it as the bounds\n // for the slider.\n bounds = stack.pop();\n //slider.setMin(bounds[0]);\n slider.slider(\"option\", \"min\", bounds[0]);\n //slider.setMax(bounds[1]);\n slider.slider(\"option\", \"max\", bounds[1]);\n\n // OWF messaging\n if (twitter_geomap.config.timeChangeMessagesEnabled) {\n sendTimeChangeMessage(bounds)\n }\n\n // If the stack now contains no entries, disable the unzoom\n // button.\n if (stack.length === 0) {\n unzoom.classed(\"disabled\", true);\n }\n }\n };\n }());\n\n d3.select(\"#zoom\")\n .data([twitter_geomap.timeslider])\n .on('click', zoomfunc.zoomer);\n\n\t// when user clicks the button below the user input field, clear\n\t// the value and redraw the map so all user's tweets are displayed.\n\td3.select(\"#clearUser\")\n\t .on('click', function() {\n\t\t\tvar userSelector = document.getElementById(\"user\");\n\t\t\tuserSelector.value = \"\";\n\t\t\tretrieveData();\n\n if (twitter_geomap.config.clearUserMessageEnabled) {\n sendClearUserMessage();\n }\n\t\t});\n\n\n\td3.select(\"#explore-trends-button\")\n\t .on(\"click\",sendBoundsMessage);\n\n // When the \"focus user\" button is clicked, and the user filter box is not\n // blank, retrieve new data with bounds checking disabled, then\n // automatically zoom to the right level to show all the tweets.\n d3.select(\"#focusUser\")\n .on(\"click\", function () {\n if (d3.select(\"#user\").property(\"value\").length > 0) {\n retrieveData({\n focusUser: true,\n callback: _.bind(twitter_geomap.map.zoomToFit, twitter_geomap.map)\n });\n }\n });\n\n d3.select(\"#unzoom\")\n .data([twitter_geomap.timeslider])\n .on('click', zoomfunc.unzoomer);\n\n // Get the earliest and latest times in the database, to create a suitable\n // range for the time slider. Pass in the \"zoomer\" function so the initial\n // range can be properly zoomed to begin with.\n getMinMaxDates(zoomfunc.zoomer);\n\n // Install the abort action on the button.\n d3.select(\"#abort\")\n .on(\"click\", function () {\n twitter_geomap.ac.logUserActivity(\"User Clicked Query/Abort Button\", \"query button\", twitter_geomap.ac.WF_GETDATA);\n\n // If there is a current ajax call in flight, abort it (it is\n // theoretically possible that the abort button is clicked between\n // the time it's activated, and the time an ajax call is sent).\n if (twitter_geomap.currentAjax) {\n twitter_geomap.currentAjax.abort();\n twitter_geomap.currentAjax = null;\n twitter_geomap.ac.logUserActivity(\"Active query aborted\", \"query abort\", twitter_geomap.ac.WF_GETDATA);\n\n // Place a message in the abort button.\n d3.select(\"#abort\")\n .classed(\"disabled\", true)\n .text(\"Query aborted\");\n }\n\n // Disable the button.\n d3.select(\"#abort\").classed(\"disabled\", true);\n });\n }", "function selectValues(map, attribute) { \n //create \"raw\" and \"normalized\" buttons\n $('#panel').append('<button class=\"Cities\" style=\"-moz-box-shadow: 0px 10px 14px -7px #383838; -webkit-box-shadow: 0px 10px 14px -7px #383838; box-shadow: 0px 10px 14px -7px #383838; background-color:#FFF; -moz-border-radius:8px; -webkit-border-radius:8px; border-radius:8px; display:inline-block; cursor:pointer; color:#000000; font-family:avenir; font-size:14px; font-weight:bold; padding:8px 14px; text-decoration:none;\">Show US Cities</button>');\n $('#panel').append('<button class=\"Countries\" style=\"-moz-box-shadow: 0px 10px 14px -7px #383838; -webkit-box-shadow: 0px 10px 14px -7px #383838; box-shadow: 0px 10px 14px -7px #383838; background-color:#FFF; -moz-border-radius:8px; -webkit-border-radius:8px; border-radius:8px; display:inline-block; cursor:pointer; color:#000000; font-family:avenir; font-size:14px; font-weight:bold; padding:8px 14px; text-decoration:none;\">Show Global</button>');\n \n //If normalized button hit, call function\n $(\".Cities\").click(function(){\n console.log(\"cities\")\n // var index = $('.range-slider').val();\n // normalized = true\n // raw = false\n // //create true false statement\n // if (normalized == true) {\n // //if true, update based on normalized attributes\n // updatePropSymbols(map, attributes[index], rawAttributes[index]);\n // };\n \n map.setView(new L.LatLng(41.4, -89), 4)\n\n console.log(\"this is a test\")\n if (map.hasLayer(geoJsonLayers.countries)){\n console.log(\"map has countries\")\n map.removeLayer(geoJsonLayers.countries)\n map.addLayer(geoJsonLayers.cities)\n map.removeLayer(geoJsonLayers.usa)\n }\n console.log(GE_Cities)\n \n });\n \n $(\".Countries\").click(function(){\n console.log(\"clicky\")\n //updateLegend(map, attribute)\n // var index = $('.range-slider').val();\n // //re-set statement\n // normalized = false\n // raw = true\n // if (raw == true) {\n // //take off previous layer\n // map.removeLayer(attributes);\n // //call update prop symbols based on normalized data\n // updatePropSymbols(map, rawAttributes[index], attributes[index]); \n // };\n map.setView(new L.LatLng(41.4, -0), 2)\n if (map.hasLayer(geoJsonLayers.cities)){\n\n map.removeLayer(geoJsonLayers.cities)\n map.addLayer(geoJsonLayers.countries)\n //map.addLayer(geoJsonLayers.usa)\n};\n});\n}", "function addListMapMoves(){\n if (map) {\n // attach proper event listener after first idle\n // as the races have already been fetched in initialize()\n google.maps.event.addListenerOnce(map, \"idle\", function() {\n google.maps.event.addListener(map, \"idle\", function() {\n // Do not refresh races if the map is not visible or \"follow map bounds\" not checked\n if ($(\"#follow_map_bounds\").is(\":checked\") && $(\".mapbox\").is(\":visible\") ) {\n viewport = map.getBounds().toUrlValue().split(\",\");\n getRaces(new RefreshOptions({\"refreshMap\": false}));\n pushState(getParamQuery());\n }\n });\n });\n }\n}", "function eventShowMap() {\n // Create a map object and specify the DOM element for display.\n $.ajax({\n url: document.URL,\n method:'GET',\n dataType: 'JSON'\n }).done(function(response){\n eventLat = response[\"lat\"];\n eventLng = response[\"lng\"];\n\n coord = {lat: response[\"lat\"], lng: response[\"lng\"]};\n var styles = [\n {elementType: 'geometry', stylers: [{color: '#242f3e'}]},\n {elementType: 'labels.text.stroke', stylers: [{color: '#242f3e'}]},\n {elementType: 'labels.text.fill', stylers: [{color: '#746855'}]},\n {\n featureType: 'administrative.locality',\n elementType: 'labels.text.fill',\n stylers: [{color: '#d59563'}]\n },\n {\n featureType: 'poi',\n elementType: 'labels.text.fill',\n stylers: [{color: '#d59563'}]\n },\n {\n featureType: 'poi.park',\n elementType: 'geometry',\n stylers: [{color: '#263c3f'}]\n },\n {\n featureType: 'poi.park',\n elementType: 'labels.text.fill',\n stylers: [{color: '#6b9a76'}]\n },\n {\n featureType: 'road',\n elementType: 'geometry',\n stylers: [{color: '#38414e'}]\n },\n {\n featureType: 'road',\n elementType: 'geometry.stroke',\n stylers: [{color: '#212a37'}]\n },\n {\n featureType: 'road',\n elementType: 'labels.text.fill',\n stylers: [{color: '#9ca5b3'}]\n },\n {\n featureType: 'road.highway',\n elementType: 'geometry',\n stylers: [{color: '#746855'}]\n },\n {\n featureType: 'road.highway',\n elementType: 'geometry.stroke',\n stylers: [{color: '#1f2835'}]\n },\n {\n featureType: 'road.highway',\n elementType: 'labels.text.fill',\n stylers: [{color: '#f3d19c'}]\n },\n {\n featureType: 'transit',\n elementType: 'geometry',\n stylers: [{color: '#2f3948'}]\n },\n {\n featureType: 'transit.station',\n elementType: 'labels.text.fill',\n stylers: [{color: '#d59563'}]\n },\n {\n featureType: 'water',\n elementType: 'geometry',\n stylers: [{color: '#17263c'}]\n },\n {\n featureType: 'water',\n elementType: 'labels.text.fill',\n stylers: [{color: '#515c6d'}]\n },\n {\n featureType: 'water',\n elementType: 'labels.text.stroke',\n stylers: [{color: '#17263c'}]\n }\n ]\n\n googleMap = new google.maps.Map(document.getElementById('map'), {\n center: coord,\n disableDefaultUI: true,\n zoom: 13,\n styles: styles\n });\n var marker = new google.maps.Marker({\n map: googleMap,\n position: coord,\n title: response[\"venueName\"]\n });\n var contentString = '<div class=\"content\">'+\n '<h1>'+ response[\"venueName\"] +'</h1> ' +\n '<p>'+ response[\"address_1\"] + '</p>' +\n '<p>'+ response[\"city\"] + '</p>' +\n '<p>'+ response[\"postal_code\"] + '</p>' +\n '</div>';\n\n var infowindow = new google.maps.InfoWindow({\n content: contentString\n });\n\n marker.addListener('click', function() {\n infowindow.open(googleMap, marker);\n });\n })\n var formElement = document.querySelector(\"#map-form form\")\n\n formElement.addEventListener(\"submit\", function(e){\n e.preventDefault();\n\n var postalCode = document.querySelector(\"#postal-code-input\").value\n\n $.ajax({\n url: '/events/location',\n method:'post',\n data: {postal_code: postalCode},\n dataType: 'JSON'\n }).done(function(response){\n\n\n //WAYPOINTS CREATION\n clientLocation = response[\"clientLocation\"]\n clientLat = response[\"clientLocation\"][\"lat\"];\n clientLng = response[\"clientLocation\"][\"lng\"];\n var directionsDisplay;\n var directionsService = new google.maps.DirectionsService();\n directionsDisplay = new google.maps.DirectionsRenderer();\n directionsDisplay.setMap(googleMap);\n var start = new google.maps.LatLng(eventLat, eventLng);\n var end = new google.maps.LatLng(clientLat, clientLng);\n var request = {\n origin: start,\n destination: end,\n travelMode: 'WALKING'\n };\n\n directionsService.route(request, function(result, status) {\n if (status == 'OK') {\n directionsDisplay.setDirections(result);\n }\n });\n })\n })\n}", "function continent_events_over(ev) {\n // console.log(\"na:1\");\n // console.log(ev);\n var count = 0;\n var ts = Array.from(ev.target.parentNode.children, function(x) {\n var previous_style = x.getAttribute('style');\n // console.log(previous_style);\n if (previous_style != null) { previous_style = previous_style.split(\";\").filter(p => !p.startsWith('fill:') && !p.startsWith('fill-opacity:')); } else { previous_style = []; }\n previous_style.push('fill:#273F47');\n previous_style.push('fill-opacity:1');\n previous_style = previous_style.filter(x => (x != \"\"));\n count++;\n // if (count == 0) console.log(\"PS list:\", previous_style);\n x.setAttribute('style', previous_style.join(';'));\n\n\n // change world name\n var continentname = x.parentElement.id.replace('_',' ');\n $('#worldmapname').text(continentname);\n });\n}", "function riverHover(e) {\n map.getCanvas().style.cursor = 'pointer';\n var description = e.features[0].properties.GNIS_NAME;\n\n riverPopup\n .setLngLat(mouseCoord)\n .setHTML(description)\n .addTo(map);\n document.getElementsByClassName('mapboxgl-popup-content')[0].classList.add('riverLabel');\n\n }", "function ClickbleMapItemCursor(){\n //changes cursor style when hovering \"clickable\" layer.\n map.on(\"mousemove\", \"photos\", function(e) {map.getCanvas().style.cursor = 'pointer';});\n map.on('mouseleave', \"photos\", function() {map.getCanvas().style.cursor = '';});\n\n}", "function showOverlays() {\n setAllMap(map);\n }", "function updateMap() {\n\t\n\tvar sel_option = $(\"input[name=dataDisplayOption]:checked\").val();\n\t\n\t// ignore func call if the setting was not changed\n\tif (sel_option == c_display_option) { return; }\n\t\n\t// clear the map of the old overlays\n\tclearMap();\n\t\n\t// save the new display option\n\tc_display_option = sel_option;\n\t\n\t// plot the data all over again\n\tplotAllData();\n\t\n}", "function initMapClickHandlers() {\r\n\tvar listener = google.maps.event.addListener(map, 'tilesloaded', function() {\r\n\t\tgoogle.maps.event.addListener(map, 'click', mapLeftClicked);\r\n\t\tgoogle.maps.event.removeListener(listener);\r\n\t});\r\n}", "function onEachFeature(feature, layer) {\n layer.on({\n mouseover: highlightFeature,\n mouseout: resetHighlight,\n click: goToMap\n });\n}", "function mouseOverGraphic(ev) {\n map.setMapCursor(\"crosshair\");\n}", "function updateMapPoints(ui) {\n\tui = $('#slider-range').slider('option');\n\tvar min = ui.values[0]\n\tvar max = ui.values[1];\n\t\n\tfor(var victim in victimsPoints){\n\t\t\n\t\tvar representative = false;\n\t\tfor(var i = 0; i < victimsPoints[victim].length; i++) {\n\t\t\tvar p = victimsPoints[victim][i];\n\t\t\t\n\t\t\tif(representative == false && \n\t\t\t\tp.timestamp >= min && p.timestamp <= max && \n\t\t\t\t(!filterMissing || (filterMissing && !isVictimSafe(victim))) ){\n\t\t\t\tif(p.getMap() === null)\n\t\t\t\t\tp.setMap(map);\n\n\t\t\t\trepresentative = true;\n\t\t\t}else{\n\t\t\t\tp.setMap(null);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// redraw marker colors\n\tredrawMarkers();\n\t\n\t// update window info\n\t/*if(markerPath !== false) {\n\t\tshowPath(markerPath);\n\t\tinfoWindow.setContent(createDialog(markerPath));\n\t}*/\n}", "function _switchtoMap1(){\ndocument.getElementById(\"issMap\").style.display = \"block\";\ndocument.getElementById(\"issMap2\").style.display = \"none\";\t\n\n// HIDE SLIDER\n// document.getElementById(\"sliderLabel\").style.display = \"none\";\n// document.getElementById(\"intervalSlider\").style.display = \"none\";\n\n// _cleanInterval();\n}", "function updateCarbonVisibility(evt) {\n evt = evt || window.event;\n //get the layer index from the element id\n var lName = evt.target.id.split(\"_\");\n //If radio button is checked show Map layer\n if (dom.byId(evt.target.id).checked) {\n dynamicMapSerives[lName[1]].show();\n } else {\n dynamicMapSerives[lName[1]].hide();\n }\n }", "function _mapZoomed() {\n _setAllIcons();\n}", "function handler(canvasid)\n {\n \tvar idcode=canvasid[canvasid.length-1];\n \tvar idx=((idcode==\"x\")?0:((idcode==\"y\")?1:2));\n\t\tvar ii=GLOBAL.iiarr[idx];\n\t\tvar canvas=document.getElementById(canvasid);\n\t\tvar img=document.getElementById(canvas.id+\"-img\");\n\t\tvar phony=document.getElementById(canvas.id+\"-img-phony\");\n\n\t\tcanvas.width =parseFloat(canvas.parentNode.style.width );\n\t\tcanvas.height=parseFloat(canvas.parentNode.style.height);\n\t\tvar maxii=181*217/Math.max(canvas.width,canvas.height);\n\t\tGLOBAL.iiarr[idx]=Math.min(maxii,Math.max(0,ii));\n\t\tDrawImage(canvas,img,idx);\n\n\t\tvar phonyid=\"map-\"+idx+\"-\"+GLOBAL.iiarr[idx];\n\t\tphony.useMap=\"#\"+phonyid;\n\t\tvar areas=document.getElementById(phony.useMap.substr(1)).childNodes;\n\t\tfor (var areaiter=0; areaiter < areas.length; areaiter++){\n\t\t\tareas[areaiter].addEventListener(\"click\",MouseClickAreaHandler,false);\n\t\t\tareas[areaiter].addEventListener(\"mouseover\",MouseOverAreaHandler,false);\n\t\t\t// areas[areaiter].addEventListener(\"mouseout\", MouseOutAreaHandler ,false);\n\t\t}\n\t\t\n\t\tphony.addEventListener(\"mousedown\", MouseDraggingHandler_start,false);\n\t\tphony.addEventListener(\"mousemove\", MouseDraggingHandler_move ,false);\n\t\tphony.addEventListener(\"mouseup\", MouseDraggingHandler_stop ,false);\n\n\t\tphony.addEventListener(\"mousewheel\", MouseWheelHandler,false);\n\t\tphony.addEventListener(\"DOMMouseScroll\",MouseWheelHandler,false);\n\n\t\tfunction MouseWheelHandler(e){\n \t var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));\n\t\t\tvar ii=GLOBAL.iiarr[idx];\n \t if (delta>0){ii+=1;}else{ii-=1;}\n\t\t\tGLOBAL.iiarr[idx]=Math.min(maxii,Math.max(0,ii));\n\t\t\tUpdate();\n\n\t\t\tif (GLOBAL.area_map_flag){\n\t\t\t\tvar phonyid=\"map-\"+idx+\"-\"+GLOBAL.iiarr[idx];\n\t\t\t\tphony.useMap=\"#\"+phonyid;\n\t\t\t\t\n\t\t\t\tvar areas=document.getElementById(phony.useMap.substr(1)).childNodes;\n\t\t\t\tfor (var areaiter=0; areaiter < areas.length; areaiter++){\n\t\t\t\t\tareas[areaiter].addEventListener(\"mouseover\",MouseOverAreaHandler,false);\n\t\t\t\t\tareas[areaiter].addEventListener(\"click\",MouseClickAreaHandler,false);\n\t\t\t\t\t// areas[areaiter].addEventListener(\"mouseout\", MouseOutAreaHandler ,false);\n\t\t\t\t}\n\t\t\t}\n\t\t} // function MouseWheelHandler\n }", "function showTooltip(d) {\n\nfunction addStosingle(number){\nif(number==1){\nreturn number + ' ' + \"predicts\"\n} else if(number>1) {\nreturn number + ' ' + \"predict\"\n} else if(number==0){\n return 'none' + ' ' + \"predict\"\n}\n}\n\n\nvar tooltipsDisplay = mapTooltip.style(\"display\",\"block\");\n\ntooltipsDisplay.style(\"visibility\", \"visible\")\nif(className == 'simpleMap'){\n $('path').mouseenter(function (d) {\n\n var pathId = $(this).attr('id');\n\n for(var i=0; i<data.length; i++){\n var dem = data[i].twoPartyDemo\n var rep = data[i].twoPartyRep\n\n if (pathId == data[i].iso_2 && data[i].Democrats_fre > data[i].Republican_fre){\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+ \"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \" + \"<span >\"+ data[i].totalComponents + \"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre) +\"</span>\" +\" Clinton to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre) +\"</span>\" +\" Trump.\" +\"</p>\"+\n \"<p class='elecVote boldText'>Popular vote forecast:</p>\"+\n \"<p class='elecVote'>Clinton:\" + \" \" + dem + \"</p>\"+\n \"<p class='elecVote'>Trump:\" + \" \" + rep + \"</p>\"+\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n\n } else if(pathId == data[i].iso_2 && data[i].Democrats_fre < data[i].Republican_fre) {\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+\"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \"+ \"<span >\" + data[i].totalComponents+\"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre)+\"</span>\" + \" Trump to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre)+\"</span>\" + \" Clinton.\" + \"</p>\" +\n \"<p class='elecVote boldText'>Popular vote forecast:</p>\"+\n \"<p class='elecVote'>Clinton:\" + \" \" + dem + \"</p>\"+\n \"<p class='elecVote'>Trump:\" + \" \" + rep + \"</p>\"+\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n }\n else if(pathId == data[i].iso_2 && data[i].Democrats_fre == data[i].Republican_fre && data[i].twoPartyRep>data[i].twoPartyDemo) {\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+\"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \"+ \"<span >\" + data[i].totalComponents+\"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre)+\"</span>\" + \" Trump to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre)+\"</span>\" + \" Clinton.\" + \"</p>\" +\n \"<p class='elecVote boldText'>Popular vote forecast:</p>\"+\n \"<p class='elecVote'>Clinton:\" + \" \" + dem + \"</p>\"+\n \"<p class='elecVote'>Trump:\" + \" \" + rep + \"</p>\"+\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n }\n else if(pathId == data[i].iso_2 && data[i].Democrats_fre == data[i].Republican_fre && data[i].twoPartyRep<data[i].twoPartyDemo) {\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+\"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \"+ \"<span>\" + data[i].totalComponents+\"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre)+\"</span>\" + \" Trump to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre) +\"</span>\" + \" Clinton.\" + \"</p>\" +\n \"<p class='elecVote boldText'>Popular vote forecast:</p>\"+\n \"<p class='elecVote'>Clinton:\" + \" \" + dem + \"</p>\"+\n \"<p class='elecVote'>Trump:\" + \" \" + rep + \"</p>\"+\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n }\n\n else if(pathId == data[i].iso_2 && data[i].Democrats_fre==0 && data[i].Republican_fre==0 && data[i].twoPartyRep==0 && data[i].twoPartyDemo==0){\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p>\"+ \"Sorry No Data available for \"+ data[i].name +\"</p>\"\n\n )\n }\n }\n\n\n\n\n\n\n\n });\n\n}\nelse if(className == 'mapmain'){\n\n $('path').mouseenter(function (d) {\n\n var pathId = $(this).attr('id');\n\n for(var i=0; i<data.length; i++){\n var dem = data[i].twoPartyDemo\n var rep = data[i].twoPartyRep\n if (pathId == data[i].iso_2 && data[i].Democrats_fre > data[i].Republican_fre){\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+ \"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \" + \"<span >\"+data[i].totalComponents+ \"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre) +\"</span>\" +\" Clinton to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre) +\"</span>\" +\" Trump.\" +\"</p>\"+\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n\n } else if(pathId == data[i].iso_2 && data[i].Democrats_fre < data[i].Republican_fre) {\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+\"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \"+ \"<span >\" + data[i].totalComponents+\"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre)+\"</span>\" + \" Trump to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre)+\"</span>\" + \" Clinton.\" + \"</p>\" +\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n }\n else if(pathId == data[i].iso_2 && data[i].Democrats_fre == data[i].Republican_fre) {\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p class='elecVote'>\" + \"Electoral votes: \"+ \"<span class='boldText'>\" +data[i].electoral_vote+\"</span>\" + \"</p>\"+\n \"<p class='elecVote'>\" + \"Out of \"+ \"<span>\" + data[i].totalComponents+\"</span>\" + \" available component methods, \"+ \"<span>\" + addStosingle(dataUs[i].Republican_fre)+\"</span>\" + \" Trump to win whereas \"+ \"<span>\" + addStosingle(dataUs[i].Democrats_fre)+\"</span>\" + \" Clinton.\" + \"</p>\" +\n \"<p class='boldText pollyBot'>\"+ \"Click to learn more about the race in \" + data[i].name + \".\" + \"</p>\"\n )\n }\n else if(pathId == data[i].iso_2 && data[i].Democrats_fre==0 && data[i].Republican_fre==0 && data[i].twoPartyRep==0 && data[i].twoPartyDemo==0){\n return mapTooltip.html(\n \"<h3 class='headerMap'>\" + data[i].name + \"</h3>\"+\n \"<p>\"+ \"Sorry No Data available for \"+ data[i].name +\"</p>\"\n\n )\n }\n }\n\n\n\n\n\n\n\n });\n\n}\n\n\n\n\n\n\n}", "function onEachFeature(feature, layer) {\n layer.on({\n mouseover: highlightFeature,\n mouseout: resetHighlight\n //click: zoomToFeature -- with this, we will redirect to the individual state map\n });\n }", "function openMap () {\n $('.interactivemap-head').click(function() {\n if(!$(this).hasClass('up')) {\n $('#imagemap-wrapper').slideDown(900);\n $(this).addClass('up');\n $('.interactivemap-head .interactivebtn-wraper span').fadeOut(1000);\n } else {\n $('#imagemap-wrapper').slideUp(1200);\n $(this).removeClass('up');\n $('.interactivemap-head .interactivebtn-wraper span').fadeIn(1000);\n }\n });\n }", "function triggerUIUpdate(mapPlotData, maxWeight, minWeight, polygons, level) {\n /** Clear anything currently on the map **/\n console.time(\"query_aql_draw\");\n mapWidgetClearMap();\n\n $.each(mapPlotData, function (m) {\n\n\n var cp = polygons[mapPlotData[m].cell];\n if (!cp) {\n if (level === \"city\") {\n var coordinate_list = [];\n var rectangle = mapPlotData[m].area;\n if (rectangle) {\n coordinate_list.push({lat: rectangle[0][1], lng: rectangle[0][0]});\n coordinate_list.push({lat: rectangle[1][1], lng: rectangle[0][0]});\n coordinate_list.push({lat: rectangle[1][1], lng: rectangle[1][0]});\n coordinate_list.push({lat: rectangle[0][1], lng: rectangle[1][0]});\n coordinate_list.push({lat: rectangle[0][1], lng: rectangle[0][0]});\n }\n\n polygons[mapPlotData[m].cell] = new google.maps.Polygon({\n paths: coordinate_list,\n strokeColor: 'black',\n strokeOpacity: 0.8,\n strokeWeight: 0.5,\n fillColor: 'blue',\n fillOpacity: 0.4,\n level: \"city\",\n key: mapPlotData[m].cell\n });\n cp = polygons[mapPlotData[m].cell];\n }\n }\n\n if (cp) {\n cp.fillColor = \"#\" + rainbow.colourAt(Math.ceil(100 * (mapPlotData[m].count / maxWeight)));\n cp.fillOpacity = 0.8;\n\n\n // Clicking on a circle drills down map to that value, hovering over it displays a count\n // of tweets at that location.\n //google.maps.event.addListener(cp, 'click', function (event) {\n //$.each(markers, function (i) {\n // markers[i].close();\n //});\n //onMapPointDrillDown(map_circle.val);\n //});\n\n google.maps.event.addListener(cp, 'mousemove', function (event) {\n label_marker.setPosition(event.latLng);\n label_marker.labelContent = mapPlotData[m].cell + \":\" + mapPlotData[m].count + \" tweets\";\n label_marker.label.draw();\n label_marker.setVisible(true);\n\n });\n\n google.maps.event.addListener(cp, 'mouseout', function (event) {\n label_marker.setVisible(false);\n //sample_marker.setVisible(false);\n });\n\n google.maps.event.addListener(cp, 'click', function (event) {\n var sample = '';\n for (var i = 0; i < 1; i++) {\n sample += mapPlotData[m]['s{0}'.format(i)] + '\\n';\n }\n\n var aql = buildTimeGroupby(cp) +\n buildHashTagCountQuery(cp);\n\n A.aql(aql, function (res) {\n drawTimeSerialBrush(res.results[0]);\n drawWordCloud(res.results[1]);\n return;\n }, \"synchronous\");\n\n reportUserMessage(sample, true, 'report-sample');\n reportUserMessage(\"use dataverse \" + A._properties['dataverse'] + \";\\n\" + aql, true, 'report-query');\n });\n\n polygons[mapPlotData[m].cell] = cp;\n //polygons[mapPlotData[m].cell].setMap(null);\n polygons[mapPlotData[m].cell].setMap(map);\n\n // Show legend\n $(\"#legend-min\").html(minWeight);\n $(\"#legend-max\").html(maxWeight);\n $(\"#rainbow-legend-container\").show();\n }\n });\n\n console.timeEnd(\"query_aql_draw\");\n\n updateDashBoard(mapPlotData.slice(0, 50));\n}", "function mousePressed() {\n $(\"#winner-info\").html(\"\");\n for (var i = 0; i < dataPoints.length; i ++) {\n dataPoints[i].clicked();\n }\n}", "function hotSpotHoverBind() {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//add pulse animation\r\n\t\t\t\t\t$('.nectar_image_with_hotspots[data-hotspot-icon=\"numerical\"]').each(function () {\r\n\t\t\t\t\t\t$(this).find('.nectar_hotspot_wrap').each(function (i) {\r\n\t\t\t\t\t\t\tvar $that = $(this);\r\n\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t$that.find('.nectar_hotspot').addClass('pulse');\r\n\t\t\t\t\t\t\t}, i * 300);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar hotSpotHoverTimeout = [];\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('.nectar_image_with_hotspots:not([data-tooltip-func=\"click\"]) .nectar_hotspot').each(function (i) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\thotSpotHoverTimeout[i] = '';\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$(this).on('mouseover', function () {\r\n\t\t\t\t\t\t\tclearTimeout(hotSpotHoverTimeout[i]);\r\n\t\t\t\t\t\t\t$(this).parent().css({\r\n\t\t\t\t\t\t\t\t'z-index': '400',\r\n\t\t\t\t\t\t\t\t'height': 'auto',\r\n\t\t\t\t\t\t\t\t'width': 'auto'\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$(this).on('mouseleave', function () {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar $that = $(this);\r\n\t\t\t\t\t\t\t$that.parent().css({\r\n\t\t\t\t\t\t\t\t'z-index': 'auto'\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\thotSpotHoverTimeout[i] = setTimeout(function () {\r\n\t\t\t\t\t\t\t\t$that.parent().css({\r\n\t\t\t\t\t\t\t\t\t'height': '30px',\r\n\t\t\t\t\t\t\t\t\t'width': '30px'\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}, 300);\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});\r\n\t\t\t\t\t\r\n\t\t\t\t}", "function onchange()\r\n{\r\n window.updateHeatmap();\r\n window.updateBar();\r\n window.updateLine();\r\n}", "function update_map_slide()\n{\n var elapsed = 1 + new Date().getTime() - mapview_slide['start']; \n mapview_slide['i'] = Math.floor(mapview_slide['max'] * (mapview_slide['slide_time'] - elapsed) / mapview_slide['slide_time']);\n\n if (mapview_slide['i'] <= 0) {\n mapview_slide['active'] = false;\n return;\n } \n\n var dx = mapview_slide['dx'];\n var dy = mapview_slide['dy'];\n var sx = 0;\n var sy = 0;\n\n if (dx >= 0 && dy <= 0) {\n sx = Math.floor((dx * ((mapview_slide['max'] - mapview_slide['i']) / mapview_slide['max'])));\n sy = Math.floor((dy * ( -1 * mapview_slide['i'] / mapview_slide['max'])));\n } else if (dx >= 0 && dy >= 0) {\n sx = Math.floor((dx * ((mapview_slide['max'] - mapview_slide['i']) / mapview_slide['max'])));\n sy = Math.floor((dy * ((mapview_slide['max'] - mapview_slide['i']) / mapview_slide['max'])));\n } else if (dx <= 0 && dy >= 0) {\n sx = Math.floor((dx * ( -1 * mapview_slide['i'] / mapview_slide['max'])));\n sy = Math.floor((dy * ((mapview_slide['max'] - mapview_slide['i']) / mapview_slide['max'])));\n } else if (dx <= 0 && dy <= 0) {\n sx = Math.floor((dx * ( -1 * mapview_slide['i'] / mapview_slide['max'])));\n sy = Math.floor((dy * ( -1 * mapview_slide['i'] / mapview_slide['max'])));\n }\n\n mapview_canvas_ctx.drawImage(buffer_canvas, sx, sy, \n mapview['width'], mapview['height'],\n 0,0, mapview['width'], mapview['height']);\n\n}", "function changeMapDisplay(){\n $('.map-display-buttons').click(function() {\n // disable the selected button color\n // $('.map-display-buttons a').addClass('disabled');\n $('.map-display-buttons').addClass('disabled');\n // get the name of the selected feature\n var sel = $(this).text().toUpperCase().trim();\n // turn on the selected button color\n // $('a', this).toggleClass('disabled');\n $(this).toggleClass('disabled');\n console.log(\"the map option selected: \", sel);\n // change the map based on the button selected\n if (sel == \"CLIMATE\") {\n el.data_layer.setCartoCSS(el.bec_cartocss[el.selected_unit]);\n } else if (sel == \"BEC UNIT\") {\n el.data_layer.setCartoCSS(el.bec_cartocss.unit);\n } else if (sel == \"BEC ZONE\") {\n el.data_layer.setCartoCSS(el.bec_cartocss.zone);\n };\n });\n }", "function initPanZoom() {\n\tvar panZoom = map.paper.panzoom();\n\tpanZoom.enable()\n\n setInterval(function() {\n \t$('h1').html(panZoom.currZoom +' x:'+panZoom.currPos.x.toFixed(0)+' y:'+panZoom.currPos.y.toFixed(0));\n }, 50);\n var css = '<style type=\"text/css\">.grabbing { cursor: url(data:image/x-icon;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAAH/AAAB/wAAA/0AAANsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//+AB///wAf//4AH//+AD///yT/////////////////////////////8=), pointer !important; } .map-controls div { cursor:pointer; font-size: 20px; color: #777; font-weight:bold; font-family: Helvetica; line-height: 28px; text-align:center;border: 1px solid #bbb; } .map-controls div:hover { border: 1px solid #999; color: #000; }</style>';\n $('body').append(css);\n\n // init pan zoom controls\n var ctrls = $('<div />'), up = $('<div>+</div>'), down = $('<div>-</div>');\n ctrls\n \t.addClass('map-controls')\n \t.css({ position: 'relative', top: -80, left: 30, 'z-index': 1000 })\n \t.append(up).append(down);\n up.css({ 'border-radius': '14px 14px 0 0', width: 28, height: 28, position: 'absolute',\n \ttop: 0, left: 0, background: '#fff' });\n \tdown.css({ 'border-radius': '0 0 14px 14px', width: 28, height: 28, position: 'absolute',\n \ttop: 29, left: 0, background: '#fff' })\n $('#map').parent().append(ctrls);\n up.click(function (e) {\n panZoom.zoomIn(1);\n e.preventDefault();\n });\n down.click(function (e) {\n panZoom.zoomOut(1);\n e.preventDefault();\n });\n}", "function handleMouseMove(evt)\r\n{\r\n\tif(isClicked)\r\n\t{\r\n\t\tvar xCoor = evt.clientX - getLeft();\r\n\t\tvar yCoor = evt.clientY - getTop();\r\n\r\n\t\tvar deltaX = xOld - xCoor;\r\n\t\tvar deltaY = yOld - yCoor;\r\n\r\n\t\tvar oldLeft = getMapLeft();\r\n\t\tvar oldTop = getMapTop();\r\n\r\n\t\tvar newLeft = getMapLeft() - deltaX;\r\n\t\tvar newTop = getMapTop() - deltaY;\r\n\r\n\t\tmap.style.left = newLeft + \"px\";\r\n\t\tmap.style.top = newTop + \"px\";\r\n\r\n\t\txOld = xCoor;\r\n\t\tyOld = yCoor;\r\n\r\n\t\tmapFrame.style.cursor = \"move\";\r\n\t}\r\n}", "afterMapLoaded(map) {\r\n this.initQueryParamListener();\r\n this.initFeatureClickEvent();\r\n this.initLayerAnchorClickEvent();\r\n }", "function brushend() {\n mapUpdate();\n}", "function initDataMap(){\n\n \tinit3ViewsMode(); // init the view with 3 maps\n\n \t$('#link_1900').click(function(event) {\n \t event.preventDefault();\n \t console.log('clicked 1900');\n \t $('#map1').hide();\n \t $('#map2').hide();\n \t});\n \t$('#link_2000').click(function(event) {\n \t event.preventDefault();\n \t console.log('clicked 2000');\n \t $('#map0').hide();\n \t $('#map1').show();\n \t $('#map2').hide();\n \t});\n \t$('#link_2010').click(function(event) {\n \t event.preventDefault();\n \t console.log('clicked 2010');\n \t $('#map0').hide();\n \t $('#map1').hide();\n \t $('#map2').show();\n \t});\n\n }", "function loadMapShapes() {\n\n map.data.loadGeoJson('https://raw.githubusercontent.com/lotharJiang/Cluster-Sentiment-Analysis/master/Data%20Visualisation/newVicJson.json',{idPropertyName:'Suburb_Name'});\n\n google.maps.event.addListenerOnce(map.data,\"addfeature\",function(){\n google.maps.event.trigger(document.getElementById('Aurin-Variable'),'change');\n })\n\n map2.data.loadGeoJson('https://raw.githubusercontent.com/lotharJiang/Cluster-Sentiment-Analysis/master/Data%20Visualisation/newVicJson.json',{idPropertyName:'Suburb_Name'});\n\n google.maps.event.addListenerOnce(map2.data,\"addfeature\",function(){\n google.maps.event.trigger(document.getElementById('Aurin-Variable2'),'change');\n })\n}", "function createMap() {\n \n // Set variables to change the appearance of toggled interface buttons\n var highlightStyle = \"5px solid yellow\";\n var unhighlight = \"none\";\n \n // Connect to Mapbox account\n mapboxgl.accessToken = 'pk.eyJ1IjoidGhvbWFzaGFybmVyIiwiYSI6ImNqMXA2dTY2OTAwZnUycnJ3MzhtYWc5NHAifQ.JYDW8uR0odthCOHngoNqUg';\n \n // Declare map object containing the OSM tileset\n var osmMap = new mapboxgl.Map({\n container: 'osm',\n center: [-78.024408,38.155655],\n zoom: 7.5,\n style: 'mapbox://styles/thomasharner/cj1vmsm5e00002sqj13hcdwtm'\n });\n \n bounds = [[-84.67539,36.54076],[-74.16643,39.46601]];\n \n // Declare map object containing Gov tileset\n var govMap = new mapboxgl.Map({\n container: 'govt',\n center: [-78.024408,38.155655],\n zoom: 7.5,\n style: 'mapbox://styles/thomasharner/cj1vmwd6b00012rp221mlcom4'\n \n });\n \n // Confine the map to roughly the state of Virginia\n osmMap.setMaxBounds(bounds);\n govMap.setMaxBounds(bounds);\n \n // Create the comparison slider for the map divs\n var map = new mapboxgl.Compare(osmMap, govMap);\n \n // Upon clicking on Alexandria, highlight the button and fly to area\n $(\"#flyAlexandria\").click(function(){\n clearHighlight();\n var key = document.getElementById(\"flyAlexandria\");\n key.style.border = highlightStyle\n flyToLocation(govMap,osmMap,this.id);\n });\n \n // Upon clicking on Henrico, highlight the button and fly to area\n $(\"#flyHenrico\").click(function() {\n clearHighlight();\n var key = document.getElementById(\"flyHenrico\");\n key.style.border = highlightStyle;\n flyToLocation(govMap,osmMap,this.id);\n\n });\n \n // Upon clicking on Lynchburg, highlight the button and fly to area\n $(\"#flyLynchburg\").click(function() {\n clearHighlight();\n var key = document.getElementById(\"flyLynchburg\");\n key.style.border = highlightStyle;\n flyToLocation(govMap,osmMap,this.id);\n });\n \n // Toggle the vector and basemap layers\n document.getElementById('changeBasemap').addEventListener('click',function() {\n \n // Set the new styles and change the button label\n if(this.firstChild.nodeValue == 'View Imagery'){\n osmMap.setStyle('mapbox://styles/thomasharner/cj1vn4jr300092rpo7dnyxqm2');\n govMap.setStyle('mapbox://styles/thomasharner/cj1vn5pml00002sp9nx799k71');\n this.firstChild.nodeValue = 'View Vector';\n }\n else {\n osmMap.setStyle('mapbox://styles/thomasharner/cj1vmsm5e00002sqj13hcdwtm');\n govMap.setStyle('mapbox://styles/thomasharner/cj1vmwd6b00012rp221mlcom4');\n this.firstChild.nodeValue = 'View Imagery';\n }\n \n });\n \n // Clears the highlight when another AOI is selected\n function clearHighlight() {\n document.getElementById(\"flyLynchburg\").style.border = unhighlight;\n document.getElementById(\"flyAlexandria\").style.border = unhighlight;\n document.getElementById(\"flyHenrico\").style.border = unhighlight;\n \n }\n \n \n osmMap.on('load',function(){\n // Features and corresponding hex colors to build the legend \n var features = ['Parks', 'Building Footprints','Primary Roads', 'Secondary Roads', 'Trails'];\n var hexColors = ['#00CC00','#9933CD','#000','#E0E0E0', '#663300']\n \n for (i = 0; i < features.length; i++){\n var color = hexColors[i];\n var item = document.createElement('div');\n var key = document.createElement('span');\n key.className = 'legend-key' + color;\n key.style.backgroundColor = color;\n // if roads or trails, set to larger width and smaller height than CSS\n \n if (i == 2 || i == 3 || i == 4){\n \n key.style.display = \"inline-block\";\n key.style.height = \"0.1px\";\n key.style.width = \"25px\";\n \n }\n else {\n item.innerHTML= \"&nbsp&nbsp\";\n }\n \n var value = document.createElement('span');\n if (i == 2 || i == 3 || i == 4){\n value.innerHTML = features[i];\n }\n else {\n value.innerHTML = \"&nbsp&nbsp\" + features[i];\n }\n item.appendChild(key);\n item.appendChild(value);\n legend.appendChild(item);\n \n };\n \n \n \n });\n \n\n}", "returnToMap(){\n\t\tthis.setState({in: 87, out: 83, left: 65, right: 68});\n\t\tdocument.getElementById(\"over\").setAttribute('set_bind','true');\n\t}", "function proceed() {\n // hide map until the rendering is done\n me.__root.css('opacity', 1);\n if (me.map_meta.options) {\n $.extend(me.map.opts, me.map_meta.options);\n }\n\n me.updateMap();\n\n // binds mouse events\n me.map.getLayer('layer0').tooltips(_.bind(me.tooltip, me));\n\n // mark visualization as rendered\n me.renderingComplete();\n }", "function updateMapPointsAutoPlay(data, year) {\n var circles = g_bubbles.selectAll(\"circle.seizure-bubble\").data(data, function(d) { return d.id });\n\n if (year == \"2000\") { //reset\n svg.selectAll(\"circle.seizure-bubble\").remove()\n }\n\n circles.enter().append(\"circle\") // new entering points\n .attr('class', 'seizure-bubble')\n .attr(\"fill\", \"rgba(240, 135, 24, 0.3)\")\n .attr(\"cx\", function(d) { return projection([+d.Longitude, +d.Latitude])[0]; })\n .attr(\"cy\", function(d) { return projection([+d.Longitude, +d.Latitude])[1]; })\n .attr(\"r\", 0)\n .transition()\n .duration(500)\n .attr(\"r\", function(d) { return radiusScale(+d.ESTNUM); });\n\n circles.exit() // exiting points\n .transition()\n .duration(500)\n .attr(\"fill\", \"rgba(201, 62, 62, 0.3)\")\n}", "function addListeners() {\n\t\tGoogleMapsFactory.addListener('map', 'zoom_changed', function() {\n\t\t\tGoogleMapsFactory.closeInfowindow('cluster');\n\t\t\t// $scope.getPoints(GoogleMapsFactory.getZoom());\n\t\t});\n\t\tGoogleMapsFactory.addListener('map', 'click', function() {\n\t\t\tGoogleMapsFactory.closeInfowindow('marker');\n\t\t\t$('.result').removeClass('result_selected');\n\t\t});\n\t\tGoogleMapsFactory.addListener('infowindow_marker', 'domready', function() {\n\t\t\t$('.rating').rating();\n\t\t});\n\t\tGoogleMapsFactory.addListener('markers_clusters', 'mouseover', function(cluster) {\n\t\t\tvar markers = cluster.getMarkers();\n\t\t\tvar count = markers.length;\n\t\t\tvar avg_rating = markers.map(function(el) {\n\t\t\t\treturn el.rating;\n\t\t\t}).reduce(function(x, y) {\n\t\t\t\treturn x + y;\n\t\t\t}) / count;\n\t\t\t$translate(['points_here', 'avg_rating'], {\n\t\t\t\tnum: count\n\t\t\t}).then(function(translations) {\n\t\t\t\tvar content = '<div>' + translations.points_here + '. ' + translations.avg_rating + ': ' + avg_rating.toFixed(1) + '</div>';\n\t\t\t\tGoogleMapsFactory.openInfowindow('cluster', content, cluster.getCenter());\n\t\t\t});\n\t\t});\n\t\tGoogleMapsFactory.addListener('markers_clusters', 'mouseout', function(cluster) {\n\t\t\tGoogleMapsFactory.closeInfowindow('cluster');\n\t\t});\n\t\tGoogleMapsFactory.addListener('markers_clusters', 'click', function(cluster) {\n\t\t\tGoogleMapsFactory.closeInfowindow('cluster');\n\t\t\tGoogleMapsFactory.fitBounds(cluster.getBounds());\n\t\t\tGoogleMapsFactory.setZoom('-1');\n\t\t});\n\t}", "function initMap() {\n\t//Initial the map\n\tmap = new google.maps.Map(document.getElementById('map'),{\n\t\tzoom: 19,\n\t\tcenter: {lat:22.334754065936046, lng:114.26302671432495}\n\t});\n\n\n\t\n //////////////////////////For temp test//////////////////////////////\n\tgoogle.maps.event.addListener(map, \"rightclick\", function(event) {\n\t\tconsole.log(\"{lat:\" + event.latLng.lat() + \", lng:\" + event.latLng.lng()+\"}\");\n\t});\n //////////////////////Right Click Show Position///////////////////////\n \n //Start updating\n updateMap(1000);\n updateReporter(1000);\n\n //showTrack(60);\n}", "function updateVisibility(evt) {\n evt = evt || window.event;\n //get the layer index from the element id\n var lName = evt.target.id.split(\"_\");\n //If radio button is checked show Map layer\n if (dom.byId(evt.target.id).checked) {\n dynamicMapSerives[lName[1]].show();\n domStyle.set(\"btn_\" + lName[1] + \"_\" + mapID, {\n background: \"white\",\n color: \"#64acf7\"\n });\n } else {\n dynamicMapSerives[lName[1]].hide();\n domStyle.set(\"btn_\" + lName[1] + \"_\" + mapID, {\n background: \"#64acf7\",\n color: \"black\"\n });\n }\n }", "function updateVisibility(evt) {\n evt = evt || window.event;\n //get the layer index from the element id\n var lName = evt.target.id.split(\"_\");\n //If radio button is checked show Map layer\n if (dom.byId(evt.target.id).checked) {\n dynamicMapSerives[lName[1]].show();\n domStyle.set(\"btn_\" + lName[1] + \"_\" + mapID, {\n background: \"white\",\n color: \"#64acf7\"\n });\n } else {\n dynamicMapSerives[lName[1]].hide();\n domStyle.set(\"btn_\" + lName[1] + \"_\" + mapID, {\n background: \"#64acf7\",\n color: \"black\"\n });\n }\n }", "function mouseMoveHandler(e) \n{\n var position = this.events.getMousePosition(e);\n var lonlat = mapa.getLonLatFromPixel(position);\n\t//Tras obtener las coordenadas, podemos hacer lo que deseemos\n \n\t$(\"#coordenadas\").attr('value','Evento MouseMove: '+transformMouseCoords(lonlat));\n\t\n\n}", "render() {\n MapPlotter.setUpFilteringButtons();\n MapPlotter.readFiltersValues();\n\n MapPlotter.currentStateName = 'Texas';\n MapPlotter.drawRaceDoughnut();\n\n MapPlotter.drawMap();\n }", "function triggerRedraw() {\r\n\t if ($maps.length && Webflow.app) {\r\n\t $maps.each(Webflow.app.redrawElement);\r\n\t }\r\n\t }", "function initMaps($maps) {\n\n //var LEGEND_BG_LINK = '//images1.wikia.nocookie.net/__cb1/wowwiki/images/5/50/Map-legend-bg.jpg';\n var LEGEND_BG_LINK = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mN8tMnrPwAHOwLfJJG8pgAAAABJRU5ErkJggg=='; //#E2B24A\n var ABOUT_NOTE_LINK = '/Template:Map/Note';\n var EDIT_NOTE_ENABLE = true;\n var MAP_RATIO = null;\n\n var MAP_MIN_WIDTH = 50,\n MAP_MAX_WIDTH = 1002,\n MAP_MAX_HEIGHT = 880,\n COLUMN_WIDTH = 240,\n COLUMN_PADDING = 6,\n HEADER_HEIGHT = 15,\n HEADER_PADDING = 4,\n MARGIN_INNER = 10,\n MARGIN_VERTICAL = 15,\n MARGIN_HORIZONTAL = 25,\n LEGEND_PADDING = 10,\n MIN_SCALE = 25; // minimum percent of max scale before not open or auto close map\n\n var nId = 0; // counter for for non-conflicting node IDs\n\n function GetValue(value, defvalue) { return value || parseInt(value) == 0 ? value : defvalue; }\n var $settings = $('.map-settings').last();\n if ($settings.length) {\n LEGEND_BG_LINK = GetValue($settings.data(\"legend-bg-link\"), LEGEND_BG_LINK);\n ABOUT_NOTE_LINK = GetValue($settings.data(\"about-note-link\"), ABOUT_NOTE_LINK);\n EDIT_NOTE_ENABLE = GetValue($settings.data(\"edit-note-enable\"), EDIT_NOTE_ENABLE) != 0;\n MAP_RATIO = GetValue($settings.data(\"map-ratio\"), MAP_RATIO);\n MAP_MAX_WIDTH = GetValue($settings.data(\"map-max-width\"), MAP_MAX_WIDTH);\n MAP_MAX_HEIGHT = GetValue($settings.data(\"map-max-height\"), MAP_MAX_HEIGHT);\n }\n\n var callbacks = {\n close: $.Callbacks('unique'),\n enable: $.Callbacks('unique'),\n disable: $.Callbacks('unique'),\n refresh: $.Callbacks('unique'),\n resize: $.Callbacks('unique')\n };\n\n/* ********************* Preloader ********************* */\n\n var preloader = {\n\n imgDefers: {},\n imgDefer: function (src) {\n var imgDefer = this.imgDefers[src];\n if (!imgDefer) {\n var defer = $.Deferred(),\n img = new Image();\n\n img.src = src;\n img.onload = defer.resolve;\n this.imgDefers[src] = imgDefer = {\n defer: defer, img: img\n };\n }\n return imgDefer;\n },\n imgPromise: function (src) {\n var imgDefer = this.imgDefer(src);\n return imgDefer.defer.promise();\n },\n imgObj: function (src) {\n var imgDefer = this.imgDefer(src);\n var promise = imgDefer.defer.promise();\n if (promise.state() === 'pending')\n return null;\n\n return imgDefer.img;\n },\n\n marker: function (marker) { // preload markers\n var $marker = $(marker);\n var bg = $marker.css(\"background-image\");\n if (bg === \"none\") {\n bg = $marker.find(\"img\").attr(\"src\");\n } else {\n bg = bg.replace(/^url\\(['\"]?(.+?)['\"]?\\)/,'$1');\n }\n return (typeof bg == \"string\") ? this.imgPromise(bg) : $.when();\n },\n\n cancel: function (src) {\n delete preloader.imgDefers[src];\n },\n };\n\n/* ********************* Sort ********************* */\n\n function SortedObject(obj) {\n this.keys = [];\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n this.keys.push(i);\n }\n }\n this.keys.sort(this.compare);\n this.obj = obj;\n this.walker = -1;\n }\n\n var STOP_WORD_REGEX = /^\\s*(?:a|the)\\s+(.*)/i;\n\n $.extend(SortedObject.prototype, {\n\n compare: function (a, b) {\n /*jshint camelcase:false*/\n var m_a = a.match(STOP_WORD_REGEX),\n m_b = b.match(STOP_WORD_REGEX);\n a = m_a ? m_a[1] : a;\n b = m_b ? m_b[1] : b;\n return a > b ? 1 : (a < b ? -1 : 0);\n },\n\n reset: function () {\n this.walker = -1;\n },\n\n next: function () {\n return ++this.walker < this.keys.length;\n },\n\n key: function () {\n return this.keys[this.walker];\n },\n\n val: function () {\n return this.obj[this.keys[this.walker]];\n }\n });\n\n/* ********************* Tool Tips ********************* */\n\n // portions of this tipsie section derrived from mediawiki tipsy 12/1/17:\n // tipsy, facebook style tooltips for jquery, version 1.0.0a*\n // (c) 2008-2010 jason frame [jason@onehackoranother.com]\n // released under the MIT license\n // - shorter non-global version, w/ some mobile support\n // - note: CB means DOM callback verison that expects a DOM 'this'\n\n var tipsie = {\n get: function (elem) {\n return $.data(elem, 'tipsie');\n },\n\n enterCB: function () {\n var that = tipsie.get(this);\n if (!that) return;\n var options = that.options;\n that.hoverState = 'in';\n if (options.delayIn == 0) {\n that.show();\n } else {\n that.fixTitle();\n setTimeout(function() { if (that.hoverState == 'in') that.show(); }, options.delayIn);\n }\n },\n\n leaveCB: function() {\n var that = tipsie.get(this);\n if (!that) return;\n var options = that.options;\n that.hoverState = 'out';\n if (options.delayOut == 0) {\n that.hide();\n } else {\n setTimeout(function() { if (that.hoverState == 'out') that.hide(); }, options.delayOut);\n }\n },\n\n set: function ($elems, options) {\n if (!this.Tipsie) this.initTipsie();\n\n options = $.extend({}, this.defaults, options);\n\n $elems.each(function() {\n if (!tipsie.get(this)) $.data(this, 'tipsie', new tipsie.Tipsie(this, options));\n });\n\n if (options.trigger != 'manual')\n $elems.on(options.trigger == 'hover' ? 'mouseenter focus' : 'focus', this.enterCB)\n .on(options.trigger == 'hover' ? 'mouseleave blur' : 'blur', this.leaveCB);\n\n return this;\n },\n\n initTipsie: function () {\n this.defaults = {\n tipClass: null,\n delayIn: 0,\n delayOut: 0,\n fade: true,\n fallback: '',\n gravity: 'n',\n center: true,\n html: false,\n live: false,\n offset: 0,\n opacity: 1.0,\n title: 'title',\n trigger: 'hover'\n };\n\n this.Tipsie = function (element, options) {\n this.$element = $(element);\n this.options = $.metadata ? $.extend({}, options, this.$element.metadata()) : options;\n this.enabled = true;\n this.keyHandler = $.proxy( this.closeOnEsc, this );\n this.$template = null,\n this.fixTitle();\n };\n\n this.Tipsie.prototype = {\n/******** start Tipsie prototype ********/\n\nshow: function() {\n var title = null;\n if (!this.enabled || !(title = this.getTitle())) return;\n var element = this.$element[0], options = this.options;\n\n // measurethat - http://tinyurl.com/ycfdnf5k jsperf - http://tinyurl.com/y9fuegc7\n if (!this.$template)\n this.$template = $('<div class=\"tipsie\" role=\"tooltip\" aria-hidden=\"false\">' +\n '<div class=\"tipsie-arrow\"></div><div class=\"tipsie-inner\"></div></div>');\n var $this = this.$template.clone();\n\n var gravity = options.gravity, tipClass = options.tipClass;\n if (typeof gravity == 'function') gravity = gravity.call(element);\n if (typeof tipClass == 'function') tipClass = tipClass.call(element);\n $this.addClass('tipsie-' + gravity + ' ' + tipClass);\n\n $this.find('.tipsie-inner')[options.html ? 'html' : 'text'](title);\n\n var offset = this.$element.offset(), left = offset.left, top = offset.top,\n width = element.offsetWidth, height = element.offsetHeight;\n\n if (this.$tooltip) this.$tooltip.remove();\n this.$tooltip = $this;\n $this.appendTo(document.body); // force layout\n\n var tipWidth = $this[0].offsetWidth, tipHeight = $this[0].offsetHeight;\n\n switch (gravity.charAt(0)) {\n case 'n': top = top + height + options.offset; left = left + width / 2 - tipWidth / 2; break;\n case 's': top = top - tipHeight - options.offset; left = left + width / 2 - tipWidth / 2; break;\n case 'e': top = top + height / 2 - tipHeight / 2; left = left - tipWidth - options.offset; break;\n case 'w': top = top + height / 2 - actualHeight / 2; left = left + width + options.offset; break;\n }\n switch (gravity.charAt(1)) {\n case 'e': left = options.center ? (offset.left + width / 2 - tipWidth + 15) : (offset.left + width); break;\n case 'w': left = options.center ? (offset.left + width / 2 - 15) : offset.left; break;\n }\n\n $( document ).on( 'keydown', this.keyHandler );\n if (options.fade)\n $this.stop().css({ top: top, left: left }).animate({ opacity: options.opacity }, 100);\n else\n $this.css({ top: top, left: left, opacity: options.opacity});\n},\n\nhide: function() {\n $( document ).off( 'keydown', this.keyHandler );\n if (this.$tooltip) {\n if (this.options.fade)\n this.$tooltip.stop().fadeOut(100, function() { $(this).remove(); });\n else\n this.$tooltip.remove();\n }\n},\n\nfixTitle: function() {\n var $element = this.$element;\n if ($element.attr('title') || typeof($element.attr('original-title')) != 'string') {\n $element.attr('original-title', $element.attr('title') || '').removeAttr('title');\n }\n},\n\ngetTitle: function() {\n var title, $element = this.$element, o = this.options;\n this.fixTitle();\n if (typeof o.title == 'string') {\n title = $element.attr(o.title == 'title' ? 'original-title' : o.title);\n } else if (typeof o.title == 'function') {\n title = o.title.call($element[0]);\n }\n title = ('' + title).replace(/(^\\s*|\\s*$)/, \"\");\n return title || o.fallback;\n},\n\nvalidate: function() {\n if (!this.$element[0].parentNode) {\n this.hide();\n this.$element = null;\n this.options = null;\n }\n},\n\ncloseOnEsc: function ( e ) {\n if ( e.keyCode === 27 ) {\n this.hide();\n }\n},\n\nenable: function() { this.enabled = true; },\ndisable: function() { this.enabled = false; },\n\n/******** end Tipsie prototype ********/\n };\n }\n }\n\n /* map ToolTip interface */\n var tips = {\n // adds a text ToolTip\n addTextTip: function ($elems, trigger, autoShow) {\n var that = tipsie.set($elems, {\n tipClass: 'map-tip-text',\n delayIn: 20, //50\n opacity: 1,\n trigger: trigger,\n fade: true,\n gravity: tips.gravityCB\n });\n\n if (autoShow && $elems.length) {\n this.show($elems);\n this.closeElems.push($elems);\n callbacks.close.add(tips.close);\n }\n },\n\n close: function () {\n var a = tips.closeElems;\n tips.closeElems = [];\n for (var i= 0, len = a.length; i < len; i++)\n tips.hide(a[i]);\n },\n closeElems: [],\n\n show: function ($elems) {\n $elems.each(function () { var that = tipsie.get(this); if (that) that.show(); })\n },\n\n hide: function ($elems) {\n $elems.each(function () { var that = tipsie.get(this); if (that) that.hide(); })\n },\n\n gravityCB: function () {\n var $elem = $(this),\n w = $elem.parent().width(),\n offset = w / 100 * $elem.data('x');\n return offset > 200 ? (offset < w - 200 ? 's' : 'se') : 'sw';\n }\n };\n\n/* ********************* Lightbox ********************* */\n\n var blackOut = {\n\n $blackOut: null,\n\n create: function () {\n var defer = $.Deferred();\n\n this.$blackOut = $('<div></div>')\n .addClass('map-blackout')\n .css({\n width: $(document).width() + 'px',\n height: $(document).height() + 'px',\n display: 'none'\n })\n .appendTo(document.body)\n .fadeIn(200, function () {\n $('html').css('overflow', 'hidden');\n blackOut.refresh();\n\n blackOut.$blackOut.click(callbacks.close.fire);\n\n callbacks.refresh.add(blackOut.refresh);\n callbacks.close.add(blackOut.close);\n\n defer.resolve();\n });\n\n return defer.promise();\n },\n\n refresh: function () {\n var $blackOut = blackOut.$blackOut;\n if (!$blackOut || !$blackOut.length) return;\n\n var $document = $(document);\n $blackOut\n .css({\n width: $document.width() + 'px',\n height: $document.height() + 'px'\n });\n },\n\n close: function () {\n var $blackOut = blackOut.$blackOut;\n if (!$blackOut || !$blackOut.length) return;\n\n $('html').css('overflow', 'auto');\n\n callbacks.refresh.remove(blackOut.refresh);\n callbacks.close.remove(blackOut.close);\n\n $blackOut\n .off('click')\n .stop().fadeOut(100, function () {\n $blackOut.remove();\n $blackOut = null;\n });\n }\n };\n\n/* ********************* Map Base ********************* */\n\n function Map() { }\n\n $.extend(Map.prototype, {\n $map: null, // map dom object\n src: null, // smallSrc href string\n extents: null, // map coordinates meta\n\n mapLightbox: null, // lightbox class object\n\n initMap: function ($map, editLink, $markers, autoShow) {\n var projectionType = $map.data('projection'),\n dataFile = $map.data('file'),\n largeSrc = $map.data('large'),\n smallSrc = $map.data('small');\n\n var projectionType = projectionType ? process : \"flat\";\n var file = 'File:' + dataFile;\n var href = mw.config.get('wgArticlePath').replace(/\\$1/, file);\n\n // constrain wire size of large map, if larger than any max\n var maxW = MAP_MAX_WIDTH, maxH = MAP_MAX_HEIGHT;\n largeSrc = largeSrc.replace(/\\/latest/, '/latest/scale-to-'\n + (maxW < maxH ? ('width-down/' + maxW) : ('height-down/' + maxH)));\n\n var left = Number($map.data('left')), top = Number($map.data('top')),\n right = Number($map.data('right')), bottom = Number($map.data('bottom')),\n centerx = Number($map.data('centerx')), centery = Number($map.data('centery'));\n var extents = { // coordinate extents for this map image\n left: left ? left : 0.0,\n top: top ? top : 0.0,\n right: right ? right : 100.0,\n bottom: bottom ? bottom : 100.0,\n centerx: centerx ? centerx : null,\n centery: centery ? centery : null\n };\n\n this.$map = $map;\n this.src = smallSrc\n this.extents = extents;\n\n this.mapLightbox = new MapLightbox({\n projectionType: projectionType,\n src: largeSrc, // full href to largeSrc\n zone: $map.data('zone'),\n extents: extents,\n editLink: editLink, // edit notes link\n file: file, // wiki file name\n href: href, // full href to wiki file\n $markers: $markers,\n autoShow: autoShow\n });\n\n this.callbacks = {\n enable: $.proxy(this.enable, this),\n disable: $.proxy(this.disable, this)\n };\n\n callbacks.enable.add(this.callbacks.enable);\n callbacks.disable.add(this.callbacks.disable);\n },\n\n openMapInLightboxCB: function () {\n var $this = $(this);\n var that = $this.data('map');\n\n // start the preload now\n var largeSrc = that.mapLightbox.largeSrc;\n\n var legendPromise = preloader.imgPromise(LEGEND_BG_LINK),\n largeSrcPromise = preloader.imgPromise(largeSrc);\n\n blackOut.create()\n .done(function () {\n $.when(\n legendPromise,\n largeSrcPromise,\n that.mapLightbox.create()\n )\n .done(function () {\n that.mapLightbox.initLightbox();\n });\n });\n },\n\n enable: function () {\n this.$map\n .removeClass('map-disabled')\n .off('click')\n .attr('title', 'click to enlarge')\n .click(this.openMapInLightboxCB);\n\n callbacks.enable.remove(this.callbacks.enable);\n callbacks.disable.add(this.callbacks.disable);\n },\n\n disable: function () {\n this.$map\n .addClass('map-disabled')\n .attr('title', '(window too small to display map)')\n .off('click');\n\n callbacks.disable.remove(this.callbacks.disable);\n callbacks.enable.add(this.callbacks.enable);\n },\n\n getMapPopupWH: function () { // temp popup html, for small map popup\n var mapRatio = layout.getMapRatio(this.src);\n var w = this.$map.data('width'),\n h = mapRatio ? Math.round(w / mapRatio) : null;\n\n var w2 = !h ? Math.round(w / 2) : null;\n\n return { w:w, h:h, w2:w2 };\n },\n\n createMapPopupHtml: function () { // real popup html, for small map popup\n var dim = this.getMapPopupWH();\n var w = dim.w, h = dim.h;\n\n var content = '<div style=\"position: relative;\">' +\n '<img src=\"' + this.src + '\" width=\"' + w +\n (h ? ('px\" height=\"' + h) : '') + 'px\">';\n\n var $markers = this.$map.find('.map-marker');\n $markers.each(function () { // add markers verbatim from embedded markers\n content += $(this).prop('outerHTML');\n });\n\n return content += '</div>';\n },\n\n createMapPopupDefer: function () { // temp popup html, for small map popup\n var dim = this.getMapPopupWH();\n var w = dim.w, h = dim.h;\n if (!dim.h) { w = dim.w2; h = w; }\n\n return '<div style=\"position: relative; width: ' +\n w + 'px; height: ' + h + 'px;' + '\" class=\"map map-zone map-preload\"></div>'\n },\n\n createMapPopupCB: function () { // only used small map popup\n var $this = $(this);\n var that = $this.data('map');\n\n var promise = preloader.imgPromise(that.src);\n var pending = promise.state() === 'pending';\n\n if (pending) {\n var $markers = $this.find('.map-marker');\n $markers.each(function () { // make sure markers preload also\n if (pending) promise = $.when(preloader.marker(this), promise);\n });\n\n promise.done(function () { // reload and re-layout the popup\n that.mapPopupTooltipShow();\n });\n return that.createMapPopupDefer();\n }\n return that.createMapPopupHtml();\n },\n\n gravityCB: function () {\n var $this = $(this);\n var that = $this.data('map');\n\n // need the restricted height via the restricted width and current ratio\n var dim = that.getMapPopupWH();\n var height = dim.h ? dim.h : dim.w2;\n var top = $this.offset().top;\n\n return (top - height - 20) < $(window).scrollTop() ? 'nw' : 'sw';\n },\n\n mapPopupTooltipShowCB: function () {\n var $this = $(this);\n tips.show($this);\n },\n\n mapPopupTooltipHideCB: function () {\n var $this = $(this);\n tips.hide($this);\n },\n\n mapPopupTooltipShow: function () {\n tips.show(this.$map);\n },\n\n mapPopupTooltipHide: function () {\n tips.hide(this.$map);\n },\n\n createMapPopupTooltip: function () { // only used small map popup\n tipsie.set(this.$map, {\n tipClass: 'map-tip-popup',\n delayIn: 50,\n opacity: '1.0',\n html: true,\n fade: true,\n trigger: 'manual',\n gravity: this.gravityCB,\n title: this.createMapPopupCB\n });\n this.$map\n .on('mouseover mouseenter', this.mapPopupTooltipShowCB)\n .on('mouseleave click', this.mapPopupTooltipHideCB);\n },\n\n });\n\n/* ********************* Map Coords with Hover Popup ********************* */\n\n function Coords($map) {\n var that = this;\n\n this.x = $map.data('x');\n this.y = $map.data('y');\n this.iconTitle = '[' + this.x + ',' + this.y + ']';\n\n var $a = $map.find('a');\n if ($a.length) {\n $map.find('sup').unwrap();\n }\n\n var $markers = $map.find('.map-marker');\n\n this.initMap($map, false, $markers, true);\n\n that.createMapPopupTooltip();\n }\n\n Coords.prototype = new Map();\n\n/* ********************* Map Link with Hover Popup ********************* */\n\n function Link($map) {\n var that = this;\n\n var $a = $map.find('a');\n if ($a.length) {\n $map.text($a.text());\n }\n\n this.initMap($map, false, false, false);\n\n that.createMapPopupTooltip();\n }\n\n Link.prototype = new Map();\n\n/* ********************* Embeded Map ********************* */\n\n function Embedded($map) { // Template:Map\n\n var smallSrc = $map.data('small');\n\n var $markers = $map.find('.map-marker');\n\n this.initMap($map, this.findEditLink($map), $markers.length ? $markers : false, false);\n\n $map.find('> a > img')\n .unwrap();\n\n if ($markers.length) {\n $map\n .addClass('map-preload');\n\n var defer = $.when(\n preloader.imgPromise(smallSrc)\n )\n\n $markers.each(function () {\n defer = $.when(preloader.marker(this), defer); // first display, make sure markers preload also\n });\n\n defer.done(function () {\n $map\n .removeClass('map-preload');\n tips.addTextTip($markers, 'hover');\n });\n } else {\n $map\n .removeClass('map-preload');\n }\n }\n\n Embedded.prototype = new Map();\n\n $.extend(Embedded.prototype, {\n\n findEditLink: function ($map) {\n var $walker = $map,\n $prev, $h = false,\n $top = $('#mw-content-text');\n\n while (!$walker.is($top)) {\n if (/^h\\d$/i.test($walker[0].nodeName)) {\n $h = $walker;\n break;\n }\n $prev = $walker.prev();\n $walker = $prev.length ? $prev : $walker.parent();\n }\n\n if (!mw.config.get('wgUserName')) {\n return '/Special:SignUp?returnto=' +\n mw.util.wikiUrlencode(\n mw.config.get('wgPageName') +\n ($h ? '#' + $h\n .find('.mw-headline')\n .attr('id') : '')\n ) +\n '&type=login';\n }\n\n return $h ? $h\n .find('.editsection > a')\n .attr('href') : '?action=edit';\n }\n });\n\n/* ********************* Legend ********************* */\n\n function Legend($markers) {\n this.parsed = {};\n this.forceIndex = [];\n\n $markers.each(\n $.proxy(this.readNote, this)\n );\n delete this.forceIndex;\n }\n\n $.extend(Legend.prototype, {\n\n isEmpty: function () {\n if (this.empty === undefined) {\n this.empty = true;\n for (var i in this.parsed) {\n if (this.parsed.hasOwnProperty(i)) {\n this.empty = false;\n break;\n }\n }\n }\n return this.empty;\n },\n\n isCoord: function (coord) {\n return (/^[-+]?\\d{1,16}(?:\\.\\d{1,6})?$/).test(coord);\n },\n\n parseNote: function (node) {\n var $note = $(node),\n x, y, title, icon, id, legend;\n\n if (!$note.attr('title')) return false;\n\n x = $note.data('x');\n if (!this.isCoord(x)) return false;\n y = $note.data('y');\n if (!this.isCoord(y)) return false;\n\n title = $note.data('title') || '';\n\n icon = $note.data('icon');\n if (!icon || !icon.length) return false;\n\n legend = $note.data('legend');\n if (!legend || !legend.length) return false;\n\n id = 'mn' + nId++;\n $note.attr('data-note', id);\n\n return { id: id, legend: legend };\n },\n\n readNote: function (key, node) {\n var i, g, legend, hash, colon,\n note = this.parseNote(node);\n if (!note) return;\n\n legend = note.legend.split(/\\s*;;\\s*/);\n for (i = 0; i < legend.length; i++) {\n hash = legend[i].split(/\\s*##\\s*/);\n if (hash.length === 2) {\n this.parsed[hash[0]] = this.parsed[hash[0]] || {\n indexed: {}, named: {}\n };\n g = this.parsed[hash[0]];\n g.indexed[hash[1]] = g.indexed[hash[1]] || [];\n g.indexed[hash[1]].push(note.id);\n } else {\n colon = legend[i].split(/\\s*::\\s*/);\n if (colon.length === 2) {\n this.parsed[colon[0]] = this.parsed[colon[0]] || {\n indexed: {}, named: {}\n };\n g = this.parsed[colon[0]];\n if (this.forceIndex.indexOf(colon[1]) !== -1) {\n g.indexed[colon[1]].push(note.id);\n } else if (g.named[colon[1]]) {\n this.forceIndex.push(colon[1]);\n g.indexed[colon[1]] = g.indexed[colon[1]] || [];\n g.indexed[colon[1]].push(g.named[colon[1]]);\n g.indexed[colon[1]].push(note.id);\n delete g.named[colon[1]];\n } else {\n g.named[colon[1]] = note.id;\n }\n }\n }\n }\n },\n\n renderIndexed: function (key, notes) {\n var i, node, span;\n\n span = document.createElement('span');\n span.setAttribute('class', 'map-subGroup-name');\n span.appendChild(\n document.createTextNode(key)\n );\n\n node = document.createElement('div');\n node.setAttribute('class', 'map-subGroup');\n node.appendChild(span);\n\n for (i = 0; i < notes.length; i++) {\n span = document.createElement('span');\n span.setAttribute('class', 'map-subGroup-note pseudo-link');\n span.setAttribute('data-note', notes[i]);\n span.appendChild(\n document.createTextNode(i + 1)\n );\n node.appendChild(span);\n }\n\n return node;\n },\n\n renderNamed: function (key, value) {\n var node = document.createElement('div');\n node.setAttribute('data-note', value);\n node.setAttribute('class', 'map-group-note pseudo-link');\n node.appendChild(\n document.createTextNode(key)\n );\n return node;\n },\n\n renderGroup: function (key, list) {\n var sorted, nodes = [], div;\n\n div = document.createElement('div');\n div.setAttribute('class', 'map-group-name')\n div.appendChild(\n document.createTextNode(key)\n );\n nodes.push(div);\n\n div = document.createElement('div');\n div.setAttribute('class', 'map-group')\n nodes.push(div);\n\n sorted = new SortedObject(list.indexed);\n while (sorted.next()) {\n div.appendChild(\n this.renderIndexed(sorted.key(), sorted.val())\n );\n }\n\n sorted = new SortedObject(list.named);\n while (sorted.next()) {\n div.appendChild(\n this.renderNamed(sorted.key(), sorted.val())\n );\n }\n\n return nodes;\n },\n\n render: function () {\n var sorted = new SortedObject(this.parsed),\n nodes = [];\n\n while (sorted.next()) {\n nodes = nodes.concat(this.renderGroup(sorted.key(), sorted.val()));\n }\n\n this.$wrapper = $(document.createElement('div'))\n .addClass('map-legend-wrapper')\n .append(nodes);\n\n return $(document.createElement('div'))\n .addClass('map-legend')\n .css('background-image', \"url('\" + LEGEND_BG_LINK +\"')\")\n .append(this.$wrapper);\n },\n\n addScrollbar: function () {\n this.$wrapper.removeAttr('style');\n if (this.$wrapper.height() > layout.legend.h) {\n this.$wrapper\n .css({\n width: '255px',\n paddingRight: '15px',\n maxHeight: (layout.legend.h - 2 * LEGEND_PADDING) + 'px'\n });\n }\n }\n });\n\n/* ********************* Map in Lightbox ********************* */\n\n function MapLightbox(data) {\n this.projectionType = data.projectionType;\n this.largeSrc = data.src;\n this.zoneName = data.zone;\n this.extents = data.extents;\n this.editLink = data.editLink;\n this.file = data.file;\n this.href = data.href;\n this.autoShow = data.autoShow;\n\n var $markers = data.$markers\n\n if ($markers && $markers.length) {\n this.$markersOriginal = $markers;\n this.legend = new Legend($markers);\n }\n\n this.empty = !this.legend || this.legend.isEmpty();\n }\n\n $.extend(MapLightbox.prototype, {\n\n create: function () {\n var defer = $.Deferred();\n\n layout.setImage(this.largeSrc)\n\n this.createHeader();\n this.createLargeMap();\n if (!this.empty) {\n this.createLegend();\n }\n\n layout.setLegend(this.empty);\n\n return defer.resolve().promise();\n },\n\n initLightbox: function () {\n var that = this;\n\n layout.doLayout(); // need re-layout after image pre-load completes\n this.resize(); // which suplies data to these resizes and inits\n\n this.initHeader();\n this.initLargeMap();\n if (!this.empty) {\n this.initLegend();\n }\n\n this.callbacks = {\n close: function () { that.close(); },\n resize: function () { that.resize(); },\n refresh: function () { that.refresh(); }\n };\n\n callbacks.refresh.add(this.callbacks.refresh);\n callbacks.resize.add(this.callbacks.resize);\n callbacks.close.add(this.callbacks.close);\n },\n\n createHeader: function () {\n this.$scale = $('<span class=\"map-scale\" style=\"display:none;\"></span>');\n this.$coordinates = $('<span class=\"map-coordinates\" style=\"display:none;\"></span>');\n this.$close = $('<a href=\"#\" class=\"map-close pseudo-link\" title=\"Close\">Close</a>');\n\n this.$info = $('<span class=\"map-info\"></span>')\n .append( $('<span class=\"map-title\"></span>')\n .text(this.zoneName))\n .append(this.$scale)\n .append(this.$coordinates);\n\n this.$buttons = $('<span class=\"map-buttons\"></span>');\n\n this.$buttons\n .append($('<a class=\"map-href\"></a>')\n .prop('href', mw.html.escape(this.href))\n .prop('title', mw.html.escape(this.file))\n .text(this.file));\n\n if (EDIT_NOTE_ENABLE && this.editLink) {\n this.$buttons\n .append($('<a class=\"map-href\" title=\"Edit Map Notes\">Edit Map Notes</a>')\n .prop('href', this.editLink))\n .append($('<a class=\"map-href\" title=\"About Map Notes\">About Map Notes</a>')\n .prop('href', ABOUT_NOTE_LINK));\n }\n\n this.$buttons\n .append(this.$close);\n\n this.$header = $('<div class=\"map-header\" style=\"display:none;\"></div>')\n .css('background-image', \"url('\" + LEGEND_BG_LINK +\"')\")\n .append(this.$info)\n .append(this.$buttons)\n .appendTo(document.body);\n },\n\n closeButtonClick: function () {\n callbacks.close.fire();\n return false;\n },\n\n initHeader: function () {\n this.$close\n .click( this.closeButtonClick );\n },\n\n showNotice: function () {\n if (this.$notice) return;\n\n this.$notice = $('<div class=\"map-title\">press SPACE to fade map</div>')\n .css({\n position: 'fixed',\n left: layout.map.x + layout.map.w / 20 + 'px',\n top: layout.map.y + layout.map.h / 10 * 9 + 'px'\n });\n\n this.$largeMap\n .append(this.$notice);\n\n this.clearNotice = $.proxy(this.removeNotice, this);\n callbacks.close.add(this.clearNotice);\n callbacks.refresh.add(this.clearNotice);\n callbacks.resize.add(this.clearNotice);\n\n window.setTimeout($.proxy(this.fadeNotice, this), 3000);\n },\n\n fadeNotice: function () {\n if (!this.$notice) return;\n this.$notice\n .fadeOut(200,\n $.proxy(this.removeNotice, this)\n );\n },\n\n removeNotice: function () {\n if (!this.$notice) return;\n this.$notice.remove();\n callbacks.close.remove(this.clearNotice);\n callbacks.refresh.remove(this.clearNotice);\n callbacks.resize.remove(this.clearNotice);\n delete this.$notice;\n delete this.clearNotice;\n },\n\n createLargeMap: function () {\n if (this.$markersOriginal) {\n this.$markers = this.$markersOriginal\n .clone()\n .each(function () {\n var $this = $(this);\n $this\n .attr({\n id: $this.attr('data-note'),\n title: $this.attr('original-title')\n })\n .removeAttr('orginal-title');\n });\n }\n\n this.$image = $('<img>', {\n src: this.largeSrc\n });\n\n this.$largeMap = $('<div class=\"map-large\" style=\"display:none;\"></div>')\n .append(this.$image);\n\n if (this.$markers) {\n this.$largeMap\n .append(this.$markers);\n }\n\n this.$largeMap\n .appendTo(document.body);\n },\n\n initLargeMap: function () {\n var that = this;\n\n if (this.$markers) {\n tips.addTextTip(this.$markers, 'hover', this.autoShow);\n //tips.addTextTip(this.$markers, 'manual', this.autoShow);\n }\n\n this.$largeMap\n .on('mouseenter mousemove', $.proxy(this.updateCoords, this))\n .mouseleave($.proxy(this.hideCoords, this));\n\n if (this.$markers) {\n this.showNotice();\n\n $(document.body)\n .on('keydown.mapLightbox', function (e) {\n if (e.which === 32) that.fadeMap();\n })\n .on('keyup.mapLightbox', function (e) {\n if (e.which === 32) that.showMap();\n })\n .on('keypress.mapLightbox', function (e) {\n e.stopImmediatePropagation();\n e.preventDefault();\n });\n }\n },\n\n createLegend: function () {\n this.$legend = this.legend.render()\n .css('display', 'none')\n .appendTo(document.body);\n },\n\n initLegend: function () {\n var that = this;\n this.$legend\n .find('.pseudo-link')\n .mouseenter(function () {\n tips.show($( document.getElementById($(this).data('note')) ));\n })\n .mouseleave(function () {\n tips.hide($( document.getElementById($(this).data('note')) ));\n });\n\n this.$legend\n .find('.map-group-name')\n .data('opened', true)\n .css('cursor', 'pointer')\n .click(function () {\n var $this = $(this),\n move = $this.data('opened') ? 'slideUp' : 'slideDown',\n $group = $this.next('.map-group');\n\n $this.data('opened', !$this.data('opened'));\n\n $group[move](100, function () {\n that.legend.addScrollbar();\n });\n });\n },\n\n hideCoords: function () {\n this.$coordinates.css('display', 'none');\n this.showMap();\n this.showHideButtons();\n },\n\n fadeMap: function () {\n if (!this.isInCorner) {\n this.$image.stop().animate({ opacity: 0.25 }, 200);\n this.isInCorner = true;\n }\n },\n\n showMap: function () {\n if (this.isInCorner) {\n this.$image.stop().animate({ opacity: 1 }, 200);\n this.isInCorner = false;\n }\n },\n\n updateCoords: function (e) { // display current mouse hover map coordinates\n var projection = projectionLinear;\n //var projection = projectionEPSG3857;\n\n var displayString = projection.clientPointToCoordsDisplay(e, layout.map, this.extents)\n\n this.$coordinates\n .css('display', 'inline')\n .text(displayString);\n\n this.showHideButtons();\n },\n\n/*\n formatCoord: function (coord, min, max) { // format and clip coordinates to extents\n var c = Math.round(coord * 10.0) / 10.0;\n if (min > max) { var m = min; min = max; max = m; } // dont assume the coord systems handedness\n c = Math.min(max - 0.1, Math.max(min + 0.1, c));\n return Math.round(c) === c ? c + '.0' : c;\n },\n\n updateCoords: function (e) { // display current mouse hover map coordinates\n var map = layout.map, extents = this.extents;\n var left = extents.left, top = extents.top,\n right = extents.right, bottom = extents.bottom,\n centerx = extents.centerx, centery = extents.centery;\n\n var x100 = (e.clientX - map.x) / map.w * 100.0,\n y100 = (e.clientY - map.y) / map.h * 100.0;\n\n var x, y;\n if (centerx)\n if (x100 < 50.0)\n x = ((x100 * 2) / 100.0) * (centerx - left) + left;\n else\n x = (((x100 - 50.0) * 2) / 100.0) * (right - centerx) + centerx;\n else\n x = (x100 / 100.0) * (right - left) + left;\n\n if (centery)\n if (y100 < 50.0)\n y = ((y100 * 2) / 100.0) * (centery - top) + top;\n else\n y = (((y100 - 50.0) * 2) / 100.0) * (bottom - centery) + centery;\n else\n y = (y100 / 100.0) * (bottom - top) + top;\n\n this.$coordinates\n .css('display', 'inline')\n .text(\n this.formatCoord(x, left, right) + ',' +\n this.formatCoord(y, top, bottom) + (\n left == 0 && top == 0 && right == 100 && bottom == 100 ? '' :\n ' (' + this.formatCoord(x100, 0, 100) + ',' +\n this.formatCoord(y100, 0, 100) + ')'\n )\n );\n\n this.showHideButtons();\n },\n*/\n refresh: function () {\n this.$header\n .add(this.$largeMap)\n .add(this.$legend)\n .css('display', 'none');\n },\n\n resize: function () {\n var map = layout.map;\n\n this.resizePart(this.$header, layout.header);\n this.resizePart(this.$largeMap, map);\n if (!this.empty) {\n this.resizePart(this.$legend, layout.legend);\n }\n\n this.$image.attr({\n width: map.w + 'px',\n height: map.h + 'px'\n });\n\n if (map.scale !== 100) {\n this.$scale\n .css('display', 'inline')\n .text('scale: ' + map.scale + '%');\n } else {\n this.$scale\n .css('display', 'none');\n }\n\n if (this.$legend) {\n this.legend.addScrollbar();\n }\n\n this.showHideButtons();\n },\n\n showHideButtons: function () {\n var infoWidth = this.$info.width(),\n buttonWidth = this.$buttons.removeClass('map-minimal').width();\n\n if (infoWidth + buttonWidth + 20 >= layout.map.w) {\n this.$buttons.addClass('map-minimal');\n }\n },\n\n resizePart: function (part, values) {\n part\n .css({\n width: values.w + 'px', height: values.h + 'px',\n left: values.x + 'px', top: values.y + 'px',\n display: 'block'\n });\n },\n\n close: function () {\n this.$header.remove();\n this.$largeMap.remove();\n if (!this.empty) {\n this.$legend.remove();\n }\n\n delete this.$info;\n delete this.$buttons;\n delete this.$scale;\n delete this.$coordinates;\n delete this.$close;\n delete this.$header;\n delete this.$image;\n delete this.$markers;\n delete this.$largeMap;\n if (!this.empty) {\n delete this.$legend;\n delete this.legend.$wrapper;\n }\n\n callbacks.refresh.remove(this.callbacks.refresh);\n callbacks.resize.remove(this.callbacks.resize);\n callbacks.close.remove(this.callbacks.close);\n delete this.callbacks;\n }\n }); // end of Map in Lightbox, MapLightbox\n\n\n/* ********************* MapProjection ********************* */\n\n var projectionLinear = {\n\n formatCoord: function (coord, min, max) { // format and clip coordinates to extents\n var c = Math.round(coord * 10.0) / 10.0;\n if (min > max) { var m = min; min = max; max = m; } // dont assume the coord systems handedness\n c = Math.min(max - 0.1, Math.max(min + 0.1, c));\n return Math.round(c) === c ? c + '.0' : c;\n },\n\n // display current mouse hover map coordinates\n clientPointToCoordsDisplay: function (e, map, extents) {\n // find client point and percentage\n var left = extents.left, top = extents.top,\n right = extents.right, bottom = extents.bottom,\n centerx = extents.centerx, centery = extents.centery;\n\n var x100 = (e.clientX - map.x) / map.w * 100.0,\n y100 = (e.clientY - map.y) / map.h * 100.0;\n\n var x, y;\n if (centerx)\n if (x100 < 50.0)\n x = ((x100 * 2) / 100.0) * (centerx - left) + left;\n else\n x = (((x100 - 50.0) * 2) / 100.0) * (right - centerx) + centerx;\n else\n x = (x100 / 100.0) * (right - left) + left;\n\n if (centery)\n if (y100 < 50.0)\n y = ((y100 * 2) / 100.0) * (centery - top) + top;\n else\n y = (((y100 - 50.0) * 2) / 100.0) * (bottom - centery) + centery;\n else\n y = (y100 / 100.0) * (bottom - top) + top;\n\n // update display\n return this.formatCoord(x, left, right) + ',' +\n this.formatCoord(y, top, bottom) + (\n left == 0 && top == 0 && right == 100 && bottom == 100 ? '' :\n ' (' + this.formatCoord(x100, 0, 100) + ',' +\n this.formatCoord(y100, 0, 100) + ')');\n }\n };\n\n var projectionEPSG3857 = {\n\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n _a: null, _b: null, _c: null, _d: null,\n setTransform: function (a,b,c,d) {\n this._a = a; this._b = b; this._c = c; this._d = d;\n },\n\n formatCoord: function (coord, min, max) { // format and clip coordinates to extents\n var c = Math.round(coord * 10.0) / 10.0;\n if (min > max) { var m = min; min = max; max = m; } // dont assume the coord systems handedness\n c = Math.min(max - 0.1, Math.max(min + 0.1, c));\n return Math.round(c) === c ? c + '.0' : c;\n },\n\n // display current mouse hover map coordintes\n clientPointToCoordsDisplay: function (e, map, extents) {\n // set environment for EPSG:3857\n var scale = 0.5 / (Math.PI * this.R);\n this.setTransform(scale, 0.5, -scale, 0.5)\n\n // find client point and percentage\n var left = extents.left, top = extents.top,\n right = extents.right, bottom = extents.bottom,\n centerx = extents.centerx, centery = extents.centery;\n\n var xP = e.clientX - map.x,\n yP = e.clientY - map.y;\n var x100 = xP / map.w * 100.0,\n y100 = yP / map.h * 100.0;\n var xPE = this.R * (x100 / 100.0),\n yPE = this.R * (y100 / 100.0);\n\n // transform the point to EPSG:3857\n scale = null;\n var scale = scale || 1;\n //var xPS = (xPE / scale - this._b) / this._a,\n // yPS = (yPE / scale - this._d) / this._c;\n var xPS = xPE,\n yPS = yPE;\n\n var d = 180 / Math.PI;\n var y2 = (2 * Math.atan(Math.exp(yPS / this.R)) - (Math.PI / 2)) * d,\n x2 = xPS * d / this.R;\n if (isNaN(y2) || isNaN(x2))\n { y2 = 0; x2 = 0; }\n\n // transform as linear sections\n var x, y;\n if (centerx)\n if (x100 < 50.0)\n x = ((x100 * 2) / 100.0) * (centerx - left) + left;\n else\n x = (((x100 - 50.0) * 2) / 100.0) * (right - centerx) + centerx;\n else\n x = (x100 / 100.0) * (right - left) + left;\n\n if (centery)\n if (y100 < 50.0)\n y = ((y100 * 2) / 100.0) * (centery - top) + top;\n else\n y = (((y100 - 50.0) * 2) / 100.0) * (bottom - centery) + centery;\n else\n y = (y100 / 100.0) * (bottom - top) + top;\n\n // update display\n return this.formatCoord(x, left, right) + ',' +\n this.formatCoord(y, top, bottom) +\n (left == 0 && top == 0 && right == 100 && bottom == 100 ? '' :\n ' (' + this.formatCoord(x100, 0, 100) + ',' +\n this.formatCoord(y100, 0, 100) + ')') +\n (' (' + this.formatCoord(x2, -999999999999, 999999999999) + ',' +\n this.formatCoord(y2, -999999999999, 999999999999) + ')');\n //(' (' + x2 + ',' +\n // y2 + ')');\n }\n };\n /*\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n export function Transformation(a, b, c, d) {\n if (Util.isArray(a)) {\n // use array properties\n this._a = a[0];\n this._b = a[1];\n this._c = a[2];\n this._d = a[3];\n return;\n }\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n export function toTransformation(a, b, c, d) {\n return new Transformation(a, b, c, d);\n }\n\n transformation: (function () {\n var scale = 0.5 / (Math.PI * SphericalMercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }())\n\n scale: function (zoom) {\n return 256 * Math.pow(2, zoom);\n },\n zoom: function (scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n pointToLatLng: function (point, zoom) {\n var scale = this.scale(zoom),\n untransformedPoint = this.transformation.untransform(point, scale);\n\n return this.projection.unproject(untransformedPoint);\n },\n\n untransform: function (point, scale) {\n scale = scale || 1;\n return new Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c);\n }\n\n unproject: function (point) {\n var d = 180 / Math.PI;\n return new LatLng(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R);\n },\n\n export function LatLng(lat, lng, alt) {\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\n }\n\n // @property lat: Number\n // Latitude in degrees\n this.lat = +lat;\n\n // @property lng: Number\n // Longitude in degrees\n this.lng = +lng;\n\n // @property alt: Number\n // Altitude in meters (optional)\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n */\n\n /*\n transformation: (function () {\n var scale = 0.5 / (Math.PI * SphericalMercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }())\n\n scale: function (zoom) {\n return 256 * Math.pow(2, zoom);\n },\n\n zoom: function (scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n pointToLatLng: function (point, zoom) {\n var scale = null; //1; //256 * Math.pow(2, zoom ? zoom : 1);\n\n scale = scale || 1;\n var x = (point.x / scale - this._b) / this._a;\n var y = (point.y / scale - this._d) / this._c;\n\n return this.projection.unproject(untransformedPoint);\n },\n\n untransform: function (point, scale) {\n scale = scale || 1;\n return new Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c);\n }\n\n unproject: function (point) {\n var d = 180 / Math.PI;\n return new LatLng(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R);\n },\n */\n/*\n formatCoord: function (coord, min, max) { // format and clip coordinates to extents\n var c = Math.round(coord * 10.0) / 10.0;\n if (min > max) { var m = min; min = max; max = m; } // dont assume the coord systems handedness\n c = Math.min(max - 0.1, Math.max(min + 0.1, c));\n return Math.round(c) === c ? c + '.0' : c;\n },\n\n clientPointToCoordsDisplay: function (e, map, extents) { // display current mouse hover map coordinates\n var left = extents.left, top = extents.top,\n right = extents.right, bottom = extents.bottom,\n centerx = extents.centerx, centery = extents.centery;\n\n var x100 = (e.clientX - map.x) / map.w * 100.0,\n y100 = (e.clientY - map.y) / map.h * 100.0;\n\n var d = 180 / Math.PI;\n var y2 = (2 * Math.atan(Math.exp(y100 / this.R)) - (Math.PI / 2)) * d;\n var x2 = x100 * d / this.R;\n\n var x, y;\n if (centerx)\n if (x100 < 50.0)\n x = ((x100 * 2) / 100.0) * (centerx - left) + left;\n else\n x = (((x100 - 50.0) * 2) / 100.0) * (right - centerx) + centerx;\n else\n x = (x100 / 100.0) * (right - left) + left;\n\n if (centery)\n if (y100 < 50.0)\n y = ((y100 * 2) / 100.0) * (centery - top) + top;\n else\n y = (((y100 - 50.0) * 2) / 100.0) * (bottom - centery) + centery;\n else\n y = (y100 / 100.0) * (bottom - top) + top;\n\n return this.formatCoord(x, left, right) + ',' +\n this.formatCoord(y, top, bottom) +\n (left == 0 && top == 0 && right == 100 && bottom == 100 ? '' :\n ' (' + this.formatCoord(x100, 0, 100) + ',' +\n this.formatCoord(y100, 0, 100) + ')') +\n (' (' + this.formatCoord(x2, left, right) + ',' +\n this.formatCoord(y2, top, bottom) + ')');\n },\n*/\n\n/* ********************* Map in Lightbox Layout ********************* */\n\n var layout = ({\n\n header: {\n h: HEADER_HEIGHT + HEADER_PADDING * 2\n },\n\n margin: {\n vertical: MARGIN_VERTICAL * 2,\n horizontal: MARGIN_HORIZONTAL * 2\n },\n\n between: {\n headerMap: MARGIN_INNER\n },\n\n // current layout, in pixels\n image: { // natural image\n src: null\n },\n win: { // html client window\n w: null,\n h: null\n },\n map: { // image display layout\n w: null,\n h: null,\n scale: null // percent scale of max display size\n },\n\n setImage: function (imageSrc) {\n this.image.src = imageSrc;\n preloader.imgObj(imageSrc); // start the preload right away\n },\n\n getMapRatio: function (imageSrc) {\n var mapRatio = MAP_RATIO; // predfined image ratio from settings\n\n if (!mapRatio) { // get natural ratio if not predefined, if image is loaded\n var imgObj = preloader.imgObj(imageSrc);\n\n if (imgObj) {\n var w = imgObj.naturalWidth,\n h = imgObj.naturalHeight;\n\n if (w && h) {\n mapRatio = w / h;\n }\n }\n }\n return mapRatio;\n },\n\n resetLegend: function () {\n this.legend = {\n w: COLUMN_WIDTH + COLUMN_PADDING * 2\n };\n this.between.mapLegend = MARGIN_INNER;\n },\n\n setLegend: function (empty) {\n if (empty) {\n this.legend = { w: 0, h: 0, x: 0, y: 0 };\n this.between.mapLegend = 0;\n } else {\n this.resetLegend();\n }\n\n this.doLayout();\n },\n\n // sets layout of interface elements based on current client area and maximum possible image\n doLayout: function () {\n\n var win = this.win, $window = $(window);\n win.w = $window.width();\n win.h = $window.height();\n\n // total remaining area left-over available for image, inside current client area\n var header = this.header, legend = this.legend;\n var maxImageW = win.w - (legend.w + this.between.mapLegend + this.margin.horizontal);\n var maxImageH = win.h - (header.h + this.between.headerMap + this.margin.vertical);\n\n // clip max available height and width\n maxImageW = Math.min(MAP_MAX_WIDTH, maxImageW);\n maxImageH = Math.min(MAP_MAX_HEIGHT, maxImageH);\n\n // get image aspect ratio from predfined settings or image\n var mapRatio = this.getMapRatio(this.image.src);\n\n // scale max available height and width to ratio\n if (mapRatio) {\n var newHeight = Math.round(maxImageW / mapRatio); // 3 wide / 2 high -> height = width / 1.5\n\n if (newHeight > maxImageH) // rescale width if scale height needs clipping\n maxImageW = Math.round(maxImageH * mapRatio); // like 2 high * 1.5 = 3 wide\n else\n maxImageH = newHeight; // set new available height\n }\n\n // set straw-man image width and height\n var map = this.map;\n map.w = maxImageW;\n map.h = maxImageH;\n\n map.scale = Math.min(Math.max(Math.round(map.w / MAP_MAX_WIDTH * 100),\n Math.round(map.h / MAP_MAX_HEIGHT * 100)), 100);\n\n if (map.scale < MIN_SCALE) { // image hole is less than 50% of the max hole then bail, not sure why\n callbacks.disable.fire();\n callbacks.close.fire();\n\n } else {\n header.y = Math.round((win.h - map.h - header.h - this.between.headerMap) / 2);\n header.x = Math.round((win.w - map.w - legend.w - this.between.mapLegend) / 2);\n header.w = map.w;\n\n map.x = header.x;\n map.y = header.y + header.h + this.between.headerMap;\n\n if (legend.w) {\n legend.h = map.h + header.h + this.between.headerMap;\n legend.x = map.x + header.w + this.between.mapLegend;\n legend.y = Math.round((win.h - legend.h) / 2);\n }\n\n callbacks.enable.fire();\n }\n },\n\n init: function () {\n this.resetLegend();\n callbacks.refresh.add($.proxy(this.doLayout, this));\n callbacks.close.add($.proxy(this.resetLegend, this));\n return this;\n }\n\n }).init();\n\n function isWikiaImage(src) {\n return src && src.length &&\n /^(?:https?:)?\\/\\/(images|static|img|vignette)(\\d*)\\.wikia\\.(?:nocookie\\.net|com)\\//.test(src);\n }\n\n function isWithinBounds(data, min, max) {\n return data !== undefined && data !== null && data >= min && data <= max;\n }\n\n // now that the infrastructure is in place, process each command on the page\n $maps.each(function () {\n var $map = $(this);\n\n if (!$map.data('map') &&\n isWikiaImage($map.data('small')) &&\n isWikiaImage($map.data('large')) &&\n isWithinBounds($map.data('width'), MAP_MIN_WIDTH, MAP_MAX_WIDTH)\n ) {\n if ($map.hasClass('map-coords') // Template:Map/Coords\n ) {\n $map.data('map', new Coords($map));\n } else if ($map.hasClass('map-textlink')) { // Template:Map/Link\n $map.data('map', new Link($map));\n } else if ($map.hasClass('map-embed')) { // Template:Map\n $map.data('map', new Embedded($map));\n }\n }\n });\n\n layout.doLayout(); // will also set Map to enabled\n $(window)\n .resize(callbacks.refresh.fire)\n .resize($.debounce(100, callbacks.resize.fire));\n\n } // end of initMaps()", "function Update()\n{\n\t\t// show the correct image\n\tmapScreen.renderer.material = mapList[DataTransfer.activeLevel-1];\n\t\n\t\t// show the correct name\n\t//mapName.text = LanguageHandler.mapNames[DataTransfer.activeLevel-1];\n\t\t// trigger localize refresh\n\t//NGUI_Handler.locUpdate = true;\n\t//Debug.Log (\"mapNext\");\n\t\t// if the current map is locked, show our lock symbol and switch for the buy button...\n\tif (!DataTransfer.trackUnlocks[(DataTransfer.activeLevel-1)])\n\t{\n\t\tbtn_select.localPosition = Vector3(0,200,0);\n\t\tbtn_buy.localPosition = Vector3(0,0,0);\n\t\ticon_lock.localPosition = Vector3(0,0,0);\n\t}\n\telse\n\t{\n\t\tbtn_select.localPosition = Vector3(0,0,0);\n\t\tbtn_buy.localPosition = Vector3(0,200,0);\n\t\ticon_lock.localPosition = Vector3(0,-2000,0);\n\t}\n}", "function updateGulfVisibility(evt) {\n evt = evt || window.event;\n //get the layer index from the element id\n var lName = evt.target.id.split(\"_\");\n //If radio button is checked show Map layer\n if (dom.byId(evt.target.id).checked) {\n dynamicMapSerives[lName[1]].show();\n } else {\n dynamicMapSerives[lName[1]].hide();\n }\n }", "function kmap(map) {\n//\tthis.mapMode = '0';\n //Overlays \n this.addOverlay = function (obj) {\n this.overlays.push(obj);\n if (typeof(obj.init) == \"function\") {\n obj.init(this);\n }\n this.renderOverlays();\n }\n this.renderOverlays = function () {\n this.overlayDiv.style.display = \"\";\n //if(!this.internetExplorer){\n this.svg.style.display = \"\";\n //}\n var that = this;\n\n for (obj in this.overlays) {\n this.overlays[obj].render(that);\n }\n\n }\n\n this.hideOverlays = function () {\n this.overlayDiv.style.display = \"none\";\n if (this.svgSupport) {\n this.svg.style.display = \"none\";\n }\n /*\n for(obj in this.overlays){\n this.overlays[obj].hide();\n }\n */\n }\n this.removeOverlays = function () {\n while (this.overlays.length > 0) {\n var overlay = this.overlays.pop();\n overlay.destroy();\n }\n }\n this.removeOverlay = function (ov) {\n for (var i = 0; i < this.overlays.length; i++) {\n var overlay = this.overlays[i];\n if (ov == overlay) {\n overlay.destroy();\n }\n }\n }\n\n //\n // every change (lat,lng,zoom) will call a user defined function\n //\n\n this.callbackFunctions = new Array();\n this.addCallbackFunction = function (func) {\n if (typeof(func) == \"function\") {\n this.callbackFunctions.push(func);\n }\n }\n this.executeCallbackFunctions = function () {\n for (var i = 0; i < this.callbackFunctions.length; i++) {\n this.callbackFunctions[i].call();\n }\n }\n\n //\n // A simple distance measuring\n //\n this.startDistance = function () {\n this.distanceMeasuring = \"yes\";\n }\n\n this.endDistance = function () {\n this.distanceMeasuring = \"no\";\n }\n\n /*==================================================\n\t//\n\t// Touchscreen and Mouse EVENTS\n\t//\n\t===================================================*/\n\n //\n // Touchscreen\n // Here also the multitouch zoom is done\n //\n\n this.oldMoveX=0;\n this.oldMoveY=0;\n\n this.start = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n evt.returnValue = false; // The IE way\n }\n this.moveAnimationBlocked = true;\n this.hideOverlays();\n if (evt.touches.length == 1) {\n this.startMoveX = this.moveX - evt.touches[0].pageX / this.faktor / this.sc;\n this.startMoveY = this.moveY - evt.touches[0].pageY / this.faktor / this.sc;\n if (this.mousedownTime != null) {\n var now = (new Date()).getTime();\n if (now - this.mousedownTime < this.doubleclickTime) {\n var zoomD = Math.ceil(0.01 + this.getZoom() - this.intZoom);\n this.autoZoomIn(evt.touches[0].pageX, evt.touches[0].pageY, zoomD);\n }\n }\n this.mousedownTime = (new Date()).getTime();\n var that = this;\n clearTimeout(this.zoomOutInterval);\n var tempFunction = function () {\n that.autoZoomOut()\n };\n this.zoomOutInterval = window.setInterval(tempFunction, 20);\n }\n\n if (evt.touches.length == 2) {\n window.clearInterval(this.zoomOutInterval);\n this.moveok = false;\n var X1 = evt.touches[0].pageX;\n var Y1 = evt.touches[0].pageY;\n var X2 = evt.touches[1].pageX;\n var Y2 = evt.touches[1].pageY;\n this.startDistance = Math.sqrt(Math.pow((X2 - X1), 2) + Math.pow((Y2 - Y1), 2));\n this.startZZ = this.zoom;\n var x = (X1 + X2) / 2 / this.faktor / this.sc;\n var y = (Y1 + Y2) / 2 / this.faktor / this.sc;\n this.startMoveX = this.moveX - x;\n this.startMoveY = this.moveY - y;\n }\n\tthis.oldMoveX=this.moveX;\n\tthis.oldMoveY=this.moveY;\n }\n\n\tthis.moveok=true;\n this.move = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n evt.returnValue = false; // The IE way\n }\n\n //\tthis.mousedownTime=null;\n if (evt.touches.length == 1) {\n if (this.moveok) {\n this.lastMoveX = this.moveX;\n this.lastMoveY = this.moveY;\n this.moveX = evt.touches[0].pageX / this.faktor / this.sc + this.startMoveX;\n this.moveY = evt.touches[0].pageY / this.faktor / this.sc + this.startMoveY;\n if (!this.zoomOutStarted) {\n if ((Math.abs(this.moveX - this.oldMoveX) > 5) || (Math.abs(this.moveY - this.oldMoveY) > 5)) {\n\t\t\t//alert(this.moveX+\":\"+this.moveY);\n window.clearInterval(this.zoomOutInterval);\n this.zoomOutSpeed = 0.01;\n this.mousedownTime = null;\n }\n var center = new kPoint(this.lat, this.lng);\n this.setCenter2(center, this.zoom);\n this.moveAnimationBlocked = false;\n }\n if ((Math.abs(this.moveX - this.oldMoveX) > 5) || (Math.abs(this.moveY - this.oldMoveY) >5)) {\n\t\t//\talert(this.moveX+\":\"+this.moveX);\n\t\t\t//alert(99);\n this.mousedownTime = null; //prevents doubleclick if map is moved already\n }\n } else {\n //alert(\"no move\");\n }\n }\n\n if (evt.touches.length == 2) {\n this.mousedownTime = null;\n var X1 = evt.touches[0].pageX;\n var Y1 = evt.touches[0].pageY;\n var X2 = evt.touches[1].pageX;\n var Y2 = evt.touches[1].pageY;\n var Distance = Math.sqrt(Math.pow((X2 - X1), 2) + Math.pow((Y2 - Y1), 2));\n var zoomDelta = (Distance / this.startDistance);\n var zz = this.startZZ + zoomDelta - 1;\n if (zz < 1) {\n zz = 1;\n }\n if (zz > 18) {\n zz = 18;\n zoomDelta = 1;\n }\n var x = (X1 + X2) / 2;\n var y = (Y1 + Y2) / 2;\n\n faktor = Math.pow(2, zz);\n var zoomCenterDeltaX = x / faktor - this.width / 2;\n var zoomCenterDeltaY = y / faktor - this.height / 2;\n var f = Math.pow(2, zoomDelta - 1);\n var dx = zoomCenterDeltaX - zoomCenterDeltaX * f;\n var dy = zoomCenterDeltaY - zoomCenterDeltaY * f;\n\n this.moveX = (x + dx) / faktor + this.startMoveX;\n this.moveY = (y + dy) / faktor + this.startMoveY;\n\n var center = new kPoint(this.lat, this.lng);\n this.setCenter2(center, zz);\n }\n }\n\n this.end = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n evt.returnValue = false; // The IE way\n }\n window.clearInterval(this.zoomOutInterval);\n this.zoomOutStarted = false;\n\tthis.zoomOutSpeed = 0.01;\n\n if (evt.touches.length == 0) {\n this.moveok = true;\n if (this.moveAnimationMobile) {\n if (this.moveAnimationBlocked == false) {\n var speedX = this.lastMoveX - this.moveX;\n var speedY = this.lastMoveY - this.moveY;\n clearTimeout(this.animateMoveTimeout);\n this.animateMove(speedX, speedY);\n }\n }\n /*\n\t\t\t var that=this;\n\t\t\t var tempFunction=function () {that.moveAnimationBlocked=false};\n\t\t\t setTimeout(tempFunction,this.doubleclickTime);\n\t\t\t */\n }\n this.renderOverlays();\n }\n\n //\n // mouse events\n //\n //ie sucks\n this.pageX = function (evt) {\n try {\n if (evt.pageX === undefined) {\n var px = evt.clientX + document.body.scrollLeft;\n } else {\n var px = evt.pageX;\n }\n return px - this.mapLeft;\n } catch (e) {\n return this.lastMouseX;\n //return this.width/2 + this.mapLeft;\n }\n }\n this.pageY = function (evt) {\n try {\n if (evt.pageY === undefined) {\n var py = evt.clientY + document.body.scrollTop;\n } else {\n var py = evt.pageY;\n }\n return py - this.mapTop;\n } catch (e) {\n return this.lastMouseY;\n //return this.height/2 +this.mapTop;\n }\n }\n\n this.doubleclick = function (evt) {\n var zoom = this.getZoom();\n var zoomD = Math.ceil(0.0001 + this.getZoom()) - zoom;\n this.autoZoomIn(this.pageX(evt), this.pageY(evt), zoomD);\n }\n\n this.mousedown = function (evt) {\n this.mapParent.focus();\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n window.event.returnValue = false; // The IE way\n }\n\n this.lastMouseX = this.pageX(evt);\n this.lastMouseY = this.pageY(evt);\n this.moveAnimationBlocked = true;\n if (this.mousedownTime2 != null) {\n var now = (new Date()).getTime();\n if (now - this.mousedownTime2 < this.doubleclickTime2) {\n this.doubleclick(evt);\n }\n }\n this.mousedownTime2 = (new Date()).getTime();\n\n if (this.distanceMeasuring == \"yes\") {\n //this.normalize();\n this.distanceStartpoint = this.XYTolatlng(this.moveX + this.pageX(evt), this.moveY + this.height - this.pageY(evt));\n var img = document.createElement(\"img\");\n img.setAttribute(\"src\", \"images/dot_green.png\");\n img.style.position = \"absolute\";\n img.style.top = \"-3px\"; //<--- flag\n img.style.left = \"-4px\"; //<--- flag\n img.style.width = \"8px\"; //<--- flag\n img.style.height = \"8px\";\n\n var marker = new kMarker(this.distanceStartpoint, img);\n this.addOverlay(marker);\n var img2 = img.cloneNode(img);\n this.moveMarker = new kMarker(this.distanceStartpoint, img2);\n\n var points = new Array();\n var style = new kStyle();\n style.addStyle(\"stroke-width\", 1);\n style.addStyle(\"stroke\", \"green\");\n style.addStyle(\"stroked\", \"green\");\n this.measureLine = new kPolyline(points, style);\n this.addOverlay(this.measureLine);\n\n return;\n }\n\n\n if (evt.shiftKey) {\n this.selectRectLeft = this.pageX(evt);\n this.selectRectTop = this.pageY(evt);\n\n //\t\tthis.distanceStartpoint=this.XYTolatlng( this.pageX(evt),this.height - this.pageY(evt));\n this.selectRect = document.createElement(\"div\");\n this.selectRect.style.left = this.selectRectLeft + \"px\";\n this.selectRect.style.top = this.selectRectTop + \"px\";\n this.selectRect.style.border = \"1px solid gray\";\n if (!this.internetExplorer) {\n this.selectRect.style.opacity = 0.5;\n this.selectRect.style.backgroundColor = \"white\";\n }\n this.selectRect.style.position = \"absolute\";\n this.map.parentNode.appendChild(this.selectRect);\n } else {\n this.hideOverlays();\n this.startMoveX = this.moveX - (this.pageX(evt)) / this.faktor / this.sc;\n this.startMoveY = this.moveY - (this.pageY(evt)) / this.faktor / this.sc;\n this.movestarted = true;\n }\n return false;\n }\n\n this.mousemove = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n window.event.returnValue = false; // The IE way\n }\n //this.mousedownTime2=0; //if it's moved it's not a doubleclick\n this.lastMouseX = this.pageX(evt);\n this.lastMouseY = this.pageY(evt);\n if (this.distanceMeasuring) {\n if (this.moveMarker) {\n //this.normalize();\n var movePoint = this.XYTolatlng(this.pageX(evt), this.height - this.pageY(evt));\n this.moveMarker.moveTo(movePoint);\n this.addOverlay(this.moveMarker);\n //add line\n var points = new Array();\n if (this.distanceStartpoint.getLng() < movePoint.getLng()) {\n points.push(this.distanceStartpoint);\n points.push(movePoint);\n } else {\n points.push(movePoint);\n points.push(this.distanceStartpoint);\n }\n\n this.measureLine.setPoints(points);\n var mbr = new kBounds(movePoint, this.distanceStartpoint);\n var d = mbr.getDistanceText();\n\n var style2 = new kStyle();\n style2.addStyle(\"fill\", \"black\");\n style2.addStyle(\"stroke\", \"white\");\n style2.addStyle(\"stroke-width\", 0.5);\n style2.addStyle(\"font-size\", \"18px\");\n if (navigator.userAgent.indexOf(\"Opera\") != -1) {\n style2.addStyle(\"font-size\", \"15px\");\n } else {\n style2.addStyle(\"font-weight\", \"bold\");\n }\n style2.addStyle(\"text-anchor\", \"middle\");\n style2.addStyle(\"dy\", \"-2\");\n this.measureLine.setText(d, style2);\n var that = this;\n this.measureLine.render(that);\n return;\n }\n }\n if (evt.shiftKey) {\n if (this.selectRect) {\n this.selectRect.style.width = Math.abs(this.pageX(evt) - this.selectRectLeft) + \"px\";\n this.selectRect.style.height = Math.abs(this.pageY(evt) - this.selectRectTop) + \"px\";\n if (this.pageX(evt) < this.selectRectLeft) {\n this.selectRect.style.left = this.pageX(evt);\n }\n if (this.pageY(evt) < this.selectRectTop) {\n this.selectRect.style.top = this.pageY(evt);\n }\n }\n } else {\n if (this.movestarted) {\n this.lastMoveX = this.moveX;\n this.lastMoveY = this.moveY;\n this.lastMoveTime = new Date();\n this.moveX = (this.pageX(evt)) / this.faktor / this.sc + this.startMoveX;\n this.moveY = (this.pageY(evt)) / this.faktor / this.sc + this.startMoveY;\n\n var center = new kPoint(this.lat, this.lng);\n //alert(evt.pageX);\n this.setCenter2(center, this.zoom);\n this.moveAnimationBlocked = false;\n }\n }\n return false;\n }\n this.mouseup = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n evt.returnValue = false; // The IE way\n }\n this.lastMouseX = this.pageX(evt);\n this.lastMouseY = this.pageY(evt);\n if (this.moveMarker) {\n this.moveMarker = null;\n }\n if (this.selectRect) {\n //this.normalize();\n var p1 = this.XYTolatlng(this.selectRect.offsetLeft, this.height - this.selectRect.offsetTop - this.selectRect.offsetHeight);\n var p2 = this.XYTolatlng(this.selectRect.offsetLeft + this.selectRect.offsetWidth, this.height - this.selectRect.offsetTop);\n\n var bounds = new kBounds(p1, p2);\n this.setBounds(bounds);\n this.selectRect.parentNode.removeChild(this.selectRect);\n this.selectRect = null;\n }\n\n //using this normalize some things are working better, others not so goot. \n //delelte it will solve some problems but bring other problems\n //this.normalize();\n if (this.wheelSpeedConfig[\"moveAnimateDesktop\"]) {\n if (this.movestarted) {\n if (this.moveAnimationBlocked == false) {\n\t var now=new Date();\t\n var timeDelta=now - this.lastMoveTime;\t\t\t\t\t\t\n var speedX = (this.lastMoveX - this.moveX) / timeDelta *30;\n var speedY = (this.lastMoveY - this.moveY) / timeDelta *30;\n\t\t\t\n\t\t\tif(Math.abs(speedX) > this.wheelSpeedConfig[\"animateMinSpeed\"] || Math.abs(speedY) > this.wheelSpeedConfig[\"animateMinSpeed\"]){\n\t\t\t this.animateMove(speedX, speedY);\n\t\t\t}\n }\n }\n } else {\n this.renderOverlays();\n }\n this.movestarted = false;\n }\n\n //\n // this function should draw the map and remove any moveX,moveY\n // Maybe buggy\n //\n/*\n\tthis.normalize=function(){\n\t\t//normalize after move speed trick\n\t\tif(!isNaN(this.movedLat)){\n\t\tif(!isNaN(this.movedLng)){\n\t\tvar lat=this.movedLat;\n\t\tvar lng=this.movedLng;\n\t\tvar center=new kPoint(lat,lng);\n\t\tvar zoom=this.getZoom();\n\t\t//this.moveX=0;\n\t\t//this.moveY=0;\n\t\t//this.setCenterNoLog(center,zoom);\n\t\t//end normalize (maybe this.stop needs the same)\n\t\t}\n\t\t}\n\t}\n\t*/\n\n //\n // mouse wheel zoom\n // the mousewheel speed depends on browser and os\n // to optimize this could improve the map a lot.\n // todo: wheelspeed\n //\n\n this.zoomAccelerate = 0;\n this.mousewheel = function (evt) {\n if (evt.preventDefault) {\n evt.preventDefault(); // The W3C DOM way\n } else {\n evt.returnValue = false; // The IE way\n }\n this.mapParent.focus();\n\n this.wheelEventCounter++;\n var that = this;\n var tempFunction = function () {\n that.wheelEventCounter--\n };\n window.setTimeout(tempFunction, 1000);\n\n delta = null;\n if (!evt) /* For IE. */\n evt = window.event;\n if (evt.wheelDelta) { /* IE/Opera/Chrom. */\n delta = evt.wheelDelta / 60;\n if (window.opera) {\n delta = delta / 5;\n }\n } else if (evt.detail) { /** Mozilla case. */\n delta = -evt.detail / 3;\n }\n if (navigator.userAgent.indexOf(\"Chrome\") != -1) {\n if (navigator.userAgent.indexOf(\"Linux\") != -1) {\n delta = evt.wheelDelta / 120;\n }\n }\n\n var dzoom = delta * this.wheelSpeedConfig[\"acceleration\"] * 0.03;\n\n if (dzoom > 0 && this.zoomAccelerate < 0) this.zoomAccelerate = 0;\n if (dzoom < 0 && this.zoomAccelerate > 0) this.zoomAccelerate = 0;\n\n if (!isNaN(dzoom)) {\n this.zoomAccelerate = this.zoomAccelerate + dzoom;\n } else {\n alert(\"hopala\");\n this.zoomAccelerate = 0;\n }\n\n var that = this;\n\n var tempFunction = function () {\n that.zooming(that.pageX(evt), that.pageY(evt))\n };\n if (this.wheelZoomTimeout) {\n window.clearTimeout(this.wheelZoomTimeout);\n }\n window.setTimeout(tempFunction, 20);\n }\n\n this.wheelZoomTimeout = null;\n this.zooming = function (pageX, pageY) {\n var ttt = this.zoomAccelerate;\n\n if (this.wheelZoomTimeout) {\n clearTimeout(this.wheelZoomTimeout);\n }\n if (Math.abs(this.zoomAccelerate) > this.wheelSpeedConfig[\"zoomAnimationSlowdown\"] * 2) {\n if (this.wheelSpeedConfig[\"animate\"]) {\n var that = this;\n var tempFunction = function () {\n that.zooming(pageX, pageY)\n };\n var time = 1 / this.wheelSpeedConfig[\"animationFPS\"] * 1000;\n this.wheelZoomTimeout = window.setTimeout(tempFunction, time);\n } else {\n //alert(\"gut\");\n }\n }\n\n if (this.zoomAccelerate > this.wheelSpeedConfig[\"maxSpeed\"] / 10) this.zoomAccelerate = this.wheelSpeedConfig[\"maxSpeed\"] / 10;\n if (this.zoomAccelerate < -this.wheelSpeedConfig[\"maxSpeed\"] / 10) this.zoomAccelerate = -this.wheelSpeedConfig[\"maxSpeed\"] / 10;\n var oldzoom = this.zoom;\n this.zoom = this.zoom + this.zoomAccelerate; // * this.wheelSpeedConfig[\"speed\"]; \n if (this.zoom <= 1) {\n this.zoom = 1;\n }\n if (this.zoom >= 18) {\n this.zoom = 18;\n }\n\n faktor = Math.pow(2, this.zoom);\n var zoomCenterDeltaX = (pageX) - this.width / 2;\n var zoomCenterDeltaY = (pageY) - this.height / 2;\n\n var dzoom = this.zoom - oldzoom;\n var f = Math.pow(2, dzoom);\n\n var dx = zoomCenterDeltaX - zoomCenterDeltaX * f;\n var dy = zoomCenterDeltaY - zoomCenterDeltaY * f;\n\n this.moveX = this.moveX + dx / faktor;\n this.moveY = this.moveY + dy / faktor;\n\n if (this.zoomAccelerate > 0) {\n this.zoomAccelerate = this.zoomAccelerate - this.wheelSpeedConfig[\"zoomAnimationSlowdown\"];\n }\n if (this.zoomAccelerate < 0) {\n this.zoomAccelerate = this.zoomAccelerate + this.wheelSpeedConfig[\"zoomAnimationSlowdown\"];\n }\n\n this.setCenter2(this.center, this.zoom);\n this.renderOverlays();\n\n if (Math.abs(this.zoomAccelerate) < this.wheelSpeedConfig[\"zoomAnimationSlowdown\"] * 2) {\n this.zoomAccelerate = 0;\n }\n }\n\n //\n // Map continues moving after mouse up\n //\n\n this.animateMove = function (speedX, speedY) {\n clearTimeout(this.animateMoveTimeout);\n if (Math.abs(speedX) <= 0.00001 && Math.abs(speedY) <= 0.00001) {\n this.renderOverlays();\n return;\n }\n this.moveX = -speedX + this.moveX;\n this.moveY = -speedY + this.moveY;\n\n var that = this;\n var tempFunction = function () {\n that.animateMove(speedX * that.wheelSpeedConfig[\"moveAnimationSlowdown\"], speedY * that.wheelSpeedConfig[\"moveAnimationSlowdown\"]);\n }\n this.animateMoveTimeout = window.setTimeout(tempFunction, 20);\n this.setCenter2(this.center, this.zoom);\n }\n\n //\n // zoom in animation\n //\n\n this.autoZoomInTimeout = null;\n this.autoZoomIn = function (x, y, z) {\n //console.log(z);\n if (this.autoZoomInTimeout) {\n window.clearTimeout(this.autoZoomInTimeout);\n }\n var stepwidth = 0.1;\n if (z < 0) {\n //alert(this.getZoom());\n this.renderOverlays();\n return;\n }\n zoomGap = false;\n if (z <= stepwidth) {\n zoomGap = true;\n }\n this.hideOverlays();\n var dzoom = stepwidth;\n var zoom = this.zoom + dzoom;\n if (zoomGap) {\n zoom = Math.round(zoom);\n dzoom = z;\n //console.log(\"gap: \"+dzoom+\" : \"+zoom);\n }\n\n faktor = Math.pow(2, zoom);\n var zoomCenterDeltaX = x - this.width / 2;\n var zoomCenterDeltaY = y - this.height / 2;\n var f = Math.pow(2, dzoom);\n\n var dx = zoomCenterDeltaX - zoomCenterDeltaX * f;\n var dy = zoomCenterDeltaY - zoomCenterDeltaY * f;\n\n this.moveX = this.moveX + dx / faktor;\n this.moveY = this.moveY + dy / faktor;\n\n\n var center = new kPoint(this.lat, this.lng);\n if (zoom > 18) zoom = 18;\n zoom = Math.round(zoom * 1000) / 1000;\n this.setCenter2(center, zoom);\n var newz = z - dzoom;\n var that = this;\n if (!zoomGap) {\n var tempFunction = function () {\n that.autoZoomIn(x, y, newz)\n };\n this.autoZoomInTimeout = window.setTimeout(tempFunction, 50);\n } else {\n this.renderOverlays();\n }\n\n }\n\n //\n // zoom out animation\n //\n this.autoZoomOut = function () {\n if (this.mousedownTime != null) {\n var now = (new Date()).getTime();\n if (now - this.mousedownTime > this.zoomOutTime) {\n this.zoomOutStarted = true;\n //var center=new kPoint(this.lat,this.lng);\n var center = this.getCenter();\n var zoom = this.zoom - this.zoomOutSpeed;\n if (zoom < 1) zoom = 1;\n this.setCenter(center, zoom);\n this.zoomOutSpeed = this.zoomOutSpeed * 1.01;\n }\n }\n }\n\tthis.setMapType = function (mapType) {\n\t\tthis.mapMode = mapType;\n\t}\n\n\n //\n // Set the map coordinates and zoom\n //\n\n this.setCenter = function (center, zoom) {\n this.moveX = 0;\n this.moveY = 0;\n this.record();\n this.setCenterNoLog(center, zoom);\n }\n this.setCenter3 = function (center, zoom) {\n this.moveX = 0;\n this.moveY = 0;\n this.setCenterNoLog(center, zoom);\n }\n\n // same as setCenter but moveX,moveY are not reset (for internal use)\n this.setCenter2 = function (center, zoom) {\n this.record();\n this.setCenterNoLog(center, zoom);\n }\n\n\n //\n // same as setCenter but no history item is generated (for undo, redo)\n //\n\n this.setCenterNoLog = function (center, zoom) {\n this.center = center;\n this.lat = center.getLat();\n this.lng = center.getLng();\n\n var zoom = parseFloat(zoom);\n this.center = center;\n this.zoom = zoom;\n\n this.layer(this.map, this.lat, this.lng, this.moveX, this.moveY, zoom);\n this.executeCallbackFunctions();\n }\n\n //\n // For good speed many frames are dropped. If the frames must not be dropped, this medthod can be used\n //\t\n\n this.forceSetCenter = function (center, zoom) {\n var zoom = parseFloat(zoom);\n this.center = center;\n this.zoom = zoom;\n this.lat = center.getLat();\n this.lng = center.getLng();\n this.moveX = 0;\n this.moveY = 0;\n\n this.layer(this.map, this.lat, this.lng, this.moveX, this.moveY, zoom);\n }\n\n\n\n //\n // read the map center (no zoom value)\n //\n\n this.getCenter = function () {\n if (this.moveX != 0 || this.moveY != 0) {\n var center = new kPoint(this.movedLat, this.movedLng);\n } else {\n if (!this.center) {\n/*\n\t\t\t\tthis.setCenterNoLog(new kPoint(0,0),2);\n\t\t\t\tvar center=this.center;\n\t\t\t\t*/\n } else {\n var center = this.center;\n }\n }\n return center;\n }\n\n\n //\n // read bounds. The Coordinates at corners of the map div sw, ne would be better (change it!)\n //\n\n this.getBounds = function () {\n var sw = this.XYTolatlng(0, this.height);\n var ne = this.XYTolatlng(this.width, 0);\n var bounds = new kBounds(sw, ne);\n //\talert(p1.getLat()+\":\"+p1.getLng()+\":\"+p2.getLat()+\":\"+p2.getLng());\n return bounds;\n }\n\n //\n // like setCenter but with two gps points\n //\n\n this.setBounds = function (b) {\n //this.normalize();\n //the setbounds should be a mathematical formula and not guessing around.\n //if you know this formula pease add it here.\n //this.getSize();\n var p1 = b.getSW();\n var p2 = b.getNE();\n\n var minlat = p1.getLat();\n var maxlat = p2.getLat();\n var minlng = p1.getLng();\n var maxlng = p2.getLng();\n\n var minlat360 = lat2y(minlat);\n var maxlat360 = lat2y(maxlat);\n var centerLng = (minlng + maxlng) / 2;\n var centerLat360 = (minlat360 + maxlat360) / 2;\n var centerLat = y2lat(centerLat360);\n var center = new kPoint(centerLat, centerLng);\n var extendY = Math.abs(maxlat360 - minlat360);\n var extendX = Math.abs(maxlng - minlng);\n if (extendX / this.width > extendY / this.height) {\n var extend = extendX;\n var screensize = this.width;\n } else {\n var extend = extendY;\n var screensize = this.height;\n }\n //zoomlevel 1: 512 pixel\n //zoomlevel 2: 1024 pixel\n //...\n //extend = 360 > zoomlevel 1 , at 512px screen\n //extend = 360 > zoomlevel 2 , at 1024px screen\n //extend at zoomlevel1: extend/360 * 512px\t\n var scalarZoom = 360 / extend;\n var screenfaktor = 512 / screensize;\n var zoom = (Math.log(scalarZoom / screenfaktor)) / (Math.log(2)) + 1;\n\n if (zoom > 18) {\n zoom = 18;\n }\n if (zoom < 1) {\n zoom = 1;\n }\n if (this.center) {\n if (this.wheelSpeedConfig[\"rectShiftAnimate\"]) {\n this.animatedGoto(center, zoom, this.wheelSpeedConfig[\"rectShiftAnimationTime\"]);\n } else {\n this.setCenter(center, zoom);\n }\n } else {\n this.setCenter(center, zoom);\n }\n\n }\n\n this.animatedGotoStep = null;\n this.animatedGoto = function (newCenter, newZoom, time) {\n this.hideOverlays();\n var zoomSteps = time / 10;\n var oldCenter = this.getCenter();\n var newLat = newCenter.getLat();\n var newLng = newCenter.getLng();\n var oldLat = oldCenter.getLat();\n var oldLng = oldCenter.getLng();\n var oldZoom = this.getZoom();\n var dLat = (newLat - oldLat) / zoomSteps;\n var dLng = (newLng - oldLng) / zoomSteps;\n var dZoom = (newZoom - oldZoom) / zoomSteps;\n var dMoveX = this.moveX / zoomSteps;\n var dMoveY = this.moveY / zoomSteps;\n var oldMoveX = this.moveX;\n var oldMoveY = this.moveY;\n this.animatedGotoStep = 0;\n var that = this;\n for (var i = 0; i < zoomSteps; i++) {\n var lat = oldLat + dLat * i;\n var lng = oldLng + dLng * i;\n var zoom = oldZoom + dZoom * i;\n\n var tempFunction = function () {\n that.animatedGotoExec(oldLat, oldLng, oldZoom, dLat, dLng, dZoom, oldMoveX, oldMoveY, dMoveX, dMoveY)\n }\n window.setTimeout(tempFunction, 10 * i);\n }\n/*\n\t\tvar tempFunction=function(){ that.setCenter2(new kPoint(newLat,newLng),newZoom);that.renderOverlays()}\n\t\twindow.setTimeout(tempFunction,time+200);\n\t\t*/\n\n }\n this.animatedGotoExec = function (oldLat, oldLng, oldZoom, dLat, dLng, dZoom, oldMoveX, oldMoveY, dMoveX, dMoveY) {\n this.moveX = -dMoveX;\n this.moveY = -dMoveY;\n var lat = oldLat + dLat * this.animatedGotoStep;\n var lng = oldLng + dLng * this.animatedGotoStep;\n var zoom = oldZoom + dZoom * this.animatedGotoStep;\n this.animatedGotoStep++;\n\n this.setCenter(new kPoint(lat, lng), zoom);\n\n }\n\n this.getZoom = function () {\n return this.zoom;\n }\n\n //\n // WGS84 to x,y at the layer calculation\n // This method is uses when 3D CSS is used.\n // For Vector graphics also the 3D CSS is used.\n //\n\n this.latlngToXYlayer = function (point) {\n //if you use this function be warned that it only works for the SVG Layer an css3d\n var zoom = this.map.intZoom;\n var lat = point.getLat();\n var lng = point.getLng();\n\n var tileTest = getTileNumber(lat, lng, zoom);\n var worldCenter = this.getCenter();\n var tileCenter = getTileNumber(worldCenter.getLat(), worldCenter.getLng(), zoom);\n\n var faktor = Math.pow(2, this.intZoom);\n var x = (tileCenter[0] - tileTest[0]) * this.tileW * faktor;\n var y = (tileCenter[1] - tileTest[1]) * this.tileW * faktor;\n\n if (x > 1000000) {\n alert(\"grosser wert\");\n }\n\n var dx = this.layers[this.intZoom][\"dx\"];\n var dy = this.layers[this.intZoom][\"dy\"];\n var point = new Array();\n/*\n point[\"x\"]=-x +this.svgWidth/2 ;\n point[\"y\"]=-y +this.svgHeight/2 ;\n var rand=Math.random();\n if(rand > 1.2){\n point[\"x\"]=0;\n point[\"y\"]=0;\n }\n\t\t*/\n\n point[\"x\"] = -x + this.width / 2;\n point[\"y\"] = -y + this.height / 2;\n return (point);\n\n }\n\n //\n // WGS84 to x,y at the div calculation\n //\n this.latlngToXY = function (point) {\n var lat = point.getLat();\n var lng = point.getLng();\n var intZoom = Math.floor(this.getZoom());\n tileTest = getTileNumber(lat, lng, intZoom);\n var worldCenter = this.getCenter();\n\n var tileCenter = getTileNumber(worldCenter.getLat(), worldCenter.getLng(), intZoom);\n var x = (tileCenter[0] - tileTest[0]) * this.tileW * this.sc - this.width / 2;\n var y = (tileCenter[1] - tileTest[1]) * this.tileW * this.sc - this.height / 2;\n\n var point = new Array();\n point[\"x\"] = -x;\n point[\"y\"] = -y;\n return (point);\n\n }\n\n\n //\n // screen (map div) coordinates to lat,lng \n //\n this.XYTolatlng = function (x, y) {\n var center = this.getCenter();\n if (!center) {\n return\n };\n var faktor = Math.pow(2, this.intZoom)\n var centerLat = center.getLat();\n var centerLng = center.getLng();\n\n var xypoint = getTileNumber(centerLat, centerLng, this.intZoom);\n var dx = x - this.width / 2;\n var dy = -y + this.height / 2; //das style\n var lng = (xypoint[0] + dx / this.tileW / this.sc) / faktor * 360 - 180;\n var lat360 = (xypoint[1] + dy / this.tileH / this.sc) / faktor * 360 - 180;\n\n var lat = -y2lat(lat360) + 0;\n var p = new kPoint(lat, lng);\n return p;\n }\n\n\n //\n // for iPhone to make page fullscreen (maybe not working)\n //\n this.reSize = function () {\n var that = this;\n //setTimeout(\"window.scrollTo(0,1)\",500);\n var tempFunction = function () {\n that.getSize(that)\n };\n window.setTimeout(tempFunction, 1050);\n\n }\n\n //\n // read the size of the DIV that will contain the map\n // this method is buggy - no good\n //\n\n this.getSize = function () {\n this.width = this.map.parentNode.offsetWidth;\n this.height = this.map.parentNode.offsetHeight;\n var obj = this.map\n var left = 0;\n var top = 0;\n do {\n left += obj.offsetLeft;\n top += obj.offsetTop;\n obj = obj.offsetParent;\n } while (obj.offsetParent);\n/*\n\t\tthis.map.style.left=this.width/2+\"px\"; //not very good programming style\n\t\tthis.map.style.top=this.height/2+\"px\"; //not very good programming style\n\t\t*/\n this.mapTop = top;\n this.mapLeft = left;\n\n }\n\n\n //for undo,redo\n this.recordArray = new Array();\n this.record = function () {\n var center = this.getCenter();\n if (center) {\n var lat = center.getLat();\n var lng = center.getLng();\n var zoom = this.getZoom();\n var item = new Array(lat, lng, zoom);\n this.recordArray.push(item);\n }\n }\n this.play = function (i) {\n if (i < 1) return;\n if (i > (this.recordArray.length - 1)) return;\n var item = this.recordArray[i];\n var center = new kPoint(item[0], item[1]);\n //undo,redo must not generate history items\n this.moveX = 0;\n this.moveY = 0;\n this.setCenter3(center, item[2]);\n }\n\n\n\n/*================== layer (which layer is visible) =====================\n\tDescription: This method desides with layer is visible at the moment. \n\tIt has the same parameters as the \"draw\" method, but no \"intZoom\"\n\t========================================================================= */\n\n\n this.layerDrawLastFrame = null;\n this.layer = function (map, lat, lng, moveX, moveY, zoom) {\n if (!this.css3d) {\n if (this.layerDrawLastFrame) {\n window.clearTimeout(this.layerDrawLastFrame);\n this.layerDrawLastFrame = null;\n }\n if (this.blocked) {\n\n //the last frames must be drawn to have good result\n var that = this;\n var tempFunction = function () {\n that.layer(map, lat, lng, moveX, moveY, zoom)\n };\n this.layerDrawLastFrame = window.setTimeout(tempFunction, 100);\n\n return;\n }\n this.blocked = true;\n }\n var intZoom = Math.round(zoom );\n if (intZoom > this.maxIntZoom) {\n intZoom = 18;\n }\n this.intZoom = intZoom;\n if (!this.visibleZoom) {\n this.visibleZoom = intZoom;\n this.oldIntZoom = intZoom;\n }\n this.faktor = Math.pow(2, intZoom); //????????\n var zoomDelta = zoom - intZoom;\n this.sc = Math.pow(2, zoomDelta);\n\n //draw the layer with current zoomlevel\n this.draw(this.map, lat, lng, moveX, moveY, intZoom, zoom, this.mapMode);\n\n //if the current zoomlevel is not loaded completly, there must be a second layer displayed\n if (intZoom != this.visibleZoom) {\n this.draw(this.map, lat, lng, moveX, moveY, this.visibleZoom, zoom, this.mapMode);\n }\n\n\n if (this.layers[intZoom][\"loadComplete\"]) {\n if (this.visibleLayer != intZoom) {\n this.hideLayer(this.visibleZoom);\n this.visibleZoom = intZoom;\n this.layers[this.visibleZoom][\"layerDiv\"].style.visibility = \"\";\n }\n }\n if (this.oldIntZoom != this.intZoom) {\n if (this.oldIntZoom != this.visibleZoom) {\n this.hideLayer(this.oldIntZoom);\n }\n }\n this.oldIntZoom = intZoom;\n\n //firefox cheats a little bit and needs a time penalty\n if (!this.css3d) {\n var that = this;\n var func = function () {\n that.blocked = false;\n };\n window.setTimeout(func, 20);\n }\n }\n\n/* ==================== DRAW (speed optimized!!!)===============================\n\t\n\tThis function draws one layer. It is highly opimized for iPhone. \n\tPlease DO NOT CHANGE things except you want to increase speed!\n\tFor opimization you need a benchmark test.\n\n\tHow it works:\n\tThe position of the images is fixed.\n\tThe layer (not the images) is moved because of better performance\n\tEven zooming does not change position of the images, if 3D CSS is active (webkit).\n\n\tthis method uses \"this.layers\" , \"this.oldIntZoom\", \"this.width\", \"this.height\";\n\t\n\t===================================================================================*/\n\n this.draw = function (map, lat, lng, moveX, moveY, intZoom, zoom, mapMode) {\n this.framesCounter++;\n var that = this;\n var tempFunction = function () {\n that.framesCounter--\n };\n window.setTimeout(tempFunction, 1000);\n\n //console.log(\"draw\");\n var faktor = Math.pow(2, intZoom);\n\n //create new layer\n if (!this.layers[intZoom]) {\n var tile = getTileNumber(lat, lng, intZoom);\n this.layers[intZoom] = new Array();\n this.layers[intZoom][\"startTileX\"] = tile[0];\n this.layers[intZoom][\"startTileY\"] = tile[1];\n this.layers[intZoom][\"startLat\"] = lat2y(lat);\n this.layers[intZoom][\"startLng\"] = lng;\n this.layers[intZoom][\"images\"] = new Object();\n var layerDiv = document.createElement(\"div\");\n layerDiv.setAttribute(\"zoomlevel\", intZoom);\n layerDiv.style.position = \"absolute\";\n\n //svg layer for scalable things\n if (this.css3dvector) {\n var svg = document.createElement(\"div\");\n svg.style.top = -this.svgHeight / 2;\n svg.style.left = -this.svgWidth / 2;\n svg.style.zIndex = 1;\n svg.style.position = \"absolute\";\n this.layers[intZoom][\"svg\"] = svg;\n layerDiv.appendChild(svg);\n }\n\n\n\n //higher zoomlevels are places in front of lower zoomleves.\n //no z-index in use. z-index could give unwanted side effects to you application if you use this lib.\n var layers = map.childNodes;\n var appended = false;\n for (var i = layers.length - 1; i >= 0; i--) {\n var l = layers.item(i);\n if (l.getAttribute(\"zoomlevel\") < intZoom) {\n this.map.insertBefore(layerDiv, l);\n appended = true;\n break;\n }\n }\n if (!appended) {\n //the new layer has the highest zoomlevel\n this.map.appendChild(layerDiv);\n }\n\n //for faster access, a referenz to this div is in an array\t\n this.layers[intZoom][\"layerDiv\"] = layerDiv;\n var latDelta = 0;\n var lngDelta = 0;\n } else {\n //The layer with this zoomlevel already exists. If there are new lat,lng value, the lat,lng Delta is calculated\n var layerDiv = this.layers[intZoom][\"layerDiv\"];\n var latDelta = lat2y(lat) - this.layers[intZoom][\"startLat\"];\n var lngDelta = lng - this.layers[intZoom][\"startLng\"];\n }\n layerDiv.style.visibility = \"hidden\";\n\n //if the map is moved with drag/drop, the moveX,moveY gives the movement in Pixel (not degree as lat/lng)\n //here the real values of lat, lng are caculated\n this.movedLng = (this.layers[intZoom][\"startTileX\"] / faktor - moveX / this.tileW) * 360 - 180 + lngDelta;\n var movedLat360 = (this.layers[intZoom][\"startTileY\"] / faktor - moveY / this.tileH) * 360 - 180 - latDelta;\n this.movedLat = -y2lat(movedLat360); // -latDelta; //the bug\n //calculate real x,y\n var tile = getTileNumber(this.movedLat, this.movedLng, intZoom);\n var x = tile[0];\n var y = tile[1];\n\n\n var intX = Math.floor(x);\n var intY = Math.floor(y);\n\n\n var startX = this.layers[intZoom][\"startTileX\"];\n var startY = this.layers[intZoom][\"startTileY\"];\n\n var startIntX = Math.floor(startX);\n var startIntY = Math.floor(startY);\n\n var startDeltaX = -startX + startIntX;\n var startDeltaY = -startY + startIntY;\n\n var dx = x - startX;\n var dy = y - startY;\n\n var dxInt = Math.floor(dx - startDeltaX);\n var dyInt = Math.floor(dy - startDeltaY);\n var dxDelta = dx - startDeltaX;\n var dyDelta = dy - startDeltaY;\n\n //work in progress\n if (this.css3dvector) {\n if (!this.layers[intZoom][\"dx\"]) {\n this.layers[intZoom][\"dx\"] = +dxDelta * this.tileW - this.svgWidth / 2;\n this.layers[intZoom][\"svg\"].style.left = this.layers[intZoom][\"dx\"] + \"px\";\n\n }\n if (!this.layers[intZoom][\"dy\"]) {\n this.layers[intZoom][\"dy\"] = +dyDelta * this.tileH - this.svgHeight / 2;\n this.layers[intZoom][\"svg\"].style.top = this.layers[intZoom][\"dy\"] + \"px\";\n }\n }\n\n //set all images to hidden (only in Array) - the values are used later in this function\n for (var vimg in this.layers[intZoom][\"images\"]) {\n this.layers[intZoom][\"images\"][vimg][\"visibility\"] = false;\n }\n\n //for debug only\n var width = this.width;\n var height = this.height;\n\n var zoomDelta = zoom - intZoom;\n sc = Math.pow(2, zoomDelta);\n\n// if (sc < 1) sc = 1;\n if (sc < 0.5) sc = 0.5;\n //here the bounds of the map are calculated.\n //there is NO preload of images. Preload makes everything slow\n minX = Math.floor((-width / 2 / sc) / this.tileW + dxDelta);\n maxX = Math.ceil((width / 2 / sc) / this.tileW + dxDelta);\n minY = Math.floor((-height / 2 / sc) / this.tileH + dyDelta);\n maxY = Math.ceil((height / 2 / sc) / this.tileH + dyDelta);\n\n //now the images are placed on to the layer\n for (var i = minX; i < maxX; i++) {\n for (var j = minY; j < maxY; j++) {\n var xxx = Math.floor(startX + i);\n var yyy = Math.floor(startY + j);\n\n //The world is recursive. West of America is Asia.\n var xx = xxx % faktor;\n //var yy=yyy % faktor;\n var yy = yyy;\n if (xx < 0) xx = xx + faktor; //modulo function gives negative value for negative numbers\n if (yy < 0) continue;\n if (yy >= faktor) continue;\n\n var src = this.getTileSrc(xx, yy, intZoom, mapMode);\n var id = src + \":\" + xxx + \":\" + yyy;\n\n/*\n\t\t\t//Calculate the tile server. Use of a,b,c should increase speed but should not influence cache.\n\t\t\tvar hashval=(xx + yy) %3;\n\t\t\tswitch(hashval){\n\t\t\t\tcase 0:var server=\"a\";break;\n\t\t\t\tcase 1:var server=\"b\";break;\n\t\t\t\tcase 2:var server=\"c\";break;\n\t\t\t\tdefault: var server=\"f\";\n\t\t\t}\n\t\t\t\t\n var src=\"http://\"+server+\".tile.openstreetmap.org/\"+intZoom+\"/\"+xx+\"/\"+yy+\".png\";\n// var src=\"/iphonemapproxy/imgproxy.php?url=http://\"+server+\".tile.openstreetmap.org/\"+intZoom+\"/\"+xx+\"/\"+yy+\".png\";\n\t\t\t//see imageproxy.php for offline map usage\n\n\t\t\t//bing tiles\n\t\t\t//var n=mkbin(intZoom,xxx,yyy);\n\t\t\t//var src=\"http://ecn.t0.tiles.virtualearth.net/tiles/a\"+n+\".jpeg?g=367&mkt=de-de\";\n\t\t\t//var src=\"http://maps3.yimg.com/ae/ximg?v=1.9&t=a&s=256&.intl=de&x=\"+xx+\"&y=\"+(yy)+\"&z=\"+intZoom+\"&r=1\";\n\t\t\t//end bing tiles\n\n\t\t\t//\n var id=\"http://\"+server+\".tile.openstreetmap.org/\"+intZoom+\"/\"+xxx+\"/\"+yyy+\".png\";\n\t\t\t*/\n\n //draw images only if they don't exist on the layer\t\n if (this.layers[intZoom][\"images\"][id] == null) {\n\n var img = document.createElement(\"img\");\n img.style.visibility = \"hidden\";\n img.style.position = \"absolute\";\n img.setAttribute(\"src\", src);\n img.style.left = i * this.tileW + \"px\";\n img.style.top = j * this.tileH + \"px\";\n img.style.width = this.tileW + \"px\";\n img.style.height = this.tileH + \"px\";\n\n //if the images are loaded, they will get visible in the imgLoad function\n Event.attach(img, \"load\", this.imgLoaded, this, false);\n Event.attach(img, \"error\", this.imgError, this, false);\n\n //add img before SVG, SVG will be visible \n if (layerDiv.childNodes.length > 0) {\n layerDiv.insertBefore(img, layerDiv.childNodes.item(0));\n } else {\n layerDiv.appendChild(img);\n }\n\n //To increase performance all references are in an array\n this.layers[intZoom][\"images\"][id] = new Object();\n this.layers[intZoom][\"images\"][id][\"img\"] = img;\n this.layers[intZoom][\"loadComplete\"] = false;\n //}\t\n } else {\n }\n\n if (!this.css3d) {\n var sc = Math.pow(2, zoomDelta);\n var ddX = (tile[0] - intX) + Math.floor(dxDelta);\n var ddY = (tile[1] - intY) + Math.floor(dyDelta);\n\n var tileW = Math.round(this.tileW * sc);\n var tileH = Math.round(this.tileH * sc);\n\n var left = Math.floor((-ddX) * tileW + i * tileW);\n var top = Math.floor(-ddY * tileH + j * tileH);\n var right = Math.floor((-ddX) * tileW + (i + 1) * tileW);\n var bottom = Math.floor(-ddY * tileH + (j + 1) * tileH);\n var img = this.layers[intZoom][\"images\"][id][\"img\"];\n img.style.left = left + \"px\";\n img.style.top = top + \"px\";\n img.style.height = (right - left) + \"px\";\n img.style.width = (bottom - top) + \"px\";\n }\n\n //set all images that should be visible at the current view to visible (only in the layer);\n this.layers[intZoom][\"images\"][id][\"visibility\"] = true;\n\n }\n }\n\n //remove all images that are not loaded and are not visible in current view.\n //if the images is out of the current view, there is no reason to load it. \n //Think about fast moving maps. Moving is faster than loading. \n //If you started in London and are already in Peking, you don't care\n //about images that show vienna for example\n //this code is useless for webkit browsers (march 2010) because of bug:\n //https://bugs.webkit.org/show_bug.cgi?id=6656\n for (var vimg in this.layers[intZoom][\"images\"]) {\n if (this.layers[intZoom][\"images\"][vimg][\"visibility\"]) {\n if (this.layers[intZoom][\"images\"][vimg][\"img\"].getAttribute(\"loaded\") == \"yes\") {\n this.layers[intZoom][\"images\"][vimg][\"img\"].style.visibility = \"\";\n }\n } else {\n this.layers[intZoom][\"images\"][vimg][\"img\"].style.visibility = \"hidden\";\n //delete img if not loaded and not needed at the moment\n if (this.layers[intZoom][\"images\"][vimg][\"img\"].getAttribute(\"loaded\") != \"yes\") {\n/*\t\n\t\t\t\t\tvar src=this.layers[zoomlevel][\"images\"][vimg][\"img\"].getAttribute(\"src\");\t\n\t\t\t\t\tvar z=this.intZoom;\n\t\t\t\t\tsrc=src+\"&nix=first&zoom=\"+z;\n\t\t\t\t\tthis.layers[zoomlevel][\"images\"][vimg][\"img\"].setAttribute(\"src\",src);\n\t\t\t\t\t*/\n layerDiv.removeChild(this.layers[intZoom][\"images\"][vimg][\"img\"]);\n delete this.layers[intZoom][\"images\"][vimg][\"img\"];\n delete this.layers[intZoom][\"images\"][vimg];\n }\n }\n }\n\n //move and zoom the layer\n //The 3D CSS is used to increase speed. 3D CSS is using hardware accelerated methods to zoom and move the layer.\n //every layer is moved independently - maybe not the best approach, but maybe the only working solution\n var zoomDelta = zoom - intZoom;\n var sc = Math.pow(2, zoomDelta);\n var left = -dxDelta * this.tileW;\n var top = -dyDelta * this.tileH;\n\n if (this.css3d) {\n //document.getElementById(\"debug\").textContent=zoomDelta+\": \"+sc+\": \"+left+\": \"+top;\n var scale = \" scale3d(\" + sc + \",\" + sc + \",1) \";\n/*\t\n\t\t\tvar zx=this.zoomCenterDeltaX;\t\n\t\t\tvar zy=this.zoomCenterDeltaY;\t\n\t\t\tleft=left-zx*sc;\n\t\t\ttop=top-zx*sc;\n\t\t\t*/\n\n layerDiv.style['-webkit-transform-origin'] = (-1 * left) + \"px \" + (-1 * top) + \"px\";\n var transform = 'translate3d(' + left + 'px,' + top + 'px,0px) ' + scale;\n layerDiv.style.webkitTransform = transform;\n } else {\n //layerDiv.style.left=left+\"px\";\n //layerDiv.style.top+\"px\";\n }\n\n //set the visibleZoom to visible\n layerDiv.style.visibility = \"\";\n }\n // ====== END OF DRAW ======\t\n this.getTileSrc = function (x, y, z, mapMode) {\n //Calculate the tile server. Use of a,b,c should increase speed but should not influence cache.\n var hashval = (x + y) % 3;\n switch (hashval) {\n case 0:\n var server = \"a\";\n break;\n case 1:\n var server = \"b\";\n break;\n case 2:\n var server = \"c\";\n break;\n default:\n var server = \"f\";\n }\n\t//\talert(mapMode);\n\t\tswitch(mapMode) {\n\t\t\tcase '0':\n\t\t\t\tvar src = \"http://\" + server + \".tile.openstreetmap.org/\" + z + \"/\" + x + \"/\" + y + \".png\";\n\t\t\t\tbreak;\n\t\t\tcase '1':\n\t\t\t\tvar src = \"http://\" + server + \".andy.sandbox.cloudmade.com/tiles/cycle/\" + z + \"/\" + x + \"/\" + y + \".png\";\n\t\t\t\tbreak;\n\t\t\tcase '2':\n\t\t\t\tvar src = \"http://tile.map2go.org/mn/\" + z + \"/\" + x + \"/\" + y + \".png\";\n\t\t\t\tbreak;\t \n\t\t\tdefault:\n\t\t\t\tvar src = \"http://\" + server + \".tile.openstreetmap.org/\" + z + \"/\" + x + \"/\" + y + \".png\";\n\t\t\t\n\t\t}\n //var src = \"http://\" + server + \".tile.openstreetmap.org/\" + z + \"/\" + x + \"/\" + y + \".png\";\n // var src=\"http://khm1.google.com/kh/v=58&x=\"+x+\"&s=&y=\"+y+\"&z=\"+z+\"&s=Gal\";\n return src;\n }\n\n //\n // this function was for BING tiles. It's not in use but I don't want to dump it.\n //\n\n function mkbin(z, x, y) {\n var nn = parseInt(x.toString(2)) + parseInt(y.toString(2)) * 2;\n n = \"\";\n for (var i = 0; i < 30; i++) {\n var restX = parseInt(x / 2);\n var restY = parseInt(y / 2);\n var xx = (x / 2 - restX) * 2;\n var yy = (y / 2 - restY) * 2;\n x = restX;\n y = restY;\n s = Math.round(xx + yy * 2);\n n = s + n;\n if (x == 0 && y == 0) break;\n }\n return n;\n }\n\n //\n //this function trys to remove images if they are not needed at the moment.\n //For webkit it's a bit useless because of bug\n //https://bugs.webkit.org/show_bug.cgi?id=6656\n //For Firefox it really brings speed\n //\t\n this.hideLayer = function (zoomlevel) {\n if (this.intZoom != zoomlevel) {\n if (this.layers[zoomlevel]) {\n this.layers[zoomlevel][\"layerDiv\"].style.visibility = \"hidden\";\n }\n }\n\n //delete img if not loaded and not needed at the moment\n //for(var layer in this.layers){\n //var zoomlevel=layer;\n //for(var vimg in this.layers[zoomlevel][\"images\"]){\n for (var vimg in this.layers[zoomlevel][\"images\"]) {\n if (this.layers[zoomlevel][\"images\"][vimg]) {\n if (this.layers[zoomlevel][\"images\"][vimg][\"img\"]) {\n if (this.layers[zoomlevel][\"images\"][vimg][\"img\"].getAttribute(\"loaded\") != \"yes\") {\n if (zoomlevel != this.intZoom) {\n /*\n\t\t\t\t\t var src=this.layers[zoomlevel][\"images\"][vimg][\"img\"].getAttribute(\"src\");\t\n\t\t\t\t\t var z=this.intZoom;\n\t\t\t\t\t src=src+\"&nix=load&zoom=\"+z;\n\t\t\t\t\t this.layers[zoomlevel][\"images\"][vimg][\"img\"].setAttribute(\"src\",src);\n\t\t\t\t\t */\n this.layers[zoomlevel][\"images\"][vimg][\"img\"].setAttribute(\"src\", \"#\");\n this.layers[zoomlevel][\"layerDiv\"].removeChild(this.layers[zoomlevel][\"images\"][vimg][\"img\"]);\n delete this.layers[zoomlevel][\"images\"][vimg][\"img\"];\n delete this.layers[zoomlevel][\"images\"][vimg];\n }\n } else {\n\n }\n }\n }\n }\n\n }\n\n //\n // method is called if an image has finished loading (onload event)\n //\n this.imgLoaded = function (evt) {\n if (evt.target) {\n var img = evt.target;\n } else {\n var img = evt.srcElement;\n }\n var loadComplete = true;\n img.style.visibility = \"\";\n img.setAttribute(\"loaded\", \"yes\");\n if (!img.parentNode) return;\n var zoomlevel = img.parentNode.getAttribute(\"zoomlevel\");\n for (var i = 0; i < img.parentNode.getElementsByTagName(\"img\").length; i++) {\n if (img.parentNode.getElementsByTagName(\"img\").item(i).getAttribute(\"loaded\") != \"yes\") {\n loadComplete = false;\n }\n }\n\n this.layers[zoomlevel][\"loadComplete\"] = loadComplete;\n if (loadComplete) {\n if (this.intZoom == zoomlevel) {\n //if(Math.abs(this.intZoom - zoomlevel) < Math.abs(this.intZoom - this.visibleZoom)){\n //this.layers[this.visibleZoom][\"layerDiv\"].style.visibility=\"hidden\";\n this.hideLayer(this.visibleZoom);\n this.visibleZoom = zoomlevel;\n this.layers[this.visibleZoom][\"layerDiv\"].style.visibility = \"\";\n }\n }\n }\n //\n // Image load error\n //\n this.imgError = function (evt) {\n if (evt.target) {\n var img = evt.target;\n } else {\n var img = evt.srcElement;\n }\n if (!img.parentNode) return;\n img.parentNode.removeChild(img);\n //evt.target.style.backgroundColor=\"lightgrey\";\n this.imgLoaded(evt);\n }\n\n //next function is from wiki.openstreetmap.org\n var getTileNumber = function (lat, lon, zoom) {\n var xtile = ((lon + 180) / 360 * (1 << zoom));\n var ytile = ((1 - Math.log(Math.tan(lat * Math.PI / 180) + 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * (1 << zoom));\n var returnArray = new Array(xtile, ytile);\n return returnArray;\n }\n\n //map is positioned absolute and is an a clone of the original map div.\n //on window resize it must be positioned again\n this.setMapPosition = function () {\n //this.getSize();\n var obj = this.mapParent;\n\n this.width = obj.offsetWidth;\n this.height = obj.offsetHeight;\n var d = document.getElementById(\"debug\");\n //\t\tthis.clone.style.width=obj.offsetWidth+\"px\";\n //\t\tthis.clone.style.height=obj.offsetHeight+\"px\";\n var relativeleft = 0;\n var relativetop = 0;\n do {\n\t if(obj.style.position==\"absolute\"){\n\t\tbreak;\n }\n relativeleft += obj.offsetLeft;\n relativetop += obj.offsetTop;\n obj = obj.offsetParent;\n } while (obj.offsetParent);\n\n var left = 0;\n var top = 0;\n obj = this.mapParent;\n\n do {\n left += obj.offsetLeft;\n top += obj.offsetTop;\n obj = obj.offsetParent;\n } while (obj.offsetParent);\n\n\n\n\n // this.width=obj.offsetWidth;\n // this.height=obj.offsetHeight;\n this.mapTop = top;\n this.mapLeft = left;\n if (this.mapParent.style.position == \"absolute\") {\n top = 0;\n left = 0;\n }\n this.clone.style.top = relativetop + \"px\";\n this.clone.style.left = relativeleft + \"px\";\n this.clone.style.width = this.width + \"px\";\n this.clone.style.height = this.height + \"px\";\n\n this.clone.style.position = \"absolute\";\n this.clone.style.overflow = \"hidden\";\n\n this.map.style.left = this.width / 2 + \"px\";\n this.map.style.top = this.height / 2 + \"px\";\n //this.mapParent.appendChild(this.clone);\n var center = this.getCenter();\n var zoom = this.getZoom();\n if (zoom) {\n this.setCenter2(this.getCenter(), this.getZoom());\n }\n }\n\n //functions from wiki gps2xy \n var lat2y = function (a) {\n return 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + a * (Math.PI / 180) / 2));\n }\n var y2lat = function (a) {\n return 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2);\n }\n\n\n //\n //\n // INIT kmap\n //\n //\n\n this.internetExplorer = false;\n this.svgSupport = true;\n if (navigator.userAgent.indexOf(\"MSIE\") != -1) {\n this.internetExplorer = true;\n this.svgSupport = false;\n //alert(\"Sorry, Internet Explorer does not support this map, please use a good Browser like chrome, safari, opera.\");\n }\n if (navigator.userAgent.indexOf(\"Android\") != -1) {\n //this.internetExplorer=true;\n this.svgSupport = false;\n //wordaround for Android - Android is not a good browser, remembers me to IE 5.5\n var that=this;\n var tempFunction=function () {that.blocked=false};\n setInterval(tempFunction,300);\n\n }\n this.maxIntZoom = 18;\n\n this.wheelSpeedConfig = new Array();\n this.wheelSpeedConfig[\"acceleration\"] = 2;\n this.wheelSpeedConfig[\"maxSpeed\"] = 2;\n //\talert(navigator.userAgent);\n this.wheelSpeedConfig[\"animate\"] = false;\n if (navigator.userAgent.indexOf(\"AppleWebKit\") != -1) {\n this.wheelSpeedConfig[\"animate\"] = true;\n }\n if (navigator.userAgent.indexOf(\"Opera\") != -1) {\n this.wheelSpeedConfig[\"animate\"] = false;\n }\n this.wheelSpeedConfig[\"zoomAnimationSlowdown\"] = 0.02;\n this.wheelSpeedConfig[\"animationFPS\"] = 50;\n this.wheelSpeedConfig[\"moveAnimateDesktop\"] = true;\n this.wheelSpeedConfig[\"moveAnimationSlowdown\"] = 0.7;\n this.wheelSpeedConfig[\"rectShiftAnimate\"] = true;\n this.wheelSpeedConfig[\"rectShiftAnimationTime\"] = 1500;\n this.wheelSpeedConfig[\"animateMinSpeed\"]=1;\n\n //variables for performance check\n this.wheelEventCounter = 0;\n this.framesCounter = 0;\n\n this.mapParent = map;\n //\tmapInit=map;\n this.clone = map.cloneNode(true); //clone is the same as the map div, but absolute positioned\n this.clone.removeAttribute(\"id\");\n this.clone.style.overflow = \"hidden\";\n if (map.firstChild) {\n map.insertBefore(this.clone, map.firstChild);\n } else {\n map.appendChild(this.clone);\n }\n\n //this.setMapPosition();\n this.map = document.createElement(\"div\"); //this is the div that holds the layers, but no marker and svg overlayes\n this.map.style.position = \"absolute\";\n this.clone.appendChild(this.map);\n //this.getSize();\n this.clone.style.overflow = \"hidden\";\n this.setMapPosition();\n\n if (this.svgSupport) {\n this.svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n } else {\n this.svg = document.createElement(\"div\");\n }\n //container for Vector graphics (SVG, VML, and maybe Canvas for Android)\n this.svg.style.width = \"100%\";\n this.svg.style.height = \"100%\";\n this.svg.style.position = \"absolute\";\n this.clone.appendChild(this.svg);\n\n\n //div for markers\n this.overlayDiv = document.createElement(\"div\");\n this.overlayDiv.style.width = \"100%\";\n this.overlayDiv.style.height = \"100%\";\n this.overlayDiv.style.position = \"absolute\";\n this.overlayDiv.style.overflow = \"hidden\";\n this.clone.appendChild(this.overlayDiv);\n\n //should be bigger than screen\n this.svgWidth = 100000;\n this.svgHeight = 100000;\n\n //distance tool\n this.distanceMeasuring = \"no\";\n this.moveMarker = null;\n this.measureLine = null;\n this.moveAnimationMobile = true;\n this.moveAnimationDesktop = false;\n this.moveAnimationBlocked = false;\n\n this.lastMouseX = this.width / 2;\n this.lastMouseY = this.height / 2;\n\n this.layers = new Array();\n this.overlays = new Array();\n this.visibleZoom = null;\n this.oldVisibleZoom = null;\n this.intZoom = null;\n\n this.moveX = 0;\n this.moveY = 0;\n\n this.lastMoveX = 0;\n this.lastMoveY = 0;\n this.lastMoveTime = 0;\n\n this.startMoveX = 0;\n this.startMoveY = 0;\n this.sc = 1;\n this.blocked = false;\n\n this.tileW = 256;\n this.tileH = 256;\n this.zoom = 1;\n this.movestarted = false;\n\n //touchscreen\n this.mousedownTime = null;\n this.doubleclickTime = 400;\n //mouse\n this.mousedownTime2 = null;\n this.doubleclickTime2 = 500;\n\n this.zoomOutTime = 1000;\n this.zoomOutSpeed = 0.01;\n this.zoomOutInterval = null;\n this.zoomOutStarted = false;\n\n this.zoomSpeedTimer = null;\n this.zoomAcceleration = 1;\n\n this.css3d = false;\n this.css3dvector = false;\n if (navigator.userAgent.indexOf(\"iPhone OS\") != -1) {\n this.css3d = true;\n }\n if (navigator.userAgent.indexOf(\"iPad\") != -1) {\n this.css3d = true;\n }\n if (navigator.userAgent.indexOf(\"Safari\") != -1) {\n this.css3d = true;\n }\n if (navigator.userAgent.indexOf(\"Android\") != -1) {\n this.css3d = false;\n }\n\n if (this.internetExplorer) {\n var w = map;\n } else {\n var w = window;\n // how to do that in ie?\n Event.attach(window, \"resize\", this.setMapPosition, this, false);\n }\n if (navigator.userAgent.indexOf(\"Konqueror\") != -1) {\n var w = map;\n }\n Event.attach(map, \"touchstart\", this.start, this, false);\n Event.attach(map, \"touchmove\", this.move, this, false);\n Event.attach(map, \"touchend\", this.end, this, false);\n Event.attach(w, \"mousemove\", this.mousemove, this, false);\n Event.attach(map, \"mousedown\", this.mousedown, this, false);\n Event.attach(w, \"mouseup\", this.mouseup, this, false);\n Event.attach(w, \"orientationchange\", this.reSize, this, false);\n Event.attach(map, \"DOMMouseScroll\", this.mousewheel, this, false);\n Event.attach(map, \"dblclick\", this.doubleclick, this, false);\n}", "function MapCoordsClick(e) {\r\n\tvar vo = map.vectorObject;\r\n\tvar pix = vo.pixelObject;\r\n\tvar xycoord = vo.xyCoord;\r\n\tgetXY(e);\r\n\tzleft = mouseX - map.containerLeft;\r\n\tztop = mouseY - map.containerTop;\r\n\tvo.clear();\r\n\tvo.crosshair(zleft, ztop);\r\n\tvo.draw();\r\n\r\n\tmap.xMin=zleft;\r\n\tmap.yMin=ztop;\r\n\tmap.getTopLeftTile();\r\n coordString = + zleft + \":\" + ztop;\r\n var argument = \"ControlID=\" + map.controlName + \"&EventArg=Point&ControlType=Map&coords=\" + coordString + \"&VectorMode=Measure&VectorAction=Coordinates&minx=\" + zleft + \"&miny=\" + ztop;\r\n if (checkForFormElement(document, 0, \"MeasureUnits\")) argument += \"&MeasureUnits=\" + document.forms[0].MeasureUnits.value;\r\n if (checkForFormElement(document, 0, \"AreaUnits\")) argument += \"&AreaUnits=\" + document.forms[0].AreaUnits.value;\r\n if (checkForFormElement(document, 0, \"MapUnits\")) argument += \"&MapUnits=\" + document.forms[0].MapUnits.options[document.forms[0].MapUnits.selectedIndex].value;\r\n \r\n var context = map.controlName + \",Point\";\r\n \r\n map.vectorCallbackFunctionString = measureVectorCallbackFunctionString;\r\n eval(map.vectorCallbackFunctionString);\r\n\r\n}", "function onEachFeature4 (feature,layer) {\n layer.on('click',function(event){\n layer.bindPopup(\"The hourly departure projection of selected station rounds to \" + Math.round(feature.properties.predict));\n map.setView(event.latlng,15);\n });\n }", "function popStateHandler(){\n var theMap = window.$('theMap_primary'); \n \n if( !event.state ){ return false; }\n document.title = event.state.title;\n xml.getElementsByTagName( \"ENVELOPE\" )[0].attributes[0].nodeValue = event.state.minxOld;\n xml.getElementsByTagName( \"ENVELOPE\" )[0].attributes[2].nodeValue = event.state.maxxOld;\n xml.getElementsByTagName( \"ENVELOPE\" )[0].attributes[1].nodeValue = event.state.minyOld;\n xml.getElementsByTagName( \"ENVELOPE\" )[0].attributes[3].nodeValue = event.state.maxyOld;\n window.$( 'zoom_slider' ).style.top = event.state.zoom;\n window.theMap.sliderPosition = +event.state.zoom.replace( /px/, '' );\n window.utilities_module.makeArcXMLRequest( event.state.minxOld, event.state.maxxOld, event.state.minyOld, event.state.maxyOld, true );\n getInfoFromUrl();\n window.theMap.addEventListener( 'load', window.utilities_module.createMarkersFromInfoFromUrl );\n }", "function onEachFeature(feature, layer) {\n layer.on({\n //mouseover: highlightFeature,\n //mouseout: resetHighlight,\n click: highlightFeature, \n });\n}", "function mapDraggedListener(thisWithMap,action) {\n //console.log(\"map drag: \"+action)\n twitter_geomap.ac.logUserActivity(\"map drag: \"+action, \"pan-\"+action, twitter_geomap.ac.WF_EXPLORE);\n}", "function bindTrackInteractionEvents(id, track, thePilgrimsRoute){\n\n // 1. highlight track when an entry is hovered\n\n blogPannel.on( 'mouseenter', 'li#'+id, function(){\n track.setStyle({opacity: 1});\n });\n blogPannel.on( 'mouseleave', 'li#'+id, function(){\n track.setStyle({opacity: 0});\n });\n\n // 2. conversely, highlight entry when track is hoovered\n\n // 3. zoom in when post is openned\n\n blogPannel.on( 'post:open', function(event, postId){\n\n if(id === postId){\n\n // highlight openned track\n track.setStyle({opacity: 1});\n\n // zoom-in\n map.flyToBounds(track, { maxZoom: 10 });\n\n // save bounds\n console.log('Open!')\n blogPannel.trigger('state:update', {\n mapbounds: bounds2array( track.getBounds() )\n });\n\n } else {\n\n // if post-open was triggered by an other post,\n // unhighlight the current track (in case it was highlighted for whatever reason)\n track.setStyle({opacity: 0});\n\n };\n\n });\n\n // 4. zoom out when post is closed\n // 4a. un-highlight track\n\n // zoom itself is delegated outside the function\n // for avoiding beeing called multiple times\n\n blogPannel.on( 'post:close', function(){\n\n track.setStyle({opacity: 0});\n\n });\n\n // 5. highlight track when an entry is clicked\n // until post is closed or until an other entry is clicked\n\n // 6. highlight track on restore\n \n blogPannel.on( 'post:restore', function(event, postId){\n\n console.log(postId);\n\n if(id === postId){\n\n // highlight openned track\n track.setStyle({opacity: 1});\n\n } else {\n\n // unhighlight any other track\n // (in case it was highlighted for whatever reason)\n track.setStyle({opacity: 0});\n\n };\n\n });\n\n }", "function changeDate(e) {\n console.log(\"slider value: \" + document.getElementById(\"mySlider\").value);\n\n // Update the desired date\n dataForDate = coordinates.filter(function(d) {\n return d[\"acq_date\"] === uniqueDates[document.getElementById(\"mySlider\").value]\n });\n\n const node = document.getElementById(\"inner-CL\"); // find the inner-CL div\n node.innerHTML = \"\"; // delete all the circle elements that were in the inner-CL div\n\n g1.selectAll(\"circle\")\n .data(dataForDate)\n .enter().append(\"circle\"); // Like before, this created the correct number of circle elements in this layer depending on the date\n\n // Selector. Selects all the circle elements in the circle-layer div\n allCircles = document.querySelectorAll(\".inner-CL > circle\");\n\n // Sets all the attributes for each circle element\n for(var i = 0; i < dataForDate.length; i++) {\n if (dataForDate[i].latitude > 4 && dataForDate[i].latitude < 21) {\n if (dataForDate[i].longitude > 95 && dataForDate[i].longitude < 107) {\n allCircles[i].classList.add(i);\n allCircles[i].setAttribute(\"r\", 4)\n allCircles[i].setAttribute(\"stroke-width\", 1);\n allCircles[i].setAttribute(\"stroke\", \"#4F442B\");\n allCircles[i].setAttribute(\"fill\", \"#FFD061\");\n allCircles[i].setAttribute(\"cx\", map.latLngToLayerPoint(new L.LatLng(dataForDate[i].latitude, dataForDate[i].longitude)).x);\n allCircles[i].setAttribute(\"cy\", map.latLngToLayerPoint(new L.LatLng(dataForDate[i].latitude, dataForDate[i].longitude)).y);\n allCircles[i].onclick = function () {\n wildfireID = this.className.animVal\n\n console.log(wildfireID)\n console.log(dataForDate[wildfireID])\n\n document.querySelector('#acqDate').innerHTML = dataForDate[wildfireID].acq_date\n document.querySelector('#acqTime').innerHTML = dataForDate[wildfireID].acq_time\n document.querySelector('#latitude').innerHTML = dataForDate[wildfireID].latitude\n document.querySelector('#longitude').innerHTML = dataForDate[wildfireID].longitude\n document.querySelector('#dOrN').innerHTML = dataForDate[wildfireID].daynight\n document.querySelector('#satellite').innerHTML = dataForDate[wildfireID].satellite\n document.querySelector('#version').innerHTML = dataForDate[wildfireID].version\n };\n\n allCircles[i].onmouseover = function () {\n this.setAttribute('fill', '#F50D00')\n }\n allCircles[i].onmouseout = function () {\n this.setAttribute('fill', '#FFD061')\n }\n\n }\n }\n }\n }", "addZoomAndMapPanHandling() {\n\n this.getMap().on(\"zoomend\", (event) => {\n // console.log(\"zoomend\");\n this.updateMarkersToShowOnMapChange(event);\n\n });\n\n this.getMap().on(\"moveend\", (event) => {\n this.updateMarkersToShowOnMapChange(event);\n });\n\n\n }", "function initHover() {\r\n\t\t$('#map-hover-box').show();\r\n\t\t$(document).bind('mousemove', getPosition);\r\n\t}", "function mapInit() {\n if (temporal.value == \"daily\") {\n $('#seldate').prop(\"disabled\", false);\n }\n //Reset map\n if (map.hasLayer(dataLayer)) {\n $(dataLayer._image).fadeOut(200, function() {\n //map.removeLayer(dataLayer);\n });\n }\n if ((layerControl._map)) {\n layerControl.remove(map);\n }\n if (map.hasLayer(gibsLayers['Reference_Features'])) {\n map.removeLayer(gibsLayers['Reference_Features']);\n }\n map.removeControl(legendG)\n\n var id_added = 'none'\n\n for (var id in L.GIBS_LAYERS) {\n if (map.hasLayer(gibsLayers[id])) {\n id_added = id\n map.removeLayer(gibsLayers[id]);\n }\n }\n\n if ((gibscontrol._map)) {\n gibscontrol.remove(map);\n\n }\n\n map.removeLayer(Statistics1)\n map.removeLayer(Timeseries0)\n\n // gibs control\n var x = document.getElementById(\"compare\");\n if (x.checked == true) {\n var dateOrig = document.getElementById('seldate').value;\n\n for (var id in L.GIBS_LAYERS) {\n gibsLayers[id] = new L.GIBSLayer(id, {\n date: new Date(dateOrig),\n transparent: true\n });\n }\n\n gibsLayers['Reference_Features'].addTo(map);\n gibsLayers['Reference_Features'].bringToFront();\n\n //styled control\n baseMapsGibs = [{\n groupName: \"Surface Temperature\",\n //expanded: true,\n layers: {\n \"MODIS Terra (Day)\": gibsLayers['MODIS_Terra_Land_Surface_Temp_Day'],\n \"MODIS Terra (Night)\": gibsLayers['MODIS_Terra_Land_Surface_Temp_Night'],\n \"MODIS Aqua (Day)\": gibsLayers['MODIS_Aqua_Land_Surface_Temp_Day'],\n \"MODIS Aqua (Night)\": gibsLayers['MODIS_Aqua_Land_Surface_Temp_Night']\n }\n },\n {\n groupName: \"Precipitation\",\n layers: {\n \"AMSR2 Surface ppt rate (Day) \": gibsLayers['AMSR2_Surface_Precipitation_Rate_Day'],\n \"AMSR2 Surface ppt rate (Night) \": gibsLayers['AMSR2_Surface_Precipitation_Rate_Night'],\n \"Aqua/AIRS precipitation(Day)\": gibsLayers['AIRS_Precipitation_Day'],\n \"Aqua/AIRS precipitation(Night)\": gibsLayers['AIRS_Precipitation_Night']\n\n }\n },\n {\n groupName: \"Snow Water Equivalent\",\n layers: {\n \"AMSR2 SWE\": gibsLayers['AMSR2_Snow_Water_Equivalent']\n }\n },\n // {\n // groupName: \"Snow Cover\",\n // layers: {\n // \"Modis Terra Snow Cover\": gibsLayers['MODIS_Terra_Snow_Cover'],\n // \"Modis Aqua Snow Cover\": gibsLayers['MODIS_Aqua_Snow_Cover'],\n // // \"Modis Terra NDSI\": gibsLayers['MODIS_Terra_NDSI_Snow_Cover'],\n // // \"Modis Aqua NDSI\": gibsLayers['MODIS_Aqua_NDSI_Snow_Cover']\n //\n // }\n // },\n\n {\n groupName: \"Corrected Reflectance\",\n layers: {\n \"MODIS Terra (True Color)\": gibsLayers['MODIS_Terra_CorrectedReflectance_TrueColor'],\n \"MODIS Aqua (True Color)\": gibsLayers['MODIS_Aqua_CorrectedReflectance_TrueColor'],\n \"MODIS Terra (Bands 7-2-1)\": gibsLayers['MODIS_Terra_CorrectedReflectance_Bands721'],\n \"MODIS Aqua (Bands 7-2-1)\": gibsLayers['MODIS_Aqua_CorrectedReflectance_Bands721'],\n\n\n }\n },\n {\n groupName: \"Soil Moisture\",\n layers: {\n // \"SMAP L3 Active (3km)\": gibsLayers['SMAP_L3_Active_Soil_Moisture'],\n // \"SMAP L3 Active-Passive (9km)\": gibsLayers['SMAP_L3_Active_Passive_Soil_Moisture'],\n \"SMAP L3 Passive (Day, 9km)\": gibsLayers['SMAP_L3_Passive_Enhanced_Day_Soil_Moisture'],\n \"SMAP L3 Passive (Night, 9km)\": gibsLayers['SMAP_L3_Passive_Enhanced_Night_Soil_Moisture'],\n \"AMSR-U2 NPD (Day, 25km)\": gibsLayers['AMSRU2_Soil_Moisture_NPD_Day'],\n \"AMSR-U2 NPD (Night, 25km)\": gibsLayers['AMSRU2_Soil_Moisture_NPD_Night']\n }\n }\n ];\n\n overlayGibs = [{\n groupName: \"Borders\",\n expanded: true,\n layers: {\n \"Country/State Borders\": gibsLayers['Reference_Features']\n }\n }];\n\n options = {\n container_width: \"210px\",\n group_maxHeight: \"80px\",\n //container_maxHeight : \"350px\",\n exclusive: false,\n collapsed: false,\n position: 'bottomright',\n autoZIndex: true\n };\n\n gibscontrol = L.Control.styledLayerControl(baseMapsGibs, overlayGibs, options);\n map.addControl(gibscontrol);\n if (id_added != 'none') {\n gibsLayers[id_added].addTo(map);\n }\n\n // Legend for GIBS layer\n map.on('baselayerchange', function(e) {\n if (e.name == 'MODIS Terra (True Color)' || e.name == 'MODIS Aqua (True Color)' || e.name == 'MODIS Terra (Bands 7-2-1)' || e.name == 'MODIS Aqua (Bands 7-2-1)') {\n map.removeControl(legendG)\n legendG.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<b><center>' + e.name + '</b></center>';\n return div;\n };\n } else {\n var selgibs = (e.layer._layerInfo.title)\n map.removeControl(legendG)\n legendG.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<b><center>' + e.name + '</b></center>';\n div.innerHTML += '<img src=\"images/gibs/' + selgibs + '.png\" /><br>';\n return div;\n };\n }\n\n legendG.addTo(map);\n });\n\n }\n // Layer control /////////////////////////////\n layerControl.removeLayer(Statistics1)\n layerControl.removeLayer(Timeseries0)\n\n\n layer_Timeseries0 = new L.geoJson(json_Timeseries0, {\n attribution: '<a href=\"\"></a>',\n pane: 'pane_Timeseries0',\n onEachFeature: function (feature, layer) {\n layer.bindPopup(\"popupContent\");\n },\n style: style_Timeseries0\n });\n\n layer_Statistics1 = new L.geoJson(json_Statistics1, {\n attribution: '<a href=\"\"></a>',\n pane: 'pane_Statistics1',\n onEachFeature: pop_Statistics1,\n style: style_Statistics1\n });\n\n Timeseries0 = L.layerGroup().addLayer(layer_Timeseries0);\n Statistics1 = L.layerGroup().addLayer(layer_Statistics1);\n // Layer control ends\n\n L.ImageOverlay.include({\n getBounds: function() {\n return this._bounds;\n }\n });\n\n // Selections from user\n var region = document.getElementById(\"region\");\n var model = document.getElementById(\"model\");\n //var forcing = document.getElementById(\"forcing\");\n var dataset = document.getElementById(\"dataset\");\n\n var strRegion = region.options[region.selectedIndex].value;\n var strModel = model.options[model.selectedIndex].value;\n //var strForcing = forcing.options[forcing.selectedIndex].value;\n var strDataset = dataset.options[dataset.selectedIndex].value;\n var strTemporal = temporal.options[temporal.selectedIndex].value;\n\n // if (model.selectedIndex == 0) {\n // console.log('Please select a model');\n // } else if (forcing.selectedIndex == 0) {\n // console.log('Please select a forcing');\n // } else\n if (dataset.selectedIndex == 0) {\n console.log('Please select a dataset');\n } else {\n\n // Check if layer control already added to map, if not, add\n // if (!(layerControl._map)) {\n // layerControl.addTo(map);\n // }\n\n var dateOrig = document.getElementById('seldate').value;\n datepick = dateOrig.replace(/-/g, \"\");\n yearpick = datepick.substring(0, 4);\n var imgdata = 'DATA_DIR/tile/' + strModel + '/' + strDataset + '/' + strTemporal + '/' + datepick + '.png';\n\n if (region.value == 'himat') {\n //layerControl.addOverlay(Statistics1, '<img src=\"legend/stat.png\" width=15px style=\"vertical-align: middle\"/> Statistics');\n //layerControl.addOverlay(Timeseries0, '<img src=\"legend/ts.png\" width=17px style=\"vertical-align: middle\" /> Timeseries');\n var img_bounds = [ // himat\n [22.02, 66.02],\n [38.98, 84.98]\n ];\n\n }\n\n // add png overlay\n dataLayer = new L.imageOverlay(imgdata, img_bounds, {\n opacity: 1,\n interactive: false\n });\n\n\n $('#bgopacity').on('input', function(value) {\n dataLayer.setOpacity($(this).val() * '.01');\n });\n\n // save dataset option\n document.getElementById(\"savebtn\").onclick = function() {\n var a = document.createElement('a');\n var urldata = strRegion + '_' + strModel + '_' + strDataset + '_' + strTemporal + '_' + datepick + '.png';\n a.href = imgdata;\n a.download = urldata;\n a.click();\n };\n\n\n // Adding legends\n map.removeControl(legendSM);\n map.removeControl(legendT);\n map.removeControl(legendSW);\n map.removeControl(legendP);\n map.removeControl(legendET);\n\n if (dataset.value == 'swe') {\n\n // Legend////////\n legendSW.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<b><center>Snow Water Equivalent (mm)</b></center>';\n div.innerHTML += '<img src=\"images/swe.png\" /><br>';\n div.innerHTML += '<center><font size=\"2\" color=\"black\">Dataset for <b>' + dateOrig + '</b></font></center>';\n return div;\n };\n legendSW.addTo(map);\n ////////////////\n\n } else if (dataset.value == 'soilmoisture') {\n\n // Legend////////\n legendSM.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<b><center>Soil Moisture (Percentile)</b></center>';\n div.innerHTML += '<img src=\"images/soilmoisture.png\" /><br>';\n div.innerHTML += '<center><font size=\"2\" color=\"black\">Dataset for <b>' + dateOrig + '</b></font></center>';\n return div;\n };\n legendSM.addTo(map);\n ////////////////\n\n\n } else if (dataset.value == 'temperature') {\n\n // Legend////////\n legendT.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<center><b>Temperature (˚C)</b></center>';\n div.innerHTML += '<img src=\"images/temperature.png\" /><br>';\n div.innerHTML += '<center><font size=\"2\" color=\"black\">Dataset for <b>' + dateOrig + '</b></font></center>';\n return div;\n };\n legendT.addTo(map);\n ////////////////\n\n\n } else if (dataset.value == 'precipitation') {\n\n // Legend////////\n legendP.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<center><b>Precipitation (mm/day)</b></center>';\n div.innerHTML += '<img src=\"images/precipitation.png\" /><br>';\n div.innerHTML += '<center><font size=\"2\" color=\"black\">Dataset for <b>' + dateOrig + '</b></font></center>';\n return div;\n };\n legendP.addTo(map);\n ////////////////\n\n\n } else if (dataset.value == 'evapotranspiration') {\n\n // Legend////////\n legendET.onAdd = function(map) {\n var div = L.DomUtil.create('div', 'legend');\n div.innerHTML += '<center><b>Evapotranspiration (mm/day)</b></center>';\n div.innerHTML += '<img src=\"images/evapotranspiration.png\" /><br>';\n div.innerHTML += '<center><font size=\"2\" color=\"black\">Dataset for <b>' + dateOrig + '</b></font></center>';\n return div;\n };\n legendET.addTo(map);\n ////////////////\n\n\n }\n\n // give message if data unavailable\n var http = new XMLHttpRequest();\n http.open('HEAD', imgdata, false);\n http.send();\n\n // get id of message/compare divs to display on data loading\n var msg = document.getElementById('message');\n var opc = document.getElementById('selOpacity');\n var cmp = document.getElementById('comp_checkbox');\n var exp = document.getElementById('exportdiv');\n if (http.status != 404) {\n msg.style.display = 'none';\n opc.style.display = 'block';\n cmp.style.display = 'block';\n exp.style.display = 'block';\n\n map.addLayer(layer_Statistics1);\n\n map.addLayer(dataLayer);\n var imgElement = dataLayer.getElement();\n dataLayer.getElement().classList.add('styleOverlay');\n return \"datapresent\";\n } else {\n msg.style.display = 'block';\n opc.style.display = 'none';\n cmp.style.display = 'none';\n exp.style.display = 'none';\n\n $(document).ready(function() {\n $('#message').delay(2500).fadeOut();\n });\n }\n\n\n\n }\n}", "initMouseEvents(layer) {\r\n // keep track of last feature\r\n let lastFeature;\r\n\r\n // mouse enter event\r\n this.map.on('mouseenter', layer.id, (event) => {\r\n // turn mouse cursor into a pointer\r\n this.map.getCanvas().style.cursor = 'pointer';\r\n\r\n });\r\n\r\n // mouse leave event\r\n this.map.on('mouseleave', layer.id, (event) => {\r\n this.map.getCanvas().style.cursor = '';\r\n\r\n lastFeature = undefined;\r\n $('.mapboxgl-choropleth-info-box').remove();\r\n });\r\n\r\n // mouse move event\r\n this.map.on('mousemove', layer.id, (event) => {\r\n let currentFeature = this.map.queryRenderedFeatures(event.point)[0];\r\n let $mapboxGLInfobox;\r\n let offsetInfobox;\r\n let mapboxGlInfoboxWidth;\r\n\r\n // Update the info box only if the hovered element changes\r\n if (currentFeature !== lastFeature) {\r\n // set the lastFeature to the current Feature\r\n lastFeature = currentFeature;\r\n\r\n // remove any previous info boxes\r\n if ($('.mapboxgl-choropleth-info-box').length) {\r\n $('.mapboxgl-choropleth-info-box').remove();\r\n } \r\n\r\n // property info string for the info box\r\n let featurePropertyString = '';\r\n\r\n // loop the currentFeature's property object\r\n for (let featureProperty in currentFeature.properties) {\r\n if (featureProperty !== 'name' && featureProperty !== 'keys') {\r\n featurePropertyString += `\r\n <div class=\"mapboxgl-choropleth-info-box__property\">\r\n <span class=\"mapboxgl-choropleth-info-box__property-key\">${featureProperty}</span>: <span class=\"mapboxgl-choropleth-info-box__property-value\">${numberWithCommas(currentFeature.properties[featureProperty])}</span>\r\n </div>\r\n `; \r\n }\r\n } \r\n\r\n // append the new info box to map\r\n $(this.options.mapConfig.mapSelector).append(`\r\n <div class=\"mapboxgl-choropleth-info-box\">\r\n <h3 class=\"mapboxgl-choropleth-info-box__title\">${currentFeature.properties.name}</h3>\r\n ${featurePropertyString}\r\n </div>\r\n `)\r\n }\r\n\r\n $mapboxGLInfobox = $('.mapboxgl-choropleth-info-box');\r\n mapboxGlInfoboxWidth = parseInt($mapboxGLInfobox.outerWidth());\r\n\r\n // Reposition the info box if it spills over \r\n if ( (event.originalEvent.clientX + mapboxGlInfoboxWidth ) > this.mapElement.getBoundingClientRect().right) {\r\n offsetInfobox = mapboxGlInfoboxWidth;\r\n } else {\r\n offsetInfobox = 0;\r\n }\r\n\r\n // Reposition the info box based on mouse cursor's position\r\n if ($mapboxGLInfobox.length) {\r\n $mapboxGLInfobox.css({\r\n top: `${event.originalEvent.clientY - parseInt($mapboxGLInfobox.height()) - 32}px`,\r\n left: `${event.originalEvent.clientX - offsetInfobox}px`\r\n })\r\n }\r\n });\r\n }", "function toggleListener () {\n //clear the screen\n setAllMap (null);\n markers = [];\n console.log(tags);\n //if either food or stores are selected\n if (tags[3] == true || tags[4] == true) {\n //send in the radius\n\n var xmlhttp = new XMLHttpRequest();\n var url = 'http://citykit.ca/promotions';\n var stringData = '';\n xmlhttp.onreadystatechange = function () {\n if (xmlhttp.readyState == 4) {\n handlePromos(JSON.parse(xmlhttp.responseText).array);\n //console.log(JSON.parse(xmlhttp.responseText));\n }\n\n }\n xmlhttp.open('GET', url, true);\n xmlhttp.send();\n }\n //for events\n\n if (tags[0] == true || tags[1] == true || tags[2] == true) {\n //send in the time\n\n var exmlhttp = new XMLHttpRequest();\n var url = 'http://citykit.ca/events/'+time;\n var stringData = '';\n exmlhttp.onreadystatechange = function () {\n if (exmlhttp.readyState == 4) {\n //console.log(JSON.parse(xmlhttp.responseText));\n handleEvents(JSON.parse(exmlhttp.responseText).array);\n }\n\n }\n exmlhttp.open('GET', url, true);\n exmlhttp.send();\n }\n\n if (tags[5] == true/* || tags[6] == true || tags[7] == true || tags[8] == true || tags[9] == true || tags[10] == true || tags[11] == true*/) {\n //send in the time\n\n var sxmlhttp = new XMLHttpRequest();\n var url = 'http://citykit.ca/landmarks/';\n var stringData = '';\n sxmlhttp.onreadystatechange = function () {\n if (sxmlhttp.readyState == 4) {\n //console.log(JSON.parse(xmlhttp.responseText));\n handleLandmarks(JSON.parse(sxmlhttp.responseText).array);\n }\n\n }\n sxmlhttp.open('GET', url, true);\n sxmlhttp.send();\n }\n }", "function getData(map) {\r\n //load the data\r\n $.ajax('data/FrontRangeCounties.geojson', {\r\n dataType: \"json\",\r\n success: function (response) {\r\n var attributes = processData(response);\r\n var index = $('#slider').val();\r\n createPropSymbols(response, map, attributes[index]);\r\n $('.skip').click(function() { \r\n var index = $('.slider').val();\r\n if ($(this).attr('id') == 'forward') {\r\n index++;\r\n //Wwrap around to first attribute\r\n index = index > 6 ? 0 : index;\r\n } else if ($(this).attr('id') == 'backward') {\r\n index--;\r\n\r\n index = index < 0 ? 6 : index;\r\n }\r\n $('.slider').val(index);\r\n updatePropSymbols(map, attributes[index]);\r\n updateLegend(map, attributes[index]);\r\n });\r\n $('#slider').on('input', function() {\r\n var index = $(this).val();\r\n updatePropSymbols(map, attributes[index]);\r\n updateLegend(map, attributes[index]);\r\n });\r\n createLegend(map, attributes[index]);\r\n }\r\n });\r\n}", "function activeMap() {\n window.map.classList.remove('map--faded');\n mapMainPin.addEventListener('mousedown', onMainPinMousedownHandler);\n }" ]
[ "0.67183304", "0.66139746", "0.6606271", "0.64502835", "0.63984793", "0.63540715", "0.63458467", "0.6335029", "0.63268363", "0.6315137", "0.63049525", "0.630314", "0.63001895", "0.6298992", "0.6297705", "0.6282006", "0.62523997", "0.62441564", "0.62262225", "0.6190531", "0.6189292", "0.6172274", "0.6164958", "0.61495113", "0.6138991", "0.6120231", "0.61150557", "0.61035854", "0.6095096", "0.60868186", "0.6084907", "0.60803187", "0.6066922", "0.6066651", "0.6062375", "0.60515696", "0.6045112", "0.6032205", "0.6011661", "0.6009167", "0.5996782", "0.59949", "0.59933054", "0.59929365", "0.59833723", "0.59817505", "0.59802985", "0.5976454", "0.59754515", "0.59715706", "0.5969113", "0.59674567", "0.59625727", "0.59501266", "0.5939719", "0.59372014", "0.5935167", "0.5933224", "0.59268314", "0.5925072", "0.5923862", "0.59114194", "0.5904348", "0.59019965", "0.58906484", "0.5889154", "0.5886887", "0.5872054", "0.58703625", "0.58695555", "0.58658266", "0.58657026", "0.5846478", "0.5843862", "0.58409476", "0.5834654", "0.58323365", "0.5829777", "0.5828686", "0.5828686", "0.58269364", "0.58268", "0.58242303", "0.5822381", "0.5820596", "0.58176756", "0.5817475", "0.58171844", "0.58167076", "0.58144814", "0.5810823", "0.58103746", "0.58098364", "0.58037657", "0.58033365", "0.58020073", "0.5797142", "0.5791567", "0.57912636", "0.57905215", "0.5787204" ]
0.0
-1
utilty functions insert new classes into the stylesheet
function createClass(name,rules){ var style = document.createElement('style'); style.type = 'text/css'; document.getElementsByTagName('head')[0].appendChild(style); if(!(style.sheet||{}).insertRule) (style.styleSheet || style.sheet).addRule(name, rules); else style.sheet.insertRule(name+"{"+rules+"}",0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateSpryCSSClasses()\n{\n var dom = dw.getDocumentDOM();\n\tvar allClasses = dom.getSelectorsDefinedInStylesheet('class');\n\tfor (i = 0; i < allClasses.length; i++)\n\t{\n\t\tif (allClasses[i][0] == '.')\n\t\t{\n\t\t\tallClasses[i] = allClasses[i].slice(1);\n\t\t}\n\t}\n\t_LIST_SPRY_HOVER_CLASSES.setAll(allClasses,allClasses);\n\t_LIST_SPRY_SELECT_CLASSES.setAll(allClasses,allClasses);\n\t_LIST_SPRY_ODD_CLASSES.setAll(allClasses,allClasses);\n\t_LIST_SPRY_EVEN_CLASSES.setAll(allClasses,allClasses);\n}", "insertCss() { }", "appendCssClass(className, classRules) {\n\t\tconst style = document.createElement('style');\n\t\tlet classRulesString = '';\n\t\tfor(let key in classRules){\n\t\t\tclassRulesString += `${key}: ${classRules[key]}; `;\n\t\t}\n\t\tstyle.type = 'text/css';\n\t\tstyle.innerHTML = `.${className} { ${classRulesString} }`;\n\t\tdocument.getElementsByTagName('head')[0].appendChild(style);\n\t\tthis.element.classList.add(className);\n\t}", "function writeNodeClasses(node) {\n for (var i in node.classList) { // classes\n addSelectorIfNodeMatchesRule(node, node.classList[i]);\n }\n addSelectorIfNodeMatchesRule(node, node.id); // id\n addSelectorIfNodeMatchesRule(node, node.localName); // tag name\n }", "function uuklassadd(node, // @param Node:\r\n classNames) { // @param String: \"class1 class2 ...\"\r\n // @return Node:\r\n node.className += \" \" + classNames; // [OPTIMIZED] // uutriminner()\r\n return node;\r\n}", "function add_css() {\n\tvar style = Object(svelte_shared_js__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"])(\"style\");\n\tstyle.id = 'svelte-1tosv1m-style';\n\tstyle.textContent = \"li.svelte-1tosv1m{clear:both;margin-bottom:30px}ul.svelte-1tosv1m{margin:0;padding:0;list-style-type:none}h3.svelte-1tosv1m{font-weight:normal;font-size:12px;text-transform:uppercase;letter-spacing:1px;text-align:center;position:relative;margin-top:10px;margin-bottom:20px;margin:10px 0 20px;padding:0 30px}h3.svelte-1tosv1m:before{content:'';position:absolute;border-bottom:1px solid #888;top:-8px;left:40%;right:40%}\";\n\tObject(svelte_shared_js__WEBPACK_IMPORTED_MODULE_0__[\"appendNode\"])(style, document.head);\n}", "function changeCss(className, classValue) {\n\t\tvar cssMainContainer = $('#css-modifier-container');\n\n\t\tif (cssMainContainer.length == 0) {\n\t\t\tvar cssMainContainer = $('<style id=\"css-modifier-container\"></style>');\n\t\t\tcssMainContainer.appendTo($('head'));\n\t\t}\n\t\tcssMainContainer.append(className + \" {\" + classValue + \"}\\n\");\n\t}", "addClasses(){\n\t\tif(!this.visible) return;\n\t\t\n\t\tif(this.classes){\n\t\t\tthis.appliedClasses = this.classes;\n\t\t\tthis.element.classList.add(...this.appliedClasses);\n\t\t}\n\t}", "function add_css() {\n\tvar style = (0,internal/* element */.bG)(\"style\");\n\tstyle.id = \"svelte-v5teao-style\";\n\tstyle.textContent = \".tab-list.svelte-v5teao{border-bottom:1px solid teal}\";\n\t(0,internal/* append */.R3)(document.head, style);\n}", "function classMap(classes) {\n _stylingMap(classes, true);\n}", "function add_css(target) {\n\tappend_styles(target, \"svelte-1jyh043\", \"p.svelte-1jyh043{font-size:small;color:crimson}\");\n}", "_addClass(className) {\n this.container.className = this.container.className.split(' ')\n .concat(className)\n .join(' ');\n }", "_setClassNames() {\n const classNames = ['osjs-window', ...this.attributes.classNames];\n if (this.id) {\n classNames.push(`Window_${this.id}`);\n }\n\n classNames.filter(val => !!val)\n .forEach((val) => this.$element.classList.add(val));\n }", "addClass(...classes) {\n this._props.className = classNames(this._props.className, classes);\n }", "function add_css() {\n\tvar style = Object(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"g\" /* element */])(\"style\");\n\tstyle.id = 'svelte-yx5wa5-style';\n\tstyle.textContent = \".small.svelte-yx5wa5{font:normal 12px sans-serif;background:white;text-align:left\\n }\";\n\tObject(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"b\" /* append */])(document.head, style);\n}", "function _addClassesOption(options, classes) {classes.forEach(function(cls){_addClassOption(options, cls)})}", "setClass(el, classname) {\n el.className += ' ' + classname;\n }", "ReplaceClass(node, className) {\n node.className = className;\n }", "function addCss() {\n let style = document.createElement('style')\n style.innerHTML = `\n .tu-re-added {\n font-weight: bold !important;\n color: red !important;\n }\n `\n document\n .getElementsByTagName('head')[0]\n .appendChild(style)\n}", "function AddClass(ele, classStr) {\r\n //w[i].className\r\n ele.className = ele.className.replaceAll(\" \" + classStr, \"\") + \" \" + classStr; //function (replaceThis, withThis)\r\n //console.log(ele);\r\n}", "function add_css() {\n\tvar style = (0, _shared.createElement)(\"style\");\n\tstyle.id = 'svelte-12mbumt-style';\n\tstyle.textContent = \".colab-root.svelte-12mbumt{display:inline-block;background:rgba(255, 255, 255, 0.75);padding:4px 8px;border-radius:4px;font-size:11px!important;text-decoration:none;color:#aaa;border:none;font-weight:300;border:solid 1px rgba(0, 0, 0, 0.08);border-bottom-color:rgba(0, 0, 0, 0.15);text-transform:uppercase;line-height:16px}span.svelte-12mbumt{background-image:url(images/colab.svg);background-repeat:no-repeat;background-size:20px;background-position-y:2px;display:inline-block;padding-left:24px;border-radius:4px;text-decoration:none}a.svelte-12mbumt:hover{color:#666;background:white;border-color:rgba(0, 0, 0, 0.2)}\";\n\t(0, _shared.append)(document.head, style);\n}", "function addClasses() {\r\n\t\t\t\tvar str, firstChar, spl, $this, hasPrefixes = (opts.prefixes.length > 0);\r\n\t\t\t\t$($list).children().each(function() {\r\n\t\t\t\t\t$this = $(this), firstChar = '', str = $.trim($this.text()).toLowerCase();\r\n\t\t\t\t\tif (str) {\r\n\t\t\t\t\t\tif (hasPrefixes) {\r\n\t\t\t\t\t\t\tspl = str.split(' ');\r\n\t\t\t\t\t\t\tif ((spl.length > 1) && ($.inArray(spl[0], opts.prefixes) > -1)) {\r\n\t\t\t\t\t\t\t\tfirstChar = spl[1].charAt(0);\r\n\t\t\t\t\t\t\t\taddLetterClass(firstChar, $this, true);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfirstChar = str.charAt(0);\r\n\t\t\t\t\t\taddLetterClass(firstChar, $this);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}", "function ScaffoldClassName(className) {\n if (className != undefined) {\n var classes = className.split(' ');\n var additionalStyle = '';\n var additionalKey = '';\n var additionalValue = '';\n var styleCollection = ['height', 'width', 'margintop', 'marginleft', 'marginright', 'marginbottom', 'marginallsides'];\n if (classes != undefined && classes.length > 0) {\n var n;\n var i;\n for (n = 0; n < styleCollection.length; n++) {\n for (i = 0; i < classes.length; i++) {\n var jqHeightIndex = classes[i].toLowerCase().indexOf(styleCollection[n]);\n if (jqHeightIndex > 0) {\n jqHeightIndex = classes[i].indexOf('-');\n }\n if (jqHeightIndex > 0) {\n jqHeightIndex += 1;\n var extractedNumber = classes[i].substring(jqHeightIndex);\n if (extractedNumber != undefined && extractedNumber.toString().length > 0 && !isNaN(extractedNumber)) {\n if (styleCollection[n] == 'height' || styleCollection[n] == 'width') {\n additionalKey = styleCollection[n];\n }\n else {\n if (styleCollection[n] == 'marginleft') {\n additionalKey = 'margin-left';\n }\n else if (styleCollection[n] == 'margintop') {\n additionalKey = 'margin-top';\n }\n else if (styleCollection[n] == 'marginlright') {\n additionalKey = 'margin-right';\n }\n else if (styleCollection[n] == 'marginbottom') {\n additionalKey = 'margin-bottom';\n }\n else if (styleCollection[n] == 'marginallsides') {\n additionalKey = 'margin';\n }\n }\n additionalValue = extractedNumber + 'px';\n additionalStyle += ' ' + additionalKey + ':' + additionalValue + ';';\n break;\n }\n }\n }\n }\n }\n return additionalStyle;\n }\n }", "function ScaffoldClassName(className) {\n if (className != undefined) {\n var classes = className.split(' ');\n var additionalStyle = '';\n var additionalKey = '';\n var additionalValue = '';\n var styleCollection = ['height', 'width', 'margintop', 'marginleft', 'marginright', 'marginbottom', 'marginallsides'];\n if (classes != undefined && classes.length > 0) {\n var n;\n var i;\n for (n = 0; n < styleCollection.length; n++) {\n for (i = 0; i < classes.length; i++) {\n var jqHeightIndex = classes[i].toLowerCase().indexOf(styleCollection[n]);\n if (jqHeightIndex > 0) {\n jqHeightIndex = classes[i].indexOf('-');\n }\n if (jqHeightIndex > 0) {\n jqHeightIndex += 1;\n var extractedNumber = classes[i].substring(jqHeightIndex);\n if (extractedNumber != undefined && extractedNumber.toString().length > 0 && !isNaN(extractedNumber)) {\n if (styleCollection[n] == 'height' || styleCollection[n] == 'width') {\n additionalKey = styleCollection[n];\n }\n else {\n if (styleCollection[n] == 'marginleft') {\n additionalKey = 'margin-left';\n }\n else if (styleCollection[n] == 'margintop') {\n additionalKey = 'margin-top';\n }\n else if (styleCollection[n] == 'marginlright') {\n additionalKey = 'margin-right';\n }\n else if (styleCollection[n] == 'marginbottom') {\n additionalKey = 'margin-bottom';\n }\n else if (styleCollection[n] == 'marginallsides') {\n additionalKey = 'margin';\n }\n }\n additionalValue = extractedNumber + 'px';\n additionalStyle += ' ' + additionalKey + ':' + additionalValue + ';';\n break;\n }\n }\n }\n }\n }\n return additionalStyle;\n }\n }", "function add_css_class(dom_ob, cl) {\n var classes=dom_ob.className.split(\" \");\n\n if(!in_array(cl, classes)) {\n classes.push(cl);\n }\n\n dom_ob.className=classes.join(\" \");\n\n return classes;\n}", "function add (domNode, classes) {\n classes.split(' ').forEach(function (c) {\n if (!has(domNode, c)) {\n domNode.setAttribute('class', domNode.getAttribute('class') + ' ' + c);\n }\n });\n}", "function _addClass(string, node) {\n\tclasses(node).add(string);\n}", "function classAdd(me, strin) {\n me.className += \" \" + strin;\n }", "_applyClassModifiers() {\n if (this.options.feedbackOnHover) {\n this.wrapperEl.addClass(this.options.classes.feedbackOnHover);\n }\n else {\n this.wrapperEl.removeClass(this.options.classes.feedbackOnHover);\n }\n if (this.options.backgroundInSlots) {\n this.wrapperEl.addClass(this.options.classes.backgroundInSlots);\n }\n else {\n this.wrapperEl.removeClass(this.options.classes.backgroundInSlots);\n }\n }", "function bodyAddClass(cl){\n $('body').attr('class',cl);\n}", "onClassChange() {\n for ( let i = 0; i < this.node.pdomClasses.length; i++ ) {\n const dataObject = this.node.pdomClasses[ i ];\n this.setClassToElement( dataObject.className, dataObject.options );\n }\n }", "addClass() {\n document.body.classList.add('learn-to-code');\n }", "addClass(...classes) {\n return this.forEach((el => el.classList.add(...classes))), this;\n }", "function add_css$1() {\n\tvar style = element(\"style\");\n\tstyle.id = \"svelte-5smswp-style\";\n\tstyle.textContent = \".apple-list-reminders.svelte-5smswp{margin:0;padding:0}.apple-list-break.svelte-5smswp{margin:0}.apple-list-reminder-break-line.svelte-5smswp{margin-left:2em;margin-top:0.5em;margin-bottom:0.5em;padding:0;height:0.5px;opacity:0.2}.apple-list-top-rule.svelte-5smswp,.apple-list-bottom-rule.svelte-5smswp{opacity:0}\";\n\tappend(document.head, style);\n}", "function addCssO(c,objetos){\n\tvar i=1;\n\twhile (i<arguments.length){\n\t\tdocument.querySelector(arguments[i]).classList.add(c);\n\t\ti++;\n\t}\n}", "function applyCssClasses() {\n\t\t\tif($(\"#ef-factsheet-node-form\").hasClass(\"author-role\")){\n\t\t\t\t$(\".ef-edit-links\").hide();\n\t\t\t\t$(\".field-name-field-ef-factsheet-sources\").hide();\n\t\t\t\t//$(\".vertical-tabs-list li\").first().hide();\n\n\t\t\t}\n\n\t\t\t/*var class_array = new Array( \"icon-ef_european_company_surveys_ecs\", \"icon-ef_european_quality_of_life_surveys_eqls\", \"icon-ef_european_working_conditions_surveys_ewcs\",\"icon-ef_data_visualisation\" );\n\t\t\t$index =0 ;*/\n\t\t\t$(\".block-menu-menu-ef-user-login-links-menu .first a\").each(function(){\n\t\t\t\t$(this).addClass('icon-ef_login');\n\t\t\t});\n\t\t\t$(\".block-menu-menu-ef-user-login-links-menu .last a\").each(function(){\n\t\t\t\t$(this).addClass('icon-ef_signup');\n\n\t\t\t});\n\t\t\tif($(\"#page-title\").hasClass(\"parent_emcc\")){\n\t\t\t\t$(\".block-panels-mini-browse-by\").addClass(\"parent_emcc\");\n\t\t\t}\n\t\t\tif($(\"#page-title\").hasClass(\"parent_eurwork\")){\n\t\t\t\t$(\".block-panels-mini-browse-by\").addClass(\"parent_eurwork\");\n\t\t\t}\n\n\t\t\t$(\".section-surveys\").find('.menu-block-1 > .menu > .menu-mlid-16488 > a').addClass('icon-ef_european_company_surveys_ecs');\n\t\t\t$(\".section-surveys\").find('.menu-block-1 > .menu > .menu-mlid-16489 > a').addClass('icon-ef_european_quality_of_life_surveys_eqls');\n\t\t\t$(\".section-surveys\").find('.menu-block-1 > .menu > .menu-mlid-16490 > a').addClass('icon-ef_european_working_conditions_surveys_ewcs');\n\t\t\t$(\".section-surveys\").find('.menu-block-1 > .menu > .menu-mlid-16491 > a').addClass('icon-ef_data_visualisation');\n\n\t\t\t/*if($(\".html\").hasClass( \"section-surveys\" )){\n\t\t\t\t$(\".menu-block-1 > .menu > li\").each(function(){\n\t\t\t\t\t$to_change = $(this).find(\"a\").first();\n\t\t\t\t\t$to_change.addClass(class_array[$index]);\n\t\t\t\t\t$index++;\n\t\t\t\t})\n\t\t\t}*/\n\t\t}", "function add_css() {\n\tvar style = element(\"style\");\n\tstyle.id = \"svelte-1t0xcr9-style\";\n\tstyle.textContent = \".checkbox-round.svelte-1t0xcr9{width:1.3em;height:1.3em;background-color:rgba(255, 255, 255, 0);border-radius:50%;vertical-align:middle;border:1px solid rgb(170, 168, 168);-webkit-appearance:none;outline:none;cursor:pointer;opacity:0.3}.checkbox-round.svelte-1t0xcr9:checked{background-color:gray}.apple-reminder-name.svelte-1t0xcr9{padding-left:1rem}.apple-reminder-due-date.svelte-1t0xcr9{opacity:0.3;padding-left:4em}.apple-reminder-container.svelte-1t0xcr9{padding:0;margin:0}.apple-reminder-priority.svelte-1t0xcr9{color:red}.apple-reminder-note.svelte-1t0xcr9{opacity:0.3;padding-left:4em}\";\n\tappend(document.head, style);\n}", "function renderInitialStylesAndClasses(element,context,renderer){var initialClasses=context[3/* InitialClassValuesPosition */];renderInitialStylingValues(element,renderer,initialClasses,true);var initialStyles=context[2/* InitialStyleValuesPosition */];renderInitialStylingValues(element,renderer,initialStyles,false);}", "function changeStylesTuT() {\n document.querySelector(\".classNames\").classList.remove(\"hidden\");\n\n // document.querySelector(\".classname\").style.color = \"black\";\n // document.querySelector(\".classname\").style.backgroundColor = \"yellow\";\n // change multipöe in one line:\n // document.querySelector(\".classname\").style.cssText = \"background-color: orange; color: dark blue;\";\n document.querySelector(\".classname\").setAttribute(\"style\",\"background-color: black; color: white;\");\n \n }", "addObject(pos, classes) {\n this.grid[pos].classList.add(...classes);\n }", "function addElementClasses() {\n\n $(layout_classes.layout__wrapper).each(function(index, element) {\n var $wrapper = $(this),\n $header = $wrapper.children(layout_classes.layout__header),\n $drawer = $wrapper.children(layout_classes.layout__drawer);\n\n // Scroll header\n if ($header.hasClass(layout_classes.header_scroll)) {\n $wrapper.addClass(layout_classes.wrapper_has_scrolling_header);\n }\n\n // Drawer\n if ($drawer.length > 0) {\n $wrapper.addClass(layout_classes.wrapper_has_drawer);\n }\n\n // Upgraded\n if ($wrapper.length > 0) {\n $wrapper.addClass(layout_classes.wrapper_is_upgraded);\n }\n });\n }", "function add_css() {\n\tvar style = element(\"style\");\n\tstyle.id = 'svelte-rlyv7c-style';\n\tstyle.textContent = \".plans.svelte-rlyv7c{display:grid;grid-template-columns:33% 33% 33%;grid-gap:10px}\";\n\tappend(document.head, style);\n}", "function addClass(clist,ncls) {\n\tif (clist == '')\n\t\treturn clist + ncls;\n\telse\n\t\treturn clist + ' ' + ncls;\n}", "function add_css(target) {\n\tappend_styles(target, \"svelte-12yh6aw\", \".wrapper.svelte-12yh6aw{display:flex;justify-content:center;margin:0}.button-enabled.svelte-12yh6aw:hover{color:var(--interactive-accent)}.button-disabled.svelte-12yh6aw{color:var(--text-muted)}\");\n}", "function changeStyle(){\n\n // Creating a style for the CDMs by three value in cpclass attribute (inline, bullet and no-bullet)\n var style = document.createElement('style');\n\n var cssRule = '';\n switch (parameters.cpclass) {\n case \"inline\":\n cssRule = '#'+ parameters.cdmContainer+ ' ul li{ display: inline-block; margin-left: 10px}';\n break;\n case \"bullet\":\n cssRule = '#'+ parameters.cdmContainer+ ' ul{ display: block; list-style: initial;}';\n break;\n case \"no-bullet\":\n cssRule = '#'+ parameters.cdmContainer+ ' ul{ display: block; list-style: none;}';\n break;\n }\n style.appendChild(document.createTextNode(cssRule));\n // Add the <style> element to the page\n document.head.appendChild(style);\n }", "function initAddClasses() {\n jQuery('.tabset-holder .opener').clickClass({\n classAdd: 'active',\n addToParent: 'tabset-holder'\n });\n jQuery('.rating-opener').clickClass({\n classAdd: 'active',\n addToParent: 'user-rating'\n });\n}", "function initAddClasses() {\n jQuery('.tabset-holder .opener').clickClass({\n classAdd: 'active',\n addToParent: 'tabset-holder'\n });\n jQuery('.rating-opener').clickClass({\n classAdd: 'active',\n addToParent: 'user-rating'\n });\n}", "function add_css(target) {\n\t\tappend_styles(target, \"svelte-1gtarpt\", \".hide-div.svelte-1gtarpt.svelte-1gtarpt{visibility:hidden}.fabs.svelte-1gtarpt.svelte-1gtarpt{bottom:0;position:fixed;margin:1em;right:0;z-index:998}.fab.svelte-1gtarpt.svelte-1gtarpt{display:block;width:56px;height:56px;border-radius:50%;text-align:center;color:#f0f0f0;margin:25px auto 0;box-shadow:0 0 4px rgba(0, 0, 0, .14), 0 4px 8px rgba(0, 0, 0, .28);cursor:pointer;-webkit-transition:all .1s ease-out;transition:all .1s ease-out;position:relative;z-index:998;overflow:hidden;background:#42a5f5}.fab.svelte-1gtarpt.svelte-1gtarpt:not(:last-child){width:0;height:0;margin:20px auto 0;opacity:0;visibility:hidden;line-height:40px}.fab:not(:last-child).is-visible.svelte-1gtarpt.svelte-1gtarpt{width:40px;height:40px;margin:15px auto 10;opacity:1;visibility:visible}.fab.svelte-1gtarpt.svelte-1gtarpt:nth-last-child(1){-webkit-transition-delay:25ms;transition-delay:25ms}.fab.svelte-1gtarpt.svelte-1gtarpt:not(:last-child):nth-last-child(2){-webkit-transition-delay:20ms;transition-delay:20ms}.fab.svelte-1gtarpt.svelte-1gtarpt:not(:last-child):nth-last-child(3){-webkit-transition-delay:40ms;transition-delay:40ms}.fab.svelte-1gtarpt.svelte-1gtarpt:not(:last-child):nth-last-child(4){-webkit-transition-delay:60ms;transition-delay:60ms}.fab.svelte-1gtarpt.svelte-1gtarpt:not(:last-child):nth-last-child(5){-webkit-transition-delay:80ms;transition-delay:80ms}.fab.svelte-1gtarpt.svelte-1gtarpt:active,.fab.svelte-1gtarpt.svelte-1gtarpt:focus,.fab.svelte-1gtarpt.svelte-1gtarpt:hover{box-shadow:0 0 6px rgba(0, 0, 0, .16), 0 6px 12px rgba(0, 0, 0, .32)}.chat.svelte-1gtarpt.svelte-1gtarpt{position:fixed;right:85px;bottom:20px;width:400px;font-size:12px;line-height:22px;font-family:'Roboto';font-weight:500;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;opacity:0;box-shadow:1px 1px 100px 2px rgba(0, 0, 0, 0.22);border-radius:10px;-webkit-transition:all .2s ease-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.chat_header.svelte-1gtarpt.svelte-1gtarpt{font-size:13px;font-family:'Roboto';font-weight:500;color:#f3f3f3;height:55px;background:#42a5f5;border-top-left-radius:10px;border-top-right-radius:10px;padding-top:8px}.chat.is-visible.svelte-1gtarpt.svelte-1gtarpt{opacity:1;-webkit-animation:svelte-1gtarpt-zoomIn .2s cubic-bezier(.42, 0, .58, 1);animation:svelte-1gtarpt-zoomIn .2s cubic-bezier(.42, 0, .58, 1)}.chat_option.svelte-1gtarpt.svelte-1gtarpt{float:left;font-size:15px;list-style:none;position:relative;height:100%;width:100%;text-align:relative;margin-right:10px;letter-spacing:0.5px;font-weight:400\\n }.chat_option.svelte-1gtarpt img.svelte-1gtarpt{border-radius:50%;width:55px;float:left;margin:-30px 20px 10px 20px;border:4px solid rgba(0, 0, 0, 0.21)}.chat_option.svelte-1gtarpt .agent.svelte-1gtarpt{font-size:12px;font-weight:300}.chat_option.svelte-1gtarpt .online.svelte-1gtarpt{opacity:0.4;font-size:11px;font-weight:300}.chat_body.svelte-1gtarpt.svelte-1gtarpt{background:#fff;width:100%;display:inline-block;text-align:center;overflow-y:auto}.chat_body.svelte-1gtarpt p.svelte-1gtarpt{padding:20px;color:#888\\n }.chat_field.svelte-1gtarpt.svelte-1gtarpt{position:relative;margin:5px 0 5px 0;width:50%;font-family:'Roboto';font-size:12px;line-height:30px;font-weight:500;color:#4b4b4b;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;border:none;outline:none;display:inline-block}.chat_field.chat_message.svelte-1gtarpt.svelte-1gtarpt{height:30px;resize:none;font-size:13px;font-weight:400}.fab_field.svelte-1gtarpt.svelte-1gtarpt{width:100%;display:inline-block;text-align:center;background:#fff;border-top:1px solid #eee;border-bottom-right-radius:10px;border-bottom-left-radius:10px}.fab_field.svelte-1gtarpt a.svelte-1gtarpt{display:inline-block;text-align:center}#fab_send.svelte-1gtarpt.svelte-1gtarpt{float:right;background:rgba(0, 0, 0, 0)}.fab_field.svelte-1gtarpt .fab.svelte-1gtarpt{width:35px;height:35px;box-shadow:none;margin:5px}.chat_converse.svelte-1gtarpt.svelte-1gtarpt{position:relative;background:#fff;margin:6px 0 0px 0;height:300px;min-height:0;font-size:12px;line-height:18px;overflow-y:auto;width:100%;float:right;padding-bottom:30px}.chat.svelte-1gtarpt .chat_converse .chat_msg_item.svelte-1gtarpt{position:relative;margin:8px 0 15px 0;padding:8px 10px;max-width:60%;display:block;word-wrap:break-word;border-radius:3px;-webkit-animation:svelte-1gtarpt-zoomIn .5s cubic-bezier(.42, 0, .58, 1);animation:svelte-1gtarpt-zoomIn .5s cubic-bezier(.42, 0, .58, 1);clear:both;z-index:999}.chat.svelte-1gtarpt .chat_converse .chat_msg_item .chat_avatar.svelte-1gtarpt{position:absolute;top:0}.chat.svelte-1gtarpt .chat_converse .chat_msg_item.chat_msg_item_admin .chat_avatar.svelte-1gtarpt{left:-52px;background:rgba(0, 0, 0, 0.03)}.chat.svelte-1gtarpt .chat_converse .chat_msg_item .chat_avatar.svelte-1gtarpt,.chat_avatar.svelte-1gtarpt img.svelte-1gtarpt{width:40px;height:40px;text-align:center;border-radius:50%}.chat.svelte-1gtarpt .chat_converse .chat_msg_item.chat_msg_item_admin.svelte-1gtarpt{margin-left:60px;float:left;background:rgba(0, 0, 0, 0.03);color:#666}.chat.svelte-1gtarpt .chat_converse .chat_msg_item.chat_msg_item_admin.svelte-1gtarpt:before{content:'';position:absolute;top:15px;left:-12px;z-index:998;border:6px solid transparent;border-right-color:rgba(255, 255, 255, .4)}input.svelte-1gtarpt.svelte-1gtarpt{position:relative;width:90%;font-family:'Roboto';font-size:12px;line-height:20px;font-weight:500;color:#4b4b4b;-webkit-font-smoothing:antialiased;font-smoothing:antialiased;outline:none;background:#fff;display:inline-block;resize:none;padding:5px;border-radius:3px}.svelte-1gtarpt.svelte-1gtarpt::-webkit-scrollbar{width:6px}.svelte-1gtarpt.svelte-1gtarpt::-webkit-scrollbar-track{border-radius:0}.svelte-1gtarpt.svelte-1gtarpt::-webkit-scrollbar-thumb{margin:2px;border-radius:10px;background:rgba(0, 0, 0, 0.2)}.is-float.svelte-1gtarpt.svelte-1gtarpt{box-shadow:0 0 6px rgba(0, 0, 0, .16), 0 6px 12px rgba(0, 0, 0, .32)}@-webkit-keyframes svelte-1gtarpt-zoomIn{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0.0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes svelte-1gtarpt-zoomIn{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0.0}100%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes svelte-1gtarpt-load{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0.0}50%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:1}100%{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@keyframes svelte-1gtarpt-load{0%{-webkit-transform:scale(0);transform:scale(0);opacity:0.0}50%{-webkit-transform:scale(1.5);transform:scale(1.5);opacity:1}100%{-webkit-transform:scale(1);transform:scale(1);opacity:0}}@media only screen and (min-width: 300px){.chat.svelte-1gtarpt.svelte-1gtarpt{width:250px}}@media only screen and (min-width: 480px){.chat.svelte-1gtarpt.svelte-1gtarpt{width:300px}.chat_field.svelte-1gtarpt.svelte-1gtarpt{width:65%}}@media only screen and (min-width: 768px){.chat.svelte-1gtarpt.svelte-1gtarpt{width:300px}.chat_field.svelte-1gtarpt.svelte-1gtarpt{width:65%}}@media only screen and (min-width: 1024px){.chat.svelte-1gtarpt.svelte-1gtarpt{width:300px}.chat_field.svelte-1gtarpt.svelte-1gtarpt{width:65%}}@-webkit-keyframes svelte-1gtarpt-ripple{100%{opacity:0;-moz-transform:scale(5);-ms-transform:scale(5);webkit-transform:scale(5);-webkit-transform:scale(5);transform:scale(5)}}@keyframes svelte-1gtarpt-ripple{100%{opacity:0;-moz-transform:scale(5);-ms-transform:scale(5);webkit-transform:scale(5);-webkit-transform:scale(5);transform:scale(5)}}.svelte-1gtarpt.svelte-1gtarpt::-webkit-input-placeholder{color:#bbb}.svelte-1gtarpt.svelte-1gtarpt:-ms-input-placeholder{color:#bbb}.svelte-1gtarpt.svelte-1gtarpt::-moz-placeholder{color:#bbb}.svelte-1gtarpt.svelte-1gtarpt:-moz-placeholder{color:#bbb}.label-color.svelte-1gtarpt.svelte-1gtarpt{color:black}\");\n\t}", "function add_css() {\n\tvar style = Object(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"g\" /* element */])(\"style\");\n\tstyle.id = 'svelte-1elzdbg-style';\n\tstyle.textContent = \".small.svelte-1elzdbg{font:normal 13px sans-serif;background:white;text-align:left;line-height:18px}.grid-container.svelte-1elzdbg{position:absolute;top:65px;display:grid;grid-template-columns:auto auto;padding:10px;width:200px}.grid.svelte-1elzdbg{margin:100px}\";\n\tObject(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"b\" /* append */])(document.head, style);\n}", "function addClasses(elems, className) {\n var ln = elems.length, i;\n\n for (i = 0; i < ln; i++) {\n var elem = elems[i];\n if (elem.nodeType === 1) addClass(elem, className);\n };\n }", "function addClass(element, classesToAdd) {\t\t\n\t\tvar newClasses = classesToAdd.replace(/\\s+/g,'').split(\",\");\t\t\n\t\tvar newClassName = element.className.trim().replace(/\\s+/g,' ') + ' ';\n var len = newClasses.length;\n var ind = 0;\n\t\twhile(ind < len) { \n\t\t\tvar testTerm = new RegExp(newClasses[ind] + ' ');\n if (!testTerm.test(newClassName)) {\n\t\t\t\t//current className doesn't contain class - add it\n\t\t\t\tnewClassName += newClasses[ind] + ' ';\t\t\t\n \t\t\t}\n ind++;\n \t\t}\n\n\t\telement.className = newClassName.trim();\n \t}", "addClass(clazz) {\n this.eachElem(item => item.classList.add(clazz));\n return this;\n }", "addClass(clazz) {\n this.eachElem(item => item.classList.add(clazz));\n return this;\n }", "function addC(item, className) { item.classList.add(className) }", "function addC(item, className) { item.classList.add(className) }", "function D3PedalMap_clutch_svelte_add_css() {\n\tvar style = (0,internal/* element */.bG)(\"style\");\n\tstyle.id = \"svelte-xp8anw-style\";\n\tstyle.textContent = \".svelte-xp8anw .line{stroke-width:2;fill:none}.svelte-xp8anw .axis path{stroke:black}.svelte-xp8anw .text{font-size:12px}.svelte-xp8anw .title-text{font-size:12px}.svelte-xp8anw .grid line{stroke:lightgrey;stroke-opacity:0.7;shape-rendering:crispEdges}\";\n\t(0,internal/* append */.R3)(document.head, style);\n}", "function add_css(target) {\n\tappend_styles(target, \"svelte-133qdtd\", \"g.svelte-133qdtd{paint-order:stroke;stroke-width:3px;stroke:var(--visual-math-line-color);stroke-opacity:0.75}\");\n}", "alterClass(removals, additions) {\n const self = this;\n\n if (removals.indexOf(\"*\") === -1) {\n // Use native jQuery methods if there is no wildcard matching\n self.removeClass(removals);\n return !additions ? self : self.addClass(additions);\n }\n\n const patt = new RegExp(\n `\\\\s${removals\n .replace(/\\*/g, \"[A-Za-z0-9-_]+\")\n .split(\" \")\n .join(\"\\\\s|\\\\s\")}\\\\s`,\n \"g\"\n );\n\n self.each((i, it) => {\n let cn = ` ${it.className} `;\n while (patt.test(cn)) {\n cn = cn.replace(patt, \" \");\n }\n it.className = $.trim(cn);\n });\n\n return !additions ? self : self.addClass(additions);\n }", "cssSetup(config) {\n ((config, sliderr) => {\n var cssUtils = {\n \"addClassName\": function addClassName(classes = ['sliderr']) {\n sliderr._el.className += ' ' + classes.join(' ');\n },\n \"removeClassName\": function removeClassName(classes = ['sliderr-loader']) {\n console.log(this);\n let _length = classes.length;\n let _removeClass = (classname) => {\n sliderr._el.classList.remove(classname); // classList not supported on IE 9 and below\n }\n if(_length > 1) {\n classes.map( function(classname) {\n _removeClass(classname);\n });\n }\n else {\n _removeClass(classes[0]);\n } \n }\n }\n\n for (var fn of Object.keys(config)) {\n cssUtils[fn](config[fn]);\n }\n })(config, this);\n }", "function add_css() {\n\tvar style = Object(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"f\" /* element */])(\"style\");\n\tstyle.id = 'svelte-1hfm4g5-style';\n\tstyle.textContent = \".flex-container.svelte-1hfm4g5{display:flex;justify-content:center;flex-wrap:wrap}\";\n\tObject(__WEBPACK_IMPORTED_MODULE_0_svelte_internal__[\"b\" /* append */])(document.head, style);\n}", "function add_css() {\n\tvar style = element(\"style\");\n\tstyle.id = 'svelte-p8vizn-style';\n\tstyle.textContent = \".fa-svelte.svelte-p8vizn{width:1em;height:1em;overflow:visible;display:inline-block}\";\n\tappend(document.head, style);\n}", "function add_css() {\n \tvar style = element(\"style\");\n \tstyle.id = 'svelte-5qo5ik-style';\n \tstyle.textContent = \".codemirror-container.svelte-5qo5ik{position:relative;width:100%;height:100%;border:none;line-height:1.5;overflow:hidden}.codemirror-container.svelte-5qo5ik .CodeMirror{height:100%;background:transparent;font:400 14px/1.7 var(--font-mono);color:var(--base)}.codemirror-container.flex.svelte-5qo5ik .CodeMirror{height:auto}.codemirror-container.flex.svelte-5qo5ik .CodeMirror-lines{padding:0}.codemirror-container.svelte-5qo5ik .CodeMirror-gutters{padding:0 16px 0 8px;border:none}.codemirror-container.svelte-5qo5ik .error-loc{position:relative;border-bottom:2px solid #da106e}.codemirror-container.svelte-5qo5ik .error-line{background-color:rgba(200, 0, 0, .05)}textarea.svelte-5qo5ik{visibility:hidden}pre.svelte-5qo5ik{position:absolute;width:100%;height:100%;top:0;left:0;border:none;padding:4px 4px 4px 60px;resize:none;font-family:var(--font-mono);font-size:13px;line-height:1.7;user-select:none;pointer-events:none;color:#ccc;tab-size:2;-moz-tab-size:2}.flex.svelte-5qo5ik pre.svelte-5qo5ik{padding:0 0 0 4px;height:auto}\";\n \tappend(document.head, style);\n }", "addClass(cssClass, condition) {\n let conditionStatement = condition !== undefined ? condition : true;\n if (cssClass !== undefined && conditionStatement) {\n this.classes.push(cssClass);\n }\n }", "function addNewClass(elementName, newClass) {\n const element = document.querySelectorAll(elementName)\n\n element.forEach(el => {\n el.classList.add(newClass)\n })\n}", "function setBodyClass(){\n /* nectar addition */ \n /*\n var section = $(SECTION_ACTIVE_SEL);\n var slide = section.find(SLIDE_ACTIVE_SEL);\n\n var sectionAnchor = getAnchor(section);\n var slideAnchor = getAnchor(slide);\n\n var text = String(sectionAnchor);\n\n if(slide.length){\n text = text + '-' + slideAnchor;\n }\n\n //changing slash for dash to make it a valid CSS style\n text = text.replace('/', '-').replace('#','');\n\n //removing previous anchor classes\n var classRe = new RegExp('\\\\b\\\\s?' + VIEWING_PREFIX + '-[^\\\\s]+\\\\b', \"g\");\n $body[0].className = $body[0].className.replace(classRe, '');\n\n //adding the current anchor\n $body.addClass(VIEWING_PREFIX + '-' + text);\n */\n }", "addClass(c) {\n const sch = this._getDays(c);\n\n //add all the classes to our schedule by days\n Object.keys(sch).forEach(d => {\n sch[d].forEach(cl => this.courses[d].push(cl));\n });\n }", "function addMyClass(param, classToAdd) {\r\n //if it has the class\r\n if (param.classList.contains(classToAdd)) {\r\n param.classList.remove(classToAdd);\r\n } else {\r\n //if it doesnt have the class add it\r\n var classString = param.className; // returns the string of all the classes for element\r\n var newClass = classString.concat(\" \" + classToAdd);\r\n param.className = newClass;\r\n }\r\n}", "function add_css() {\n\tvar style = element(\"style\");\n\tstyle.id = \"svelte-f66dpe-style\";\n\tstyle.textContent = \".flex.svelte-f66dpe{display:flex}.flex-direction--row.svelte-f66dpe{flex-direction:row}.flex-direction--column.svelte-f66dpe{flex-direction:column}.flex-direction--row--reverse.svelte-f66dpe{flex-direction:row-reverse}.flex-direction--column--reverse.svelte-f66dpe{flex-direction:column-reverse}.flex-align--start.svelte-f66dpe{align-items:flex-start}.flex-align--center.svelte-f66dpe{align-items:center}.flex-align--end.svelte-f66dpe{align-items:flex-end}.flex-align--stretch.svelte-f66dpe{align-items:stretch}.flex-justify--start.svelte-f66dpe{justify-content:flex-start}.flex-justify--center.svelte-f66dpe{justify-content:center}.flex-justify--end.svelte-f66dpe{justify-content:flex-end}.flex-justify--around.svelte-f66dpe{justify-content:space-around}.flex-justify--between.svelte-f66dpe{justify-content:space-between}.flex-justify--evenly.svelte-f66dpe{justify-content:space-evenly}\";\n\tappend(document.head, style);\n}", "function add_css() {\n\tvar style = element(\"style\");\n\tstyle.id = \"svelte-10bst2e-style\";\n\tstyle.textContent = \".svelte-10bst2e.svelte-10bst2e{user-select:none}h1.svelte-10bst2e.svelte-10bst2e{text-align:center;padding-bottom:1rem}.puzzle.svelte-10bst2e.svelte-10bst2e{font-family:system-ui;width:max(375px, 50vmin);margin:auto;padding-top:3rem;padding-bottom:3rem}.grid.svelte-10bst2e.svelte-10bst2e{width:max(375px, 50vmin);height:max(375px, 50vmin);display:grid;grid-template-rows:repeat(4, 1fr);grid-template-columns:repeat(4, 1fr);grid-gap:5px;margin:auto}.grid.svelte-10bst2e>.item.svelte-10bst2e{border-radius:7px;background-color:blanchedalmond;display:flex;justify-content:center;align-items:center;font-size:2rem}.item.hidden.svelte-10bst2e.svelte-10bst2e{opacity:0}.history.svelte-10bst2e.svelte-10bst2e{display:flex;justify-content:center;flex-wrap:wrap;padding-top:2rem;padding-bottom:2rem}.history.svelte-10bst2e>.item.svelte-10bst2e{padding:4px;font-size:2rem}.history.svelte-10bst2e>.item[flag='0'].svelte-10bst2e{color:rgb(211, 211, 211)}.history.svelte-10bst2e>.item[flag='1'].svelte-10bst2e{color:rgb(63, 203, 141)}.button.svelte-10bst2e.svelte-10bst2e{padding:1rem 2rem;border:none;border-radius:8px;background-color:#e8e9e4}\";\n\tappend(document.head, style);\n}", "function addClass(element, cls) {\n element.className +=cls+' ';\n}", "function setClass(node, index, newClass){\n let newClasses = [];\n let classList = node.classList;\n for(let i = 2; i >= 0; i--){\n newClasses.unshift(node.classList[i]);\n classList.remove(classList[i]);\n }\n\n newClasses[index] = newClass;\n\n for(let i = 0; i < 3; i++){\n classList.add(newClasses[i]);\n }\n\n}", "function insertClass (obj, arr) {\n if (!Array.isArray(arr)) return;\n \n let classes = \"\";\n let out = \"\";\n \n arr.forEach(element => {\n classes = classes + \" \" + element;\n });\n out = obj.addClass(classes);\n return out;\n}", "_addPanelClasses(cssClasses) {\n if (this._pane) {\n Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_5__[\"coerceArray\"])(cssClasses).forEach(cssClass => {\n if (cssClass !== '' && this._appliedPanelClasses.indexOf(cssClass) === -1) {\n this._appliedPanelClasses.push(cssClass);\n this._pane.classList.add(cssClass);\n }\n });\n }\n }", "function rebuildClassList() {\n var s = 'wait-rotator-circle'; // base class\n\n s += _getRadioValue(sizes);\n s += _getRadioValue(slices);\n s += _getRadioValue(parts);\n s += _getRadioValue(speed);\n s += _getRadioValue(thick);\n s += _getRadioValue(colors);\n s += _getRadioValue(styles);\n s += _getRadioValue(shapes);\n\n example.className = '';\n example.offsetWidth = example.offsetWidth; // reflow magic\n var classes = s.split(' ');\n var t = '';\n for (var i = 0; i < classes.length; i++) {\n if (t != '') t += ' ';\n t += '<span>' + classes[i] + '</span>';\n }\n\n layout_example.innerHTML = '&lt;div class=\"' + t + '\"&gt;&lt;/div&gt;';\n\n example.className = s;\n example.offsetWidth = example.offsetWidth;\n}", "showClasses(classElements) {\n const props = this.props\n classElements.forEach(item => {\n props.classListElement.appendChild(item)\n })\n }", "function setStyles() {\n\t\t_.each(_.keys(site.styles), function(classKey) {\n\t\t\tvar cssClass = site.styles[classKey];\n\t\t\t_.each(_.keys(cssClass), function(styleKey) {\n\t\t\t\tsetStyle(classKey, styleKey, cssClass[styleKey]);\n\t\t\t});\n\t\t});\n\t}", "function insertStyles() {\n let head = document.getElementsByTagName('head')[0];\n let lastHeadElement = head.lastChild;\n let style = document.createElement('style');\n const styleArray = [];\n style.type = 'text/css';\n // Prism css\n styleArray.push('.token.comment,.token.prolog,.token.doctype,.token.cdata{color: slategray}.token.punctuation{color: #999}.namespace{opacity: .7}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.deleted{color: #905}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color: #690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color: #a67f59;background: hsla(0, 0%, 100%, .5)}.token.atrule,.token.attr-value,.token.keyword{color: #07a}.token.function{color: #DD4A68}.token.regex,.token.important,.token.variable{color: #e90}.token.important,.token.bold{font-weight: bold}.token.italic{font-style: italic}.token.entity{cursor: help}');\n // Custom css to fix some layout problems because of the insertion of <code> element\n styleArray.push('pre>code{border-radius:initial;display:initial;line-height:initial;margin-left:initial;overflow-y:initial;padding:initial}code,tt{background:initial;border:initial}.refract-container .deletion pre.source {background-color: #fff1f2 !important;} .refract-container .addition pre.source { background-color: #e8ffe8;}');\n style.innerHTML = styleArray.join('');\n head.insertBefore(style, lastHeadElement);\n head = null;\n lastHeadElement = null;\n style = null;\n }", "function add_css(target) {\n\tappend_styles(target, \"svelte-kqcr7b\", \".buttonContainer.svelte-kqcr7b{display:flex;justify-content:center;margin-top:1rem}button.svelte-kqcr7b{margin-left:5px;margin-right:5px;font-size:15px}\");\n}", "function superclasses(classNames) { }", "toNewClassAttribute(old_class, theme) {\n let new_classes = [];\n if (old_class != null)\n new_classes = old_class.split(\" \").filter(is_not_perspective_class);\n new_classes.push(theme_to_class(theme));\n return new_classes.join(\" \");\n }", "function add_css$3(){var style=element(\"style\");style.id=\"svelte-82cst2-style\";style.textContent=\"span.svelte-82cst2{font-size:inherit;font-family:inherit}\";append(document.head,style)}", "addStyleClasses(type) {\n var _a, _b, _c;\n this.renderer.addClass(this.host, 'cx-icon');\n (_a = this.styleClasses) === null || _a === void 0 ? void 0 : _a.forEach((cls) => this.renderer.removeClass(this.host, cls));\n this.styleClasses = (_b = this.iconLoader.getStyleClasses(type)) === null || _b === void 0 ? void 0 : _b.split(' ');\n (_c = this.styleClasses) === null || _c === void 0 ? void 0 : _c.forEach((cls) => {\n if (cls !== '') {\n this.renderer.addClass(this.host, cls);\n }\n });\n }", "function exAddClass(node, name) {\n var list = node.classList;\n var parts = name.split(/\\s+/);\n for (var i = 0, n = parts.length; i < n; ++i) {\n if (parts[i])\n list.add(parts[i]);\n }\n}", "function appendClass(classElement){\r\n\r\n\t$(classElement).each(function(){\r\n\t\t//Balloon styles\r\n\t\tif($(this).attr('balloon_styles')){\r\n\t\t\tvar balloonStyle = $(this).attr('balloon_styles');\r\n\t\t\tif(balloonStyle == \"speech_left\"){classArray.push(\"speech left\");}\r\n\t\t\tif(balloonStyle == \"speech_right\"){classArray.push(\"speech right\");}\r\n\t\t\tif(balloonStyle == \"speech_bottom\"){classArray.push(\"speech\");}\r\n\t\t\tif(balloonStyle == \"speech_top\"){classArray.push(\"speech top\");}\r\n\t\t\tif(balloonStyle == \"thought\"){classArray.push(\"thought\");}\r\n\t\t}\r\n\t\t\r\n\t\t//Classes\r\n\t\tif($(this).attr('class')){\r\n\t\t\tclassArray.push($(this).attr('class'));\r\n\t\t}\r\n\t\t\r\n\t\t//Font family\r\n\t\tif($(this).attr('font_family')){\r\n\t\t\tclassArray.push($(this).attr('font_family'));\r\n\t\t}\r\n\t\t\r\n\t\t//Font color\r\n\t\tif($(this).attr('font_color')){\r\n\t\t\tclassArray.push($(this).attr('font_color'));\r\n\t\t}\r\n\t\t\r\n\t\t//Background color\r\n\t\tif($(this).attr('background_color')){\r\n\t\t\t//Include '_BG' at the end of background_color to indicate it's a background, as named in the CSS.\r\n\t\t\tclassArray.push($(this).attr('background_color') + \"_BG\");\r\n\t\t}\r\n\t\t\r\n\t\t//Font size\r\n\t\tif($(this).attr('font_size')){\r\n\t\t\t//Include 'fs_' before the class to indicate it's a 'font-size' class, as named in the CSS.\r\n\t\t\tclassArray.push(\"fs_\" + $(this).attr('font_size'));\r\n\t\t}\r\n\t\t//Text shadow\r\n\t\tif($(this).attr('text_shadow')){\r\n\t\t\tclassArray.push($(this).attr('text_shadow'));\r\n\t\t}\r\n\t});\r\n}", "addClass(id, data) {\n this.classes[id] = new ClassData(data);\n this.classNames.push(data.name);\n }", "function addCustomClasses(survey, options) {\n var classes = options.cssClasses\n\n classes.root += ` ${options.question.customClasses}`;\n // console.log(survey.cssValue)\n}", "function add_css$1() {\n \tvar style = element(\"style\");\n \tstyle.id = 'svelte-7fiviz-style';\n \tstyle.textContent = \"\";\n \tappend(document.head, style);\n }", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function add_css$4(){var style=element(\"style\");style.id=\"svelte-82cst2-style\";style.textContent=\"span.svelte-82cst2{font-size:inherit;font-family:inherit}\";append(document.head,style)}", "function add_css() {\n var style = element$1(\"style\");\n style.id = \"svelte-cm45hh-style\";\n style.textContent = \".circle.svelte-cm45hh{height:var(--size);width:var(--size);border-color:var(--color) transparent var(--color) var(--color);border-width:calc(var(--size) / 15);border-style:solid;border-image:initial;border-radius:50%;animation:0.75s linear 0s infinite normal none running svelte-cm45hh-rotate}@keyframes svelte-cm45hh-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}\";\n append$1(document.head, style);\n }", "function Px(a){return{addClass:function(b){a.classList.add(b)},removeClass:function(b){a.classList.remove(b)},hasClass:function(b){return a.classList.contains(b)}}}", "function addClass(el,cls){/* istanbul ignore if */if(!cls||!cls.trim()){return;}/* istanbul ignore else */if(el.classList){if(cls.indexOf(' ')>-1){cls.split(/\\s+/).forEach(function(c){return el.classList.add(c);});}else{el.classList.add(cls);}}else{var cur=' '+el.getAttribute('class')+' ';if(cur.indexOf(' '+cls+' ')<0){el.setAttribute('class',(cur+cls).trim());}}}", "function addClass(el,cls){/* istanbul ignore if */if(!cls||!(cls=cls.trim())){return;}/* istanbul ignore else */if(el.classList){if(cls.indexOf(' ')>-1){cls.split(/\\s+/).forEach(function(c){return el.classList.add(c);});}else{el.classList.add(cls);}}else{var cur=\" \"+(el.getAttribute('class')||'')+\" \";if(cur.indexOf(' '+cls+' ')<0){el.setAttribute('class',(cur+cls).trim());}}}", "function addClass(el,cls){/* istanbul ignore if */if(!cls||!(cls=cls.trim())){return;}/* istanbul ignore else */if(el.classList){if(cls.indexOf(' ')>-1){cls.split(/\\s+/).forEach(function(c){return el.classList.add(c);});}else{el.classList.add(cls);}}else{var cur=\" \"+(el.getAttribute('class')||'')+\" \";if(cur.indexOf(' '+cls+' ')<0){el.setAttribute('class',(cur+cls).trim());}}}", "function add_css(){var style=element(\"style\");style.id=\"svelte-r8gx3p-style\";style.textContent=\"div.svelte-r8gx3p{display:flex;justify-content:center;align-items:center;font-size:inherit;font-family:inherit;padding:0.3em;border-radius:40px;transition:background 150ms ease-in-out}div.svelte-r8gx3p:hover{background:#eeeeee;cursor:pointer}.bn-notify-dark-mode-close-background.svelte-r8gx3p:hover{background:#00222c}\";append(document.head,style)}", "function createElementModAddClass(type, parent, classname) {\n var telem = document.createElement(type);\n telem.classList.add(classname);\n parent.appendChild(telem);\n}", "function registerTemplates(newStyles) {\n var stylesheet = \"\";\n\n for (const [id, style] of Object.entries(newStyles)) {\n styles.set(id, style);\n if (style.stylesheet) {\n stylesheet += style.stylesheet + \"\\n\";\n }\n }\n\n if (stylesheet) {\n let styleElement = document.createElement(\"style\");\n styleElement.innerHTML = stylesheet;\n document.getElementsByTagName(\"head\")[0].appendChild(styleElement);\n }\n}", "function updateClassProp(context,offset,addOrRemove,directiveRef){_updateSingleStylingValue(context,offset,addOrRemove,true,directiveRef);}", "function add_css$c() {\n\tvar style = element(\"style\");\n\tstyle.id = \"svelte-19yho4w-style\";\n\tstyle.textContent = \".wrapper.svelte-19yho4w{width:var(--size);height:calc(var(--size) / 2);overflow:hidden}.rainbow.svelte-19yho4w{width:var(--size);height:var(--size);border-left-color:transparent;border-bottom-color:transparent;border-top-color:var(--color);border-right-color:var(--color);box-sizing:border-box;transform:rotate(-200deg);border-radius:50%;border-style:solid;animation:var(--duration) ease-in-out 0s infinite normal none running svelte-19yho4w-rotate}@keyframes svelte-19yho4w-rotate{0%{border-width:10px}25%{border-width:3px}50%{transform:rotate(115deg);border-width:10px}75%{border-width:3px}100%{border-width:10px}}\";\n\tappend(document.head, style);\n}" ]
[ "0.69386965", "0.6909671", "0.69048554", "0.635301", "0.62114275", "0.62052315", "0.61946356", "0.6148107", "0.61036515", "0.6102438", "0.6059425", "0.60481244", "0.6035947", "0.60336137", "0.60330087", "0.60144967", "0.5971051", "0.59632194", "0.59470534", "0.59456784", "0.5941409", "0.59372425", "0.5926974", "0.5926974", "0.5926083", "0.59245825", "0.5890752", "0.5887957", "0.5884731", "0.5880941", "0.58725756", "0.58693814", "0.5865099", "0.58636284", "0.58615166", "0.58489776", "0.5845126", "0.5844982", "0.5842553", "0.5835735", "0.5824966", "0.5819786", "0.5817804", "0.58150667", "0.58113223", "0.5799313", "0.5799313", "0.57927567", "0.5785816", "0.57790995", "0.57729155", "0.5752459", "0.5752459", "0.57430017", "0.57430017", "0.5740111", "0.5739127", "0.57293075", "0.57269424", "0.5725646", "0.5719519", "0.57099235", "0.57055265", "0.56985044", "0.5696617", "0.5693289", "0.568617", "0.5683752", "0.5680588", "0.5676722", "0.5674486", "0.5670945", "0.5670529", "0.56568784", "0.56553775", "0.5652419", "0.56495374", "0.5637673", "0.5630117", "0.5625218", "0.56250274", "0.5624851", "0.56176007", "0.56123674", "0.5611735", "0.5602428", "0.55925936", "0.55846655", "0.55846655", "0.558459", "0.55844927", "0.55813724", "0.5579877", "0.5572067", "0.5572067", "0.5569819", "0.55697316", "0.55684656", "0.5567528", "0.5565651" ]
0.61105055
8
dynamically create classes with fill property interpolated from given starting colors
function genlegendScaleLevels(start, end, num) { var incr=(end[0]-start[0])/num; var incg=(end[1]-start[1])/num; var incb=(end[2]-start[2])/num; for(k = 1; k <= num; k++) { cur=[Math.round(start[0]+k*incr),Math.round(start[1]+k*incg),Math.round(start[2]+k*incb)]; createClass(".heatLevel"+k.toString(),"fill: rgb("+cur.toString()+");"); legendScaleLevels[k]=cur; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateFillStyle(grd, ...colors) {\n switch (colors.length) {\n case 2:\n grd.addColorStop(0, colors[0]);\n grd.addColorStop(1, colors[1]);\n break;\n case 3:\n grd.addColorStop(0, colors[0]);\n grd.addColorStop(0.5, colors[1]);\n grd.addColorStop(1, colors[2]);\n break;\n case 4:\n grd.addColorStop(0, colors[0]);\n grd.addColorStop(0.4, colors[1]);\n grd.addColorStop(0.8, colors[2]);\n grd.addColorStop(1, colors[3]);\n break;\n case 5:\n grd.addColorStop(0, colors[0]);\n grd.addColorStop(0.25, colors[1]);\n grd.addColorStop(0.5, colors[2]);\n grd.addColorStop(0.75, colors[3]);\n grd.addColorStop(1, colors[4]);\n break;\n default:\n }\n return grd;\n }", "createColors(color, num) {\n //receive hex color from parent, return array of colors for gradient\n //num is # of generated color in return array\n let a = []\n let red = parseInt( color.substring(1, 3), 16)\n let green = parseInt(color.substring(3, 5), 16)\n let blue = parseInt(color.substring(5,7), 16)\n \n let k = 0.8 \n //from lighter colder to darker warmer\n // console.log(red, green, blue)\n for (i=0;i<num;i++) {\n let new_red = (Math.floor(red*k)).toString(16)\n let new_green = (Math.floor(green*k)).toString(16)\n let new_blue = (Math.floor(blue*k)).toString(16)\n let new_color = '#'+new_red+new_green+new_blue\n k += 0.1\n a.push(new_color)\n }\n return a\n\n }", "paintFill(prop) {\r\n let fillColorArray = [\r\n 'step',\r\n ['get', prop.key]\r\n ];\r\n\r\n prop.colorScale.map((color, index) => {\r\n if (index > 0) {\r\n fillColorArray.push(prop.step[index]) \r\n }\r\n\r\n fillColorArray.push(color);\r\n })\r\n\r\n return fillColorArray;\r\n }", "function getDynamicColors(fillPercent) {\n // mix colors\n // green rgb(169,215,11) #a9d70b\n // yellow rgb(249,200,2) #f9c802\n // red rgb(255,0,0) #ff0000\n\n if (fillPercent >= 0.5 ) {\n fillPercent = 2 * fillPercent - 1;\n var R = fillPercent * 255 + (1 - fillPercent) * 249;\n var G = fillPercent * 0 + (1 - fillPercent) * 200;\n var B = fillPercent * 0 + (1 - fillPercent) * 2;\n }\n else {\n fillPercent = 2 * fillPercent;\n var R = fillPercent * 249 + (1 - fillPercent) * 169;\n var G = fillPercent * 200 + (1 - fillPercent) * 215;\n var B = fillPercent * 2 + (1 - fillPercent) * 11;\n }\n\n return \"rgb(\" + Math.round(R) + \",\" + Math.round(G) + \",\" + Math.round(B) + \")\"\n }", "newColors(){\n for (let i = 0; i < this.colorCount; i++) {\n this.addColorToObject()\n }\n this.updateGradientString()\n }", "function rangeColors(rangeNumber) {\n var colorArr = [];\n var red = new Color(232, 9, 26),\n white = new Color(255, 255, 255),\n green = new Color(6, 170, 60),\n start = green,\n end = red;\n // if (rangeNumber > 50) {\n // start = white,\n // end = red;\n // rangeNumber = rangeNumber % 51;\n // }\n var startColors = start.getColors(),\n endColors = end.getColors();\n for (var i = 0; i <= rangeNumber; i++) {\n var r = Interpolate(startColors.r, endColors.r, rangeNumber, i);\n var g = Interpolate(startColors.g, endColors.g, rangeNumber, i);\n var b = Interpolate(startColors.b, endColors.b, rangeNumber, i);\n var color = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n colorArr.push(color);\n }\n\n function Interpolate(start, end, steps, count) {\n var s = start,\n e = end,\n final = s + (((e - s) / steps) * count);\n return Math.floor(final);\n }\n\n function Color(_r, _g, _b) {\n var r, g, b;\n var setColors = function(_r, _g, _b) {\n r = _r;\n g = _g;\n b = _b;\n };\n setColors(_r, _g, _b);\n this.getColors = function() {\n var colors = {\n r: r,\n g: g,\n b: b\n };\n return colors;\n };\n }\n return colorArr;\n}", "_prepareColorShades(min, max) {\n let step = (max - min) / 5;\n this._shades = [];\n for (let i = 0; i < 5; i++) {\n this._shades.push(max - i * step);\n }\n }", "function generateColor(red, green, blue)\n{\n paintColor[0] = red;\n paintColor[1] = green;\n paintColor[2] = blue;\n}", "function generateClasses({ colors = {}, properties = {}, states = [] }) {\n const chromaColors = parse(colors);\n\n return Object.keys(colors).reduce((output, colorKey) => {\n const colorName = kebabCase(colorKey);\n const colorValue = chromaColors[colorKey];\n\n return [\n ...output,\n ...Object.keys(properties).map(property => {\n const className = properties[property].replace('${name}', colorName);\n\n const styles = `${property}: ${colorValue.css('hsl').replace(/,/g, ', ')}`;\n\n return [\n `.${className} { ${styles} }`,\n ...states.map(pseudoClassName => `.${className}:${pseudoClassName} { ${styles} }`),\n ].join('\\n');\n }),\n ];\n }, []).join('\\n');\n}", "set_colors()\r\n {\r\n /* colors */\r\n let colors = [\r\n Color.of( 0.9,0.9,0.9,1 ), /*white*/\r\n Color.of( 1,0,0,1 ), /*red*/\r\n Color.of( 1,0.647,0,1 ), /*orange*/\r\n Color.of( 1,1,0,1 ), /*yellow*/\r\n Color.of( 0,1,0,1 ), /*green*/\r\n Color.of( 0,0,1,1 ), /*blue*/\r\n Color.of( 1,0,1,1 ), /*purple*/\r\n Color.of( 0.588,0.294,0,1 ) /*brown*/\r\n ]\r\n\r\n this.boxColors = Array();\r\n for (let i = 0; i < 8; i++ ) {\r\n let randomIndex = Math.floor(Math.random() * colors.length);\r\n this.boxColors.push(colors[randomIndex]);\r\n colors[randomIndex] = colors[colors.length-1];\r\n colors.pop();\r\n }\r\n\r\n }", "initPaints(){\n switch ( this.data.resource ) {\n case 'health':\n this.empty = color( 0, colorMax, colorMax * 0.75 );\n this.filled = color( 0, colorMax, colorMax * 0.5 );\n break;\n case 'mana':\n this.empty = color( 200, colorMax, colorMax * 0.75 );\n this.filled = color( 200, colorMax, colorMax * 0.5 );\n break;\n case 'stamina':\n this.empty = color( 150, colorMax, colorMax * 0.75 );\n this.filled = color( 150, colorMax, colorMax * 0.5 );\n break;\n case 'experience':\n this.empty = color( 50, colorMax, colorMax * 0.75 );\n this.filled = color( 50, colorMax, colorMax * 0.5 );\n break;\n case 'composure':\n this.empty = color( 270, colorMax, colorMax * 0.75 );\n this.filled = color( 270, colorMax, colorMax * 0.5 );\n break;\n case 'rage':\n this.empty = color( 30, colorMax, colorMax * 0.75 );\n this.filled = color( 30, colorMax, colorMax * 0.5 );\n break;\n }\n }", "function colorfn(a) {\n return intervalChoice(a, [\n function() { return c0; },\n x0,\n lerpColorFactory(c0, c1),\n x1,\n lerpColorFactory(c1, c2),\n x2,\n lerpColorFactory(c2, c3),\n x3,\n lerpColorFactory(c3, c4),\n x4,\n function() { return c4; }\n ]);\n}", "function createConstructors(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader) {\n\n console.log(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader);\n\n colorScheme[index] = new backgroundColorScheme(newName, sliderRedBody, sliderGreenBody, sliderBlueBody, sliderRedHeader, sliderGreenHeader, sliderBlueHeader);\n\n index += 1;\n}", "function fillColorArray() {\n return randomColor({\n count: 100\n });\n }", "function handleFill(event) {\n var target = cross_target(event);\n var new_class = target.className;\n getById('fill_sample').className = new_class;\n // Extract the color from the class name, that is like:\n // \"class_sample class_000000\"\n var new_color = '#' + new_class.split(' ')[1].split('_')[1];\n g['shape'].fill = new_color;\n g['shape_generator'].default_values.fill = new_color;\n}", "function overwriteColour(){\n\n var i = 0;\n var k = 0;\n var p = 0;\n\n // Check every superpixel to see if it has been assigned a colour\n for (p = 0; p < 1000; p ++){\n\n // This has been classified already! Recolour it\n if ($scope.isPainted[p] == 1){\n\n // Select the colour (classification) it was previously assigned\n // Key '1'\n if ($scope.newValue[p] == 1) {\n // Colour 'orange'\n $scope.colour_f = $scope.color1RGBA;\n }\n // Key '2'\n else if ($scope.newValue[p] == 2) {\n // Colour 'Green'\n $scope.colour_f = $scope.color2RGBA;\n\n }\n // Key '3'\n else if ($scope.newValue[p] == 3) {\n // Colour 'Pink'\n //$scope.colour_f = \"rgba(128, 128, 255, 0.4)\";\n $scope.colour_f = $scope.color3RGBA;\n }\n // Key '4'\n else if ($scope.newValue[p] == 4) {\n // Colour 'Yellow'\n $scope.colour_f = $scope.color4RGBA;\n }\n // Key '5'\n else if ($scope.newValue[p] == 5) {\n // Colour 'Blue'\n $scope.colour_f = $scope.color5RGBA;\n }\n // Key '6'\n else if ($scope.newValue[p] == 6) {\n // Colour 'Grey'\n $scope.colour_f = $scope.color6RGBA;\n }\n // Key '7'\n else if ($scope.newValue[p] == 7) {\n // Colour 'Grey'\n $scope.colour_f = $scope.color7RGBA;\n }\n // Key '8'\n else if ($scope.newValue[p] == 8) {\n // Colour 'Grey'\n $scope.colour_f = $scope.color8RGBA;\n }\n // Key '9'\n else if ($scope.newValue[p] == 9) {\n // Colour 'Grey'\n $scope.colour_f = $scope.color9RGBA;\n }\n // Key '10'\n else if ($scope.newValue[p] == 10) {\n // Colour 'Grey'\n $scope.colour_f = $scope.color10RGBA;\n }\n\n // Very similar to the standard colouring function\n var mask_value = p;\n $scope.length_2 = $scope.mask_data.length;\n $scope.length_1 = $scope.mask_data[0].length;\n\n // Iterate through every pixel and colour it in\n for (i = 0; i < $scope.length_2; i ++){\n $scope.iter2 = i;\n\n for (k = 0; k < $scope.length_1; k++){\n $scope.iter1 = k;\n\n // Colour in the single pixel the appropiate colour\n if (mask_value == $scope.mask_data[$scope.iter2][$scope.iter1]){\n $scope.mask_copy[$scope.iter2][$scope.iter1] = $scope.newValue[p];\n contextTop.fillStyle = $scope.colour_f;\n contextTop.fillRect( $scope.scaleImgX*$scope.iter1, $scope.scaleImgY*$scope.iter2, 1, 1 );\n }\n // Do nothing\n else {\n }\n }\n }\n }\n }\n }", "makeGradient() {\n let low = 0;\n let high = (255*255*255);\n let step = Math.floor(high/(this.props.data.length));\n let colors = [];\n \n // Create gradients\n for (var key in this.props.data) {\n low += step;\n colors.push(\n ('#' + low.toString(16))\n );\n }\n\n // Shuffle and return\n return colors.sort(\n (a, b) => {\n return (Math.random()-Math.random());\n });\n }", "function randomColor(){\r\n r = Math.floor(Math.random() * (230));\r\n g = Math.floor(Math.random() * (230));\r\n b = Math.floor(Math.random() * (230));\r\n jQuery(\".cls-2,.cls-4\").css('fill','rgb('+r+','+g+','+b+')');\r\n\r\n}", "function thisColor(i) { \n colors = ['#001f3f', '#0074D9', '#B10DC9', '#AAAAAA', '#39CCCC', '#FFDC00', '#FF851B', \n '#01FF70', '#F012BE', '#7FDBFF', '#3D9970', '#85144b', '#2ECC40', '##FF4136', '#F012BE', \n \"#3366cc\", \"#dc3912\", \"#ff9900\"];\n\n cc = d3.scaleLinear()\n .domain([-2, 17])\n .range([1, 0]);\n\n return d3.interpolateSpectral(cc(i));\n}", "function updateColorTheme(start) {\n // Define an array so we can save colors and access later. Doing this before the draw function helps random colors stay consistent\n colorTheme = []\n\n // 1st set\n // Assign random color for colorFrom\n let r = Math.floor(Math.random() * 256)\n let g = Math.floor(Math.random() * 256)\n let b = Math.floor(Math.random() * 256)\n\n // Assign random color for colorTo\n let r2 = Math.floor(Math.random() * 256)\n let g2 = Math.floor(Math.random() * 256)\n let b2 = Math.floor(Math.random() * 256)\n\n colorFrom = color(r, g, b, alpha)\n colorTo = color(r2, g2, b2)\n\n // 2nd set\n r = Math.floor(Math.random() * 256)\n g = Math.floor(Math.random() * 256)\n b = Math.floor(Math.random() * 256)\n\n // Assign random color for colorTo\n r2 = Math.floor(Math.random() * 256)\n g2 = Math.floor(Math.random() * 256)\n b2 = Math.floor(Math.random() * 256)\n\n colorFrom2 = color(r, g, b, alpha)\n colorTo2 = color(r2, g2, b2)\n\n for (let i = 0; i < numCircles; i++) {\n // Create lerp color interpolation. More visible when one color is used.\n let lerpAmt = map(i * numCircles * 10, -width / 2, width / 2, 0, 1)\n // Alternate colors between first set and second set based on whether we are on odd or even index\n let lerpedCol =\n i % 2 === 0\n ? lerpColor(colorFrom, colorTo, lerpAmt)\n : lerpColor(colorFrom2, colorTo2, lerpAmt)\n\n // Save lerp colors so we can use later. Since we have 12 circles, 12 lerpedColors will be saved\n colorTheme.push(lerpedCol)\n }\n}", "function randomStyle() {\n let randGaps = (numGaps) => {\n let gaps = [];\n for (let i = 0; i < numGaps; i ++) {\n gaps.push(rand(0, 360));\n }\n return gaps;\n };\n\n return {\n color: [rand(0, 360), 100, rand(20, 30)],\n innerRing: randGaps(Math.floor(rand(4, 8))),\n outerRing: randGaps(Math.floor(rand(8, 16))),\n };\n}", "function colorgenerator() {\n let colours = [],\n i;\n for (i = 0; i < 372; i++){\n colours[i] = 'hsl(' + i + ', 100%, 50%)';\n if (i > 359) {\n colours[i] = 'hsl(0, 100%, 100%)';\n }\n }\n colours = colours.toString();\n //console.log(colours);\n root.style.setProperty(\"--colours\", colours);\n}", "function _createColorVariations() {\n var colors = { waveColor: [], progressColor: [] };\n for (var c in colors) {\n var tmp = WP.UTILS.hex2rgb(this._params[c]);\n colors[c].push(tmp);\n tmp = WP.UTILS.rgb2hsv(tmp);\n colors[c].push(WP.UTILS.hsv2rgb({ h: tmp.h, s: tmp.s, v: tmp.v*1.4 }));\n }\n colors.dc = {\n r: (colors.waveColor[0].r - colors.progressColor[0].r),\n g: (colors.waveColor[0].g - colors.progressColor[0].g),\n b: (colors.waveColor[0].b - colors.progressColor[0].b)\n };\n return colors;\n }", "function setColors() {\n var len = points.length / 3;\n for (var i = 0; i < len; i++) {\n colors.push(1.0);\n colors.push(0.0);\n colors.push(0.0);\n colors.push(1.0);\n }\n}", "constructor(coloring = []){\n this._coloring = coloring;\n }", "function clrs(i, j) {\n clr_list = [\n [0, 0, 0],\n [255, 255, 255],\n [204, 82, 82],\n [204, 163, 82],\n [163, 204, 82],\n [82, 204, 82],\n [82, 204, 163],\n [82, 163, 204],\n [82, 82, 204],\n [163, 82, 204],\n [204, 82, 163],\n [204, 82, 82]\n ];\n var tmp = clr_list[i];\n var foo = d3.rgb(tmp[0], tmp[1], tmp[2])\n return d3.rgb(tmp[0], tmp[1], tmp[2]).darker(2.5).brighter(j * 5);\n}", "function dynamicColors () {\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 clr = {};\n clr.bgcolor = \"rgb(\" + r + \",\" + g + \",\" + b + \",0.2)\";\n clr.bordercolor = \"rgb(\" + r + \",\" + g + \",\" + b + \",1)\";\n return clr;\n }", "randomizeColors(){\n for (const [key, color] of Object.entries(this.colors)) {\n color.newColor()\n }\n this.updateGradientString()\n }", "setColor(sector, colors){\n const group = this.groupsArray[sector];\n let amnt = 0;\n [\"red\", \"green\", \"blue\"].forEach(c=>{\n if (colors[c]){\n amnt++;\n }\n })\n\n if (amnt == 3){\n group.forEach(i=>{\n this.FadeTo(i, this.colEnum.white).then(() => {})\n })\n } else if (amnt == 2){\n if (colors.red && colors.green){\n this.setGradient(group, this.colEnum.rg1, this.colEnum.rg2)\n } else if (colors.red && colors.blue){\n this.setGradient(group, this.colEnum.rb1, this.colEnum.rb2)\n } else if (colors.green && colors.blue){\n this.setGradient(group, this.colEnum.gb1, this.colEnum.gb2)\n } \n } else if (amnt == 1){\n if (colors.red){\n this.setGradient(group, this.colEnum.white, this.colEnum.red);\n } else if (colors.green){\n this.setGradient(group, this.colEnum.white, this.colEnum.green);\n } else {\n this.setGradient(group, this.colEnum.white, this.colEnum.blue);\n }\n } else {\n group.forEach(i=>{\n this.FadeTo(i, this.colEnum.off).then(() => {})\n })\n }\n }", "function generateNewColour() {\n var finished = true;\n for (var key in Colour) {\n if(delta[key] != 0) {\n finished = false;\n }\n }\n\n if (finished) {\n colour = nextColour;\n nextColour = randomColour();\n delta = deltaRgb();\n }\n }", "setColors() {\n var squares = document.querySelectorAll('.square');\n\n for (var square of squares) {\n square.style.backgroundColor = 'hsl(' + this.fg + ',50%,50%)';\n }\n\n var hands = document.querySelectorAll('.hand');\n\n for (var hand of hands) {\n hand.style.backgroundColor = 'hsl(' + this.fg + ',20%,50%)';\n }\n\n var backColorFlr = Math.floor(this.bg);\n document.body.style.backgroundImage = 'linear-gradient(to bottom right, hsl(' + backColorFlr + ',50%,80%), hsl(' + backColorFlr + ',50%,50%))';\n }", "function fillSquares(level) {\n\tfor(var i = 0; i < squares.length; i++) {\n\t\tvar rotationDegree = randomArr[i] * level;\n\t\tsquares[i].setAttribute(\"style\",\"background-color:\" + color + \"; filter: hue-rotate(\" + rotationDegree + \"deg);\");\n\t}\n}", "calculateColors() {\n // find node with the maximum stress\n let max_stress = 0;\n for (let i = 0; i < this.n * this.m; ++i) {\n if (this.stress[i] > max_stress) max_stress = this.stress[i];\n }\n\n // normilize coefficient\n let coeff = 1 / max_stress;\n\n let color_row_delta = 3 * this.m;\n let color_column_delta = 3;\n\n // iterate over colours array and set colour between blue and red based on stress value\n for (let i = 0; i < this.n; ++i) {\n for (let j = 0; j < this.m; ++j) {\n this.color[i * color_row_delta + j * color_column_delta] = this.stress[i * this.m + j] * coeff;\n this.color[i * color_row_delta + j * color_column_delta + 1] = 0;\n this.color[i * color_row_delta + j * color_column_delta + 2] = 1 - this.stress[i * this.m + j] * coeff;\n }\n }\n }", "static LerpColor(a, b, t) {\n return new b2.Color(Fracker.Lerp(a.r, b.r, t), Fracker.Lerp(a.g, b.g, t), Fracker.Lerp(a.b, b.b, t));\n }", "function generateRandomColors() {\r\n color1.value = getRandom();\r\n color2.value = getRandom();\r\n setGradient();\r\n}", "function expandClasses({ classes = {}, colors = {} }) {\n const chromaColors = parse(colors);\n\n return Object.keys(classes).reduce((output, className) => {\n const property = getProperty({ className });\n\n const value = classes[className];\n const adjusterFn = /[a-z]*\\(.*\\)/.exec(value);\n\n const props = adjusterFn\n ? value.replace(adjusterFn[0], '').split(/\\s/)\n : value.split(/\\s/);\n\n const states = props\n .filter(name => name.includes(':'))\n .map(state => {\n if (state[0] === '&') return state.substr(1); // nest-style\n if (state[0] === ':') return state; // shorthand\n return ' ' + state; // descendent\n });\n\n const colorKey = props[0];\n const chromaColor = chromaColors[colorKey];\n const adjustedColor = adjusterFn && adjustColor(chromaColor, adjusterFn[0]);\n\n const colorValue = chromaColor\n ? (adjustedColor || chromaColor).css('hsl')\n : colorKey; // assume any values missing in parsed colors are keywords or other values that should be used as-is\n\n if (!colorValue) return output;\n\n const styles = `${property}: ${colorValue.replace(/,/g, ', ')}`;\n const hasInteractState = value.includes('focus') || value.includes('hover');\n\n return [\n ...output,\n !hasInteractState && `.${className} { ${styles} }`,\n ...states.map(pseudoClassName => `.${className}${pseudoClassName} { ${styles} }`),\n ].filter(Boolean);\n }, []).join('\\n');\n}", "function colorTiles(index) {\n switch(true) {\n case (index < 10):\n return 'linear-gradient(to right,#e6007e 0,#a81815 100%)'\n break;\n case (index>=10 && index<20):\n return 'linear-gradient(to right,#009fe3 0,#522583 100%)'\n break;\n case (index>=20 && index<30):\n return 'linear-gradient(to right,#f2e500 0,#007f2d 100%)'\n break;\n case (index>=30 && index<40):\n return 'linear-gradient(to right,#ffed00 0,#e74011 100%)'\n break;\n case (index>=40 && index<50):\n return 'linear-gradient(to right, rgba(169,49,149,1) 0%, rgba(121,8,103,1) 100%)'\n break;\n case (index>=50 && index<60):\n return 'linear-gradient(to right, rgba(240,79,33,1) 0%, rgba(155,35,0,1) 100%)'\n break;\n case (index>=60 && index<70):\n return 'linear-gradient(to right, rgba(144,172,189,1) 0%, rgba(59,102,127,1) 100%)'\n break;\n case (index>=70 && index<numberOfTiles):\n return 'linear-gradient(to right, rgba(81,51,151,1) 0%, rgba(40,14,102,1) 100%)'\n break;\n }\n}", "interpolateColors(color1, color2, mix) {\n const c1 = parseInt('0x' + color1.color.substr(1));\n const c1r = c1 >> 16;\n const c1g = c1 >> 8 & 0xff;\n const c1b = c1 & 0xff;\n const c2 = parseInt('0x' + color2.color.substr(1));\n const c2r = c2 >> 16;\n const c2g = c2 >> 8 & 0xff;\n const c2b = c2 & 0xff;\n\n const clampedMix = Math.min(1, Math.max(0, mix));\n const cr = c1r + clampedMix * (c2r - c1r);\n const cg = c1g + clampedMix * (c2g - c1g);\n const cb = c1b + clampedMix * (c2b - c1b);\n\n const colorInt = (cr << 16) + (cg << 8) + (cb | 0);\n let colorHex = '#';\n if (colorInt <= 0xff) {\n colorHex += '0000';\n } else if (colorInt <= 0xffff) {\n colorHex += '00';\n }\n\n return {\n color: `${colorHex}${colorInt.toString(16)}`,\n index: -1\n }\n }", "function getColorGenerator() {\n var hsv = [90, 90, 90];\n var seed = 0;\n return function () {\n hsv[0] = (hsv[0]+60) % 360;\n\n seed++;\n\n if (seed % 6 === 0) {\n hsv[0] = (hsv[0]+30) % 360;\n hsv[1] = (hsv[1]+30) % 100;\n hsv[2] = (hsv[2]+20) % 100;\n }\n\n if (hsv[1] < 45) hsv[1] = 45;\n if (hsv[2] < 50) hsv[2] = 50;\n\n var rgb = colorconverter.hsv(hsv[0], hsv[1], hsv[2]).rgb();\n return 'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+')';\n };\n}", "constructor(...args) {\n this.r = 0;\n this.g = 0;\n this.b = 0;\n this.a = 255;\n /* Handle Color([...]) -> Color(...) */\n if (args.length == 1 && args[0] instanceof Array) {\n args = args[0];\n }\n if (args.length == 1) {\n /* Handle Color(Color) and Color(\"string\") */\n let arg = args[0];\n if (arg instanceof Color) {\n [this.r, this.g, this.b, this.a] = [arg.r, arg.g, arg.b, arg.a];\n this.scale = arg.scale;\n } else if (typeof(arg) == \"string\" || arg instanceof String) {\n let [r, g, b, a] = ColorParser.parse(arg);\n [this.r, this.g, this.b, this.a] = [r, g, b, a];\n } else {\n throw new TypeError(`Invalid argument \"${arg}\" to Color()`);\n }\n } else if (args.length >= 3 && args.length <= 4) {\n /* Handle Color(r, g, b) and Color(r, g, b, a) */\n [this.r, this.g, this.b] = args;\n if (args.length == 4) this.a = args[3];\n } else if (args.length > 0) {\n throw new TypeError(`Invalid arguments \"${args}\" to Color()`);\n }\n }", "function InstaPalette()\n{\n var hue = Math.random() * (Math.PI * 2.0);\n var saturation = Math.random() * 0.75 + 0.25;\n var value = Math.random() * 0.75 + 0.25;\n var hueDelta = Math.random() * (Math.PI/4) + (Math.PI/4);\n var satDelta = Math.random() * 0.5 + 0.5;\n var valDelta = Math.random() * 0.5 + 0.5;\n \n this.leadCol = new Col();\n this.leadCol.SetHSVA(hue, saturation, value, 1);\n \n this.leadColDelta = function(h, s, l)\n {\n var result = new Col();\n \n result.SetHSVA(hue + h, saturation * s, value * l, 1);\n \n return result;\n }; \n \n this.leftCol = new Col();\n this.leftCol.SetHSVA(hue + hueDelta, saturation * satDelta, value * valDelta, 1);\n \n this.leftColDelta = function(h, s, l)\n {\n var result = new Col();\n \n result.SetHSVA(hue + hueDelta + h, saturation * s, value * l, 1);\n \n return result;\n };\n \n this.rightCol = new Col();\n this.rightCol.SetHSVA(hue - hueDelta, saturation * satDelta, value * valDelta, 1); \n \n this.rightColDelta = function(h, s, l)\n {\n var result = new Col();\n \n result.SetHSVA(hue - hueDelta + h, saturation * s, value * l, 1);\n \n return result;\n }; \n}", "function fillNET(color){\n // console.log($('._NET_').length);\n $('._NET_').css('fill',color);\n}", "constructor(x,y,w,h,fillColour){\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.fillColour = fillColour;\n\n }", "function attrFill(a) {\n switch (a) {\n case \"A\": return \"#00af54\"; // green\n case \"B\": return \"#f27935\"; // orange\n case \"C\": return \"#d4071c\"; // red\n case \"D\": return \"#70bdc2\"; // cyan\n case \"E\": return \"#fcf384\"; // gold\n case \"F\": return \"#e69aaf\"; // pink\n case \"G\": return \"#08488f\"; // blue\n case \"H\": return \"#866310\"; // brown\n case \"I\": return \"#9270c2\"; // purple\n case \"J\": return \"#a3cf62\"; // chartreuse\n case \"K\": return \"#91a4c2\"; // lightgray bluish\n case \"L\": return \"#af70c2\"; // magenta\n case \"S\": return \"#d4071c\"; // red\n default: return \"transparent\";\n }\n }", "function buildPalette() {\n let r = 255,\n g = 0,\n b = 0;\n\n for (g = 0; g <= 255; g++) {\n addToPalette(r, g, b, );\n }\n g--;\n\n for (r = 254; r >= 0; r--) {\n addToPalette(r, g, b, );\n }\n r++;\n\n for (b = 1; b <= 255; b++) {\n addToPalette(r, g, b, );\n }\n b--;\n\n for (g = 254; g >= 0; g--) {\n addToPalette(r, g, b, );\n }\n g++;\n\n for (r = 1; r <= 255; r++) {\n addToPalette(r, g, b, );\n }\n r--;\n\n for (b = 254; b > 0; b--) {\n addToPalette(r, g, b, );\n }\n b++;\n\n function addToPalette(r, g, b) {\n\n var color = new BABYLON.Color4(r / 255, g / 255, b / 255, 1);\n\n let mat = new BABYLON.StandardMaterial(\"mat\", scene);\n mat.diffuseColor = color;\n mat.specularColor = new BABYLON.Color3(0, 0, 0);\n mat.ambientColor = new BABYLON.Color3(r / 255 * .4, g / 255 * .4, b / 255 * .4);\n\n\n palette.push({\n r,\n g,\n b,\n color,\n mat\n });\n }\n\n // console.log(palette);\n }", "function setRandoColors(){\n\tc1 = makeHex(); // execute function twice for right and left gradients\n\tc2 = makeHex();\n\tconsole.log(c1, c2)\n\tcolor1.value = c1; // set values for backgrounds\n\tcolor2.value = c2;\n\tsetGradient() // call function to set background color\n}", "function generateBackground() {\n var hexValues = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'a', 'b', 'c', 'd', 'e']\n function populate (a) {\n for (var i = 0; i < 6; i++) {\n var x = Math.round(Math.random() * 14)\n var y = hexValues[x]\n a += y\n }\n return a\n }\n var newColor1 = populate('#')\n var newColor2 = populate('#')\n var angle = Math.round(Math.random() * 360)\n var gradient = `linear-gradient(${angle}deg, ${newColor1}e0, ${newColor2}e0)`\n document.getElementById('results').style.background = gradient\n // document.getElementById(\"output\").innerHTML = gradient;\n}", "function colorCoding() {\n for (var i = 8; i < 18; i++){\n if (hour < i){\n $(\".\" + i).attr(\"style\", \"background-color: skyblue;\")\n }\n if (hour === i){\n $(\".\" + i).attr(\"style\", \"background-color: white;\")\n }\n if (hour > i){\n $(\".\" + i).attr(\"style\", \"background-color: pink;\")\n }\n\n }\n }", "function setFillStyleGF(){\n\t\n\tfor (var i=0; i<groundFloor.length; i++){\n\t\tif (moteDoneFillGF.indexOf(groundFloor[i]) == -1){\n\t\t\tmoteDoneFillGF.push(groundFloor[i]);\n\t\t\tif (checkIdGF.indexOf(groundFloor[i]) !== -1){\n\t\t\t\tfor(var j=0;j<checkTimeGF.length; j++){\n\t\t\t\t\tif (timeGF.indexOf(checkTimeGF[j])==-1){\n\t\t\t\t\t\t\ttimeGF.push(checkTimeGF[j]);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tif (lastDay.getTime() - new Date(checkTimeGF[j]).getTime() > timeTwo){\n\t\t\t\t\t\t\tfillStyle = 'red';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (lastDay.getTime() - new Date(checkTimeGF[j]).getTime() > timeOne && lastDay.getTime() - new Date(checkTimeGF[j]).getTime() < timeTwo) {\n\t\t\t\t\t\t\tfillStyle = 'yellow';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tfillStyle = 'green';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn fillStyle;\t//Give color to the motes location\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Give the colour for the button if the mote does not have any data\n\t\t\telse{\n\t\t\t\tfillStyle = 'red';\n\t\t\t\treturn fillStyle; \n\t\t\t}\n\t\t}\n\t}\n}", "constructor(colors) {\n this.colors = colors;\n this.divider = \"-------------------------------------------------------------------------------------------------------------------------\";\n }", "function getColorClass(amount){\n\tvar color;\n\n\tif(amount >= 24)\n\t\tcolor = 'dark-red'; //'#900000'; //red\n\telse if(amount >= 18)\n\t\tcolor = 'red'; //'#FF0000'; //red\n\telse if(amount >= 12)\n\t\tcolor = 'orange'; //'#ff9900'; //orange\n\telse if(amount >= 6)\n\t\tcolor = 'yellow'; //'#FFFF00'; //yellow\n\telse if(amount >= 2)\n\t\tcolor = 'green'; //'#66ff00'; //green\n\telse if (amount >= .5)\n\t\tcolor = 'grey'; //'#888888'; //grey \n\telse if (amount > 0)\n\t\tcolor = 'light-grey'; //'#888888'; //grey\n\telse\n\t\tcolor = 'transparent';\n\t\t//'#cccccc'; //grey \n\n\treturn color;\n}", "function colorCircles(id, color1, color2){\n var grad = svg.append(\"defs\")\n .append(\"linearGradient\").attr(\"id\", \"grad\" + id)\n .attr(\"x1\", \"100%\").attr(\"x2\", \"0%\").attr(\"y1\", \"0%\").attr(\"y2\", \"0%\");\n grad.append(\"stop\").attr(\"offset\", \"50%\").style(\"stop-color\", color1);\n grad.append(\"stop\").attr(\"offset\", \"50%\").style(\"stop-color\", color2);\n}", "function lerpColorFactory(cmin, cmax) {\n return function(a, amin, amax) {\n return lerpColor(color(cmin), color(cmax), norm(a, amin, amax));\n };\n}", "function createGridColor(size){\n gridSquare.style.gridTemplateColumns = `repeat(${size}, 1fr)`;\n gridSquare.style.gridTemplateRows = `repeat(${size}, 1fr)`;\n for(i=0; i<size*size; i++){\n const div = document.createElement('div');\n div.addEventListener('mouseover', fillColor);\n div.classList.add('square');\n gridSquare.appendChild(div);\n colorCnt = 0;\n }\n}", "populateGridColorArrays() {\n //for every column..\n for (let i = 0; i < this.colNum; i++) {\n\n // //Generate colors based on a split complementry palette\n // if (i % 2 == 0) {\n // this.hVal = 19;\n // this.sVal = 91;\n // this.bVal = 95;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // } else if (i % 3 == 0) {\n // this.hVal = 59;\n // this.sVal = 96;\n // this.bVal = 87;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // }else{\n // this.hVal = 240;\n // this.sVal = 57;\n // this.bVal = 89;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // }\n\n // //Generate colors based on a triad palette\n // if (i % 2 == 0) {\n // this.hVal = 19;\n // this.sVal = 91;\n // this.bVal = 100;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // } else if (i % 3 == 0) {\n // this.hVal = 173;\n // this.sVal = 96;\n // this.bVal = 40;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // }else{\n // this.hVal = 259;\n // this.sVal = 82;\n // this.bVal = 90;\n // this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n // }\n\n //Generate colors based on a analogus palette\n\n //based on the row number push one of three possible colors into the right hand side color array\n if (i % 3 === 0) {\n this.hVal = 261;\n this.sVal = 75;\n this.bVal = 91;\n this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n } else if (i % 2 === 0) {\n this.hVal = 231;\n this.sVal = 90;\n this.bVal = 89;\n this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n } else {\n this.hVal = 202;\n this.sVal = 90;\n this.bVal = 89;\n this.colorsRight[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n }\n\n //based on the row number push one of two possible colors (white or black) into the left hand side color array\n //two possible colors linearly interpolate to three possible colors creating and asnyschronus relation between the left and right hand sides\n if (i % 2 == 0) {\n this.hVal = 0;\n this.sVal = 0;\n this.bVal = 20;\n this.colorsLeft[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n } else {\n this.hVal = 0;\n this.sVal = 0;\n this.bVal = 85;\n this.colorsLeft[i] = color(this.hVal, this.sVal, this.bVal, this.mouduleAlpha);\n }\n }\n\n }", "setColorsRand() {\n this.fg = 0;\n this.bg = 0;\n\n while (Math.abs(this.fg - this.bg) < 10) {\n this.fg = Math.floor(Math.random() * 255);\n this.bg = Math.floor(Math.random() * 255);\n }\n\n this.setColors();\n }", "function getNewColors() {\n circleBodyColor = getRandomColor();\n circleLineColor = getRandomColor();\n canvas.style.backgroundColor = getRandomColor();\n}", "function parse_fills(t, opts) {\n styles.Fills = [];\n var fill = {};\n t[0].match(tagregex).forEach(function (x) {\n var y = parsexmltag(x);\n switch (y[0]) {\n case '<fills':\n case '<fills>':\n case '</fills>':\n break;\n\n /* 18.8.20 fill CT_Fill */\n case '<fill>':\n break;\n case '</fill>':\n styles.Fills.push(fill);\n fill = {};\n break;\n\n /* 18.8.32 patternFill CT_PatternFill */\n case '<patternFill':\n if (y.patternType) fill.patternType = y.patternType;\n break;\n case '<patternFill/>':\n case '</patternFill>':\n break;\n\n /* 18.8.3 bgColor CT_Color */\n case '<bgColor':\n if (!fill.bgColor) fill.bgColor = {};\n if (y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);\n if (y.theme) fill.bgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.bgColor.tint = parseFloat(y.tint);\n\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb, fill.bgColor.tint || 0);\n if (opts.WTF) fill.bgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb,0);\n }\n /* Excel uses ARGB strings */\n if (y.rgb) fill.bgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<bgColor/>':\n case '</bgColor>':\n break;\n\n /* 18.8.19 fgColor CT_Color */\n case '<fgColor':\n if (!fill.fgColor) fill.fgColor = {};\n if (y.theme) fill.fgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.fgColor.tint = parseFloat(y.tint);\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb, fill.fgColor.tint || 0);\n if (opts.WTF) fill.fgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb,0);\n }\n\n /* Excel uses ARGB strings */\n if (y.rgb) fill.fgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<fgColor/>':\n case '</fgColor>':\n break;\n\n default:\n if (opts.WTF) throw 'unrecognized ' + y[0] + ' in fills';\n }\n });\n}", "function parse_fills(t, opts) {\n styles.Fills = [];\n var fill = {};\n t[0].match(tagregex).forEach(function (x) {\n var y = parsexmltag(x);\n switch (y[0]) {\n case '<fills':\n case '<fills>':\n case '</fills>':\n break;\n\n /* 18.8.20 fill CT_Fill */\n case '<fill>':\n break;\n case '</fill>':\n styles.Fills.push(fill);\n fill = {};\n break;\n\n /* 18.8.32 patternFill CT_PatternFill */\n case '<patternFill':\n if (y.patternType) fill.patternType = y.patternType;\n break;\n case '<patternFill/>':\n case '</patternFill>':\n break;\n\n /* 18.8.3 bgColor CT_Color */\n case '<bgColor':\n if (!fill.bgColor) fill.bgColor = {};\n if (y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);\n if (y.theme) fill.bgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.bgColor.tint = parseFloat(y.tint);\n\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb, fill.bgColor.tint || 0);\n if (opts.WTF) fill.bgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb,0);\n }\n /* Excel uses ARGB strings */\n if (y.rgb) fill.bgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<bgColor/>':\n case '</bgColor>':\n break;\n\n /* 18.8.19 fgColor CT_Color */\n case '<fgColor':\n if (!fill.fgColor) fill.fgColor = {};\n if (y.theme) fill.fgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.fgColor.tint = parseFloat(y.tint);\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb, fill.fgColor.tint || 0);\n if (opts.WTF) fill.fgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb,0);\n }\n\n /* Excel uses ARGB strings */\n if (y.rgb) fill.fgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<fgColor/>':\n case '</fgColor>':\n break;\n\n default:\n if (opts.WTF) throw 'unrecognized ' + y[0] + ' in fills';\n }\n });\n}", "function parse_fills(t, opts) {\n styles.Fills = [];\n var fill = {};\n t[0].match(tagregex).forEach(function (x) {\n var y = parsexmltag(x);\n switch (y[0]) {\n case '<fills':\n case '<fills>':\n case '</fills>':\n break;\n\n /* 18.8.20 fill CT_Fill */\n case '<fill>':\n break;\n case '</fill>':\n styles.Fills.push(fill);\n fill = {};\n break;\n\n /* 18.8.32 patternFill CT_PatternFill */\n case '<patternFill':\n if (y.patternType) fill.patternType = y.patternType;\n break;\n case '<patternFill/>':\n case '</patternFill>':\n break;\n\n /* 18.8.3 bgColor CT_Color */\n case '<bgColor':\n if (!fill.bgColor) fill.bgColor = {};\n if (y.indexed) fill.bgColor.indexed = parseInt(y.indexed, 10);\n if (y.theme) fill.bgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.bgColor.tint = parseFloat(y.tint);\n\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb, fill.bgColor.tint || 0);\n if (opts.WTF) fill.bgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.bgColor.theme].rgb,0);\n }\n /* Excel uses ARGB strings */\n if (y.rgb) fill.bgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<bgColor/>':\n case '</bgColor>':\n break;\n\n /* 18.8.19 fgColor CT_Color */\n case '<fgColor':\n if (!fill.fgColor) fill.fgColor = {};\n if (y.theme) fill.fgColor.theme = parseInt(y.theme, 10);\n if (y.tint) fill.fgColor.tint = parseFloat(y.tint);\n\n if (y.theme && themes.themeElements && themes.themeElements.clrScheme) {\n fill.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb, fill.fgColor.tint || 0);\n if (opts.WTF) fill.fgColor.raw_rgb = rgb_tint(themes.themeElements.clrScheme[fill.fgColor.theme].rgb,0);\n }\n\n /* Excel uses ARGB strings */\n if (y.rgb) fill.fgColor.rgb = y.rgb;//.substring(y.rgb.length - 6);\n break;\n case '<fgColor/>':\n case '</fgColor>':\n break;\n\n default:\n if (opts.WTF) throw 'unrecognized ' + y[0] + ' in fills';\n }\n });\n}", "function chooseColors() {\r\n brushHue += 1;\r\n \r\n strokeWeight(weight += counter);\r\n \r\n if (weight > 15) {\r\n counter = -1\r\n } else if (weight < 5) {\r\n counter = 1\r\n }\r\n \r\n if (brushHue >= 360) {\r\n brushHue = 0;\r\n }\r\n \r\n stroke(brushHue, brushSaturation, brushBrightness);\r\n fill(brushHue, brushSaturation, brushBrightness);\r\n}", "assignColor() {\n let name = arguments[arguments.length-1]; // color distribution\n for (let i = 0; i < name.length; ++i) {// for each color to be assigned\n let array = arguments[i * 2];\n let index = arguments[i * 2 + 1];\n array[index] = name[i];\n }\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 }", "function interpolateColors(color1, color2, steps) {\n var stepFactor = 1 / (steps - 1),\n interpolatedColorArray = []\n\n color1 = color1.match(/\\d+/g).map(Number)\n color2 = color2.match(/\\d+/g).map(Number)\n\n for (var i = 0; i < steps; i++) {\n interpolatedColorArray.push(\n interpolateColor(color1, color2, stepFactor * i)\n )\n }\n\n return interpolatedColorArray\n}", "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 }", "generateColors(itemCount) {\r\n let colors = [];\r\n let number = Math.round(360 / itemCount);\r\n //this loop splits the colour spectrum evenly and gives each\r\n //div a colour so that when in order, they resemble the colour spectrum\r\n for (let i = 0; i < itemCount; i++) {\r\n let color = chroma(\"#ff0000\");\r\n colors.push(color.set(\"hsl.h\", i * number));\r\n }\r\n return colors;\r\n }", "function setColors(rgbList, totalColors) {\n var color = \"\";\n for (let i = 0; i < totalColors; i++) {\n var curr = rgbList[i];\n color = \"rgb(\" + curr[0] + \", \" + curr[1] + \", \" + curr[2] + \")\";\n labelList[i].style.background = color;\n }\n if (totalColors == 3) {\n for (let i = 3; i < 6; i++) {\n labelList[i].classList.add(\".hidden\");\n }\n }\n}", "generate(seed = null) {\n if(seed === null) seed = Color.generateSeed();\n\n const left = seed.clone();\n left.v += Math.random() * 50;\n left.s = Math.random() * 100;\n const right = seed.clone();\n right.v = Math.random() * 20;\n right.s = Math.random() * 100;\n\n const complement = Color.generateComplement(seed, 30);\n complement.v = Math.random() * 50 + 50;\n complement.s += Math.random() * 50;\n const complementRight = complement.clone();\n complementRight.v -= Math.random() * 40 + 10;\n complementRight.s += Math.random() * 40 - 20;\n\n const pivotIndex = Math.floor(Math.random() * ((this.size - 2)/2)) + Math.ceil(this.size / 2);\n this.colors = [\n ... this.range(pivotIndex, left, right),\n ... this.range(this.size - pivotIndex, complement, complementRight)\n ];\n\n return this;\n }", "interpolatePathProperties(){\n [...(this.interpolate||[])].forEach(({path, offset, color}) => {\n\n let resources = path? JSONPath({json: this, path: path}) || []: [];\n if (offset){\n offset::defaults({\n \"start\": 0,\n \"end\": 1,\n \"step\": (offset.end - offset.start) / (resources.length + 1)\n });\n resources.forEach((e, i) => e.offset = offset.start + offset.step * ( i + 1 ) );\n }\n if (color){\n let {scheme, length, reversed = false, offset} = color;\n if (!colorSchemes[scheme]) {\n logger.warn(\"Unrecognized color scheme: \", scheme);\n return;\n }\n if (!length) { length = resources.length; }\n if (!offset) { offset = 0; }\n\n const getColor = i => colorSchemes[scheme](((reversed)? 1 - offset - i / length : offset + i / length));\n const assignColor = items => {\n (items||[]).forEach((item, i) => {\n if (!item::isObject()) {\n logger.warn(\"Cannot assign color to a non-object value\");\n return;\n }\n //If entity is an array, the schema is applied to each of it's items\n if (item::isArray()){\n assignColor(item);\n } else {\n item.color = getColor(i);\n }\n });\n };\n assignColor(resources);\n }\n })\n }", "rainbow(_step, _totalSteps) {\n const step = toInt(_step);\n const totalSteps = toInt(_totalSteps);\n this.color(`hsl(${Math.ceil(step / totalSteps * 360)}, 100%, 50%)`);\n }", "function fittsColors() {\n let colors;\n\n colors = d3.schemeSet1;\n\n colors.target = colors[5];\n colors.distance = colors[1];\n colors.width = colors[0];\n colors.indexOfDifficulty = colors[4];\n colors.logarithm = colors[2];\n colors.hotspot = colors[4];\n colors.pointer = colors[7];\n colors.ratio = colors[3];\n colors.design = colors[8];\n\n return colors;\n}", "createColorsArray() {\n const _hexadecimals = '0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f';\n const hexadecimals = _hexadecimals.split(',');\n const colorsArray = [];\n\n // mesaure time needed to create an array\n const startTime = performance.now();\n\n while (colorsArray.length < this.pairs) {\n let hexColor = '';\n\n for (let j = 0; j < 6; j++) {\n const randomIndex = Math.floor(Math.random() * hexadecimals.length);\n hexColor += hexadecimals[randomIndex];\n }\n\n hexColor = `#${hexColor}`;\n\n // if that color does not exist yet, push it to the array\n // else iterate again\n if (colorsArray.indexOf(hexColor) === -1)\n colorsArray.push(hexColor);\n }\n\n const endTime = performance.now();\n const creationTime = endTime - startTime;\n\n // double array to make every color have a pair\n const pairedColorsArray = colorsArray.concat(colorsArray);\n\n // function returns object maybe for future purposes\n return {\n pairedColors: pairedColorsArray,\n colors: colorsArray,\n time: creationTime,\n };\n }", "function interpolateColors(color1, color2, steps) {\n let stepFactor = 1 / (steps - 1),\n interpolatedColorArray = [];\n\n for (let i = 0; i < steps; i++) {\n interpolatedColorArray.push(\n interpolateColor(color1, color2, stepFactor * i),\n );\n }\n\n return interpolatedColorArray;\n}", "function convertFillPattern(properties, defs) {\n var hatchStr = properties['fill-pattern'];\n var hashId = getHashId(hatchStr);\n var hash = utils.find(defs, function(o) { return o.id == hashId; });\n delete properties['fill-pattern'];\n if (!hash) {\n hash = makeSVGPatternFill(hatchStr, hashId);\n if (!hash) return;\n defs.push(hash);\n }\n properties.fill = hash.href;\n }", "function generateProps({ classes = {}, colors = {} }) {\n const chromaColors = parse(colors);\n\n const classProps = Object.keys(classes).reduce((output, className) => {\n const value = classes[className];\n const adjusterFn = /[a-z]*\\(.*\\)/.exec(value);\n const props = adjusterFn\n ? value.replace(adjusterFn[0], '').split(/\\s/)\n : value.split(/\\s/);\n\n const colorKey = props[0];\n const colorValue = adjusterFn\n ? adjustColor(chromaColors[colorKey], adjusterFn[0])\n : chromaColors[colorKey];\n\n if (!colorValue) return output;\n\n return {\n ...output,\n [camelCase(className)]: colorValue.alpha() === 1\n ? colorValue.hex()\n : colorValue.css('rgba').replace(/,/g, ', ')\n };\n }, {});\n\n const colorProps = Object.keys(colors).reduce((output, colorName) => {\n if (!chromaColors[colorName]) return output;\n return {\n ...output,\n [camelCase(colorName)]: chromaColors[colorName].hex()\n };\n }, {});\n\n return {\n ...classProps,\n ...colorProps,\n };\n}", "function createColorizer(breaks, colorRange) {\n const colors = colorRange.map((c) => [\n c.r,\n c.g,\n c.b,\n Math.floor(c.opacity * 255)\n ])\n return (v) => {\n const floored = Math.floor(v)\n for (let i = 0; i < breaks.length; i++) {\n if (floored <= breaks[i]) return colors[i]\n }\n return [255, 255, 255, 0]\n }\n}", "constructor() {\n\t\tthis.colors = ['red', 'pink', 'green', 'blue', 'yellow', 'purple', 'grey'];\n\t}", "function setGradient(x, y, w, h, c1, c2, c3, c4) {\n strokeWeight(1);\n print(\"Generating gradient..\")\n noFill();\n //Left to right gradient from 1st to 2nd color\n for (let i = x; i <= x + w / 3; i++) {\n let inter = map(i, x, x + w/3, 0, 1);\n let c = lerpColor(c1, c2, inter);\n stroke(c);\n line(i, y, i, y + h);\n }\n\n //Left to right gradient from 2nd to 3rd color\n x += w / 3;\n for (let i = x; i <= x + w / 3; i++) {\n let inter = map(i, x, x + w / 3, 0, 1);\n let c = lerpColor(c2, c3, inter);\n stroke(c);\n line(i, y, i, y + h);\n }\n\n //Left to right gradient from 3rd to 4th color\n x += w / 3;\n for (let i = x; i <= x + w / 3; i++) {\n let inter = map(i, x, x + w / 3, 0, 1);\n let c = lerpColor(c3, c4, inter);\n stroke(c);\n line(i, y, i, y + h);\n }\n}", "reset(color1, color2) {\n for (let i = 0; i < this.length(); i++) {\n let slot = this.getSlot(i);\n slot.classList.remove(color1);\n slot.classList.remove(color2);\n slot.classList.remove('filled');\n slot.style.border = '2px solid black';\n }\n }", "function createColorPalette(colors){\n\n\t\t// create a swatch for each color\n\t\tfor (var i = colors.length - 1; i >= 0; i--) {\n\t\t\tvar $swatch = $(\"<div>\").css(\"background-color\", colors[i])\n\t\t\t\t\t\t\t\t.addClass(\"swatch\");\n\t\t\t$swatch.click(function(){\n\t\t\t\t// add color to the color palette history\n\t\t\t\tcp.history.push($(this).css(\"background-color\"));\n\t\t\t\t// $(this).css(\"border\",\"10px solid black\");\n\n\t\t\t});\n\t\t\tcp.$container.append($swatch);\n\t\t}\n\t}", "function buildPreDefinedColors() {\n\tvar colorArr = [color1, color2, color3, color4];\n\t$('#pre-defined-pat').change(function() {\n\t\tvar k = Number($('#pre-defined-pat').val());\n\t\tif (k >= 0) {\n\t\t\tsetUpOptions();\n\t\t\t$('#custom-color-num').attr('disabled',true);\n\t\t\t$.getJSON('js/data.json', function(data) {\n\t\t\t\t\n\t\t\t\tvar x = data.camoData[k].HEXCOLORS.length;\n\t\t\t\tvar y = colorArr.length - x;\n\t\t\t\t$('#custom-color-num').val(x);\n\t\t\t\t\n\t\t\t\tfor (i=0; i<x; i++) {\n\t\t\t\t\tcolorArr[i].val(data.camoData[k].HEXCOLORS[i]);\n\t\t\t\t\tcolorArr[i].css('background-color',data.camoData[k].HEXCOLORS[i]);\n\t\t\t\t\tcolorArr[i].attr('disabled',false);\n\t\t\t\t\tcolorArr[i].css('text-decoration','none');\n\t\t\t\t}\n\n\t\t\t\tfor (j=0; j<y; j++) {\n\t\t\t\t\tcolorDisable(colorArr[x-j]);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\telse {\n\t\t\t$('#custom-color-num').attr('disabled',false);\n\t\t}\n\t});\n}", "function interpolateColors(color1, color2, steps) {\n var stepFactor = 1 / (steps - 1),\n interpolatedColorArray = [];\n color1 = color1.match(/\\d+/g).map(Number);\n color2 = color2.match(/\\d+/g).map(Number);\n for (var i = 0; i < steps; i++) {\n interpolatedColorArray.push(interpolateColor(color1, color2, stepFactor * i));\n }\n return interpolatedColorArray;\n }", "function interpolateColors(color1, color2, steps) {\n var stepFactor = 1 / (steps - 1),\n interpolatedColorArray = [];\n\n color1 = color1.match(/\\d+/g).map(Number);\n color2 = color2.match(/\\d+/g).map(Number);\n\n for(var i = 0; i < steps; i++) {\n interpolatedColorArray.push(interpolateColor(color1, color2, stepFactor * i));\n }\n\n return interpolatedColorArray;\n}", "makeGradient(name, color1, color2, color3) {\n const gradient = this.defs.append('linearGradient')\n .attr('id', name)\n .attr('x1', '0%')\n .attr('x2', '100%')\n .attr('y1', '0%')\n .attr('y2', '100%');\n\n gradient.append('stop')\n .attr('offset', '0%')\n .attr('stop-color', color1);\n\n gradient.append('stop')\n .attr('offset', '50%')\n .attr('stop-color', color2);\n\n gradient.append('stop')\n .attr('offset', '100%')\n .attr('stop-color', color3);\n }", "function interpolateColors(color1, color2, steps) {\n var stepFactor = 1 / (steps - 1),\n interpolatedColorArray = [];\n color1 = color1.match(/\\d+/g).map(Number);\n color2 = color2.match(/\\d+/g).map(Number);\n\n for (var i = 0; i < steps; i++) {\n interpolatedColorArray.push(interpolateColor(color1, color2, stepFactor * i));\n }\n return interpolatedColorArray;\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function create(red, green, blue, alpha) {\n return {\n red: red,\n green: green,\n blue: blue,\n alpha: alpha\n };\n }", "function generateRandomColorSet() {\n currentColors.color1 = getRandomLessSaturatedRGB();\n currentColors.color2 = getRandomRGB();\n currentColors.color3 = getRandomRGB(); \n currentColors.color4 = getRandomRGB();\n \n for (let color of shoeColor1) {\n color.style.fill = `rgb(${currentColors.color1.red}, ${currentColors.color1.green}, ${currentColors.color1.blue})`;\n }\n for (let color of shoeColor2) {\n color.style.fill = `rgb(${currentColors.color2.red}, ${currentColors.color2.green}, ${currentColors.color2.blue})`;\n }\n for (let color of shoeColor3) {\n color.style.fill = `rgb(${currentColors.color3.red}, ${currentColors.color3.green}, ${currentColors.color3.blue})`;\n }\n for (let color of shoeColor4) {\n color.style.fill = `rgb(${currentColors.color4.red}, ${currentColors.color4.green}, ${currentColors.color4.blue})`;\n }\n}", "createGradient(x, y, w, h, colors) {\n let gradient = this.ctx.createLinearGradient(x, y, x+w, y+h);\n for(let i in colors) {\n gradient.addColorStop(i/colors.length, colors[i]);\n }\n return gradient;\n }", "function heatGenerate(){\n for(var key in activeArray) {\n if(activeArray[key].heat < 100) {\n activeArray[key].heat += HEAT_PER_TICK;\n }\n var $fill;\n switch (enlarged) {\n case \"\":\n $fill = $(\"#\" + key + \" .gauge-fill\");\n break;\n case key:\n $fill = $(\"#inGame .gauge-fill\");\n break;\n default:\n $fill = $(\".mini-\" + key);\n }\n $fill.height(activeArray[key].heat + \"%\");\n $fill.css(\"background-color\", 'hsl(' + (120 - (activeArray[key].heat / 5 * 6)) + ', 100%, 50%)');\n totalHeat += activeArray[key].heat;\n }\n \n if(totalHeat > 0) {\n totalHeat = totalHeat < COOLANT_LEVEL ? 0 : totalHeat - COOLANT_LEVEL;\n }\n \n if(totalHeat >= MAX_HEAT){\n totalHeat = MAX_HEAT;\n loseGame();\n }\n var meterColour;\n meterColour = 'hsl(' + (120 - ((totalHeat/MAX_HEAT) * 120)) + ', 100%, 50%)';\n heatMeter.setAttribute(\"style\", \"background-position: \" + totalHeat/MAX_HEAT * -100 + \"% 0; \" +\n \"background-image: linear-gradient(to right, transparent, transparent 50%, \" + meterColour + \n \" 50%, \" + meterColour + \" 100%)\"); \n}", "function ColorToClass(className) {\n\n // check if word is locked\n if (selectedClasses.includes(className)){\n console.log(className, \"is currently locked -> no transitions need to be applied\");\n }\n else {\n // if word is not locked find first color that is not used\n for (let i = 0; i < selectedClasses.length; ++i) {\n\n // as soon as we reached an unused slot\n if (selectedClasses[i] === ''){\n\n // assign color\n color = colors[i];\n\n // to according line\n $(\".\" + className + '_line')\n .css(\"stroke\", color)\n .css(\"stroke-width\", \"3px\")\n .css(\"background\", color);\n\n // and to according bar\n $(\".\" + className + '_bar')\n .css(\"fill\", color)\n .css(\"background\", color);\n\n // and to according circle\n $(\".\" + className + '_circle')\n .css(\"fill\", color)\n .css(\"background\", color);\n\n // and transition\n enlargeSelectedCircle(className);\n\n break;\n }\n }\n }\n}", "function create(range, color) {\n return {\n range: range,\n color: color\n };\n }", "function create(range, color) {\n return {\n range: range,\n color: color\n };\n }", "function create(range, color) {\n return {\n range: range,\n color: color\n };\n }", "constructor(white, red, green, blue) {\n this.white = white;\n this.red = red;\n this.green = green;\n this.blue = blue;\n }", "@autobind\n splitClumpsToColors() {\n var tempClumpPoints = [];\n var max = 1;\n var len = this.clumpPoints.length;\n this.clumpOriginPoints = [];\n this.clumpPoints = this.clumpTargetPoints;\n this.clumpTargetPoints = [];\n\n for (var i=0; i<len; i++) {\n this.tempVector = this.clumpPoints[i].clone();\n\n for (var a=0; a<4; a++) {\n\n this.clumpOriginPoints[i*4 + a] = this.clumpPoints[i];\n this.clumpMass[i*4 + a] = -100000;\n this.limits[i*4 + a] = 0.02 + Math.random() * 0.0005;\n\n this.tempVector2.x = this.tempVector.x + (Math.random()*max - (max*0.5));\n this.tempVector2.y = this.tempVector.y + (Math.random()*max - (max*0.5));\n this.tempVector2.z = this.tempVector.z + (Math.random()*max - (max*0.5));\n this.clumpTargetPoints[i*4 + a] = this.tempVector2.clone();\n }\n }\n\n for (var i=0; i<this.clumpOriginPoints.length; i++) {\n this.clumpPoints[i] = this.clumpOriginPoints[i].clone();\n }\n\n var inc = 0;\n for (var i = 0, i3 = 0, l = this.particleCount; i < l; i ++, i3 += 3 ) {\n if ( i / l < 0.25 ) { //blue\n inc = this.incOrder.indexOf(0);\n } else if (i / l < 0.5) { //red\n inc = this.incOrder.indexOf(1);\n } else if (i / l < 0.75 ) {//yellow\n inc = this.incOrder.indexOf(2);\n } else {//green\n inc = this.incOrder.indexOf(3);\n }\n this.attractTargetArray[i] = this.attractTargetArray[i]*4 + inc;\n }\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function create(red, green, blue, alpha) {\r\n return {\r\n red: red,\r\n green: green,\r\n blue: blue,\r\n alpha: alpha,\r\n };\r\n }", "function makeColors(n){\n\ta=[]\n\tfor (var i =0;i<n;i++) {\n\t\ta.push(CreateColor());\n\t\t\t}\n\treturn a;\n}", "function create(range, color) {\r\n return {\r\n range: range,\r\n color: color,\r\n };\r\n }" ]
[ "0.65028733", "0.646131", "0.6299367", "0.62711954", "0.6214113", "0.61833346", "0.61480886", "0.61161965", "0.6045618", "0.603745", "0.60260814", "0.60173506", "0.6010783", "0.59957993", "0.59751594", "0.590659", "0.5905914", "0.58942556", "0.58899057", "0.5887788", "0.5885184", "0.58750015", "0.5861351", "0.58589786", "0.5857708", "0.58146775", "0.58127636", "0.5794095", "0.5758467", "0.5744734", "0.5741292", "0.5741284", "0.57381237", "0.5737513", "0.5726046", "0.5721438", "0.57139087", "0.5690424", "0.5686218", "0.56751174", "0.567463", "0.5672523", "0.56688756", "0.56545275", "0.5651415", "0.56500405", "0.56341505", "0.5613025", "0.5609703", "0.56082106", "0.5600487", "0.5599103", "0.55890405", "0.55818444", "0.5581273", "0.5578622", "0.55767024", "0.55632585", "0.55632585", "0.55632585", "0.55577534", "0.55522704", "0.5543311", "0.55358326", "0.55348897", "0.5533162", "0.55328345", "0.5532129", "0.5530775", "0.5529081", "0.5525818", "0.5525676", "0.55176467", "0.5515381", "0.5510052", "0.5505816", "0.5498251", "0.54974633", "0.54932714", "0.5491833", "0.548935", "0.5482686", "0.54756683", "0.54716665", "0.54706955", "0.5467425", "0.5467425", "0.5467425", "0.54659086", "0.54655325", "0.5460161", "0.5459019", "0.5448416", "0.5448416", "0.5448416", "0.5447145", "0.5441209", "0.5437548", "0.5437548", "0.542512", "0.5424501" ]
0.0
-1
turn note on and off depending on the date
function dateLabel(year) { if (year<sliderNote) { svg.selectAll(".exp-label").classed("hidden",false); return "Class of "+niceDate(year)+"*"; } else { svg.selectAll(".exp-label").classed("hidden",true); return "Class of "+niceDate(year); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function autoStatus(note, isInView) {\r\n\t\t\t//stop if note is not in the view\r\n\t\t\tif(!isInView){ return; }\r\n\r\n\t\t\t//stop if the note is already unread\r\n\t\t\tif(!note.unread){ return; }\r\n\r\n\t\t\t//if auto marking read AND note is not excluded\r\n\t\t\tif(settingsService.load().readOnView && !exclusionService.isExcluded(note.id)){\r\n\t\t\t\t//mark note as read in the service\r\n\t\t\t\tupdateServiceStatus(note, false);\r\n\t\t\t}\r\n\t\t}", "function toggleNoteOnEvent(stepNumber, instrumentIndex, noteNumber, velocity) {\n\tif (!unsetNoteOnEvent(stepNumber, instrumentIndex, noteNumber)) {\n\t\tsetNoteOnEvent(stepNumber, instrumentIndex, noteNumber, velocity);\n\t}\n}", "function manualStatus(note) {\r\n\t\t\t//toggle the current status of the note in the UI\r\n\t\t\tnote.unread = !note.unread;\r\n\r\n\t\t\t//if the user is marking this note as unread\r\n\t\t\tif(note.unread){\r\n\t\t\t\t//exclude it from auto read\r\n\t\t\t\texclusionService.exclude(note.id);\r\n\t\t\t}\r\n\r\n\t\t\t//if the user is marking as read\r\n\t\t\telse{\r\n\t\t\t\t//remove the note from list of exclusions\r\n\t\t\t\texclusionService.remove(note.id);\r\n\t\t\t}\r\n\r\n\t\t\t//update the notes status in the service\r\n\t\t\tupdateServiceStatus(note, note.unread);\r\n\t\t}", "function toggleNote() {\n if ($('#playNoteToggle').html()[0] == \"▶\") {\n synth.playFreq(0, res.hertz, organ);\n $('#playNoteToggle').html(\"■ Stop note\");\n }\n else {\n stopNoteIfActive();\n }\n}", "function toggleNotes(con){\n\tif(con){\n\t\tcurNote++;\t\n\t\tcurNote = curNote > music_arr[curMusic].notes.length-1 ? music_arr[curMusic].notes.length-1 : curNote;\n\t}else{\n\t\tcurNote--;\t\n\t\tcurNote = curNote < 0 ? 0 : curNote;\n\t}\n\thighLightNote(true);\n}", "function setNoteOnEvent(stepNumber, instrumentIndex, noteNumber, velocity) {\n\tvar action = new Object();\n\taction.type = 'noteOn';\n\taction.instrumentIndex = instrumentIndex;\n\taction.noteNumber = noteNumber;\n\taction.value = clipInt0to127(velocity);\t\t\t// Safety step in case input validation is somehow missed.\n\tstep[stepNumber].actionList.push(action);\n\t// update sequencer grid to reflect the change\n\tdocument.getElementById(constructGridId(stepNumber, instrumentIndex, noteNumber)).style.backgroundColor = convertVelocityToBackgroundColor(action.value);\n}", "function setDate() {\n const now = new Date();\n let seconds = now.getSeconds();\n let secondsDegrees = (( seconds / 60 ) * 360) + 90;\n secondHand.style.transform = `rotate(${secondsDegrees}deg)`;\n\n let minutes = now.getMinutes();\n let minutesDegrees = (( minutes / 60 ) * 360) + 90;\n minuteHand.style.transform = `rotate(${minutesDegrees}deg)`;\n\n let hours = now.getHours();\n let hoursDegrees = (( hours / 12 ) * 360) + 90;\n hourHand.style.transform = `rotate(${hoursDegrees}deg)`; \n if ( checkbox.checked === true ) {\n tick.play();\n } else {\n return;\n }\n \n}", "function noteOff(noteNumber) { }", "function noteChange(beatNum, noteNum) {\n notes[beatNum][noteNum] = !notes[beatNum][noteNum];\n}", "doShowEntityNote () {\n this.entityInfoTickle = !this.entityInfoTickle\n }", "function setNote(range, x) {\n if (x) {\n range.setNote(new Date().toDateString());\n } else {\n range.clearNote();\n }\n}", "function activate_date(objInp){ objInp.disabled=(objInp.disabled^ true );}", "function handleNoteButtonEvent(thisObj) {\n _changed = true;\n if ($(thisObj.getHtmlIds().noteContainer).visible()) {\n if (thisObj.getStandardValue() == thisObj.getMeta().seeNoteCui) {\n thisObj.clearNote();\n }\n else {\n thisObj.hideNote();\n }\n }\n else {\n thisObj.showNote();\n }\n }", "function showNote(note, button) {\n shownNote = note;\n shownNoteButton = button;\n $(\"#noteTime\", slide.contentDocument).text(new Date(note.time).toLocaleString());\n $(\"#noteBody\", slide.contentDocument)[0].value = note.body;\n $(\"#noteBody\", slide.contentDocument)[0].focus();\n }", "onToggleDatesClick() {\n let showDates = !this.state.showDates;\n let toggleDatesText = showDates ? 'Hide' : 'Show';\n this.setState({\n showDates,\n toggleDatesText\n });\n }", "openPickyDateTime() {\n this.setState({showPickyDateTime: true});\n }", "checkDate(bool) {\n // if start date changes and become bigger then end date ...\n if (this.state.startD > this.state.endD && bool === true) {\n // add one day to end date\n this.state.endThis.addOneDay();\n // if end date changes and become smaller then start date ...\n } else if (this.state.startD > this.state.endD && bool === false) {\n // decrease the start date by one day\n this.state.startThis.minusOneDay();\n // if the start date changes and become the same date like the end date...\n } else if (this.state.startDateLabel === this.state.endDateLabel && bool === true) {\n // refresh the end time\n this.state.endThis.refreshTimer();\n }\n }", "@computed get onNotes() {\n return Object.keys(this.midiNotes[this.currentRow]).filter((note) => {\n return this.midiNotes[this.currentRow][note].noteOn === true\n })\n }", "function setOn(bool) {\n on = bool;\n bot.log((on ? 'Actif' : 'inactif'));\n}", "noteOn(velocity=60) {\n this.keyRect.fill(this.displayOptions.clickColor);\n grid.highlightPitch(this.pitch, true, this.displayOptions);\n audio.noteOn(this.pitch, velocity)\n }", "doShowRunNote (modelDgst, runDgst) {\n this.runInfoTickle = !this.runInfoTickle\n }", "function sunTrue() {\n sunNow = true;\n rainingNow = false;\n}", "function turnonoff() {\n if (!beamon){\n beamon = true;\n onoff.html(\"Turn off\");\n return\n\n }\n\n if (beamon){\n beamon = false;\n onoff.html(\"Turn on\");\n return\n\n }\n }", "function enableShowNotesButton() {\n var needed = false;\n for (let i = 0; i < activeQuestion.clues.length; i++) {\n note = activeQuestion.clues[i].r;\n if (note !== \"\") {\n needed = true;\n }\n }\n if (needed) {\n document.getElementById(\"notes-button\").classList.add(\"control-button-active\");\n }\n}", "'click .homeReminder'(){\n if (homeReminderBool == null){\n homeReminderBool = true;\n } else {\n homeReminderBool = !homeReminderBool;\n }\n }", "isOn() {\n\t\treturn !!this.at;\n\t}", "function openStatus() {\n\tif((thisDay !== 6 && thisDay !== 0 && thisDay !== 2) && (time >= 10 && time <= 18)) {\n\t\tdocument.getElementById('openStatus').innerHTML = \"åben :)\";\n\t\tdocument.getElementById('openMessage').classList.remove(\"d-none\");\n\t}\n\telse if((thisDay == 2) && (time >= 11 && time <= 19)) {\n\t\tdocument.getElementById('openStatus').innerHTML = \"åben :)\";\n\t\tdocument.getElementById('openMessage').classList.remove(\"d-none\");\n\t}\n\telse {\n\t\tdocument.getElementById('openStatus').innerHTML = \"lukket :(\";\n\t\tdocument.getElementById('closedMessage').classList.remove(\"d-none\");\n\t}\n}", "initOpenNowAtToggleLogic() {\n // When \"open now\" checked uncheck \"open at\".\n $('#open_now').on('click', function (e) {\n // uncheck \"open at\" and disable datetime input\n $('#open-at-checkbox').prop('checked', false);\n $('#open_at').prop('disabled', true);\n });\n // When \"open at\" checked uncheck \"open now\".\n // Additionally, \"open at\" needs a datetime input enabled\n // and disabled when it is checked and unchecked.\n $('#open-at-checkbox').on('click', function (e) {\n // uncheck \"open now\"\n $('#open_now').prop('checked', false);\n // enable or disable datetime input as input is checked or unchecked\n if ($('#open-at-checkbox').prop('checked')) {\n $('#open_at').prop('disabled', false);\n } else {\n $('#open_at').prop('disabled', true);\n }\n });\n }", "function on() {\r\n document.getElementById(\"on\").disabled = true;\r\n document.getElementById(\"off\").disabled = false;\r\n document.getElementById(\"data\").rows[\"seconds\"].innerHTML = \"Reading Data...\";\r\n document.getElementById(\"data\").rows[\"longitude\"].innerHTML = \"Start pushed...\";\r\n}", "function turnOnNow() {\n if (isNight && ! turnedOn) {\n if (DEBUG) { console.log(\"Turning on lights now...\" + new Date()); }\n client.publish(config.turnOnTopic, \"{}\");\n turnedOn = true;\n setTimeout(turnOffNow, 600000); // start check for when to turn off an hour from now.\n } else {\n setTimeout(turnOnNow, 60000); // Once a minute.\n }\n}", "showDaily() {\n this.setState({\n showDaily: true,\n showGraphics: false,\n showSketches: false,\n showPhotography: false\n });\n }", "function setDate() {\n const date = new Date();\n const seconds = date.getSeconds();\n const minutes = date.getMinutes();\n const hours = date.getHours();\n //calculate arrows turn angle\n const secTransform = seconds * 6;\n const minutesTransform = minutes * 6;\n const hoursTransform = hours * 30;\n //move an arrows\n secArrow.style.transform = `rotate(${secTransform}deg)`;\n minArrow.style.transform = `rotate(${minutesTransform}deg)`;\n hourArrow.style.transform = `rotate(${hoursTransform}deg)`;\n //remove threshold at 12(24)/0 point\n if (seconds == 0) {\n secArrow.style.transition = 'none';\n } else {\n secArrow.style.transition = 'all 0.1s cubic-bezier(0.37, 3.18, 0.45, 1.15)';\n }\n if (minutes == 0) {\n minArrow.style.transition = 'none';\n } else {\n minArrow.style.transition = 'all 0.1s cubic-bezier(0.37, 3.18, 0.45, 1.15)';\n }\n if (hours == 12 || hours == 24) {\n hourArrow.style.transition = 'none';\n } else {\n hourArrow.style.transition = 'all 0.1s cubic-bezier(0.37, 3.18, 0.45, 1.15)';\n }\n //update digital clock data\n digitalClock.innerHTML = `${formatDateTime(date)}`;\n}", "togglePicker() {\n\t\t\tlet section = HOUR_FLAG;\n\t\t\tif (get(this, 'isClock')) {\n\t\t\t\tsection = DAY_FLAG;\n\t\t\t}\n\t\t\tthis.sendAction('onUpdate', section, get(this, 'timestamp'));\n\t\t}", "function toggleAuto(event) {\n if(autoSwitch.checked) {\n home.enableAutoOff();\n autoTemp.style.display = \"block\";\n }\n else {\n home.disableAutoOff();\n autoTemp.style.display = \"none\"; \n }\n}", "function dateAdvanced() {\n $(\"#mnth-list\").toggleClass(\"hidden\");\n $(\"#date-inp\").toggleClass(\"hidden\");\n $(\"#mnth-wraper\").toggleClass(\"text select\");\n date_src = !date_src;\n if (date_src) {\n $(\"#dsrc\").html(\"Date:\");\n } else {\n $(\"#dsrc\").html(\"Month:\");\n }\n // console.log(date_src);\n}", "isOnDate(date) {\n const selfDate = this.timeHuman.split(\" \")[0];\n const selfDay = Number(selfDate.split(\"-\")[2]);\n const day = Number(date.split(\"-\")[2]);\n return selfDay === day;\n }", "function stayAlarmChange() {\n alarm.setAlarmEnabled(true);\n}", "function checknotes(){\r\n\r\n}", "highlightUpdate (date) {\n }", "function DateUpdater() { }", "function switchThroughTime(flag) {\n\tvar tableThroughTime = \"tableThroughTime\";\n\tElement[flag ? 'show' : 'hide'](tableThroughTime);\n\tvar tableThroughTimeBr = \"tableThroughTimeBr\";\n\tElement[flag ? 'show' : 'hide'](tableThroughTimeBr);\n}", "enableTimeIndicator() {\n const hideIndicator = this.mTimeIndicatorInterval == 0;\n this.nowIndicator.hidden = hideIndicator;\n\n const todayColumn = this.findColumnForDate(this.today());\n if (todayColumn) {\n todayColumn.column.timeIndicatorBox.hidden = hideIndicator;\n }\n\n // Update the timer but only under some circumstances, otherwise\n // it will update the wrong view or it will start without need.\n const currView = currentView().type;\n if (\n gCurrentMode == \"calendar\" &&\n currView == this.type &&\n !hideIndicator &&\n (currView == \"day\" || currView == \"week\")\n ) {\n this.updateTimeIndicatorPosition(true);\n }\n }", "function turnOnOffCount(){\n if (isCounting){\n isCounting=false; \n } else {\n isCounting=true; \n }\n}", "function ToggleCommentSwitch(value, dte)\n{\n\tvar i = getDteDifference(TimeCard.StartDate, dte)+1;\n\n\tif (typeof(eval('self.TABLE.document.comment'+i)) == \"undefined\")\n\t{\n\t\tif (Comments.Date == TimeCard.StartDate)\n\t\t{\n\t\t\tswitch (value)\n\t\t\t{\n\t\t\t\tcase \"Deleting\":\t\n\t\t\t\t\tvar cmtImg = self.TABLE.document.comment;\n\t\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"default_icon\");\n\t\t\t\t\t//self.HEADER.document.comment.src = NoCommentsIcon;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Adding\": \n\t\t\t\t\tvar cmtImg = self.TABLE.document.comment;\n\t\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"active_icon\");\t\t\t\t\t\n\t\t\t\t\t//self.HEADER.document.comment.src = ExistingCommentsIcon;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch (value)\n\t\t{\n\t\t\tcase \"Deleting\":\t\n\t\t\t\tvar cmtImg = eval('self.TABLE.document.comment'+i);\n\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"default_icon\");\n\t\t\t\t//eval('self.TABLE.document.comment'+i).src = NoCommentsIcon;\n\t\t\t\tbreak;\n\t\t\tcase \"Adding\": \n\t\t\t\tvar cmtImg = eval('self.TABLE.document.comment'+i);\n\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"active_icon\");\n\t\t\t\t//eval('self.TABLE.document.comment'+i).src = ExistingCommentsIcon;\n\t\t\t\tbreak;\n\t\t}\n\t}\n}", "function ToggleCommentSwitch(value, dte)\n{\n\tvar i = getDteDifference(TimeCard.StartDate, dte)+1;\n\n\tif (typeof(eval('self.TABLE.document.comment'+i)) == \"undefined\")\n\t{\n\t\tif (Comments.Date == TimeCard.StartDate)\n\t\t{\n\t\t\tswitch (value)\n\t\t\t{\n\t\t\t\tcase \"Deleting\":\t\n\t\t\t\t\tvar cmtImg = self.TABLE.document.comment;\n\t\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"default_icon\");\n\t\t\t\t\t//self.HEADER.document.comment.src = NoCommentsIcon;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Adding\": \n\t\t\t\t\tvar cmtImg = self.TABLE.document.comment;\n\t\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"active_icon\");\t\t\t\t\t\n\t\t\t\t\t//self.HEADER.document.comment.src = ExistingCommentsIcon;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch (value)\n\t\t{\n\t\t\tcase \"Deleting\":\t\n\t\t\t\tvar cmtImg = eval('self.TABLE.document.comment'+i);\n\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"default_icon\");\n\t\t\t\t//eval('self.TABLE.document.comment'+i).src = NoCommentsIcon;\n\t\t\t\tbreak;\n\t\t\tcase \"Adding\": \n\t\t\t\tvar cmtImg = eval('self.TABLE.document.comment'+i);\n\t\t\t\tcmtImg.src = cmtImg.getAttribute(\"active_icon\");\n\t\t\t\t//eval('self.TABLE.document.comment'+i).src = ExistingCommentsIcon;\n\t\t\t\tbreak;\n\t\t}\n\t}\n}", "function note_up(elem, is_sharp) {\n var note = elem.dataset.note;\n elem.style.background = is_sharp ? \"#333\" : \"white\";\n synth.triggerRelease(note, \"16n\");\n}", "function isDeathOnChange() {\r\n var isDeath = byId('isDead').checked;\r\n setFieldValue('deathDate', '');\r\n if( isDeath ) {\r\n showById('deathDateTR');\r\n }\r\n else {\r\n hideById('deathDateTR');\r\n }\r\n}", "function enable_disable_date_add_issue(vl)\n{\n\t//var faCodeVal = $(document).find('#2fa-code').val();\t\n\t//var endi = document.getElementById('is_addoc_issue_date').value;\n\t\n\tvar endi = $('#is_addoc_issue_date').val();\n\t//alert(endi);\n\tif($('#is_addoc_issue_date').is(\":checked\"))\n\t{\n\t\t $(\"#doc_issue_year\").prop(\"disabled\", true);\n\t\t $(\"#doc_issue_day\").prop(\"disabled\", true);\n\t\t $(\"#doc_issue_month\").prop(\"disabled\", true);\n\t}\n\telse\n\t{\n\t\t$(\"#doc_issue_year\").prop(\"disabled\", false);\n\t\t $(\"#doc_issue_day\").prop(\"disabled\", false);\n\t\t $(\"#doc_issue_month\").prop(\"disabled\", false);\t\n\t}\n}", "function isNowOpportune () {\n const now = currentTime()\n return now >= AFTER_FINALS && now > formatOptions.suppressGraduation + WEEK\n }", "function EnableDisableAEP(currentDate, startDateVal, endDateVal) {\n\t\t\t\t\t\tvar isOnOff = \"N\";\n\t\t\t\t\t\tvar year = currentDate.getFullYear();\n\t\t\t\t\t\tvar startDate = new Date(year + \"-\" + startDateVal + \" 00:00:00.000\");\n\t\t\t\t\t\tvar endDate = new Date(year + \"-\" + endDateVal + \" 23:59:00.000\");\n\n\t\t\t\t\t\tif (currentDate >= startDate && currentDate <= endDate) {\n\t\t\t\t\t\t\t\t\tisOnOff = \"Y\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn isOnOff;\n\t\t\t}", "noteOn(pitch, velocity=60) {\n this.keys[pitch].noteOn(velocity)\n }", "function periodicActivity() {\n myLed.write(ledState ? 1 : 0);\n ledState = !ledState;\n}", "static isMarkOnCalendar(date, reminder)\n\t{\n\t\t/* \n\t\t\tdayDifference is how many days pass between date and reminder date.\n\t\t\tfrequency is the number of times repeating.\n\t\t*/\n\t\tlet dayDifference = date.getTime() - reminder.startTimeMilliseconds + 86400000 - 1;\n\t\tlet frequency = reminder.frequency;\n\t\tlet reminderDate = new Date(reminder.startTimeMilliseconds);\n\t\tlet monthDifference;\n\t\tlet week;\n\t\n\t\t/* date is before the reminder */\n\t\tif(dayDifference < 0) return false;\n\t\n\t\t/* Until a specific date */\n\t\tif(reminder.effectiveType == \"U\" && getDateString(date) > reminder.effectiveData) return false; \n\t\t\n\t\n\t\tdayDifference = Math.floor(dayDifference / 86400000);\n\t\t\n\t\t/* never repeat */\n\t\tif(reminder.repeatType == 'n') // \"Nerver\"\n\t\t{\n\t\t\tif(dayDifference == 0) return true;\n\t\t\telse return false;\n\t\t}\n\t\n\t\t/* evert ? days. ? means positive number */\n\t\tif(reminder.repeatType == 'd')\n\t\t{\n\t\t\tif(dayDifference % frequency == 0) \n\t\t\t{\n\t\t\t\tif(reminder.effectiveType == \"N\") // For a number of event \n\t\t\t\t{\n\t\t\t\t\tif(dayDifference / frequency < parseInt(reminder.effectiveData)) return true;\n\t\t\t\t}\n\t\t\t\telse return true;\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\n\t\t/* repeat ? year */\n\t\tif(reminder.repeatType == 'y')\n\t\t{\t\n\t\n\t\t\tif((date.getFullYear() - reminderDate.getFullYear()) % frequency == 0)\n\t\t\t{\n\t\t\t\t/* they must have same day and month */\n\t\t\t\tif(date.getMonth() == reminderDate.getMonth() && date.getDate() == reminderDate.getDate())\n\t\t\t\t{\n\t\t\t\t\tif(reminder.effectiveType == \"N\")\n\t\t\t\t\t{\n\t\t\t\t\t\tif((date.getFullYear() - reminderDate.getFullYear()) / frequency < parseInt(reminder.effectiveData)) return true;\n\t\t\t\t\t}\n\t\t\t\t\telse return true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\n\t\t/* evert ? month */\n\t\tif(reminder.repeatType == 'm')\n\t\t{\t\n\t\t\tmonthDifference = (date.getFullYear() - reminderDate.getFullYear()) * 12;\n\t\t\tmonthDifference += date.getMonth() - reminderDate.getMonth();\n\t\t\tif(monthDifference % frequency == 0)\n\t\t\t{\n\t\t\t\t/* same day */\n\t\t\t\tif(date.getDate() == reminderDate.getDate()) \n\t\t\t\t{\n\t\t\t\t\tif(reminder.effectiveType == \"N\")\n\t\t\t\t\t{\n\t\t\t\t\t\tif( monthDifference / frequency < parseInt(reminder.effectiveData)) return true;\n\t\t\t\t\t}\n\t\t\t\t\telse return true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\n\t\t/* every ? week (on Mon. Tue. and so on) */\n\t\tif(reminder.repeatType == 'w')\n\t\t{\n\t\t\tlet num_reminders = 0;\n\t\t\tlet total = parseInt(reminder.effectiveData);\n\t\t\t/*\n\t\t\tif((dayDifference % (7 * frequency) == 0)) return true;\n\t\t\t*/\n\t\t\t/* create week that stores interger */\n\t\t\tif(reminder.week == \"\") week = [0];\n\t\t\telse week = reminder.week.split(\",\").map(function(element){ return parseInt(element); });\n\t\t\t\n\t\t\tnum_reminders = Math.floor(dayDifference / (7 * frequency)) * week.length;\n\t\n\t\t\t//if(num_reminders > total) return false;\n\t\n\t\t\tfor(var i = 0; i < week.length; i++)\n\t\t\t{\n\t\t\t\tif(num_reminders >= total) return false;\n\t\t\t\tnum_reminders++;\n\t\t\t\tif(( dayDifference % (7 * frequency)) == (week[i] - week[0]) ) return true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}", "noteOn(note, velocity) {\n this.note = note;\n\n // setting the frequency\n let noteDelta = this.pitchBendRange * this.pitchBendValue;\n this.operators.forEach((op, index) => {\n let freq = frequencyFromMidi(note + noteDelta) * (1 + this.detune * this.detuneScale[index]);\n let f = op.source.parameters.get('frequency');\n f.linearRampToValueAtTime(freq, this.audioContext.currentTime + this.glideTime);\n });\n\n // triggering the envelopes\n this.outEnv.noteOn(this.maxOutputGain, velocity);\n for (let i = 1; i < 4; i++) { // the first operator's envelope isn't triggered\n this.operatorsEnv[i].noteOn(this.operatorsEnvAmount[i], 127);\n }\n }", "goalState() {\n let date = new Date()\n let goalDate\n (this.last_click) ? goalDate = this.last_click : goalDate = this.created_at\n if ((this.formatDate(goalDate)[0] < date.getFullYear()) || (this.formatDate(goalDate)[1] < date.getMonth())) {\n this.status = 'dead'}\n else if ((date.getDate() - this.formatDate(goalDate)[2]) > 1) {\n this.status = 'dead';}\n else if ((date.getDate() - this.formatDate(goalDate)[2]) == 1) {\n this.status = 'late';}\n else this.status = 'alive';\n }", "function dateWeighting(){\n \n dateWeight = 1;\n \n }", "function event_day_status() {\n\tif( $(\"#event_all_day\").is(\":checked\")){\n\t\tblock_hours_event();\n\t} else {\n\t\tunblock_hours_event();\n\t}\n\n\tfunction unblock_hours_event(){\n\t\t$('#event_starts_at_4i').attr('disabled', false);\n\t\t$('#event_starts_at_5i').attr('disabled', false);\n\t\t$('#event_ends_at_4i').attr('disabled', false);\t\t\n\t\t$('#event_ends_at_5i').attr('disabled', false);\n\t}\n\tfunction block_hours_event(){\n\t\t$('#event_starts_at_4i').attr('disabled', true);\n\t\t$('#event_starts_at_5i').attr('disabled', true);\n\t\t$('#event_ends_at_4i').attr('disabled', true);\t\t\n\t\t$('#event_ends_at_5i').attr('disabled', true);\n\t}\n}", "function setDate()\n{\n const weaks=['Sunday','Monday','Tuesday','Wednesday','Thrusday','Friday','Saturday'];\n const currentDate=new Date();\n const year=currentDate.getFullYear();\n const months=['January','February','March','April',\n 'May','June','July','August','September','October',\n 'November','December'];\n const month=currentDate.getMonth();\n const todayDate=currentDate.getDate();\n const num=currentDate.getDay();\n date.innerHTML=`${weaks[num]},${months[month]} ${todayDate}, ${year}`;\n}", "function checkForNotes() {\n for (var q = 0; q < self.allDays.length; q++) {\n for (var k = 0; k < self.monthNotes.length; k++) {\n var note = self.monthNotes[k],\n monthNum = note.date.split('-')[1].toString(),\n cDay = Number(note.date.split('-')[2]),\n year = Number(note.date.split('-')[0]),\n monthName = '',\n day = self.allDays[q];\n\n // Normalize month number and get month name\n if (monthNum.split('')[0] == 0) {\n monthNum = Number(monthNum.split('')[1] - 1);\n }\n else {\n monthNum = Number(monthNum) - 1;\n }\n monthName = self.months[monthNum];\n\n if (day && (day.hasOwnProperty('num') && (day.hasOwnProperty('month') && (day.hasOwnProperty('year'))))) {\n if (day.num == cDay && day.year == year && day.month == monthName) {\n if (note.label === 'Yellow') {\n day.yellow++;\n }\n if (note.label === 'Green') {\n day.green++;\n }\n if (note.label === 'Red') {\n day.red++;\n }\n if (note.label === 'Blue') {\n day.blue++;\n }\n\n }\n }\n }\n }\n }", "function switchTimerOn() {\n\tdocument.getElementById(\"notification\").style.visibility = \"visible\"; \n document.getElementById(\"counter\").innerHTML= pomoTimer;\n\t\t\tdocument.getElementById(\"text1\").innerHTML= \"Time To Work!\";\n document.getElementById(\"text2\").innerHTML= \"\";\n\t\t\t\n}", "function disableDates(date){\n //Testing, need to get dates from DB instead\n return date.getDate();\n}", "function apply_behaviours() {\r\n if(document.getElementById('comments'))\r\n page_rules['#comments span.datetime'] = function (ele){ele.innerHTML=set_publish_date(ele.title);};\r\n Behaviour.register(page_rules);\r\n Behaviour.apply();\r\n }", "markSwitch(){\n if(this.room.roomDataArray[this.positionX][this.positionY].mark){\n this.markOff();\n } else {\n this.markOn();\n }\n }", "function toggleReceipt(){\n\tvar caller = document.getElementById(\"donation_receipt\");\n\tif (caller.value == \"on\"){\n\t\tcaller.value = \"off\";\n\t} else {\n\t\tcaller.value = \"on\";\n\t}\n}", "function onAutomaticTimeToggleSwitchChanged() {\r\n updateAutomaticDependantOptions();\r\n }", "function ampmbutton() {\n //if (dformat === \"ampm\") {\n if (dformat === true) {\n setdformat((dformat) => (dformat = false));\n } else {\n setdformat((dformat) => (dformat = true));\n }\n }", "function sleepInConditions(){\r\n var now = new Date();\r\n var month = now.getMonth();\r\n var dayOfMonth = now.getDate();\r\n var dayOfWeek = now.getDay();\r\n var message = \"Sleep in.\"\r\n \r\n if (dayOfWeek != 6 && dayOfWeek != 0){\r\n message = \"Get up and get ready for work!\";\r\n }\r\n else if (month == 0 && dayOfMonth == 1){\r\n message = \"Sleep in.\";\r\n }\r\n if (month == 6 && dayOfMonth == 4){\r\n message = \"Sleep in.\";\r\n }\r\n if (month == 11 && dayOfMonth == 25){\r\n message = \"Sleep in.\";\r\n }\r\n \r\n document.getElementById(\"conditional_statement\").innerHTML = message;\r\n}", "function turnOffNow() {\n if (isPastTime(config.turnOffTime)) {\n if (DEBUG) { console.log(\"Turning OFF lights now...\" + moment().local().format('LLL')); }\n client.publish(config.turnOffTopic, \"{}\");\n turnedOn = false;\n setTimeout(turnOnNow, 43200000); // start to check 12 hrs from now.\n } else {\n setTimeout(turnOffNow, 60000);\n }\n}", "noteOn (number, velocity, timestamp) {\n // Relabel velocity=0 to a noteOff event,\n // which is an common alternative\n if (velocity < 0.5 / 128.0) {\n this.noteOff(number)\n return\n }\n\n if (this.keys[number] !== states.KEY_SUSTAIN) {\n this.keys[number] = states.KEY_PRESSED\n }\n\n Object.keys(store.state.players).forEach(name => {\n var player = store.state.players[name]\n if (player.noteOn) {\n player.noteOn.call(player.scope, number, velocity, timestamp)\n }\n })\n }", "change() {\n\t\tthis.props.onUpdate(this.props.index, this.state.pastDate);\n this.setState({pastDate: !this.state.pastDate});\n }", "function move2Start() {\r\nconsole.log('move2Start:', sensorStartDate);\r\nif ($('#main_single').prop('checked')) {\r\n setStartRange(new Date(sensorStartDate), 0)\r\n setEndRange(new Date(sensorStartDate), $(\"#qryRangeDD\").val());\r\n} else {\r\n $(\"#date1\").val(\"2005-06-15\");\r\n setEndRange(new Date(\"06/15/2005\"), $(\"#qryRangeDD\").val());\r\n}\r\n $('#backStart').addClass('disabled'); \r\n $('#back').addClass('disabled');\r\n //timelineType();\r\n}", "function dayButtonClicked() {\n if (night == false) {\n night = true;\n nightIn();\n return;\n }\n if (night == true) {\n night = false;\n dayIn();\n return;\n }\n}", "function playNotes(notes) {\n // save for reference\n previousNotes = notes;\n // iterate through the notes\n for (var i = 0; i < notes.length; i++) {\n // TODO stop the oscillator if note is null\n // TODO keep it going if it's the same\n // TODO set new otherwise\n if (notes[i] && currentMode[i]) {\n oscillators[i].frequency.value = currentMode[i];\n oscillators[i].type = types[ notes[i]-1 ];\n } else {\n oscillators[i].frequency.value = 0;\n }\n\n }\n }", "function noteOn(noteNumber)\n{\n\tvar freq = frequencyFromNoteNumber(noteNumber);\n\tvco.frequency.setValueAtTime(freq, audioContext.currentTime);\n\tvco2.frequency.setValueAtTime(freq, audioContext.currentTime);\n\tvco3.frequency.setValueAtTime(freq, audioContext.currentTime);\n\n\tvca.gain.value = 1;\n\tvca.gain.setTargetAtTime(0, audioContext.currentTime, 0.2);\n}", "noteOff() {\n this.keyRect.fill(this.displayOptions.color);\n grid.highlightPitch(this.pitch, false, this.displayOptions);\n audio.noteOff(this.pitch)\n }", "function toggleTimer() {\n if (timerHours > 0 || timerMinutes > 0 || timerSeconds > 0)\n timerOn = !timerOn;\n}", "function turn_on(target){\n if (coffeeStatus != \"off\") {\n phonon.alert(\"\", \"Coffeemaker is already on!!\", true)\n }\n else {\n query = \"command=on\"\n function state(resultOn){\n alrt = phonon.indicator('Coffeemaker is starting', true);\n window.setTimeout(function(){\n console.log(alrt);\n alrt.close();\n alrt = null;\n }, 2000);\n };\n query_coffeemaker(state, query);\n }\n }", "function youAreAPirate (checked) { // eslint-disable-line\n var dlList = document.querySelector('#ImOKWithThat')\n var date = new Date()\n date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000))\n\n if (checked) {\n dlList.style.display = 'block'\n document.cookie = 'WhoAmI=You are a pirate!; expires=' + date.toGMTString() + '; path=/'\n setTimeout(jumpToDl, 1000)\n } else {\n dlList.style.display = 'none'\n document.cookie = 'WhoAmI=You are a great person!; expires=' + date.toGMTString() + '; path=/'\n }\n}", "function dateUpdate(date) {\n changeText(\"Week_Day\", weekDay[date.getDay()] + \",\");\n changeText( \"Day\", date.getDate() + \" \");\n changeText( \"Month\", month[date.getMonth()]);\n}", "function addNote() {\n self.showAdd = !self.showAdd;\n }", "static get ON() { return 'on'; }", "function note()\r\n {\r\n var x = document.getElementById('input-note');\r\n var y = document.getElementById('input-note-second');\r\n if (x.style.display === 'none') {\r\n x.style.display = 'block';\r\n y.style.display= 'none';\r\n } else {\r\n x.style.display = 'none';\r\n y.style.display ='block';\r\n }\r\n \r\n }", "visit(agent, date) {\n if (agent.state != State.QUARANTINED) {\n if (agent.medicalStatus.infectionDate !== undefined) {\n agent.state = State.QUARANTINED\n if (agent.medicalStatus.certifiedPositiveBy == undefined) {\n agent.medicalStatus.certifiedPositiveBy = this.id\n }\n agent.medicalStatus.quarantinedDate = new Date(date)\n } else {\n agent.state = State.NORMAL\n }\n }\n }", "updateState_isNotesEdited(arg) {\n if (arg == 'content-changed') {\n this.isNotesEditedButton.addClass('active');\n } else if (arg == 'content-saved') {\n this.isNotesEditedButton.removeClass('active');\n } else {\n console.warn('Unknown trigger to update isNotesEdited state ' + arg);\n }\n }", "function lockDown(){\n lockUnlock.addEventListener( 'click', ()=> {\n \n if( speechDate === predictDay ){\n \n input.style.display ='none';\n label.innerHTML = 'We are free to roam!!!!'\n lockUnlock.innerHTML = 'Lock';\n lockUnlock.style.backgroundColor = 'crimson';\n let face = document.getElementById('face').src = 'img/happy.png';\n\n } else{\n label.innerHTML = 'Refresh and guess another date'\n lockUnlock.style.backgroundColor = 'teal';\n let face = document.getElementById('face').src = 'img/sad.png';\n lockUnlock.innerHTML = 'Unlock';\n }\n\n });\n\n}", "function setDate() {\n // Create and retrieve Current Date and store in variable.\n const now = new Date();\n\n // Retrieve seconds from current Date variable \"now\".\n const seconds = now.getSeconds();\n // Convert seconds into notable points in 360degrees and use style.transform to implement into css for seconds hand tick movement.\n const secondsDegrees = ((seconds / 60) * 360) + 90;\n secondsHand.style.transform = `rotate(${secondsDegrees}deg)`;\n\n // Retrieve minutes from current Date variable \"now\".\n const mins = now.getMinutes();\n // Convert minute into notable points in 360degrees and use style.transform to implement into css for minutes hand tick movement.\n const minsDegrees = ((mins / 60) * 360) + 90;\n minsHand.style.transform = `rotate(${minsDegrees}deg)`;\n\n // Retrieve hours from current Date variable \"now\".\n const hours = now.getHours();\n // Convert hour into notable points in 360degrees and use style.transform to implement into css for hours hand tick movement.\n const hoursDegrees = ((hours / 12) * 360) + 90;\n hoursHand.style.transform = `rotate(${hoursDegrees}deg)`;\n}", "function set_status_date(dateid) {\n $(dateid).clear();\n var date = new Date();\n var text = formatDate(date);\n $(dateid).value = text;\n}", "function playNote(note){\n MIDI.noteOn(0, note, velocity, delay);\n MIDI.noteOff(0, note, delay + 0.75);\n}", "function C012_AfterClass_Amanda_CheckNotes() {\n\tif (((ActorGetValue(ActorCloth) == \"\") || (ActorGetValue(ActorCloth) == \"Clothed\") || (ActorGetValue(ActorCloth) == \"Pajamas\")) && !ActorHasInventory(\"Collar\") && !ActorIsRestrained() && !ActorIsGagged()) ActorSetPose(\"CheckNotes\");\n\tLeaveIcon = \"Leave\";\n}", "function setCheckinDate() {\n var today = new Date();\n var todaysTime = vm.today.getHours();\n var tomorrow = new Date();\n tomorrow.setDate(today.getDate() + 1);\n\n if (vm.todaysTime >= 15) {\n today = tomorrow;\n }\n vm.searchData.checkin = today;\n }", "function updateTourType() {\n \n if ($(\"#tour-type\").val() == 1) {\n\n $('#date-return').prop('disabled', true);\n\n } else {\n\n $('#date-return').prop('disabled', false);\n }\n\n}", "setCommentsOn(on) {\r\n return this.getItem().then(i => {\r\n const updater = new Item(i, `SetCommentsDisabled(${!on})`);\r\n return updater.update({});\r\n });\r\n }", "_alarmOnOff() {\n this.bellElem.removeClass(\"critical major minor info\");\n let bellIcon = this.bellElem.find(\"i:first\");\n bellIcon.removeClass(\"fa-regular fa-solid\");\n let showPanel = true;\n\n switch (this._highestSeverity) {\n case Severity.CRITICAL:\n this.bellElem.addClass(\"critical\");\n bellIcon.addClass(\"fa-solid\");\n this._playErrorSound();\n break;\n\n case Severity.MAJOR:\n this.bellElem.addClass(\"major\");\n bellIcon.addClass(\"fa-solid\");\n this._playWarningSound();\n break;\n\n case Severity.MINOR:\n this.bellElem.addClass(\"minor\");\n bellIcon.addClass(\"fa-solid\");\n this._playWarningSound();\n break;\n\n case Severity.INFO:\n this.bellElem.addClass(\"info\");\n bellIcon.addClass(\"fa-solid\");\n this._playInfoSound();\n break;\n\n default:\n bellIcon.addClass(\"fa-regular\");\n this._stopSounds();\n showPanel = false;\n break;\n }\n\n if (showPanel) {\n this._show(true);\n } else {\n this._hide();\n }\n }", "function openDatePicker () {\n if (dateDis.classList.contains(\"hidden\")) {\n var dayOfWeek = days[dueDate.getDay()];\n var dayOfMonth = dueDate.getDate();\n var curYear = dueDate.getFullYear();\n var curMonth = dueDate.getMonth() + 1;\n document.getElementById(\"curDateDisplay\").innerHTML = dayOfWeek+\", \"+curMonth+\"/\"+dayOfMonth+\"/\"+curYear;\n dateDis.classList.remove(\"hidden\");\n }\n todoStage.classList.remove(\"hidden\");\n todoCal.addEventListener(\"datetap\", function(e){\n dueDate = e.detail.date;\n dayOfWeek = days[dueDate.getDay()];\n dayOfMonth = dueDate.getDate();\n curYear = dueDate.getFullYear();\n curMonth = dueDate.getMonth() + 1;\n document.getElementById(\"curDateDisplay\").innerHTML = dayOfWeek+\", \"+curMonth+\"/\"+dayOfMonth+\"/\"+curYear;\n });\n}", "function updateText(){\n scope.text = scope.on ? attrs.textwhenon : attrs.textwhenoff;\n }", "function setStatusOnOff() {\n $('#btn_onoff').addClass('mousedown');\n $('#btn_onoff').on('click',function() {\n \n if(status_onoff == false) {\n status_onoff = true;\n $('#btn_onoff').html('ON');\n \n $('#count_number').html('<p>--!!--</p>');\n $('#count_number p').addClass('animated flash')\n setStatusStart();\n \n }else if(status_onoff == true) {\n status_onoff = false;\n $('#btn_onoff').html('OFF');\n //end game function\n \n endGame();\n } \n \n \n })\n \n \n \n \n \n \n }", "function clickedButton (){\n \n let currentDay= document.getElementById('date');\n if(currentDay.style.display==='none'){\n currentDay.style.display= 'block';\n }else {\n currentDay.style.display='none';\n }\n /*For testing purposes\n console.log('click test2'); */\n }", "function setReturnDate(isAutoTrainBookingPath){\n\tvar depDate = $('wdfdate1'); \n\tvar retDate = $('wdfdate2');\n\tvar dateOnPage = getValidatedDateArray(1);\n if (isValidDate(dateOnPage)) {\n\t\tvar dateOnPageObj = new Date(dateOnPage[0], (dateOnPage[1]-1), dateOnPage[2]);\n\t\tdateOnPageObj.setDate(dateOnPageObj.getDate()+1);\n \tretDate.value = formatDate(dateOnPageObj);\n }\n if(isAutoTrainBookingPath == true) { \t\n\t\tshowHideReturnDateSection('form_item_to_date', true);\n\t} else {\n\t\tshowHideReturnDateSection('tickets_ret_date_time', true);\n\t}\n}", "function isDateJournaled(topic, date) {\n const month = date.getMonth() + 1;\n const mm = ((month < 10) ? '0' : '') + month\n const yyyy = date.getFullYear();\n const yyyymm = getYYYYMM(date);\n \n const dates = topics2yearmonth[yyyymm];\n if (dates) {\n return dates[date] || false;\n } else {\n fetchDates(topic, `${yyyy}-${mm}-01`);\n return false;\n }\n }", "function markAsPicked() {\n var days = document.querySelectorAll(\".day-in-calendar\");\n days.forEach(function(element) {\n element.classList.remove(\"picked\");\n });\n this.classList.add(\"picked\");\n currentDate.setDate(this.textContent);\n}", "noon() {\n this.time.setHours(12);\n }" ]
[ "0.5974877", "0.5926578", "0.5919073", "0.59049875", "0.5815867", "0.5793834", "0.57916176", "0.5775055", "0.5774281", "0.5747004", "0.57154095", "0.5695511", "0.56715196", "0.5624724", "0.5616657", "0.56114113", "0.55757326", "0.5500368", "0.54903036", "0.54580116", "0.54442257", "0.54258394", "0.54239714", "0.54214317", "0.5406868", "0.53753185", "0.5371111", "0.53551596", "0.53507984", "0.53476274", "0.5315914", "0.53088194", "0.52970254", "0.529663", "0.52926725", "0.528331", "0.52771306", "0.52614355", "0.5257436", "0.5256674", "0.5251011", "0.5250237", "0.5245406", "0.52287835", "0.52287835", "0.5224883", "0.52225775", "0.522009", "0.52196455", "0.52148753", "0.5211407", "0.5210889", "0.52090746", "0.52032894", "0.5198511", "0.5195218", "0.5194775", "0.5187402", "0.518498", "0.51831716", "0.5182459", "0.5182067", "0.51751393", "0.5171647", "0.5169996", "0.51692593", "0.5161252", "0.5160308", "0.5151978", "0.5145261", "0.5136876", "0.51343316", "0.5123494", "0.5121552", "0.51178837", "0.5117624", "0.5107417", "0.50993997", "0.50992304", "0.5096934", "0.5096448", "0.509163", "0.50896096", "0.50889295", "0.5079359", "0.5067372", "0.50666755", "0.5064248", "0.5062473", "0.50575775", "0.5055884", "0.50531006", "0.50494546", "0.50468194", "0.5043233", "0.5038363", "0.503706", "0.5030423", "0.50243056", "0.50158197", "0.5014892" ]
0.0
-1
format the date to be displayed in the legend
function niceDate(date) { return legendDateFormat(new Date(date)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDates() {\n for (let i = 0; i < this.results.length; i++) {\n const g = this.results[i];\n g.label = g.name;\n if (g.label instanceof Date) {\n g.label = g.label.toLocaleDateString();\n }\n if (g.series) {\n for (let j = 0; j < g.series.length; j++) {\n const d = g.series[j];\n d.label = d.name;\n if (d.label instanceof Date) {\n d.label = d.label.toLocaleDateString();\n }\n }\n }\n }\n }", "formatDates() {\n for (let i = 0; i < this.results.length; i++) {\n const g = this.results[i];\n g.label = g.name;\n if (g.label instanceof Date) {\n g.label = g.label.toLocaleDateString();\n }\n if (g.series) {\n for (let j = 0; j < g.series.length; j++) {\n const d = g.series[j];\n d.label = d.name;\n if (d.label instanceof Date) {\n d.label = d.label.toLocaleDateString();\n }\n }\n }\n }\n }", "function formatDateLabel(date){\n\tvar month = date.substring(5, 7);\n\tvar day = date.substring(8, 10);\n\tvar monthStr = getMonthStr(parseInt(month));\n\treturn (monthStr + ' ' + day);\n}", "function axis_format(d, i) {\n var index = this.index();\n if (!index) { return d }\n // date based formatting\n \n return index.get(d).format(\"YYYY-M-D\");\n}", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "function setFormatoDate(data) {\n let dd = (\"0\" + (data.getDate())).slice(-2);\n let mm = (\"0\" + (data.getMonth() + 1)).slice(-2);\n let yyyy = data.getFullYear();\n return dd + '/' + mm + '/' + yyyy;\n}", "renderDate(value) {\n 'use strict';\n\n if (value) {\n return `<span title=\"${value.full}\">${value.shortest}</span>`;\n }\n return '-';\n }", "function formatDate(date) {\n return weekdays[date.getDay()] + \", \" +\n date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n }", "getFormattedDate(date) {\n return dayjs(date).format(\"MMM MM, YYYY\");\n }", "function formatDate(date) {\n\t\treturn (date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear() + ' - ' + formatTime([date.getHours(), date.getMinutes()]));\n\t}", "function formatDate(date) {\n\t\t\t\treturn date.getDate() + \"-\" + (date.getMonth()+1) + \"-\" + date.getFullYear();\n\t\t\t}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [year, month, day].join('-');\n }", "function addTimestamp(timedate) {\n //var date = timedate.substr(0,10);\n //var time = timedate.substr(11,8);\n date = new Date(timedate);\n legend.onAdd = function (map) {\n var div = L.DomUtil.create('div', 'info legend');\n div.innerHTML = date.toLocaleString()+'<br>';\n return div;\n };\n legend.addTo(map);\n}", "function formatDate(date){\n var date_array = date.split('-');\n return date_array[1] + '/' + date_array[2] + '/' + date_array[0]\n }", "function dateFormat(i){\n var date = data.list[i].dt_txt;\n var year = date.slice(0,4);\n var day = date.slice(5,7);\n var month = date.slice(8,10);\n\n var newDateFormat = day + \"/\" + month + \"/\" + year;\n console.log(newDateFormat);\n return newDateFormat;\n }", "function formatDate(date)\n{\n g_date=date.getDate();\n if(g_date <=9)\n {\n g_date=\"0\"+g_date;\n }\n g_month=date.getMonth();\n g_year=date.getFullYear();\n if (g_year < 2000) g_year += 1900;\n return todaysMonthName(date)+\" \"+g_date+\", \"+g_year;\n}", "function formatDate(d) {\n return `${d.year}-${d.month}-${d.day}`\n }", "formatDate (date){\n var d = new Date(date),\n month = (d.getMonth() + 1),\n day = d.getDate(),\n year = d.getFullYear();\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n return [year, month, day].join('-');\n }", "display_date_formate(date) {\n if (!date)\n return null;\n const [year, month, day] = date.split('-');\n let new_date = `${day}-${month}-${year}`;\n return new_date;\n }", "function formatDate(d) {\n if (d === undefined){\n d = (new Date()).toISOString()\n }\n let currDate = new Date(d);\n let year = currDate.getFullYear();\n let month = currDate.getMonth() + 1;\n let dt = currDate.getDate();\n let time = currDate.toLocaleTimeString('en-SG')\n\n if (dt < 10) {\n dt = '0' + dt;\n }\n if (month < 10) {\n month = '0' + month;\n }\n\n return dt + \"/\" + month + \"/\" + year + \" \" + time ;\n }", "function formatDate (date) {\n return weekdays[date.getDay()] + \", \" +\n date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n}", "function formatDate(date) {\r\n return date.getFullYear().toString() + (date.getMonth() + 1).toString().padStart(2, '0') + date.getDate().toString() \r\n + date.getHours().toString().padStart(2, '0') + date.getMinutes().toString().padStart(2, '0');\r\n }", "date_lisible_format(date){\n var day = date.substring(0, 2),\n month_number = date.substring(3, 5),\n year = date.substring(6, 10);\n\n const Date_Month_Key = new Map([[\"01\", \"Janvier\"], [\"02\", \"Fevrier\"], [\"03\", \"Mars\"], [\"04\", \"Avril\"], [\"05\", \"Mai\"], [\"06\", \"Juin\"], [\"07\", \"Juillet\"], [\"08\", \"Août\"], [\"09\", \"Septembre\"], [\"10\", \"Octobre\"], [\"11\", \"Novembre\"], [\"12\", \"Decembre\"]]); \n var month = Date_Month_Key.get(month_number);\n\n var date_format = day+\" \"+month+\" \"+year;\n\n return date_format;\n }", "function formattedDate(date) {\r\n\t\t\t\t\tvar d = new Date(date),\r\n\t\t\t\t\t\tmonth = '' + (d.getMonth() + 1),\r\n\t\t\t\t\t\tday = '' + d.getDate(),\r\n\t\t\t\t\t\tyear = d.getFullYear();\r\n\r\n\t\t\t\t\tif (month.length < 2) month = '0' + month;\r\n\t\t\t\t\tif (day.length < 2) day = '0' + day;\r\n\t\t\t\t\treturn [year, month, day].join('-');\r\n\t\t\t\t}", "function formattedDate(d = new Date()) {\n return [d.getDate(), d.getMonth() + 1, d.getFullYear()]\n .map((n) => (n < 10 ? `0${n}` : `${n}`))\n .join(\"/\")\n .concat(` at ${getTime(d)}`);\n }", "function formatDate(date) {\n\tvar datum = new Date(date);\n\tvar jahr = datum.getFullYear();\n\tvar month_number = datum.getMonth();\n\tvar monat = \"\";\n\tswitch(month_number) {\n\t\tcase 0:\n\t\t\tmonat = \"Januar\"; break;\n\t\tcase 1:\n\t\t\tmonat = \"Februar\"; break;\n\t\tcase 2:\n\t\t\tmonat = \"März\"; break;\n\t\tcase 3:\n\t\t\tmonat = \"April\"; break;\n\t\tcase 4:\n\t\t\tmonat = \"Mai\"; break;\n\t\tcase 5:\n\t\t\tmonat = \"Juni\"; break;\n\t\tcase 6:\n\t\t\tmonat = \"Juli\"; break;\n\t\tcase 7:\n\t\t\tmonat = \"August\"; break;\n\t\tcase 8:\n\t\t\tmonat = \"September\"; break;\n\t\tcase 9:\n\t\t\tmonat = \"Oktober\"; break;\n\t\tcase 10:\n\t\t\tmonat = \"November\"; break;\n\t\tcase 11:\n\t\t\tmonat = \"Dezember\"; break;\n\t}\n\tvar tag = datum.getDate();\n\tvar stunden = datum.getHours();\n\tvar min = datum.getMinutes();\n\t// bei den Minuten und Stunden fehlt wenn sie einstellig sind die erste 0\n\tif (stunden < 10) {\n\t\tif (min < 10) {\n\t\t\treturn tag+\". \"+monat+\" \"+jahr+\", 0\"+stunden+\":0\"+min;\n\t\t}\n\t\treturn tag+\". \"+monat+\" \"+jahr+\", 0\"+stunden+\":\"+min;\n\t} else if (min < 10) {\n\t\treturn tag+\". \"+monat+\" \"+jahr+\", \"+stunden+\":0\"+min;\n\t}\n\treturn tag+\". \"+monat+\" \"+jahr+\", \"+stunden+\":\"+min;\n}", "function formatDate(d) {\n return (d.getMonth()+1) + '/' +\n d.getDate() + '/' +\n d.getFullYear();\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n return [year, month, day].join('-');\n }", "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "customDateHtml(date){\n\t\treturn moment(date).date(); //day of month\n\t}", "function paintGridDate(){\r\n $('.futureDate').text(gridSimulatorVar.future_date.format(gridSimulatorCons.moment_format))\r\n}", "function formatDate(d) {\n var y = d.getFullYear(),\n m = ('0' + (d.getMonth() + 1)).slice(-2),\n dy = ('0' + d.getDate()).slice(-2);\n\n return [y, m, dy].join('-');\n}", "function formatDate(d) {\n var y = d.getFullYear(),\n m = ('0' + (d.getMonth() + 1)).slice(-2),\n dy = ('0' + d.getDate()).slice(-2);\n\n return [y, m, dy].join('-');\n}", "function formatDate(date){\n\tvar day = date.getDate();\n var monthIndex = date.getMonth();\n var year = date.getFullYear();\n\treturn months[monthIndex] + \" \" + day + \", \" + year;\n}", "function formatDate() {\n var d = new Date(),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [day, month, year].join('/');\n }", "function updateCountryName() {\ncountryName.text = currentCountry + \", \" + mapChart.dateFormatter.format(currentDate, \"MMM dd, yyyy\");\n}", "function formatDate(date) {\n \n var dd = date.getDate();\n if (dd < 10) {\n dd = '0' + dd;\n }\n \n var mm = date.getMonth() + 1;\n if (mm < 10) {\n mm = '0' + mm;\n }\n \n var yy = date.getFullYear();\n if (yy < 10) {\n yy = '0' + yy;\n }\n \n return mm + '/' + dd + '/' + yy;\n }", "function timestampCellRenderer(params) {\n return params.value + ' <span style=\"font-size: 10px; color: grey;\">' + new Date().getTime() + '</span>';\n}", "function formatDate(date) {\n var d = new Date(date);\n d = d.toLocaleString();\n return d;\n }", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "function formatDate(date,formatStr){return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString,date);}", "function formatDate () {\n\t\t\t\tvar currentTimestamp = new Date(plugin.settings.current_year, plugin.settings.current_month - 1, plugin.settings.selected_day);\n\t\t\t\tplugin.settings.date_object = currentTimestamp;\n\t\t\t\tvar dateFormat = plugin.options.date_format,\n\t\t\t\t\tdateObj = new Date(currentTimestamp.getTime()),\n\t\t\t\t\tformats = {\n\t\t\t\t\t\td: function () {\n\t\t\t\t\t\t\tvar day = formats.j();\n\t\t\t\t\t\t\treturn (day < 10) ? '0' + day : day;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdo: function () {\n\t\t\t\t\t\t\tvar day = formats.j();\n\t\t\t\t\t\t\treturn getGetOrdinal(day);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tD: function () {\n\t\t\t\t\t\t\treturn plugin.settings.date_formatting.weekdays.shorthand[formats.w()];\n\t\t\t\t\t\t},\n\t\t\t\t\t\tj: function () {\n\t\t\t\t\t\t\treturn dateObj.getDate();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tl: function () {\n\t\t\t\t\t\t\treturn plugin.settings.date_formatting.weekdays.longhand[formats.w()];\n\t\t\t\t\t\t},\n\t\t\t\t\t\tw: function () {\n\t\t\t\t\t\t\treturn dateObj.getDay();\n\t\t\t\t\t\t},\n\t\t\t\t\t\tF: function () {\n\t\t\t\t\t\t\treturn monthToStr(formats.n() - 1, false);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tm: function () {\n\t\t\t\t\t\t\tvar month = formats.n();\n\t\t\t\t\t\t\treturn (month < 10) ? '0' + month : month;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tM: function () {\n\t\t\t\t\t\t\treturn monthToStr(formats.n() - 1, true);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tn: function () {\n\t\t\t\t\t\t\treturn dateObj.getMonth() + 1;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tU: function () {\n\t\t\t\t\t\t\treturn dateObj.getTime() / 1000;\n\t\t\t\t\t\t},\n\t\t\t\t\t\ty: function () {\n\t\t\t\t\t\t\treturn String(formats.Y()).substring(2);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tY: function () {\n\t\t\t\t\t\t\treturn dateObj.getFullYear();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tvar formatPieces = \"\";\n\t\t\t\t\tvar splitChar = \"\";\n\t\t\t\t\tif(dateFormat.indexOf(\"/\") > -1){\n\t\t\t\t\t\tformatPieces = dateFormat.split('/');\n\t\t\t\t\t\tsplitChar = \"/\";\n\t\t\t\t\t}else if(dateFormat.indexOf(\"-\") > -1){\n\t\t\t\t\t\tformatPieces = dateFormat.split('-');\n\t\t\t\t\t\tsplitChar = \"-\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\tformatPieces = dateFormat.split(' ');\n\t\t\t\t\t\tsplitChar = \" \";\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// build formatted date string \n\t\t\t\t$.each(formatPieces, function( index, formatPiece ) {\n\t\t\t\t\t// strip non alpha from format piece\n\t\t\t\t\tformatPiece = formatPiece.replace(/[\\W_]+/g,\"\").trim();\n\t\t\t\t\t\n\t\t\t\t\t// check the formatPiece is in the list of allowed formatting values. This allows for punctuation (comma etc) in the date format\n\t\t\t\t\tif(plugin.settings.allowed_formats.indexOf(formatPiece) > -1){\n\t\t\t\t\t\tdateFormat = dateFormat.replace(formatPiece, formats[formatPiece]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\n\t\t\t\treturn dateFormat;\n\t\t\t}", "function get_formatted_date(date) {\n function get_formatted_num(num, expected_length) {\n var str = \"\";\n var num_str = num.toString();\n var num_zeros = expected_length - num_str.length;\n for (var i = 0; i < num_zeros; ++i) {\n str += '0';\n }\n str += num_str;\n return str;\n }\n var msg = get_formatted_num(date.getFullYear(), 4) + \"-\";\n msg += get_formatted_num(date.getMonth() + 1, 2) + \"-\";\n msg += get_formatted_num(date.getDate(), 2) + \" \";\n msg += get_formatted_num(date.getHours(), 2) + \":\";\n msg += get_formatted_num(date.getMinutes(), 2) + \":\";\n msg += get_formatted_num(date.getSeconds(), 2);\n return msg;\n}", "function formatLabel(label) {\n if (label instanceof Date) {\n label = label.toLocaleDateString();\n }\n else {\n label = label.toLocaleString();\n }\n return label;\n}", "function formatLabel(label) {\n if (label instanceof Date) {\n label = label.toLocaleDateString();\n }\n else {\n label = label.toLocaleString();\n }\n return label;\n}", "function fnFormatCalenderDate(date){\r\n\tvar newDateComponents = date.split(\" \");\r\n\treturn newDateComponents[0] + \" \" + newDateComponents[1] + (newDateComponents.length < 3 ? \":00\" : \":\" + newDateComponents[2]) + \":00\";\r\n}", "function formatDate(date){\n\treturn [date.getFullYear(), \n\t\t\t(((date.getMonth()+1)<10)?\"0\":\"\") + (date.getMonth()+1),\n\t\t\t((date.getDate()<10)?\"0\":\"\") + date.getDate()\n\t\t ].join(\"-\");\n}", "formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n return [year, month, day].join('-');\n }", "function setDateFormat(date) {\n if (date !== null) {\n date = date.split(\"-\")\n return `<em>${addZero(date[2])}/${addZero(date[1])}/${date[0]}</em>`\n }\n return null\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) {\n month = '0' + month;\n }\n if (day.length < 2) {\n day = '0' + day;\n }\n\n return [year, month, day].join('-');\n}", "function shortDateDescription(entryDate) {\n // zapisuję do zmiennej pobrany z obiektu z datą dzień/ miesiąc (miesiące są w obiekcie zapisane w zakresie 0..11, więc należy dodać 1)\n var dayMonth = `${entryDate.getDate()}/${entryDate.getMonth() + 1}`;\n chartDescription.innerHTML += `<span class=\"chart__barDescription\">${dayMonth}</span>`;\n}", "formatDate() {\n var monthNames = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n\n var date = new Date();\n var day = date.getDate();\n var monthIndex = date.getMonth();\n var year = date.getFullYear();\n\n return monthNames[monthIndex] + \" \" + day + \", \" + year;\n }", "prettyBirthday() {//Can be put in method\n return dayjs(this.person.dob.date)\n .format('DD MMMM YYYY')//change in assignment to different format not default\n }", "function formatDate(date) {\n const month = date.getMonth() + 1;\n const day = date.getDate();\n const year = date.getFullYear();\n \n return `${month}/${day}/${year}`;\n }", "function dateFormatter(date){\n \n var dat = new Date(date);\n \n var data = \"\"+dat.getFullYear()+\"-\";\n \n // MONTHS\n if((dat.getMonth()*1) <10 ){\n data += \"0\"+dat.getMonth()+\"-\";\n }else{\n data += dat.getMonth()+\"-\";\n }\n \n // DAYS\n if((dat.getDate()*1) <10 ){\n data += \"0\"+dat.getDate()+\" \";\n }else{\n data += dat.getDate()+\" \";\n }\n \n //HOURS\n if((dat.getHours()*1) <10 ){\n data += \"0\"+dat.getHours()+\":\";\n }else{\n data += dat.getHours()+\":\";\n }\n\n //MINUTES\n if((dat.getMinutes()*1) <10 ){\n data += \"0\"+dat.getMinutes()+\":\";\n }else{\n data += dat.getMinutes()+\":\";\n }\n \n //SECONDS\n if((dat.getSeconds()*1) <10 ){\n data += \"0\"+dat.getSeconds();\n }else{\n data += dat.getSeconds();\n }\n \n return data;\n \n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n\n return [year, month, day].join('-');\n }", "function dateFormat(d){\n return months[d.getMonth()]+\" \"+d.getDate();\n }", "function formatDate(date) {\n let source = new Date(date);\n let day = source.getDate();\n let month = source.getMonth() + 1;\n let year = source.getFullYear();\n\n return `${day}/${month}/${year}`;\n }", "function formatDate(date) {\n var day = date.getDate();\n if (day < 10) {\n day = \"0\" + day;\n }\n\n var month = date.getMonth() + 1;\n if (month < 10) {\n month = \"0\" + month;\n }\n\n var year = date.getFullYear();\n\n return day + \".\" + month + \".\" + year;\n}", "function legendFormatter(data){\n //console.log(data);\n if(data.x == undefined){\n return '';\n }\n var html = data.xHTML + ' Hz' + ' : ';\n data.series.forEach(function(series) {\n html += ' ' + series.yHTML.fontcolor(series.color) + ' dB ';\n });\t\n return html;\n}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth() + 1; //Months are zero based\n var year = date.getFullYear();\n var formattedDate = year + \"-\" + month + \"-\" + day;\n return formattedDate;\n }", "formatDate(date, format) {\n if (!date) {\n return '';\n }\n let iFormat;\n const lookAhead = (match) => {\n const matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);\n if (matches) {\n iFormat++;\n }\n return matches;\n }, formatNumber = (match, value, len) => {\n let num = '' + value;\n if (lookAhead(match)) {\n while (num.length < len) {\n num = '0' + num;\n }\n }\n return num;\n }, formatName = (match, value, shortNames, longNames) => {\n return (lookAhead(match) ? longNames[value] : shortNames[value]);\n };\n let output = '';\n let literal = false;\n if (date) {\n for (iFormat = 0; iFormat < format.length; iFormat++) {\n if (literal) {\n if (format.charAt(iFormat) === '\\'' && !lookAhead('\\'')) {\n literal = false;\n }\n else {\n output += format.charAt(iFormat);\n }\n }\n else {\n switch (format.charAt(iFormat)) {\n case 'd':\n output += formatNumber('d', date.getDate(), 2);\n break;\n case 'D':\n output += formatName('D', date.getDay(), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].DAY_NAMES));\n break;\n case 'o':\n output += formatNumber('o', Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() -\n new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);\n break;\n case 'm':\n output += formatNumber('m', date.getMonth() + 1, 2);\n break;\n case 'M':\n output += formatName('M', date.getMonth(), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES_SHORT), this.getTranslation(primeng_api__WEBPACK_IMPORTED_MODULE_6__[\"TranslationKeys\"].MONTH_NAMES));\n break;\n case 'y':\n output += lookAhead('y') ? date.getFullYear() : (date.getFullYear() % 100 < 10 ? '0' : '') + (date.getFullYear() % 100);\n break;\n case '@':\n output += date.getTime();\n break;\n case '!':\n output += date.getTime() * 10000 + this.ticksTo1970;\n break;\n case '\\'':\n if (lookAhead('\\'')) {\n output += '\\'';\n }\n else {\n literal = true;\n }\n break;\n default:\n output += format.charAt(iFormat);\n }\n }\n }\n }\n return output;\n }", "function pgFormatDate(date) {\n /* Via http://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date */\n return String(date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()); \n}", "function dateFormat(date) {\n var month = date.getMonth();\n var day = date.getDate();\n if (day < 10) {\n day = \"0\" + day;\n }\n var year = date.getUTCFullYear();\n month = vm.months[month];\n return day + \" de \" + month + \" del \" + year;\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return [year, month, day].join('-');\n }", "function formattedDate(d) {\n let month = String(d.getMonth() + 1);\n let day = String(d.getDate());\n const year = String(d.getFullYear());\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return `${year}-${month}-${day}`;\n }", "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n }", "function formattedDate(date) {\n\n // Récupération\n var month = String(date.getMonth() + 1);\n var day = String(date.getDate());\n var year = String(date.getFullYear());\n\n // Ajout du 0\n if (month.length < 2) \n month = '0' + month;\n\n // Ajout du 0\n if (day.length < 2) \n day = '0' + day;\n\n return day+'/'+month+'/'+year;\n }", "function formatDate(date) {\n\t\tvar day = date.getDate();\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(day / 10) == 0) {\n\t\t\tday = \"0\" + day;\n\t\t}\n\t\t\n\t\tvar month = date.getMonth() + 1; // months start at 0\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(month / 10) == 0) {\n\t\t\tmonth = \"0\" + month;\n\t\t}\n\t\t\n\t\tvar year = date.getFullYear();\n\t\t\n\t\treturn day + \"/\" + month + \"/\" + year;\n\t}", "function formatDate(date) {\n var monthNames = [\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n \"10\",\n \"11\",\n \"12\"\n ];\n\n var day = date.getDate();\n var monthIndex = date.getMonth();\n var year = date.getFullYear();\n\n return monthNames[monthIndex] + \"/\" + day + \"/\" + year;\n}", "formatDate(date) {\n return date.toISOString().replaceAll(\"-\", \"\").substring(0, 8);\n }", "function formatDate(data){\n\tvar d = new Date(); \n\tvar year = d.getFullYear(); \n\tvar month = d.getMonth()+1; \n\tvar ddate = d.getDate(); \n\tvar dday = d.getDay(); \n\tvar hours = d.getHours(); \n\tvar minutes = d.getMinutes(); \n\tvar seconds = d.getSeconds(); \n\treturn year + \"-\" + formatNumber(month) + \"-\" + \n\t\tformatNumber(ddate) + \" \" + \n\t\tformatNumber(hours) + \":\" + \n\t\tformatNumber(minutes) + \":\" + \n\t\tformatNumber(seconds);\n}", "function formattedDate(d = new Date) {\n\treturn [d.getDate(), d.getMonth()+1, d.getFullYear()]\n\t\t.map(n => n < 10 ? `0${n}` : `${n}`).join('/');\n }", "function _getFormattedDate(date) {\n var year = date.getFullYear();\n var month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : '0' + month;\n var day = date.getDate().toString();\n day = day.length > 1 ? day : '0' + day;\n return month + '/' + day + '/' + year;\n }", "function formatDate ( date ) {\n return date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n}", "function formatXAxisDate(date, min, max) {\n\tvar date = new Date(date);\n\tif (max - min < 1000 * 60 * 60 * 24)\n\t\treturn date.toLocaleTimeString().substring(0,5);\n\telse\n\t\treturn date.getDate() + \"/\" + (date.getMonth() + 1) + \"/\" + date.getYear();\n}", "function dateFormat(d){\n\t\tvar string = d.getFullYear() +'/';\n\t\tstring += ( (d.getMonth() < 9) ? '0'+(d.getMonth()+1) : d.getMonth()+1) +'/';\n\t\tstring += d.getDate();\n\t\treturn string;\n\t}", "renderDateTitle(date) {\n return moment(date).format(\"dddd\") + \", \" + moment(date).format(\"MMMM Do\");\n }", "function dateFormatter(date){\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n var day = date.getDate();\n return year + '-' + ('0' + month).slice(-2) + '-' + day; // the '0' and the slicing is for left padding\n}", "function formatDate (date) {\n return dateFormat(date, 'HH:MM dd/mm/yyyy')\n}", "function formatDate(date) {\n return format(new Date(date), 'yyyy-MM-dd')\n}", "function formatDate(date) {\n let year = date.getFullYear();\n let month = date.getMonth() + 1;\n let day = date.getDate();\n return [year, month, day].join('-');\n}", "function formatteddate(inputDate){\r\n var inDate = new Date(inputDate);\r\n var month = '' + (inDate.getMonth() + 1);\r\n var day = '' + inDate.getDate();\r\n var year = inDate.getFullYear();\r\n \t if (month.length < 2) month = '0' + month;\r\n \t if (day.length < 2) day = '0' + day;\r\n return [year, month, day].join('-');\r\n }", "function getXAxisFormat() {\r\n\t\t/*Check if the timespan bigger then 1 day*/\r\n\t\t//var d_start = new Date($scope.startTime.substring(6, 10),$scope.startTime.substring(3, 5),$scope.startTime.substring(0, 2));\r\n\t\t//var d_end= new Date($scope.endTime.substring(6, 10),$scope.endTime.substring(3, 5),$scope.endTime.substring(0, 2));\r\n\t\t\r\n\t\t/*\r\n\t\tif (d_end-d_start > 0)\r\n\t\t\tformatXAxis = '%d.%m %H:%M';\r\n\t\telse\r\n\t\t\tformatXAxis = '%H:%M';\r\n\t\t*/\r\n\t\tif(chartTypeID == 'week')\r\n\t\t\treturn formatXAxis = '%A';\r\n\t\tif(chartTypeID == 'month')\r\n\t\t\treturn formatXAxis = '%d %b';\r\n\t\telse if(chartTypeID == 'year')\r\n\t\t\treturn formatXAxis = '%B';\r\n\r\n\t\treturn formatXAxis = '%d %b';\r\n\t}", "function getDateLabel(grouping, date) {\n var year = date.getFullYear(),\n month = date.getMonth()+1,\n day = date.getDate(),\n week = d3.time.weekOfYear(date);\n\n if ( day < 10 ) day = \"0\"+day;\n if ( week < 10 ) week = \"0\"+week;\n if ( month < 10 ) month = \"0\"+month;\n\n if ( grouping === \"daily\" )\n return year+\"-\"+month+\"-\"+day;\n\n if ( grouping === \"weekly\" )\n return year+\"-w\"+week;\n\n if ( grouping === \"monthly\" )\n return year+\"-\"+month;\n\n throw(\"GitSense: Unrecognized grouping '\"+grouping+\"'\");\n }", "function formatDate(date) {\r\n const hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();\r\n const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();\r\n return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} ${hours}:${minutes}`\r\n}", "function setdate(d){\n\treturn d3.time.format('%d %b %Y')(d3.time.format('%Y%m%d').parse(d));\n}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth();\n var year = date.getFullYear();\n month++;\n if (month < 10)\n month = '0' + month;\n if (day < 10)\n day = '0' + day;\n return [year, month, day].join('-').toString();\n}", "function format(d) {\n const month = d.getMonth() >= 9 ? d.getMonth() + 1 : `0${d.getMonth() + 1}`;\n const day = d.getDate() >= 10 ? d.getDate() : `0${d.getDate()}`;\n const year = d.getFullYear();\n return `${month}/${day}/${year}`;\n}", "returnDateFormat(date){\n var day = new Date(date);\n return day.toDateString();\n }", "function dateFormatter(date) {\n //alert(\"dateFormatter 0:\" + date);\n //alert(\"dateFormatter 0: \" + dateArray[0]);\n return dateArray[0].getFullYear() + \"-\" + ('' + (dateArray[0].getMonth() + 1)).padStart(2, '0') + \"-\" + ('' + dateArray[0].getDate()).padStart(2, '0');\n}", "function formatDate(date) {\n if (date.length < 2) {\n return \"0\" + date;\n } else {\n return date;\n }\n}", "function formatDate(date){\n\t\tvar formatted = {\n\t\t\tdate:date,\n\t\t\tyear:date.getFullYear().toString().slice(2),\n\t\t\tmonth:s.months[date.getMonth()],\n\t\t\tmonthAbv:s.monthsAbv[date.getMonth()],\n\t\t\tmonthNum:date.getMonth() + 1,\n\t\t\tday:date.getDate(),\n\t\t\tslashDate:undefined,\n\t\t\ttime:formatTime(date)\n\t\t}\n\t\tformatted.slashDate = formatted.monthNum + '/' + formatted.day + '/' + formatted.year;\n\t\treturn formatted;\n\t}", "get date_string() {\n return dayjs__WEBPACK_IMPORTED_MODULE_3__(this.date).format('DD MMM YYYY');\n }", "function dateFormatter(value) {\n return refactor_date(value, 'human');\n }", "function dateFormatter(value) {\n try {\n if (value) {\n return $.datepicker.formatDate(\"m/d/yy\", value);\n }\n } catch (err) {\n }\n\n return \"-\";\n }", "function formatDate(date) {\n\tif (date == null) {\n\t\treturn null;\n\t}\n\tvar d = date.getDate();\n\tvar m = date.getMonth() + 1;\n\tvar y = date.getFullYear();\n\treturn '' + (d <= 9 ? '0' + d : d) + '-' + (m <= 9 ? '0' + m : m) + '-' + y;\n}", "function getFormattedDate() {\n return \"[\" + new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '') + \"] \";\n}" ]
[ "0.6819712", "0.6819712", "0.66999257", "0.6654725", "0.6452557", "0.6452557", "0.6452557", "0.64485043", "0.64357054", "0.63821864", "0.637969", "0.63708043", "0.63325256", "0.6323073", "0.62836605", "0.62768424", "0.6266034", "0.626415", "0.6263533", "0.6251099", "0.62473476", "0.6245053", "0.62391406", "0.62272793", "0.6225135", "0.6223857", "0.6209797", "0.620305", "0.618829", "0.6183104", "0.6180032", "0.61746955", "0.61716187", "0.6168777", "0.6168777", "0.6159558", "0.61558723", "0.6154408", "0.61187667", "0.6112478", "0.61068034", "0.61063576", "0.6104267", "0.61005104", "0.6089662", "0.60854", "0.60854", "0.60775644", "0.60716444", "0.6069237", "0.6066193", "0.6060184", "0.60319406", "0.6029149", "0.60274404", "0.60242206", "0.6023302", "0.60229534", "0.60200065", "0.6018261", "0.60180455", "0.6009789", "0.6004509", "0.5999101", "0.59958154", "0.5995493", "0.5989984", "0.598947", "0.5983723", "0.59788626", "0.59772325", "0.5976722", "0.5974271", "0.5971348", "0.59692156", "0.59647393", "0.5961227", "0.59600234", "0.5955823", "0.59538096", "0.59506154", "0.5949939", "0.59495664", "0.5948618", "0.5946128", "0.59394825", "0.59388757", "0.59359324", "0.593131", "0.59309065", "0.5929816", "0.5918359", "0.5916271", "0.5910542", "0.59047544", "0.59047467", "0.59045583", "0.59038883", "0.5902008", "0.5894127" ]
0.7079235
0
retrieve the number of students for the current year from the specified state data string
function students(d,curdate) { if (d.properties.students) { var dateloc=d.properties.students.search(niceDate(curdate)); if (dateloc > -1) { return Number(d.properties.students.substr(dateloc+5,3)); } else { return "0";} } else {return "0";} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStudentYears(studentName) {\n /*\n * Filter the transcriptList for the specfied student\n */\n let transcriptList = database_data.getTranscripts();\n let findStudentTrans = transcriptList.filter(function (obj) {\n return (obj.studentName===studentName);\n });\n\n /*\n * Using the records in findStudentTrans, get distinct\n * semester, year values.\n */\n let years = findStudentTrans.reduce((acc, x) =>\n acc.concat(acc.find(y => y.year === x.year) ? [] : [x]), []);\n return years;\n}", "function getSeniority(dateString) {\n var today = new Date();\n var startDate = new Date(dateString);\n var years = today.getFullYear() - startDate.getFullYear();\n var m = today.getMonth() - startDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < startDate.getDate())) {\n years--;\n }\n return years;\n}", "function years(num){\n let years0,\n str1=num.toString(), \nsL=str1.length;\nif (sL==1) {s1=\"0\"; s2=str1} else { s2=str1.charAt(sL-2); s2=str1.charAt(sL-1)} \nif (s2==\"1\" && s1!=\"1\") {years0=' год '} else if \n((s2==\"2\"||s2==\"3\"||s2==\"4\" )&&s1!=\"1\") {years0=' года '} else {years0=' лет '};\nreturn years0\n}", "function getNumberOfYears() {\n let repaymentTerm = Number(document.querySelector('input[name=\"number-of-years\"]:checked').value);\n return isNaN(repaymentTerm) ? 0 : (repaymentTerm / 12);\n }", "function isYear (s)\r\n{ if (isEmpty(s))\r\n if (isYear.arguments.length == 1) return defaultEmptyOK;\r\n else return (isYear.arguments[1] == true);\r\n if (!isNonnegativeInteger(s)) return false;\r\n return ((s.length == 2) || (s.length == 4));\r\n}", "function isYear (s)\r\n{ if (isEmpty(s))\r\n if (isYear.arguments.length == 1) return defaultEmptyOK;\r\n else return (isYear.arguments[1] == true);\r\n if (!isNonnegativeInteger(s)) return false;\r\n return ((s.length == 2) || (s.length == 4));\r\n}", "function cstudents(d,curdate) {\n\tif (d.properties.students) {\n\t\tvar dateloc=d.properties.students.search(niceDate(curdate));\n\t\tvar cstudent= d.properties.students;\n\t\tvar csmatch=cstudent.match(/[0-9]{4}/g);\n\t\tvar breakdate=\"0\";\n\t\tfor (k=0;k<csmatch.length;k++) {\n\t\t\tif (csmatch[k]>niceDate(curdate) && k==0) {\n\t\t\t\treturn \"0\";\n\t\t\t}\n\t\t\tif (csmatch[k]>niceDate(curdate) && k>0) {\n\t\t\t\tbreakdate=csmatch[k-1];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (k==csmatch.length-1) {\n\t\t\t\tbreakdate=\"all\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (breakdate==\"0\") {\n\t\t\treturn \"0\";\n\t\t}\n\t\tif (breakdate!=\"all\") {\n\t\t\tvar repstr=\"(\"+breakdate+\":[0-9]*).*\";\n\t\t\tcstudent=cstudent.replace(new RegExp(repstr),\"$1\");\n\t\t}\n\t\tcstudent=cstudent.replace(/[^,]?[0-9]*:/g,\"+\");\n\t\tcstudent=cstudent.replace(/,/g,\"\");\n\t\treturn addbits(\"0\"+cstudent);\n\t} else {return \"0\";}\n}", "function leapyear(b_yr,c_yr){\n var leap_count =0;\n for(b_yr ; b_yr<=c_yr; b_yr++ ){\n if((b_yr%400 == 0)||(b_yr%100 != 0)&& (b_yr%4 == 0)){\n leap_count+=1;\n }\n }\n return leap_count;\n \n}", "function howManyLaunchesInYear(data, year){\n let launches = 0\n let launch_success = 0\n let successfulPayload = 0\n for (const element of data){\n if (element[\"launch_year\"] === year.toString()){\n launches++\n //1a)\n if (element[\"launch_success\"]){\n launch_success++\n //2)\n for (const payload of element[\"rocket\"][\"second_stage\"][\"payloads\"]){\n successfulPayload+=payload[\"payload_mass_kg\"]\n }\n }\n }\n }\n return \"\\nNumber of launches in \" + year + \": \" + launches + \n \"\\nSuccessful: \" + launch_success + \n \"\\nUnsuccessful: \" + (launches-launch_success) +//1b)\n \"\\nPayload: \" + successfulPayload + \"kg\"\n}", "function setYears(data, i) {\n return data.toString();\n}", "function numberOfAccidentsPerYear(accidents) {\n\n // map accidents by year\n var mapOfAccidentsPerYear = _.groupBy(accidents, 'dateYear');\n\n var numberOfAccidentsPerYear = {};\n\n _.each(mapOfAccidentsPerYear, function(accidentsPerYearArray, year) {\n\n numberOfAccidentsPerYear[year] = accidentsPerYearArray.length;\n\n });\n\n console.log(numberOfAccidentsPerYear);\n\n}", "function getYear() {\n var n = TAW.yearIndex;\n return TAW.allYears[n];\n }", "function getYear(dataItems) {\n\treturn dataItems.map(item => +item.substring(0, 4));\n}", "getYearNumerals(year) { return `${year}`; }", "get yearString(){\n if (parseInt(this.timeSavedMonthes/12) === 1){\n return 'YEAR'\n }\n return 'YEARS'\n }", "function sumYear(data) {\r\n var total = 0;\r\n\r\n // loop through passed data and sum it ...\r\n data.forEach(function (d, i) {\r\n var count = d.value.d;\r\n total = total + count;\r\n });\r\n\r\n return total;\r\n\r\n return;\r\n}", "function birthday(s, d, m) {\n let count = 0;\n\n for (let i = 0; i < s.length; i++) {\n let arr = s.slice(0 + i, m + i);\n\n if (arr.reduce((a, b) => a + b) === d) {\n count++;\n }\n }\n return count;\n}", "function nbYear(p0, percent, aug, p) { \n\n per = (percent/100)\n \n for ( var n = 0; p0 < p; n++) {\n \n p0 = p0 + (p0*per) + aug }\n \n return n\n }", "function getData(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'counties[county_index].droughtLevels' + year + '[' + i + '] += parseInt(datum.';\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'counties[county_index].dataCount' + year + '++;\\n'\r\n return result;\r\n }", "function getYear(date) {\n var year = date.substring(0, 2);\n return \"20\" + year;\n}", "function nbYear(p0, percent, aug, p) {\n\n const population = (pn,n = 0) =>\n {\n const pNext = pn*( 1 + (percent/100)) + aug \n return (pn >= p) ? n : population(pNext, n + 1)\n }\n \n return population(p0)\n}", "function nb_year(p0,percent, aug, p,){\n for (i = 0; i <= p ; i++){\n let years = p0 * (percent+1) + aug; \n return years;\n }\n}", "function getData2(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'countyObject.droughtLevels' + year + '[' + i + '] += parseInt(datum.'\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'countyObject.dataCount' + year + '++;\\n'\r\n return result;\r\n }", "function getYears(getFinals) {\n return getFinals(fifaData).map((x) => {\n return x.Year;\n });\n}", "function computeYear(inputYear) {\n if (inputYear) parseYear = `&primary_release_year=${inputYear}`;\n}", "function computeYear(inputYear) {\n if (inputYear) parseYear = `&primary_release_year=${inputYear}`;\n}", "function birthday(s, d, m) {\n\tlet count = 0;\n\tfor (let i = 0; i < s.length; i++) {\n\t\tlet sum = 0;\n\t\tlet slicedArray = s.slice(i, i + m);\n\n\t\tsum = slicedArray.reduce((acc, currV) => acc + currV);\n\t\tif (sum === d && slicedArray.length === m) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count;\n}", "function birthday(s, d, m) {\n let counter = 0;\n const reducer = (a, b) => a + b;\n for(let i = 0; i < s.length - m + 1; i++){\n if (s.slice(i,i + m).reduce(reducer) == d){\n counter++;\n }\n }\n return counter;\n}", "computeStudentCounts() {\n let passed = 0, vetCount = 0, firstYearCount = 0, alphaCount = 0;\n let vetStudents = [], binaryStudents = [];\n\n this.students.forEach((student) => {\n const studentPositions = {};\n\n if (!student.position_ids) {\n return;\n }\n\n // Figure out what teams the person belongs to, if any.\n student.position_ids.forEach((id) => {\n if (TITLE_MAP[id]) {\n studentPositions[TITLE_MAP[id]] = 1;\n }\n })\n\n const teams = Object.keys(studentPositions);\n if (teams.length > 0) {\n set(student, 'teamTitles', teams.join(', '));\n }\n\n // Count the students\n\n if (this.training.is_art) {\n if (student.is_art_prospective) {\n alphaCount++;\n binaryStudents.push(student);\n } else {\n vetCount++;\n vetStudents.push(student);\n }\n } else {\n if (student.years > 1) {\n vetCount++;\n vetStudents.push(student);\n } else {\n binaryStudents.push(student);\n\n if (student.years == 1) {\n firstYearCount++;\n } else {\n alphaCount++;\n }\n }\n }\n\n if (student.scored && student.passed) {\n passed++;\n }\n });\n\n // Sort the students\n vetStudents = this._sortByYearCallsign(vetStudents);\n binaryStudents = this._sortByYearCallsign(binaryStudents);\n\n this.vetCount = vetCount;\n this.passed = passed;\n this.firstYearCount = firstYearCount;\n this.alphaCount = alphaCount;\n\n this.studentGroups = [\n {\n groupName: 'Veterans',\n students: vetStudents\n },\n {\n groupName: (this.training.is_art ? 'ART Prospectives' : 'Binaries'),\n students: binaryStudents\n },\n ];\n }", "function countState(AddressBook) {\n const count = AddressBook.reduce(function (acc, current) {\n if (acc[current.state]) acc[current.state] = ++acc[current.state];\n else acc[current.state] = 1;\n return acc;\n }, {});\n console.log(count);\n}", "function getYearFromTransaction(transaction) { return transaction.transactionDate.substring(0, 2) }", "function countStateInArray(st, arr) {\n let count = 0;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] == st) {\n count++;\n }\n }\n return count;\n}", "function checkyearofcensus() {\r\n \r\n loadDate();\r\n\r\n}", "function displayStateInfo(st, yr){\n if (st == null){\n return;\n }\n console.log(\"Chosen state: \"+st+\", chosen year: \"+yr);\n var allCausesForState = [];\n data.forEach(function(d){\n if((d.year == yr)&&(d.state == stateCodeMap.get(st))){\n allCausesForState.push(d);\n }\n });\n var acs = allCausesForState.sort((a,b) => (a.deaths > b.deaths) ? -1 : 1);\n var resultHtml = \"<h3>Chosen state: \"+stateCodeMap.get(st)+\"</h3><h4>Total deaths: \"+acs[0].deaths+\"</h4><ul><li>\"+acs[1].causeName+\": \"+acs[1].deaths+\"</li><li>\"+acs[2].causeName+\": \"+acs[2].deaths+\"</li><li>\"+acs[3].causeName+\": \"+acs[3].deaths+\"</li><li>\"+acs[4].causeName+\": \"+acs[4].deaths+\"</li><li>\"+acs[5].causeName+\": \"+acs[5].deaths+\"</li><li>\"+acs[6].causeName+\": \"+acs[6].deaths+\"</li><li>\"+acs[7].causeName+\": \"+acs[7].deaths+\"</li><li>\"+acs[8].causeName+\": \"+acs[8].deaths+\"</li><li>\"+acs[9].causeName+\": \"+acs[9].deaths+\"</li><li>\"+acs[10].causeName+\": \"+acs[10].deaths+\"</li></ul>\"\n //var yr = d3.select(\"#chosenYear\").html();\n console.log(\"HTML: \"+d3.select(\"#stateInfo\").html(resultHtml));\n console.log(allCausesForState);\n}", "function getYear(station, year, cb) {\n const sqlQuery = 'SELECT * FROM \\`bigquery-public-data.noaa_gsod.gsod' + year + '\\` WHERE stn = \"' + toronto + '\"';\n\n const options = {\n query: sqlQuery,\n location: 'US',\n };\n\n function convert(f) {\n return parseInt((f - 32) * 5 / 9, 10)\n }\n\n // Runs the query\n bigquery.query(options).then(res => {\n let rows = res[0]\n // rows=rows.sort((a, b) => a.da < b.da ? -1 : 1)\n // rows=rows.sort((a, b) => a.mo < b.mo ? -1 : 1)\n rows = rows.map((o) => {\n let date = [o.year, o.mo, o.da].join('-')\n return {\n date: date,\n // temp: convert(o.temp),\n thunder: o.thunder === '1',\n // snow: o.sndp === 999.9 ? 0 : o.sndp,\n rain: o.prcp === 99.99 ? 0 : o.prcp,\n // pressure: o.stp, //=== 99.99 ? 0 : o.stp,\n }\n })\n rows = rows.sort((a, b) => a.date < b.date ? -1 : 1)\n cb(rows)\n })\n}", "function getYears () {\n var seconds = prompt(\"how many second?\");\n return((seconds/31536000).toFixed(5) + \" number of years\");\n }", "function countCode(string) {\n var count = 0;\n for (var i = 0; i < string.length - 3; i++) {\n // Get the current substring\n substr = string.substring(i, i + 4);\n // Replace the third character with a 'd'\n substr = substr.replaceAt(2, 'd');\n if (substr === 'code') {\n count++;\n }\n }\n return count;\n}", "function getYearsSE(earnings) {\n var substantialEarnings = getWepTables.substantialEarningsMarks()\n\n // NOTE: Assumption - years of substantial earnings includes years where the earnings amount is equal to the substantial earnings value?\n let years = 0;\n let substantialEarningsMap = {};\n if (Array.isArray(substantialEarnings)) {\n substantialEarnings.forEach((earning) => {\n substantialEarningsMap[earning.year]= earning.SubstantialEarnings;\n });\n }\n\n let earningsYears = Object.keys(earnings);\n if (Array.isArray(earningsYears)) {\n earningsYears.forEach((earningsYear) => {\n if (earnings[earningsYear] >= substantialEarningsMap[earningsYear]) {\n years++;\n }\n });\n }\n\n if (years === 0) {\n //MAYBE: default to 20 if no data\n console.warn(\"getYearsSE has returned the default value of 20, correct years could not be calculated\");\n return 20\n }\n\n return years;\n}", "function getYearFromAbbreviation(year) {\n return round(callDateGet(new date(), 'FullYear') / 100) * 100 - round(year / 100) * 100 + year;\n }", "function testDataSelection(curyear) {\n console.log(curyear);\n var sumStates = {};\n\n d3.csv(\"clean_data.csv\", function (csv) {\n csv = csv.filter(function (row) {\n return row['year'] <= curyear;\n })\n //console.log(\"data ready\");\n //console.log(csv);\n csv.forEach(function (i) {\n sumStates[i.state] = (sumStates[i.state] || 0) + 1;\n });\n //{ NY: 4, US: 3, SC: 1, NC: 1, KY: 1, …}\n testChoroplethColor(sumStates);\n\n });\n}", "changeYear(type) {\n //Copy the current year\n let cYear = this.state.year;\n //Get the next potential year\n if(type === \"INC\") {\n cYear = ++cYear;\n } else if(type === \"DEC\") {\n cYear = --cYear;\n }\n //Check if there's data for that year\n if(typeof this.state.scorecard.metrics[0].data[cYear] !== \"undefined\") {\n //If there is, change the state\n this.setState({year: cYear});\n }\n }", "function nextHappyYear(year){\n let numSet = new Set();\n while(numSet.size!==4){\n //resetting Set to size=0 in order to prepare for next year++\n numSet = new Set();\n year++\n let newArr = year.toString().split('').map(Number);\n newArr.map(x=>numSet.add(x));\n }\n //this is my fave line :)\n return parseInt([...numSet].join(''));\n}", "function getYearFromAbbreviation(year) {\n return round(callDateGet(getNewDate(), 'FullYear') / 100) * 100 - round(year / 100) * 100 + year;\n }", "function find_rownum_of_schoolName_in_dataset(aSchoolName, aDataSet) {\n\t\n\tif(aSchoolName == undefined) {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolName undefined!\");\n\t\treturn -4;\n\t}\n\telse if(aSchoolName == null) {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolName null!\");\n\t\treturn -3;\n\t}\n\telse if(typeof(aSchoolName) !== 'string') {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolName not a String!\");\n\t\treturn -2;\n\t}\n\tfor(var i = 0; i < aDataSet.length; i += 1) {\n\t\tif(aSchoolName.localeCompare(aDataSet[i].School) == 0) {\t// strings match\n\t\t\treturn i;\t// return row number\n\t\t}\n\t}\n\treturn -1;\t// return error, no match\n}", "function getYearVal(d) { return d[1]; }", "function nbYear(p0, percent, aug, p) {\n let years = 0;\n let population = p0;\n const growthRate = percent / 100;\n while (population < p) {\n population += population*growthRate + aug;\n years++;\n }\n return years\n}", "function getFilteredData(data, year, state) {\n return data.filter(function(d){return d.year == year;})\n}", "function getEnrollmentData(state) {\n //console.log(\"Getting state enrollment for \" + state);\n var result = -1;\n var index;\n for (index = 0; index < allStatesEnrollment.length; index++) {\n if (allStatesEnrollment[index].state === state) {\n result = index;\n break;\n }\n }\n if (result === -1) {\n //console.log(\"enrollment data not found for \" + state);\n } else {\n return allStatesEnrollment[result];\n }\n}", "function getYears() {\n\tconst retirementAge = 65;\n\tconst currentYear = new Date().getFullYear();\n\tconst baseYear = currentYear - retirementAge + 1;\n\treturn [...Array(65).keys()].map((index) => index + baseYear);\n}", "function getCounties(state) {\n\tvar counties = [];\n\treturn $.get( \"/get_counties/\"+ state)\n \t.done(function( data ) {\n\t\t\t$.each(data['counties'], function(key, county) {\n\t\t\t\tcounties.push(county);\n\t\t\t});\n \t});\n}", "function Student(name, major, yearInSchool, club) {\n this.name = name; // string, (e.g. \"Jim\", \"Pam\", \"Michael\")\n this.major = major; // string, (e.g. \"Computer Science\", \"Art\", \"Business\")\n this.yearInSchool = yearInSchool; // int, (e.g. 1, 2, 3, 4)\n this.club = club; // string, (e.g. \"Improv\", \"Art\")\n}", "function countingValleys(n, s) {\n var sArr=s.split('');\n var seaLevel = 0;\n var valley = 0;\n var counter = 0;\n var increment;\n while(counter!=n){\n if(sArr[counter]=='D'){\n increment =-1;\n }\n else if(sArr[counter]=='U'){\n increment = 1;\n }\n if(counter !=0 && seaLevel<0 && seaLevel+increment ==0){\n valley+=1;\n }\n seaLevel+=increment;\n counter+=1;\n }\n return valley;\n}", "function getPageCount(){\n\tlet studentCount = 0;\n\n\t//Loops through all students and for each which isn't deselected the loops adds one to the student counter.\n\tfor (var i = 0; i < studentList.length; i++) {\n\t\tif ($(studentList[i]).hasClass(\"deselected\") === false) {\n\t\t\tstudentCount++;\n\t\t}\n\t}\n\n\t//Calculates how many pages by taking the student count and divdeds it with studentsPerPage.\n\tpageCount = Math.ceil(studentCount / studentsPerPage);\n\n}", "function getData(year) {\n let data = [];\n for (let i = 0; i < dataJson.length; i++){\n if(dataJson[i][year] === \"No Law\") {\n data.push([dataJson[i].State, 1, \"Status: No Law\"]);\n }\n else if(dataJson[i][year] === \"Statutory Ban\") {\n data.push([dataJson[i].State, 2, \"Status: Statutory Ban\"]);\n }\n else if(dataJson[i][year] === \"Constitutional Ban\") {\n data.push([dataJson[i].State, 3, \"Status: Constitutional Ban\"]);\n }\n else {\n data.push([dataJson[i].State, 4, \"Status: Legal\"]);\n }\n }\n return data;\n}", "function changeYear() {\n let year = d3.select('#selected').property('value')\n buildMap(stateUrl,year)\n}", "function cowNumberWithLiveSpan(year, initNumber) {\n if(year < 1) {\n return 0\n }\n if(year == 1 | year == 2 | year == 3) {\n return year * initNumber\n }\n return cowNumberWithLiveSpan(year - 1, initNumber) + cowNumberWithLiveSpan(year - 3, initNumber) - cowNumberWithLiveSpan(year - 10, initNumber)\n}", "function getYears(id) {\n for (var i = 0; i < peopleArray.length; i++) {\n if (peopleArray[i].id == id) {\n var today = new Date();\n var yearStarted = new Date(peopleArray[i].startDate);\n var years = today.getFullYear() - yearStarted.getFullYear();\n var m = today.getMonth() - yearStarted.getMonth();\n\n if (m < 0 || (m === 0 && today.getDate() < yearStarted.getDate())) {\n years--;\n }\n return years;\n }\n }\n return '404';\n}", "function totalYearsLong(inventors) {\n var totalYears = 0;\n for (var i = 0; i < inventors.length; i++) {\n totalYears += inventors[i].year;\n }\n return totalYears;\n}", "function getYear(){\n\t//var d = new Date();\n\treturn currentYear;\t\n}", "changeYear(event) {\n this.setState({ year: parseInt(event.target.value) });\n }", "changeYear(event) {\n this.setState({ year: parseInt(event.target.value) });\n }", "function getData() {\n\n // Create new object for each year 2013-2019 \n for (let i = 2013; i <= latestYear; i++) {\n yearTotals[i] = { 'total': 0, 'total_new': 0, 'total_existing': 0, 'total_floyd': 0, 'total_clark': 0, 'total_harrison': 0, 'new_floyd': 0, 'new_clark': 0, 'new_harrison': 0, 'existing_floyd': 0, 'existing_clark': 0, 'existing_harrison': 0 };\n }\n\n for (const year in yearTotals) {\n dataList.forEach(person => {\n if (person[year] > 0) {\n if (person.first_added === parseInt(year)) {\n switch(person.primary_county) {\n case 'Floyd':\n yearTotals[year].new_floyd++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Floyd++;\n countyTotals.Total++;\n break;\n case 'Clark':\n yearTotals[year].new_clark++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Clark++;\n countyTotals.Total++;\n break;\n case 'Harrison':\n yearTotals[year].new_harrison++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Harrison++;\n countyTotals.Total++;\n break;\n default:\n break;\n }\n } else {\n switch(person.primary_county) {\n case 'Floyd':\n yearTotals[year].existing_floyd++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n case 'Clark':\n yearTotals[year].existing_clark++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n case 'Harrison':\n yearTotals[year].existing_harrison++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n default:\n break;\n }\n }\n }\n });\n }\n}", "function startOfYearPeriod(date, years) {\n /* @see https://en.wikipedia.org/wiki/Year_zero#ISO_8601 */\n var year = new Date(date).getFullYear();\n return Math.floor(year / years) * years;\n } // pattern for format parts", "function getYears (seconds) {\nreturn (seconds/31536000).toFixed(5) + \" number of years\";\n}", "getBirthYearForUserProvidedValue(birthYear) {\n // Prepend 0 as necessary\n if (birthYear >= 0 && birthYear <= 9) {\n return parseInt(`200${birthYear}`, 10);\n } else if (birthYear >= 10 && birthYear <= 99) {\n if (parseInt(`20${birthYear}`, 10) > this.nowFunction().getFullYear()) {\n return parseInt(`19${birthYear}`, 10);\n } else {\n return parseInt(`20${birthYear}`, 10);\n }\n }\n\n return birthYear;\n }", "getYears(dates) {\n const year_array = [];\n dates.forEach((date) => {\n const dateKey = this.findKeyInObject(date);\n let curr_year = date[dateKey].slice(0, 4);\n if (year_array.length === 0) {\n year_array.push(curr_year);\n } else if (!this.checkIfExist(year_array, curr_year)) {\n year_array.push(curr_year);\n }\n });\n this.setState({\n years: year_array,\n });\n }", "function createArrayOfStateCountsFromPlayerCollegeCounts(some_player_college_counts, us_states) {\n\t\n\tvar sum = 0;\n\tvar sum_states = [];\n\t\n\t// us_states arg:\n\t// 50 rows and 4 cols:\n\t// state, state_fullname, state_fullname_upper, country\n\tfor(var s = 0; s < us_states.length; s += 1) {\n\t\t\n\t\tvar thisState = us_states[s].state;\n\t\tvar thisStateLongName = us_states[s].state_fullname;\n\t\tvar aStateObject = new Object();\n\t\t\n\t\taStateObject.state = clone(thisState);\n\t\taStateObject.state_fullname = clone(thisStateLongName);\n\t\tvar count = determineStateCount(thisStateLongName, some_player_college_counts);\n\t\taStateObject.player_count = clone(count);\n\t\t\n\t\tsum_states[s] = aStateObject;\n\t}\n\treturn sum_states;\t\t// return sum total of players who played college baseball in that state\n}", "function getGlobalYearfromMaps() {\n\tvar years = Array.from(new Set(getYearsfromMaps())); // get unique years from #mapN .map_year\n\tvar year = \"none\";\n\t//if (years.length == 5) year = \"each\";\n\tif (years.length == (app.m - 1)) year = \"each\";\n\tif (years.length == 1) year = years[0];\n\treturn year;\n}", "function calculateAge(str){\n \n var a = new Date(),\n yearNow= a.getFullYear(),\n monthNow= a.getMonth()+1,\n dateNow= a.getDate();\n\n var b= new Date(str),\n yearB= b.getFullYear(str),\n monthB= b.getMonth(str)+1,\n dateB= b.getDate(str);\n\n var age= 0; \n if(monthNow > monthB){\n age =yearNow- yearB;\n } \n else if(monthNow == monthB){\n \n if(dateNow>= dateB){\n age = yearNow - yearB;\n }\n else {\n age = yearNow - yearB - 1;\n }\n }\n else {\n age = yearNow- yearB -1;\n }\n console.log(age) ;\n}", "function allSchoolYearStarts(dateRange) {\n // dateRange: A 2-element array of Moment objects.\n // returns: An array of integers, each school year in the range.\n const schoolYearStarts = _.map(dateRange, toSchoolYear);\n return _.range(schoolYearStarts[0], schoolYearStarts[1] + 1);\n}", "function returnYearIndicator(date) {\n var date = dateFromISO8601(date);\n var yearIndicator = date.split(\"/\");\n return yearIndicator[2];\n }", "function getYear(film) {\n let rok = film.split(\" (\")[1]; // tu bedzie z nawiasem zamykajacym\n rok = rok.split(\")\")[0];\t // a tu wywalamy ten nawias zamykajacy\n return rok;\n}", "function find_rownum_of_schoolID_in_dataset(aSchoolID, aDataSet) {\n\t\n\tif(aSchoolID == undefined) {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolID undefined!\");\n\t\treturn -44;\n\t}\n\telse if(aSchoolID == null) {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolID null!\");\n\t\treturn -33;\n\t}\n\telse if(typeof(aSchoolID) !== 'string') {\n\t\tconsole.log(\"\\nSTRING ERROR: aSchoolID not a String!\");\n\t\treturn -22;\n\t}\n\tfor(var i = 0; i < aDataSet.length; i += 1) {\n\t\tif(aSchoolID.localeCompare(aDataSet[i].schoolID) == 0) {\t// strings match\n\t\t\treturn i;\t// return row number\n\t\t}\n\t}\n\treturn -1;\t// return error, no match\n}", "function nbYear(p0, percent, aug, p) {\n let newPopulation = p0\n let index = 0\n \n while(newPopulation < p){ //use a while loop because we are trying to make a condition true\n newPopulation += newPopulation * (percent/100) + aug \n index++\n }\n return index\n}", "function year(datums) {\n listYear = []\n listMaand = []\n for (var i = 0; i < datums.length; i++) {\n var date = datums[i]\n var maand = date.substring(4, 6)\n listMaand.push(maand)\n var year = date.substring(0, 4)\n listYear.push(year)\n }\n return [listMaand, listYear]\n}", "stateCode(state) {\n switch(state) {\n case 'AL':\n state = 'Alabama';\n break;\n case 'FL':\n state = 'Florida';\n break;\n case 'CA':\n state = 'California';\n break;\n case 'CO':\n state = 'Colorado';\n break;\n case 'NY':\n state = 'New York';\n break;\n case 'WA':\n state = 'Washington';\n break;\n }\n return state\n }", "function getStateID(abbrev)\n{\n\tif(abbrev == \"AL\"){ return 0;}\n\tif(abbrev == \"AK\"){ return 1;}\n if(abbrev == \"AZ\"){ return 2;}\n if(abbrev == \"AR\"){ return 3;}\n if(abbrev == \"CA\"){ return 4;}\n if(abbrev == \"CO\"){ return 5;}\n if(abbrev == \"CT\"){ return 6;}\n if(abbrev == \"DE\"){ return 7;}\n if(abbrev == \"DC\"){ return 8;}\n if(abbrev == \"FL\"){ return 9;}\n\tif(abbrev == \"GA\"){ return 10;}\n\tif(abbrev == \"HI\"){ return 11;}\n\tif(abbrev == \"ID\"){ return 12;}\n\tif(abbrev == \"IL\"){ return 13;}\n\tif(abbrev == \"IN\"){ return 14;}\n\tif(abbrev == \"IA\"){ return 15;}\n\tif(abbrev == \"KS\"){ return 16;}\n\tif(abbrev == \"KY\"){ return 17;}\n\tif(abbrev == \"LA\"){ return 18;}\n if(abbrev == \"ME\"){ return 19;}\n if(abbrev == \"MD\"){ return 20;}\n\tif(abbrev == \"MA\"){ return 21;}\t\n\tif(abbrev == \"MI\"){ return 22;}\t\t\n\tif(abbrev == \"MN\"){ return 23;}\t\t\n\tif(abbrev == \"MS\"){ return 24;}\t\n\tif(abbrev == \"MT\"){ return 25;}\n\tif(abbrev == \"MO\"){ return 26;}\n\tif(abbrev == \"NE\"){ return 27;}\n if(abbrev == \"NV\"){ return 28;}\n if(abbrev == \"NH\"){ return 29;}\n if(abbrev == \"NJ\"){ return 30;}\n if(abbrev == \"NM\"){ return 31;}\n if(abbrev == \"NY\"){ return 32;}\n if(abbrev == \"NC\"){ return 33;}\n if(abbrev == \"ND\"){ return 34;}\n\tif(abbrev == \"OH\"){ return 35;}\n\tif(abbrev == \"OK\"){ return 36;}\n\tif(abbrev == \"OR\"){ return 37;}\n\tif(abbrev == \"PM\"){ return 38;}\n\tif(abbrev == \"PA\"){ return 39;}\n if(abbrev == \"RI\"){ return 40;}\n if(abbrev == \"SC\"){ return 41;}\n if(abbrev == \"SD\"){ return 42;}\n if(abbrev == \"TN\"){ return 43;}\n if(abbrev == \"TX\"){ return 44;}\n if(abbrev == \"UT\"){ return 45;}\n if(abbrev == \"VT\"){ return 46;}\n\tif(abbrev == \"VA\"){ return 47;}\n\tif(abbrev == \"WA\"){ return 48;}\n\tif(abbrev == \"WV\"){ return 49;}\n\tif(abbrev == \"WI\"){ return 50;}\n\tif(abbrev == \"WY\"){ return 51;}\n}", "yearToAcademicYear () {\n return this + \"-\" + (Number(this) + 1).toString().slice(-2);\n }", "function year_increment(){\n\t\tif(pymt_num === 1){\n\t\t\tyear++;\n\t\t\treturn 1;\n\t\t}\n\t\telse if(pymt_num % 12 === 0){\n\t\t\treturn year++;\n\t\t}else {\n\t\t\treturn '';\n\t\t}\n\t}", "function getYearPublished(yearObj){\n //takes in an objects and returns the value behind the \"year_published\" key\n var year = yearObj.year_published;\n return year; // similar setip to prev #87\n}", "function getAge(dateString) {\n var today = new Date();\n var birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n}", "function getAge(dateString){\n var today = new Date();\n var birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n}", "function getAge(dateString) {\n\n var dates = dateString.split(\"/\");\n var d = new Date();\n\n var userday = dates[0];\n var usermonth = dates[1];\n var useryear = dates[2];\n\n var curday = d.getDate();\n var curmonth = d.getMonth()+1;\n var curyear = d.getFullYear();\n\n var age = (curyear - useryear) + 1;\n\n if((curmonth < usermonth) || ( (curmonth == usermonth) && curday < userday )){\n\n age--;\n\n }\n\n return age;\n}", "function isYear(year){\n if(a%100==0 && a%400==0){\n return 'leap year';\n }else if(a%100!=0 && a%4==0){\n return 'leap year';\n }else{\n return 'not leap year';\n }\n}", "function list_pairwize_year(){\n pairwize_year=[];\n if(i_word>-1){\n\tfor(var i=0;i<pairwize[i_word];i++){\n\t if(data_json_w['links'][i]['y']===year){\n\t\tsource=data_json_w['links'][i]['s'];\n\t\ttarget=data_json_w['links'][i]['t'];\n\t\tsource=data_json['LL'][source]['continent'];\n\t\ttarget=data_json['LL'][target]['continent'];\n\t\tif((source===continent_1 && target===continent_2) || (source===continent_2 && target===continent_1) || continent_1==='all' || continent_2==='all'){\n\t\t pairwize_year.push(i);\n\t\t}\n\t }\n\t}\n }\n n_pairwize_year=pairwize_year.length;\n}", "async function updateStatewiseDataFromCovid19IndiaOrg() {\n const valueMapper = (hdr, value) => {\n if (value === undefined) return undefined;\n\n hdr = hdr.toLowerCase().trim();\n if (hdr === \"state\") return [\"state\", value];\n else if (hdr === \"confirmed\") return [\"confirmed\", parseInt(value)];\n else if (hdr === \"recovered\") return [\"recovered\", parseInt(value)];\n else if (hdr === \"deaths\") return [\"deaths\", parseInt(value)];\n else if (hdr === \"active\") return [\"active\", parseInt(value)];\n };\n const sheetId = COVID19_DATASHEET_ID;\n const cellRange = \"Statewise!A:E\";\n let data = await getGoogleSheetData(sheetId, cellRange, valueMapper);\n let lastValidIndex = data.length;\n while (lastValidIndex-- > 0) {\n const record = data[lastValidIndex];\n if (Object.keys(record).length > 1) break;\n }\n data = data.slice(0, lastValidIndex+1);\n const totalEntry = data[0];\n delete totalEntry[\"state\"];\n data = data.slice(1, data.length);\n const statewiseResponse = { total: totalEntry, statewise: data };\n updateUnofficialSource(\"covid19india.org\", statewiseResponse, 'statewise');\n}", "function getYears(dataArray) {\n\n return dataArray.map(function(item){\n return item.Year;\n })\n}", "function getAge(dateString) {\n var today = new Date();\n var birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n}", "function hseSkills(branch, generation, sprint) {\n var students = data[branch][generation]['students'];\n var totalStudentsActive = 0;\n var totalStudentSprint = 0;\n for (var i = 0; i < students.length; i++) {\n var quantitySprints = students[i]['sprints'];\n if (students[i].active) {\n for (var j = 0; j < quantitySprints.length; j++) {\n if (quantitySprints[j]['number'] === sprint && quantitySprints[j]['score']['hse'] >= 840) {\n totalStudentSprint++;\n }\n }\n }\n }\n return totalStudentSprint;\n }", "countQuakes (data, statesObj) {\n return data.features.map(quake => {\n //split string and extract quake location\n //return array of locations\n let place = quake.properties.place.split(', ');\n return place[place.length - 1];\n }).map(occurred => {\n //if location was an abbrev, return corresponding full state name\n let index = statesObj.abbrevs.indexOf(occurred);\n if (index > -1) return statesObj.states[index]; \n else return occurred;\n }).reduce((accumulator, location) => {\n //build accumulator object to tally quakes by location\n //return object with key of location, value of #quakes occurred\n const lower = location.toLowerCase();\n if (accumulator[lower]) { \n accumulator[lower]++;\n return accumulator; \n } else { \n accumulator[lower] = 1;\n return accumulator; \n }\n }, {});\n }", "function getAge(dateString) {\n\tvar today = new Date();\n\tvar birthDate = new Date(dateString);\n\tvar age = today.getFullYear() - birthDate.getFullYear();\n\tvar m = today.getMonth() - birthDate.getMonth();\n\tif (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n\t\tage--;\n\t}\n\treturn age;\n}", "function getYear(storm) {\n var date = new Date(storm.data[0].date);\n return date.getFullYear();\n }", "function getYear(){\n var today = timezone().tz(\"America/Vancouver\").format(\"L\");\n var yyyy = today.slice(6);\n\n return yyyy;\n}", "function findStudentIndex(studentName) {\n for (var i = 0; i < courseInfo.courseStudents.length; i++) {\n if (courseInfo.courseStudents[i].name === studentName){\n return i;\n }\n }\n}", "function getYears(cb) {\n const finalsYears = cb.map((final) => {\n return final.Year;\n });\n // console.log(\"TASK #3\", finalsYears);\n return finalsYears\n}", "function nextHappyYear(year) {\n do {\n year++;\n var s = year.toString();\n }\n while (\n s[0] == s[1] ||\n s[0] == s[2] ||\n s[0] == s[3] ||\n s[1] == s[2] ||\n s[1] == s[3] ||\n s[2] == s[3]\n )\n return year;\n}", "function updateNumbers() {\n document.querySelector(\"[data-field=numberGryffindor]\").textContent = allStudents.filter((student) => student.house === \"Gryffindor\").length;\n document.querySelector(\"[data-field=numberSlytherin]\").textContent = allStudents.filter((student) => student.house === \"Slytherin\").length;\n document.querySelector(\"[data-field=numberHufflepuff]\").textContent = allStudents.filter((student) => student.house === \"Hufflepuff\").length;\n document.querySelector(\"[data-field=numberRavenclaw]\").textContent = allStudents.filter((student) => student.house === \"Ravenclaw\").length;\n}", "function callAPIForState() {\n let iterator = \"01\";\n let get_country_string = [];\n\n for (let i = 0; i < 56; i++) {\n if (i === 3 || i === 7 || i === 14 || i === 43 || i === 52) {\n continue; // not associated with state, move to next iteration\n } else {\n if (i < 10) {\n iterator = \"0\" + i;\n } else { // else if greater than 10\n iterator = i;\n }\n get_country_string[i] = 'LASST' + iterator + '0000000000003';\n }\n }\n get_country_string[56] = 'LASST720000000000003'; // Count puerto rico as #56\n\n\n // return the api url for use with effect fetch\n // return 'https://api.bls.gov/publicAPI/v2/timeseries/data/' + get_country_string +\n // '?registrationkey=' + API_KEY + '&startyear=2020&endyear=2020';\n return get_country_string; // return list of API codes for retrieval\n}", "function lifespan(person){\n var birth = new Date(person.getBirthDate()),\n death = new Date(person.getDeathDate());\n var lifespan = '';\n if(birth && birth.getFullYear()){\n lifespan += birth.getFullYear();\n }\n if(death && death.getFullYear()){\n if(lifespan){\n lifespan += ' - ';\n }\n lifespan += death.getFullYear();\n }\n return lifespan;\n }", "function countCity(AddressBook) {\n const count = AddressBook.reduce(function (acc, current) {\n if (acc[current.city]) acc[current.city] = ++acc[current.city];\n else acc[current.city] = 1;\n return acc;\n }, {});\n console.log(count);\n}" ]
[ "0.59928185", "0.5751827", "0.56746644", "0.55173886", "0.54779744", "0.54779744", "0.544003", "0.53880924", "0.5353189", "0.5349633", "0.5332062", "0.531892", "0.5275218", "0.52262175", "0.5222822", "0.5198719", "0.5192834", "0.51871246", "0.51866966", "0.51818204", "0.51739985", "0.5160881", "0.5160629", "0.5149714", "0.5143387", "0.5143387", "0.51382643", "0.51358366", "0.5133002", "0.51322937", "0.51173717", "0.5114792", "0.5112151", "0.51119703", "0.51096725", "0.50978076", "0.50867605", "0.50816065", "0.5070156", "0.5033576", "0.50163263", "0.5004995", "0.5004129", "0.4998368", "0.49953055", "0.49802962", "0.4976905", "0.49601108", "0.49456593", "0.49427944", "0.49399292", "0.49335033", "0.49311408", "0.49271336", "0.4895179", "0.4893892", "0.4892041", "0.48789638", "0.48759538", "0.48753285", "0.48753285", "0.4874707", "0.48745504", "0.4867076", "0.48438206", "0.48375103", "0.4817375", "0.48173472", "0.48130912", "0.48126453", "0.48062178", "0.48060974", "0.4805304", "0.48036367", "0.47920018", "0.47889397", "0.4778602", "0.47715062", "0.47665793", "0.4764051", "0.47615224", "0.47605035", "0.47601023", "0.47539476", "0.4751965", "0.47495365", "0.47442335", "0.47437668", "0.4740248", "0.47383067", "0.47377342", "0.47321588", "0.4731643", "0.47293943", "0.47279033", "0.47248375", "0.4721276", "0.4704052", "0.4703824", "0.4701824" ]
0.6153663
0
adds numbers in a string
function addbits(s){ var total= 0, s= s.match(/[+\-]*(\.\d+|\d+(\.\d+)?)/g) || []; while(s.length){ total+= parseFloat(s.shift()); } return total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addDigit(str) {\n return str.split('').map(str => parseInt(str)).reduce((acc, el)=> acc+el, 0);\n}", "function add(input) {\n const [a, b] = input.split(' ');\n return Number(a) + Number(b);\n}", "function add(a,b) {\r\n let [a_str, b_str] = [a, b].map((e) => e.split('').reverse().join(''))\r\n let number = 0\r\n let result = []\r\n for (let i = 0; i < (a.length > b.length ? a.length : b.length); i++) {\r\n let sum = ((+a_str[i] || 0) + (+b_str[i] || 0) + number)\r\n number = sum > 9 ? Math.floor(sum / 10) : 0\r\n result.push(sum % 10)\r\n }\r\n if (number !== 0) result.push(number)\r\n return result.reverse().join('')\r\n}", "function add (stringOfNumbers) {\n var sum = 0\n var arrayOfNumbers = stringOfNumbers.split(',')\n\n for (var i = 0; i < arrayOfNumbers.length; i += 1) {\n sum += parseInt(arrayOfNumbers[i], 10)\n }\n\n return sum\n}", "function incrementString(strng) {\n let numberString = \"\"\n let wordsString = \"\"\n let array = strng.split(\"\")\n\n for(i = 0; i < array.length; i++){\n if (isNaN(array[i]))\n wordsString+=array[i]\n else\n numberString+=array[i]\n }\n \n if (numberString != \"\")\n return wordsString + zero(numberString)\n else\n return wordsString + \"1\"\n \n}", "function NumberAddition(str) {\n\n//remove any non numbers, leave a gap between to distinguish sets of numbers\nvar n = str.replace(/[^0-9]/g, \" \");\n\n//create array, note any nonnumbers will show up in array as \"\". ex. [,,1,,21,]\nvar arr = n.split(\" \");\nvar filtered = [];\nvar answer = 0;\n\n//remove empty strings\nfor (var i = 0; i < arr.length; i++) {\n if (arr[i] !== \"\") {\n filtered.push(arr[i]);\n }\n}\n//!!!All of the above can be achieved by the following!!!\n//str.match returns an array with patterns it finds\n//the + sign means include more than one digit together as a single pattern\n// || [0] means if no matches are found, better = [0]\nvar better = str.match(/[0-9]+/g)|| [0];\n\n//add the numbers in the array. Note they are strings and must be explicitely coerced\nfor (var y = 0; y < better.length; y++) {\n answer += Number(better[y]);\n}\n\nreturn answer;\n}", "function add(a, b) {\n var res = '', c = 0\n a = a.split('')\n b = b.split('')\n while (a.length || b.length || c) {\n c += ~~a.pop() + ~~b.pop()\n res = c % 10 + res\n c = c > 9\n }\n return res \n}", "function addStrings(num1, num2){\n num1 = parseInt(num1);\n num2 = parseInt(num2);\n return num1 + num2;\n}", "function incrementString (strng) {\n // First pull just the word\n const onlyWord = strng.replace(/\\d+/g, '')\n // Second pull just the number\n let num = strng.slice(onlyWord.length) || \"0\"\n // then get the length of the number to be used to fill in 0s if necessary\n const numbersLength = strng.length - onlyWord.length\n // Next lines, converts to int, increments 1 and then back to string\n num = parseInt(num)\n num++\n num = num.toString()\n // fills in 0s if needed\n while (num.length < numbersLength) {\n num = \"0\" + num\n }\n return onlyWord + num\n}", "function add(s) {\n if (s !== null && s !== '') {\n splitValues = s.split(/,|\\n/);\n return splitValues.reduce((a, b) => a + Number(b), 0);\n } else {\n return 0;\n }\n}", "function incrementString (str) {\n if(str === \"\") {\n return \"1\"\n }\n\n let regex = /[0-9]/g\n let num = str.match(regex)\n\n if (num === null) {\n return str + \"1\"\n }\n\n let remover = num.length\n let numbers = num.join('')\n let zeros = \"\"\n\n for (let i = 0; i < remover; i++){\n zeros += \"0\"\n }\n\n\n let plusOne = (+numbers) + 1\n let numString\n\n if(plusOne.toString().length > zeros.length) {\n numString = plusOne\n } else {\n numString = (zeros + plusOne).slice(-remover)\n }\n\n return str.substring(0, str.length - remover) + numString\n\n}", "function add(numstr1, numstr2){\n const lengthNum1 = numstr1.length;\n const lengthNum2 = numstr2.length;\n const diffLen = Math.abs(lengthNum1 - lengthNum2);\n\n let carryOver = 0; \n let i = Math.max(lengthNum1 - 1, lengthNum2 - 1);\n const result = [];\n while(i >= 0 || (i === -1 && carryOver > 0)) {\n if(i >= 0) {\n let num1;\n let num2;\n if(lengthNum1 > lengthNum2) {\n num1 = numstr1[i];\n if(i - diffLen >= 0){\n num2 = numstr2[i - diffLen];\n } else {\n num2 = \"0\";\n }\n } else {\n if(i - diffLen >= 0){\n num1 = numstr1[i - diffLen];\n } else {\n num1 = \"0\";\n }\n num2 = numstr2[i];\n }\n const added = parseInt(num1) + parseInt(num2) + carryOver;\n if(added > 9) {\n const digit = added % 10;\n carryOver = Math.floor( added / 10);\n result.push(digit);\n } else {\n carryOver = 0;\n result.push(added);\n }\n i--;\n } else {\n for(let c = carryOver.toString().length - 1; c >= 0; c--){\n result.push(carryOver.toString()[c]);\n }\n carryOver = 0;\n }\n }\n const final = result.reverse();\n return final.join(\"\");\n}", "function add(a, b) {\n let result = '';\n let s1 = padStrings(a, b)[0];\n let s2 = padStrings(a, b)[1];\n let isTen = false;\n for (let i = 0; i < s1.length; i++) {\n let temp =\n parseInt(s2[s2.length - i - 1]) + parseInt(s1[s1.length - i - 1]);\n if (isTen) {\n temp += 1;\n isTen = false;\n }\n if (temp >= 10) {\n isTen = true;\n temp = temp % 10;\n }\n result = temp.toString() + result;\n }\n if (isTen) {\n result = '1' + result;\n }\n return result;\n}", "function incrementString (string) {\n\n var numberPattern = /\\d+/g;\n lastChar = parseInt(string.substr(string.length - 1), 10);\n\n if (lastChar >= 0) {\n var matches = parseInt(string.match(numberPattern)[0]) + 1;\n var slicer = matches.toString().length * -1;\n\n if(string.match(numberPattern)[0].length < matches.toString().length) {\n slicer += 1; \n }; \n \n return string.slice(0, slicer) + matches; \n } else {\n return string + 1; \n }\n}", "function changeNumInString(str, isIncreasing) {\n\t\n var firstNumIndex = str.search(/\\d/g);\n if(firstNumIndex == -1) {\n return str;\n }\n var head = str.substr(0,firstNumIndex);\n var temp = str.substr(firstNumIndex);\n var lastNumIndex = temp.search(/\\D/g);\n var num = temp.substr(0,lastNumIndex);\n\t\n\tif(isIncreasing) {\n\t\tnum++;\n\t}\n\telse {\n\t\tnum--;\n\t}\n\t\n var tail = temp.substr(lastNumIndex);\n var reformedStr = head + num + tail;\n //alert(\"head\" + head + \"num: \" + num + \" tail \" + tail);\n return reformedStr;\n}", "function incrementString(strng) {\n for (let i = 0; i < strng.length; i++) {\n if(Number.isInteger(strng.charAt(i))){\n \n }\n }\n}", "function addDigit(num){\n value = Number(value.toString() + num.toString());\n draw();\n}", "function getSpotNumber(s) // paramwret is a string\r\n{\r\n var number = new String('');\r\n \r\n for(var i = 0; i < s.length; i++)\r\n {\r\n if( (s.charAt(i) >= '0') && (s.charAt(i) <= '9') )\r\n number += s.charAt(i);\r\n }\r\n return number; // return a string\r\n}", "function incrementString2(str) {\n var numStr = str.match(/0?[1-9]\\d*$/);\n console.log(numStr)\n if (!numStr) {return str + '1'}\n var prefix = str.split(numStr)[0];\n var numOrg = Number(numStr[0]);\n var numInc = numOrg + 1;\n \n console.log('prefix ' + prefix)\n console.log('numStr[0] ' + numStr)\n console.log('numOrg ' + numOrg)\n console.log('numInc ' + numInc)\n \n if (numInc.toString().length > numOrg.toString().length && numStr[0].indexOf('0') === 0) {\n return prefix + numInc;\n }\n if (numStr[0].indexOf('0') === 0) {return prefix + '0' + numInc;}\n else {return prefix + numInc;}\n}", "function add(num){\n return num<10? \"0\"+num:num;\n }", "function NumberAddition(str) {\n // First we charge our input string into an array by splitting it at every alphabetic character.\n // Note that this regex expression will match any capital or lowercase letter.\n str = str.split(/[a-zA-Z]/);\n // Next, we declare a sum variable to hold our answer.\n var sum = 0;\n\n // After that, we loop through each element in our modified array...\n for (var i = 0; i < str.length; i++) {\n // ...and if it isn't an empty string...\n if (str[i] !== \"\") {\n // ...we parse its value with parseInt and add it to our answer.\n sum += parseInt(str[i]);\n }\n }\n\n // Finally, we return our answer\n return sum;\n}", "function replaceNum(num) // Parses an int of format 123456 to an string in format 123,456 \r\n{\r\n\tvar string = String(num);\r\n\tvar temp = \"\";\r\n\tvar lentxt = string.length - ((String(Math.abs(num))).length) ; // different length between String and number \r\n\t\r\n\tfor ( j=string.length ; j > lentxt; j = j-3)\r\n\t{\r\n\t\tif (j-3 <= lentxt ) {temp = string.substring(0 , j) + temp}\r\n\t\telse\t\t\t\t{temp = unitSeparator + string.substr(j-3, 3) + temp}\r\n\t}\r\n\treturn temp;\r\n}", "function addNumber(event){ \n let str = event.target.id;\n number = str.charAt(3);\n let text =document.getElementById(\"txt\");\n text.value=text.value+number; \n \n}", "function sumFromString(str){\n var nums = str.match(/\\d+/g);\n if (nums == null){\n return 0;\n } else {\n var sum = 0;\n for (var i = 0; i < nums.length; i ++){\n sum += Number(nums[i]);\n }\n return sum;\n }\n}", "function adding(time){\r\n time = String(time)\r\n if(time.length===1)\r\n time = '0'+time\r\n return time\r\n}", "function incrementString (strng) {\n let array = strng.split(\"\");\n if (isNaN(array[array.length - 1])) {\n return strng + \"1\";\n } else {\n let match = strng.match(/\\d+$/);\n match = match[0];\n return match;\n }\n}", "function multyString(string, number) {\n var result = \"\";\n\n for (var i = 1; i <= number; i++){\n result += a;\n }\n\n return result;\n}", "function sum(number) {\n var digits = String(number).match(/./g);\n \n return digits.reduce(function(total, char) {\n return total += Number(char);\n }, 0);\n \n}", "function numberLetters (str) {\n var newStr = '';\n for(var i = 0 ; i < str.length ; i++){\n if(str[i] === '1'){\n newStr = newStr + 'i';\n }else if(str[i] === '4'){\n newStr = newStr + 'a'\n }else if(str[i] === '3'){\n newStr = newStr + 'e'\n }else if(str[i] === '7'){\n newStr = newStr + 'u'\n }else if(str[i] === '0'){\n newStr = newStr + 'o'\n }else{\n newStr = newStr + str[i]\n }\n }\n return newStr\n}", "function digitSum (str) {\n if (str.length === 1) { return str; }\n else {\n let out = str;\n do {\n out = (out+'').split('').map(el => +el).reduce((a, b) => a + b);\n } while ((out+'').length > 1);\n return out+'';\n }\n}", "function stringToNumber(s){\n //'121'\n var number = 0;\n for (var i=0; i< s.length ; i++){\n number += parseInt(s[i]) * Math.pow(10,s.length-i-1);\n }\n return number;\n}", "function incrementString(str) {\n var m = str.match(/^(\\w*?)(\\d*)$/);\n var next = (parseInt('0' + m[2],10) + 1) + '';\n return m[1] + m[2].slice(0, -next.length) + next;\n}", "function addsum(n) {\n let sum = 0;\n let parts = n.split('+');\n console.log(parts.length);\n \n for (let i = 0; i < parts.length; i++) {\n \n let num= parseInt(parts[i]);\n sum += num;\n }\n return sum\n}", "add() {\n var sum = 0;\n // Extracting the number in the string\n if (typeof arguments[0] == \"string\") {\n if (arguments[0].match(/\\d+/)) {\n let slot_num = arguments[0].match(/\\d+/);\n slot_num = Number(slot_num);\n sum = this.get_slot(slot_num) + arguments[1];\n return sum;\n }\n }\n if (arguments[0] == \"LAST\") {\n sum = arguments[1] + this.last();\n return sum;\n }\n for (let i = 0; i < arguments.length; i++) {\n sum += arguments[i];\n }\n this.lastNumber = sum;\n return sum;\n }", "function numString(total, num) {\n return total + num.toString();\n}", "function addCountAmount(string, char, count) {\n for (let i = 1; i <= count; i++) {\n string += char;\n }\n\n return string;\n}", "function digitSum(st)\n {\n let sum = 0;\n for(let i = 0; i<st.length; i++)\n {\n sum+=Number(st.charAt(i));\n }\n return sum.toString();\n\n }", "function add(a, b) {\n\tif (b == '.') {//if . is the \"number\"\n\t\tif (addDot) {//if we didnt add dot yet to this number\n\t\t\taddDot = false;\n\t\t\ta += b;\n\t\t}\n\t}\n\telse if (b == '0' && !addDot)//if b is 0 and there is a dot add the 0\n\t\ta += b;\n\telse {\n\t\ta = parseFloat(a + b).toString();\n\t}\n\treturn a;\n}", "function addTwoDigits(values) {\n const nums = values.toString().split('')\n return nums.reduce((i, sum) => Number(i) + Number(sum))\n}", "function stringToIntegerAlt(string) {\n numberCharacters = string.split('').filter((element) => (element >= '0' && element <= '9'))\n return +numberCharacters.join('');\n}", "function sumDigits(num)\n{\n// declaring variable for array and setting it equal to and array of the letters\n var arr = num.toString().split(\"\");\n\n// initialize the sum\n var sum = 0;\n// for loop that adds the digits\n for(var i = 0; i<arr.length; i++) {\n // add each digit to the sum of previous digits\n\t sum = sum + parseInt(arr[i]);\n }\nreturn sum;\n}", "function add(n) {\n let ans = 0;\n while(n) {\n ans += (n % 10) * (n % 10);\n n /= 10;\n n = parseInt(n.toString());\n }\n return ans;\n }", "function replaceNum(num)\r\n{\r\n\tvar string = String(num);\r\n\tvar temp = \"\";\r\n\tvar lentxt = string.length - ((String(Math.abs(num))).length) ; // different length between String and number \r\n\t\r\n\tfor ( j=string.length ; j > lentxt; j = j-3)\r\n\t{\r\n\t\t\r\n\t\tif (j-3 <= lentxt ) temp = string.substring(0 , j) + temp;\r\n\t\telse\t\t\t\ttemp = \",\" + string.substr(j-3, 3) + temp;\r\n\t\t\r\n\t}\r\n\treturn temp;\r\n}", "function sumDigits(num) {\n\n var total = 0;\n var str = num.toString();\n\n for(i = 0; i < str.length; i = i + 1) {\n\n console.log(str.substring(i,i+1))\n total = total + parseInt(str.substring(i,i+1));\n\n }\n\n\n console.log(total);\n return total;\n\n}", "function replaceNum(string1) {\n var newString = string1.replace(/[0-9]/, \"$\");//replaces first digit with $. Use /g to do a global replace\n console.log(newString)\n}", "function addNumber(num){\n var answer = 0;\n //changs number to string type\n var convert = num.toString();\n //converts string type to array\n convert.split(\"\")\n \n for(var i = 0; i < convert.length; i++){\n answer += parseInt(convert[i])\n }\n if( answer >= 9) {\n addNumber(answer)\n }else{\n console.log(answer)\n }\n \n }", "function numberLetters(str) {\n var angka = '14370';\n var huruf = 'iaeuo';\n var result = '';\n\n for (var i = 0; i < str.length; i++) {\n var isAngka = false;\n for (var j = 0; j < angka.length; j++) {\n if (str[i] === angka[j]) {\n isAngka = true;\n result += huruf[j];\n }\n }\n if (!isAngka) {\n result += str[i];\n }\n }\n return result;\n}", "function addZ(n) {\n return (n<10) ? '0'+n : ''+n;\n}", "function sum_digits(number){\n sum = 0;\n let num_to_str = number.toString();\n for(var char of num_to_str){\n sum += parseInt(char)\n }\n console.log(sum)\n}", "function sumOfNumber(num) {\n let sum = 0;\n let splitNum = num.toString().split(\"\");\n for (let i = 0; i < splitNum.length; i++) {\n sum += parseInt(splitNum[i]);\n }\n console.log(sum);\n}", "function sumStrings(a, b) {\n let num = 1n;\n if (a === '') {\n a = '0';\n }\n if (b === '') {\n b = '0';\n }\n a = parseInt(a);\n b = parseInt(b);\n const sum = BigInt(a+b);\n return sum.toString();\n}", "function sumDigits(n) {\n return n.split(\"\").reduce((prev, curr) => {\n const c = curr.charCodeAt(0);\n return prev + (c < 58 ? +curr : c < 91 ? c - 55 : c - 87);\n }, 0);\n}", "function sumStrings(a,b) {\n\n var result = [];\n a = a.replace(/^0+/, '');\n b = b.replace(/^0+/, '');\n a = a.split('').reverse();\n b = b.split('').reverse();\n \n for (var i = 0; (a[i] >= 0) || (b[i] >= 0); i++) {\n var sum = (parseInt(a[i]) || 0) + (parseInt(b[i]) || 0);\n\n if (!result[i]) { result[i] = 0; }\n\n var next = ((result[i] + sum) / 10) | 0;\n result[i] = (result[i] + sum) % 10;\n\n if (next) { result[i + 1] = next; }\n }\n \n return result.reverse().join('');\n}", "function add(a ,b){\n //取两个数字的最大长度\n let maxLength = Math.max(a.length, b.length);\n //用0去补齐长度\n a = a.padStart(maxLength , 0);//\"0009007199254740991\"\n b = b.padStart(maxLength , 0);//\"1234567899999999999\"\n //定义加法过程中需要用到的变量\n let t = 0;\n let f = 0; //\"进位\"\n let sum = \"\";\n for(let i=maxLength-1 ; i>=0 ; i--){\n t = parseInt(a[i]) + parseInt(b[i]) + f;\n f = Math.floor(t/10);\n sum = t%10 + sum;\n }\n if(f == 1){\n sum = \"1\" + sum;\n }\n return sum;\n}", "function addNumbers() {\n var num1 = document.getElementById(\"num1\").value;\n num1 = Number(num1); // turn string into number\n var num2 = document.getElementById(\"num2\").value;\n num2 = Number(num2);\n \n var sum = num1 + num2\n \n document.getElementById(\"outputH3\").innerHTML = num1 + \" + \" + num2 + \"=\" + sum;\n} //end addNumbers()", "leftpad(str) {\n\t\treturn (str < 10 ? `0${str}` : `${str}`);\n\t}", "function sumOfDigits(num){\n var sum = 0;\n var newString = num.toString();\n for(i = 0; i <= newString.length - 1; i++){\n sum += parseInt(newString[i]);\n }\n \n return sum;\n}", "function sum(num) {\n return String(num).split('')\n .map(Number)\n .reduce((x, y) => { \n return x + y;\n });\n}", "function AddDigit(dig) \n\t{\n\t\tif (Current.length > MAXLENGTH)\n\t\t{\n \t\t \tCurrent = \"Aargh! Too long\"; //limit length\n \t} else\n \t{ \n \t\tif ( (eval(Current) == 0) && (Current.indexOf(\".\") == -1) ) \n \t\t{ \n \t\t\tCurrent = dig;\n \t} else\n \t{ \n \t\tCurrent = Current + dig;\n \t};\n \t};\n \t\tdocument.Calculator.Display.value = Current;\n \t}", "function numbers(a){\n\n var numbers2 = \"\";\n\n for(let i = 0; i<a.length;i++){\n\n if(a[i]== \"1\" || a[i] == \"2\" || a[i] == \"3\" || a[i] == \"4\" ||a[i] == \"5\" ||a[i] == \"6\" ||a[i] == \"7\" ||a[i] == \"8\" ||a[i] == \"9\"){\n\n \n numbers2 += a[i];\n }\n\n }\n // thenum = a.match(/\\d+/)[0];\n // return thenum;\n // var numb = a.match(/\\d/g);\n // numb = numb.join(\"\");\n // return numb;\n return parseInt(numbers2);\n }", "function getNumberFromString(s) {\n return +s.replace(/[^0-9.]/g,''); //remove all the alphabetic characters\n}", "function addNumber(textArray) {\r\n\tlet newStringText = \"\";\r\n\tlet j = 1;\r\n\tfor (let i = 0; i < textArray.length; i++) {\r\n\r\n\t\tif (i === 0 && !formatFirstLine) {\r\n\t\t\tnewStringText += textArray[i] + \"\\n\";\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tnewStringText += j + \". \" + textArray[i] + \"\\n\";\r\n\t\tj++;\r\n\t}\r\n\treturn newStringText;\r\n}", "function increment(x) {\n var i = x.length - 1;\n var carry;\n var new_x = x.split(\"\");\n do {\n old_digit = x.charAt(i);\n new_digit = inc_digit(old_digit);\n new_x[i] = new_digit;\n if (new_digit == \"0\") {\n carry = true;\n i -= 1;\n } else {\n carry = false;\n }\n if (i < 0) {\n carry = false;\n }\n } while (carry);\n return new_x.join(\"\");\n}", "function makeStringNumeric(string) {\n\tif (!string){\n\t\treturn \"\";\n\t}\n\treturn string.replace(/[^0-9]/gmi, \"\");\n}", "function add(x, y) {\n // this solution was also good\n // return (BigInt(a) + BigInt(b)).toString();\n const l = Math.max(x.length, y.length);\n const r = Array(l).fill().reduce(\n (a, _, i) => [\n (a[1] + +(x[x.length - 1 - i] || '0') + +(y[y.length - 1 - i] || '0')) % 10 + a[0],\n +((a[1] + +(x[x.length - 1 - i] || '0') + +(y[y.length - 1 - i] || '0')) > 9)\n ],\n ['', 0]);\n return '' + (r[1] ? r[1] : '') + r[0]\n}", "function addDigit(dig) {\n if ((eval(currentInput) == 0) && (currentInput.indexOf(\".\") == -1)) {\n currentInput = dig;\n } else {\n currentInput = currentInput + dig;\n }\n displayCurrentInput();\n}", "function stringToIntegerAlt2(string) {\n return +string\n}", "add() {\n let result = 0;\n let digit;\n\n for (let i = 0; i < arguments.length; i++) \n \n if(arguments[i]===\"LAST\"){\n \n result += parseInt(this.last());\n \n }else \n if(arguments[i]!==\"LAST\" && typeof(arguments[i])=='string'){\n digit = arguments[i].match(this.regex)\n result += this.memory[parseInt(digit)-1]\n }else{\n result += arguments[i];\n }\n this.total = result;\n \n return parseInt(this.total);\n }", "function addNumber (number) {\n // looking for operation before number\n if (result.value != \"\" && isNaN(result.value)) {\n result.value = \"\";\n result.value += number;\n checkPoint = true;\n\n }\n else {\n result.value += number;\n checkPoint = true;\n }\n}", "function addcommas(x){\n if(parseInt(x)){\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }\n return x;\n}", "function addcommas(x){\n if(parseInt(x)){\n return x.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n }\n return x;\n}", "function getNumberFromString(s) {\n return +s.replace(/\\D/g, \"\");\n}", "function addZ(n) {\n return n < 10 ? '0' + n : '' + n;\n }", "function str2Num(input) {\n const n1 = input;\n console.log(Number(n1) + 1); // To check n1 converted to number from string. expected value 56.\n console.log(n1 + 1); // Check to test string. Expected 551.\n}", "function sumStrings(a, b) {\n let portionA = a === '' ? ['0'] : a.split('').reverse(),\n portionB = b === '' ? ['0'] : b.split('').reverse(),\n result = [],\n upOne = 0,\n numA,\n numB\n\n if (portionB.length > portionA.length) {\n const changing = portionB\n portionB = portionA\n portionA = changing\n }\n\n for (i = 0; i < portionA.length; i++) {\n numA = portionA[i] ? parseInt(portionA[i], 10) : 0\n numB = portionB[i] ? parseInt(portionB[i], 10) : 0\n\n const sum = upOne === 0 ? numA + numB : numA + numB + upOne\n\n upOne = 0\n\n if (sum > 9 && i != portionA.length - 1) {\n const sumArr = sum.toString().split('')\n upOne = parseInt(sumArr[0], 10)\n\n result.unshift(sumArr[1].toString())\n } else {\n result.unshift(sum.toString())\n }\n }\n\n return result.join('').replace(/^0+/, '')\n}", "function numm(str) {\n let val = \" \", newvar = \" \";\n for (let i = 0; i <= length; i++) {\n newvar = parseInt(str[i]);\n val = val + \" \" + arr[newvar];\n }\n if{ length }\n alert(`${str} in wordes is :${val}`)\n }", "function numberManage(value) {\n\t// if number is 0 replace it. Otherwise add to it\n\tif (buffer === \"0\") {\n\t\tbuffer = value;\n\t\t// console.log(value);\n\t} else {\n\t\tbuffer += value;\n\t}\n\t// if too many numbers inputted, stop allowing it\n\t// if (buffer.length > 10) buffer = buffer.substring(0,10);\n\t// return;\n\n}", "function getAndIncrementLastNumber(str, increment) {\n return str.replace(/(\\D*)(\\d+)(\\D*)$/, function(s, p1, p2, p3) {\n var l = p2.length, s = '' + (+p2+increment), n = l - s.length;\n\tif (n < 0)\n\t{\n\t\tn = 0;\n\t}\n return p1 + '0'.repeat(n) + s + p3;\n });\n}", "function addNum(){\r\n var fNum=document.getElementById(\"firstNum\");\r\n var sNum=document.getElementById(\"secNum\");\r\n var result=parseInt(fNum.value) + parseInt(sNum.value)\r\n document.getElementById(\"result\").value=result\r\n}", "function sumStrings(a,b) {\n \n // any empty strings:\n if(a.trim().length === 0) {\n a = 0;\n }\n \n if(b.trim().length === 0) {\n b = 0;\n }\n \n \n return (BigInt(a) + BigInt(b)).toString(10);\n \n}", "function getNumber(i,number){\n let n = \"\"\n for (let x=i ; x<number.length ; x++ ){\n if(number.charAt(x)==\"*\"||number.charAt(x)==\"-\"||number.charAt(x)==\"+\"||number.charAt(x)==\"/\"){\n flag = x ;\n\n return n;\n }\n n=n+number.charAt(x);\n }\n return n;\n}", "function addZerosLeft(numInStr) {\n while (numInStr.length < 4){\n numInStr = \"0\" + numInStr;\n }\n return numInStr;\n}", "function addComma(num){\n var commaCount = 0;\n var string = num.toString();\n var returnString =\"\";\n\n // get comma count\n if(string.length%3!=0){\n commaCount = parseInt(string.length/3);\n }\n else{\n commaCount = parseInt(string.length/3)-1;\n }\n\n // generate comma\n if(commaCount>0){\n for(var i=0; i<commaCount; i++){\n returnString = \",\"+string.substr(string.length-3*(i+1),3)+returnString;\n if(i==commaCount-1){\n if(string.length%3==0){\n returnString = string.substr(0,3)+returnString;\n }\n else{\n returnString = string.substr(0,string.length%3)+returnString;\n }\n }\n }\n return returnString;\n }\n else{\n return string\n }\n}", "function getDigits(str) {\n let strNum = '';\n for (let i = 0; i < str.length; i++) {\n if (str[i] >= '0' && str[i] <= '9') {\n strNum += str[i];\n }\n }\n return strNum;\n}", "function summy(stringOfInts) {\n var total = 0;\n var nums = stringOfInts.split(\" \");\n for (i = 0; i < nums.length; i++) {\n total += parseInt(nums[i]);\n }\n return total;\n}", "function string_times (string, num) {\n if (num == 0) {\n return false;\n } else {\n var output = string;\n for (var i = 1; i < num; i++) {\n output += string;\n }\n }\n return output;\n}", "function addNumberToPhoneNumber(num) {\n var phoneNumberStr = $(\"#dialNumberInput\").val();\n phoneNumberStr = phoneNumberStr.concat(num);\n var formattedStr = formatPhoneNumber(phoneNumberStr);\n\n $(\"#dialNumberInput\").val(formattedStr);\n}", "function addDigits(num1) {\n\n var holder;\n var sum;\n\n //check that number is positive, two digits, and integer\n if (((num1 < 0) || (num1 > 99)) || (num1 % 1 !== 0)) {\n console.log(\"Requirements are not met. Function stops here.\")\n } else {\n stringNum = num1.toString()\n firstNum = stringNum[0]\n lastNum = stringNum[1]\n sum = Number(firstNum) + Number(lastNum)\n console.log(num1 + \" can be reduced to \" + sum)\n\n \n }\n}", "function digitsEnToFa(str) {\n\t\tif (!str) return;\n\n\t\tstr = str.toString();\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\tvar replaceEntoFa = new RegExp(\"\" + i, \"g\");\n\t\t\tstr = str.toString().replace(replaceEntoFa, faNums[i]);\n\t\t}\n\n\t\treturn str;\n\t}", "function aux(str, last, count) {\n if (str.length === 0) {\n return last + count;\n } else {\n var head = str.charAt(0);\n var tail = str.substring(1);\n\n if (head === last) {\n if (count === 9) {\n return head + \"9\" + aux(tail, head, 1);\n } else {\n return aux(tail, head, count + 1);\n }\n } else {\n return last + count + aux(tail, head, 1);\n }\n }\n }", "function concatenation(){\nconcString();\nconcNumStr();\nconcNumStrAsNum();\n}", "function increaseDigits(digitString, targetSum) {\n let numbers = '0123456789';\n let digitArray = digitString.split('');\n let currentSum = sum(digitString);\n let difference = targetSum - currentSum; //'118 -> '127' -> '136' -> '145' -> '226' -> '235' -> 244' -> '334'\n let last = digitArray.length - 1;\n while (last > 0) {\n if (!difference) {\n if (digitArray[last] >= digitArray[last - 1] + 2 && digitArray[last - 1] < 9) {\n digitArray[last] -= 1;\n digitArray[last - 1] = numbers[numbers.indexOf(digitArray[last - 1]) + 1];\n last -= 1;\n }\n }\n if (difference < 10 - digitArray[last]) {\n digitArray[last] = numbers[numbers.indexOf(digitArray[last]) + difference];\n }\n }\n \n return digitArray.join(''); //returns a string\n}", "function incrementString(split){\n // increment string\n for (var i = 0; i < split.length; i++) {\n if (isNaN(split[i])) {\n word.push(split[i])\n } else if (!isNaN(split[i])) {\n number.push(split[i])\n }\n }\n word = word.join(''); //word is defined, concat this with incremetedNumber\n numCount = number.length;\n //console.log(number)\n for (var n = 0; n < number.length; n++) {\n\n console.log('check', number[n])\n\n if (number[n] > '0') {\n console.log('not zero, exit')\n\n break;\n } else if (number[n] === '0') {\n console.log('this is pre-zero', number[n])\n zeros.push(number[n])\n zeroCount++;\n }\n\n }\n\n //console.log(zeros\n\n number = number.join('');\n\n if (numCount === zeroCount) {\n number++;\n number = number.toString();\n zeros.pop();\n zeros = zeros.join('');\n return word + zeros + number\n }\n\n zeros = zeros.join('');\n number++;\n number = number.toString();\n\n return word + zeros + number\n }", "function addSpaces(inputNumber){\n\treturn inputNumber;\n}", "function sumLength(string) {\n let sum = 0;\n (string + '').split('').map(e => {\n sum += +e;\n });\n return sum;\n }", "function expandedForm(num) {\n // turn number into string\n const input = num.toString();\n const output = [];\n // initiate a multiplier for each digit\n let multiplier = 1;\n\n // loop through the input string, starting at index 1\n for (let i = 1; i <= input.length; i++) {\n // take digit by digit, going from the last digit of the number\n const digit = input[input.length - i];\n //console.log(\"digit:\", digit)\n\n // skip if the digit is a zero; add the digit\n digit > 0 && output.unshift(digit * multiplier);\n\n // increase the multiplier times 10 with each iteration as we move through the number\n multiplier *= 10;\n //console.log(\"output:\", output)\n }\n // join the output into a string using plus sign\n return output.join(\" + \");\n}", "function summy(stringOfInts) {\n var sum = (a, b) => +a + +b;\n return Number.parseInt(stringOfInts.split(\" \").reduce(sum));\n}", "function addZero (str) {\n str = str.toString();\n return str.length < 6 ? addZero(\"0\" + str) : str;\n }", "function addSpace(nStr) {\n\t\tnStr += '';\n\t\tlet x = nStr.split('.');\n\t\tlet x1 = x[0];\n\t\tlet x2 = x.length > 1 ? '.' + x[1] : '';\n\t\tlet rgx = /(\\d+)(\\d{3})/;\n\t\twhile(rgx.test(x1)) {\n\t\t\tx1 = x1.replace(rgx, '$1' + ' ' + '$2');\n\t\t}\n\n\t\treturn x1 + x2;\n\t}", "function returnNumeric(str) {\n\n\tif (!str) return \"\";\n\n\tvar arr = new Array(\".\",0,1,2,3,4,5,6,7,8,9);\n\tvar len = str.length;\n\tvar newstr = \"\";\n\n\tfor (i=0;i<len;i++) {\n\n\t\tif (arraySearch(str.charAt(i),arr)!=-1 && str.charAt(i)!=\" \") newstr += str.charAt(i);\n\n\t}\n\n\treturn newstr;\n}" ]
[ "0.7885849", "0.71828693", "0.706001", "0.7054806", "0.69809556", "0.69771135", "0.69563305", "0.6905896", "0.68593454", "0.68509257", "0.6759812", "0.67418545", "0.66835576", "0.6678926", "0.6630407", "0.6595433", "0.65815294", "0.6552585", "0.6532543", "0.6506907", "0.6503885", "0.65016526", "0.64835584", "0.64802283", "0.64621526", "0.64569056", "0.6434723", "0.6430892", "0.6396358", "0.6391407", "0.6386234", "0.6384061", "0.63768786", "0.6374768", "0.6373976", "0.6363758", "0.63257134", "0.63220024", "0.6298435", "0.62687856", "0.62546504", "0.62484574", "0.6234861", "0.6227426", "0.6225827", "0.61628723", "0.61585534", "0.61535585", "0.61512303", "0.614263", "0.6142214", "0.61329496", "0.6121429", "0.61149764", "0.6111842", "0.6099918", "0.60949826", "0.6094279", "0.6071586", "0.60714465", "0.60709715", "0.6064612", "0.60614914", "0.6058188", "0.60533565", "0.6039626", "0.6036356", "0.6033851", "0.60318154", "0.6028285", "0.6028285", "0.6019111", "0.60094965", "0.59782153", "0.5975113", "0.5959289", "0.5951276", "0.59460247", "0.5934248", "0.5933349", "0.5931552", "0.5921706", "0.59196526", "0.59118986", "0.5910849", "0.5909843", "0.5895989", "0.5889484", "0.5879627", "0.58742803", "0.5869198", "0.5868257", "0.5867075", "0.58649045", "0.5863196", "0.58547324", "0.5852378", "0.5848726", "0.58481467", "0.58434653" ]
0.6078606
58
retrieve the cummulative number of students for the current year from the specified state data string
function cstudents(d,curdate) { if (d.properties.students) { var dateloc=d.properties.students.search(niceDate(curdate)); var cstudent= d.properties.students; var csmatch=cstudent.match(/[0-9]{4}/g); var breakdate="0"; for (k=0;k<csmatch.length;k++) { if (csmatch[k]>niceDate(curdate) && k==0) { return "0"; } if (csmatch[k]>niceDate(curdate) && k>0) { breakdate=csmatch[k-1]; break; } if (k==csmatch.length-1) { breakdate="all"; break; } } if (breakdate=="0") { return "0"; } if (breakdate!="all") { var repstr="("+breakdate+":[0-9]*).*"; cstudent=cstudent.replace(new RegExp(repstr),"$1"); } cstudent=cstudent.replace(/[^,]?[0-9]*:/g,"+"); cstudent=cstudent.replace(/,/g,""); return addbits("0"+cstudent); } else {return "0";} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSeniority(dateString) {\n var today = new Date();\n var startDate = new Date(dateString);\n var years = today.getFullYear() - startDate.getFullYear();\n var m = today.getMonth() - startDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < startDate.getDate())) {\n years--;\n }\n return years;\n}", "function students(d,curdate) {\n\tif (d.properties.students) {\n\t\tvar dateloc=d.properties.students.search(niceDate(curdate));\n\t\tif (dateloc > -1) {\n\t\t\treturn Number(d.properties.students.substr(dateloc+5,3));\n\t\t} else { return \"0\";}\n\t} else {return \"0\";}\n}", "function sumYear(data) {\r\n var total = 0;\r\n\r\n // loop through passed data and sum it ...\r\n data.forEach(function (d, i) {\r\n var count = d.value.d;\r\n total = total + count;\r\n });\r\n\r\n return total;\r\n\r\n return;\r\n}", "function nbYear(p0, percent, aug, p) {\n\n const population = (pn,n = 0) =>\n {\n const pNext = pn*( 1 + (percent/100)) + aug \n return (pn >= p) ? n : population(pNext, n + 1)\n }\n \n return population(p0)\n}", "function nbYear(p0, percent, aug, p) { \n\n per = (percent/100)\n \n for ( var n = 0; p0 < p; n++) {\n \n p0 = p0 + (p0*per) + aug }\n \n return n\n }", "function getStudentYears(studentName) {\n /*\n * Filter the transcriptList for the specfied student\n */\n let transcriptList = database_data.getTranscripts();\n let findStudentTrans = transcriptList.filter(function (obj) {\n return (obj.studentName===studentName);\n });\n\n /*\n * Using the records in findStudentTrans, get distinct\n * semester, year values.\n */\n let years = findStudentTrans.reduce((acc, x) =>\n acc.concat(acc.find(y => y.year === x.year) ? [] : [x]), []);\n return years;\n}", "function nbYear(p0, percent, aug, p) {\n let years = 0;\n let population = p0;\n const growthRate = percent / 100;\n while (population < p) {\n population += population*growthRate + aug;\n years++;\n }\n return years\n}", "function nb_year(p0,percent, aug, p,){\n for (i = 0; i <= p ; i++){\n let years = p0 * (percent+1) + aug; \n return years;\n }\n}", "function numberOfAccidentsPerYear(accidents) {\n\n // map accidents by year\n var mapOfAccidentsPerYear = _.groupBy(accidents, 'dateYear');\n\n var numberOfAccidentsPerYear = {};\n\n _.each(mapOfAccidentsPerYear, function(accidentsPerYearArray, year) {\n\n numberOfAccidentsPerYear[year] = accidentsPerYearArray.length;\n\n });\n\n console.log(numberOfAccidentsPerYear);\n\n}", "function getData() {\n\n // Create new object for each year 2013-2019 \n for (let i = 2013; i <= latestYear; i++) {\n yearTotals[i] = { 'total': 0, 'total_new': 0, 'total_existing': 0, 'total_floyd': 0, 'total_clark': 0, 'total_harrison': 0, 'new_floyd': 0, 'new_clark': 0, 'new_harrison': 0, 'existing_floyd': 0, 'existing_clark': 0, 'existing_harrison': 0 };\n }\n\n for (const year in yearTotals) {\n dataList.forEach(person => {\n if (person[year] > 0) {\n if (person.first_added === parseInt(year)) {\n switch(person.primary_county) {\n case 'Floyd':\n yearTotals[year].new_floyd++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Floyd++;\n countyTotals.Total++;\n break;\n case 'Clark':\n yearTotals[year].new_clark++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Clark++;\n countyTotals.Total++;\n break;\n case 'Harrison':\n yearTotals[year].new_harrison++;\n yearTotals[year].total++;\n yearTotals[year].total_new++;\n countyTotals.Harrison++;\n countyTotals.Total++;\n break;\n default:\n break;\n }\n } else {\n switch(person.primary_county) {\n case 'Floyd':\n yearTotals[year].existing_floyd++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n case 'Clark':\n yearTotals[year].existing_clark++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n case 'Harrison':\n yearTotals[year].existing_harrison++;\n yearTotals[year].total++;\n yearTotals[year].total_existing++;\n break;\n default:\n break;\n }\n }\n }\n });\n }\n}", "computeStudentCounts() {\n let passed = 0, vetCount = 0, firstYearCount = 0, alphaCount = 0;\n let vetStudents = [], binaryStudents = [];\n\n this.students.forEach((student) => {\n const studentPositions = {};\n\n if (!student.position_ids) {\n return;\n }\n\n // Figure out what teams the person belongs to, if any.\n student.position_ids.forEach((id) => {\n if (TITLE_MAP[id]) {\n studentPositions[TITLE_MAP[id]] = 1;\n }\n })\n\n const teams = Object.keys(studentPositions);\n if (teams.length > 0) {\n set(student, 'teamTitles', teams.join(', '));\n }\n\n // Count the students\n\n if (this.training.is_art) {\n if (student.is_art_prospective) {\n alphaCount++;\n binaryStudents.push(student);\n } else {\n vetCount++;\n vetStudents.push(student);\n }\n } else {\n if (student.years > 1) {\n vetCount++;\n vetStudents.push(student);\n } else {\n binaryStudents.push(student);\n\n if (student.years == 1) {\n firstYearCount++;\n } else {\n alphaCount++;\n }\n }\n }\n\n if (student.scored && student.passed) {\n passed++;\n }\n });\n\n // Sort the students\n vetStudents = this._sortByYearCallsign(vetStudents);\n binaryStudents = this._sortByYearCallsign(binaryStudents);\n\n this.vetCount = vetCount;\n this.passed = passed;\n this.firstYearCount = firstYearCount;\n this.alphaCount = alphaCount;\n\n this.studentGroups = [\n {\n groupName: 'Veterans',\n students: vetStudents\n },\n {\n groupName: (this.training.is_art ? 'ART Prospectives' : 'Binaries'),\n students: binaryStudents\n },\n ];\n }", "function howManyLaunchesInYear(data, year){\n let launches = 0\n let launch_success = 0\n let successfulPayload = 0\n for (const element of data){\n if (element[\"launch_year\"] === year.toString()){\n launches++\n //1a)\n if (element[\"launch_success\"]){\n launch_success++\n //2)\n for (const payload of element[\"rocket\"][\"second_stage\"][\"payloads\"]){\n successfulPayload+=payload[\"payload_mass_kg\"]\n }\n }\n }\n }\n return \"\\nNumber of launches in \" + year + \": \" + launches + \n \"\\nSuccessful: \" + launch_success + \n \"\\nUnsuccessful: \" + (launches-launch_success) +//1b)\n \"\\nPayload: \" + successfulPayload + \"kg\"\n}", "function calculateCumulativeCounts(data) {\n var counts = {}\n data.rows.forEach(function(row) {\n if (row.year && row.month) {\n yearMonthString = moment([row.year, row.month, 1]).format('YYYY-MM')\n counts[yearMonthString] = row.count\n }\n })\n\n total = 0\n countsAllMonths = {}\n\n dates().forEach(function(date) {\n var dateString = date.format('YYYY-MM');\n var newCovenantsThisMonth = counts[dateString]\n\n if (newCovenantsThisMonth) {\n total += newCovenantsThisMonth;\n }\n countsAllMonths[dateString] = total\n })\n\n return countsAllMonths\n }", "function birthday(s, d, m) {\n\tlet count = 0;\n\tfor (let i = 0; i < s.length; i++) {\n\t\tlet sum = 0;\n\t\tlet slicedArray = s.slice(i, i + m);\n\n\t\tsum = slicedArray.reduce((acc, currV) => acc + currV);\n\t\tif (sum === d && slicedArray.length === m) {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count;\n}", "function nbYear(p0, percent, aug, p) {\n let newPopulation = p0\n let index = 0\n \n while(newPopulation < p){ //use a while loop because we are trying to make a condition true\n newPopulation += newPopulation * (percent/100) + aug \n index++\n }\n return index\n}", "function birthday(s, d, m) {\n let counter = 0;\n const reducer = (a, b) => a + b;\n for(let i = 0; i < s.length - m + 1; i++){\n if (s.slice(i,i + m).reduce(reducer) == d){\n counter++;\n }\n }\n return counter;\n}", "function getData(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'counties[county_index].droughtLevels' + year + '[' + i + '] += parseInt(datum.';\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'counties[county_index].dataCount' + year + '++;\\n'\r\n return result;\r\n }", "function birthday(s, d, m) {\n let count = 0;\n\n for (let i = 0; i < s.length; i++) {\n let arr = s.slice(0 + i, m + i);\n\n if (arr.reduce((a, b) => a + b) === d) {\n count++;\n }\n }\n return count;\n}", "function cowNumberWithLiveSpan(year, initNumber) {\n if(year < 1) {\n return 0\n }\n if(year == 1 | year == 2 | year == 3) {\n return year * initNumber\n }\n return cowNumberWithLiveSpan(year - 1, initNumber) + cowNumberWithLiveSpan(year - 3, initNumber) - cowNumberWithLiveSpan(year - 10, initNumber)\n}", "function countState(AddressBook) {\n const count = AddressBook.reduce(function (acc, current) {\n if (acc[current.state]) acc[current.state] = ++acc[current.state];\n else acc[current.state] = 1;\n return acc;\n }, {});\n console.log(count);\n}", "function getNumberOfYears() {\n let repaymentTerm = Number(document.querySelector('input[name=\"number-of-years\"]:checked').value);\n return isNaN(repaymentTerm) ? 0 : (repaymentTerm / 12);\n }", "function leapyear(b_yr,c_yr){\n var leap_count =0;\n for(b_yr ; b_yr<=c_yr; b_yr++ ){\n if((b_yr%400 == 0)||(b_yr%100 != 0)&& (b_yr%4 == 0)){\n leap_count+=1;\n }\n }\n return leap_count;\n \n}", "function setYears(data, i) {\n return data.toString();\n}", "function countStateInArray(st, arr) {\n let count = 0;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] == st) {\n count++;\n }\n }\n return count;\n}", "function testDataSelection(curyear) {\n console.log(curyear);\n var sumStates = {};\n\n d3.csv(\"clean_data.csv\", function (csv) {\n csv = csv.filter(function (row) {\n return row['year'] <= curyear;\n })\n //console.log(\"data ready\");\n //console.log(csv);\n csv.forEach(function (i) {\n sumStates[i.state] = (sumStates[i.state] || 0) + 1;\n });\n //{ NY: 4, US: 3, SC: 1, NC: 1, KY: 1, …}\n testChoroplethColor(sumStates);\n\n });\n}", "function cumLade (gradeArray) {\n let studentCumLaude = 0;\n for (let participants = 0; participants < gradeArray.length; participants++) {\n if (gradeArray[participants] > 7) {\n studentCumLaude = studentCumLaude + 1\n }\n }\n return studentCumLaude;\n}", "studentsPerInstructor() {\n // Return an object of how many students per teacher there are in each cohort e.g.\n // {\n // cohort1806: 9,\n // cohort1804: 10.5\n // }\n\n //divide studentCount by the amount of teachers in each module\n \n\n\n\n const result = cohorts.reduce((acc, cur) => {\n acc[`cohort${cur.cohort}`] = cur.studentCount / instructors.reduce((accInst, curInst) => {\n if(curInst.module === cur.module) {\n accInst++;\n }\n return accInst;\n }, 0);\n return acc;\n }, {});\n\n\n return result;\n\n // Annotation:\n // This one was crazy. Basically, we start by reducing the cohorts module because we are basing our length off our new object off of the cohorts array.\n //we create our values using interpolation, then to assign it our value is where it gets tricky. Basically, we need to divide the total number of students in a cohort by the amount of instructors there are. So we can iterate through instructors, and if the instructor module matches the module of the Current Cohort, we add to our second accumulator. We divide the total count by this accumulator. \n }", "function numCandies(date) {\n var total = 0; //declare var outside so it resets\n for (var i=0; i < store1[date].length ; i++) {\n total += store1[date][i][2])\n }\n console.log(total);\n}", "function createArrayOfStateCountsFromPlayerCollegeCounts(some_player_college_counts, us_states) {\n\t\n\tvar sum = 0;\n\tvar sum_states = [];\n\t\n\t// us_states arg:\n\t// 50 rows and 4 cols:\n\t// state, state_fullname, state_fullname_upper, country\n\tfor(var s = 0; s < us_states.length; s += 1) {\n\t\t\n\t\tvar thisState = us_states[s].state;\n\t\tvar thisStateLongName = us_states[s].state_fullname;\n\t\tvar aStateObject = new Object();\n\t\t\n\t\taStateObject.state = clone(thisState);\n\t\taStateObject.state_fullname = clone(thisStateLongName);\n\t\tvar count = determineStateCount(thisStateLongName, some_player_college_counts);\n\t\taStateObject.player_count = clone(count);\n\t\t\n\t\tsum_states[s] = aStateObject;\n\t}\n\treturn sum_states;\t\t// return sum total of players who played college baseball in that state\n}", "dataSet() {\n this.state = { dataset: myData.dataset };\n let count = 0;\n \n this.state.dataset.forEach(function(element) {\n this.reducedDataset.year.indexOf(element.fields.year)\n if(this.reducedDataset.year.indexOf(element.fields.year) >=0){\n let pos = this.reducedDataset.year.indexOf(element.fields.year);\n this.reducedDataset.year[pos] = element.fields.year;\n this.reducedDataset.growth[pos]+= element.fields.cumulative_growth ? Math.round(Number(element.fields.cumulative_growth)): 0; \n }else{\n this.reducedDataset.year[count] = element.fields.year;\n this.reducedDataset.growth[count] = element.fields.cumulative_growth ? Math.round(Number(element.fields.cumulative_growth)): 0;\n count++;\n }\n }, this);\n console.log(this.reducedDataset.growth)\n \n }", "function yearSum (dataArray) {\n\tvar yTotal = [];\n\n\tdataArray.forEach(function(d, i) {\n\t\tyTotal.push(d.total);\n\t});\n\n\tvar sumYear = d3.sum(yTotal);\n\treturn sumYear;\n}", "function displayStateInfo(st, yr){\n if (st == null){\n return;\n }\n console.log(\"Chosen state: \"+st+\", chosen year: \"+yr);\n var allCausesForState = [];\n data.forEach(function(d){\n if((d.year == yr)&&(d.state == stateCodeMap.get(st))){\n allCausesForState.push(d);\n }\n });\n var acs = allCausesForState.sort((a,b) => (a.deaths > b.deaths) ? -1 : 1);\n var resultHtml = \"<h3>Chosen state: \"+stateCodeMap.get(st)+\"</h3><h4>Total deaths: \"+acs[0].deaths+\"</h4><ul><li>\"+acs[1].causeName+\": \"+acs[1].deaths+\"</li><li>\"+acs[2].causeName+\": \"+acs[2].deaths+\"</li><li>\"+acs[3].causeName+\": \"+acs[3].deaths+\"</li><li>\"+acs[4].causeName+\": \"+acs[4].deaths+\"</li><li>\"+acs[5].causeName+\": \"+acs[5].deaths+\"</li><li>\"+acs[6].causeName+\": \"+acs[6].deaths+\"</li><li>\"+acs[7].causeName+\": \"+acs[7].deaths+\"</li><li>\"+acs[8].causeName+\": \"+acs[8].deaths+\"</li><li>\"+acs[9].causeName+\": \"+acs[9].deaths+\"</li><li>\"+acs[10].causeName+\": \"+acs[10].deaths+\"</li></ul>\"\n //var yr = d3.select(\"#chosenYear\").html();\n console.log(\"HTML: \"+d3.select(\"#stateInfo\").html(resultHtml));\n console.log(allCausesForState);\n}", "changeYear(type) {\n //Copy the current year\n let cYear = this.state.year;\n //Get the next potential year\n if(type === \"INC\") {\n cYear = ++cYear;\n } else if(type === \"DEC\") {\n cYear = --cYear;\n }\n //Check if there's data for that year\n if(typeof this.state.scorecard.metrics[0].data[cYear] !== \"undefined\") {\n //If there is, change the state\n this.setState({year: cYear});\n }\n }", "function getData2(year) {\r\n var result = '';\r\n var i;\r\n for(i = 0; i < 6; i++) {\r\n result += 'countyObject.droughtLevels' + year + '[' + i + '] += parseInt(datum.'\r\n if(i != 5) {\r\n result += 'D' + i + ');\\n';\r\n } else {\r\n result += 'None);\\n';\r\n }\r\n }\r\n result += 'countyObject.dataCount' + year + '++;\\n'\r\n return result;\r\n }", "function countCode(string) {\n var count = 0;\n for (var i = 0; i < string.length - 3; i++) {\n // Get the current substring\n substr = string.substring(i, i + 4);\n // Replace the third character with a 'd'\n substr = substr.replaceAt(2, 'd');\n if (substr === 'code') {\n count++;\n }\n }\n return count;\n}", "function interpolateYear(decades, statePop) {\n const popRange = decades.reduce((acc, decade) => {\n acc.push(statePop[decade]);\n return acc;\n }, []);\n return scaleLinear().domain(decades).range(popRange).clamp(false);\n}", "function year_increment(){\n\t\tif(pymt_num === 1){\n\t\t\tyear++;\n\t\t\treturn 1;\n\t\t}\n\t\telse if(pymt_num % 12 === 0){\n\t\t\treturn year++;\n\t\t}else {\n\t\t\treturn '';\n\t\t}\n\t}", "function getYearsSE(earnings) {\n var substantialEarnings = getWepTables.substantialEarningsMarks()\n\n // NOTE: Assumption - years of substantial earnings includes years where the earnings amount is equal to the substantial earnings value?\n let years = 0;\n let substantialEarningsMap = {};\n if (Array.isArray(substantialEarnings)) {\n substantialEarnings.forEach((earning) => {\n substantialEarningsMap[earning.year]= earning.SubstantialEarnings;\n });\n }\n\n let earningsYears = Object.keys(earnings);\n if (Array.isArray(earningsYears)) {\n earningsYears.forEach((earningsYear) => {\n if (earnings[earningsYear] >= substantialEarningsMap[earningsYear]) {\n years++;\n }\n });\n }\n\n if (years === 0) {\n //MAYBE: default to 20 if no data\n console.warn(\"getYearsSE has returned the default value of 20, correct years could not be calculated\");\n return 20\n }\n\n return years;\n}", "function nextHappyYear(year){\n let numSet = new Set();\n while(numSet.size!==4){\n //resetting Set to size=0 in order to prepare for next year++\n numSet = new Set();\n year++\n let newArr = year.toString().split('').map(Number);\n newArr.map(x=>numSet.add(x));\n }\n //this is my fave line :)\n return parseInt([...numSet].join(''));\n}", "function years(num){\n let years0,\n str1=num.toString(), \nsL=str1.length;\nif (sL==1) {s1=\"0\"; s2=str1} else { s2=str1.charAt(sL-2); s2=str1.charAt(sL-1)} \nif (s2==\"1\" && s1!=\"1\") {years0=' год '} else if \n((s2==\"2\"||s2==\"3\"||s2==\"4\" )&&s1!=\"1\") {years0=' года '} else {years0=' лет '};\nreturn years0\n}", "function getYears() {\n\tconst retirementAge = 65;\n\tconst currentYear = new Date().getFullYear();\n\tconst baseYear = currentYear - retirementAge + 1;\n\treturn [...Array(65).keys()].map((index) => index + baseYear);\n}", "function getPopulation(date) {\n var year = date.getFullYear();\n return 1; // disable for now. should make it by semester instead of by month\n return populationTree[year] && populationTree[year][date.getMonth()] || 1;\n}", "function countCity(AddressBook) {\n const count = AddressBook.reduce(function (acc, current) {\n if (acc[current.city]) acc[current.city] = ++acc[current.city];\n else acc[current.city] = 1;\n return acc;\n }, {});\n console.log(count);\n}", "countQuakes (data, statesObj) {\n return data.features.map(quake => {\n //split string and extract quake location\n //return array of locations\n let place = quake.properties.place.split(', ');\n return place[place.length - 1];\n }).map(occurred => {\n //if location was an abbrev, return corresponding full state name\n let index = statesObj.abbrevs.indexOf(occurred);\n if (index > -1) return statesObj.states[index]; \n else return occurred;\n }).reduce((accumulator, location) => {\n //build accumulator object to tally quakes by location\n //return object with key of location, value of #quakes occurred\n const lower = location.toLowerCase();\n if (accumulator[lower]) { \n accumulator[lower]++;\n return accumulator; \n } else { \n accumulator[lower] = 1;\n return accumulator; \n }\n }, {});\n }", "function startOfYearPeriod(date, years) {\n /* @see https://en.wikipedia.org/wiki/Year_zero#ISO_8601 */\n var year = new Date(date).getFullYear();\n return Math.floor(year / years) * years;\n } // pattern for format parts", "function countingValleys(n, s) {\n var sArr=s.split('');\n var seaLevel = 0;\n var valley = 0;\n var counter = 0;\n var increment;\n while(counter!=n){\n if(sArr[counter]=='D'){\n increment =-1;\n }\n else if(sArr[counter]=='U'){\n increment = 1;\n }\n if(counter !=0 && seaLevel<0 && seaLevel+increment ==0){\n valley+=1;\n }\n seaLevel+=increment;\n counter+=1;\n }\n return valley;\n}", "function birthday(s, d, m) {\n let count = 0;\n // Get array elements by window size\n for(let i = 0; i < s.length; i++) {\n let tempSum = 0;\n for (let j = i; j < i+m; j++) {\n tempSum += s[j];\n }\n if (tempSum === d) { //The window size in this case is m=2, but it needs to adaptable\n count++;\n }\n }\n return count;\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}", "function getYears(getFinals) {\n return getFinals(fifaData).map((x) => {\n return x.Year;\n });\n}", "function checkyearofcensus() {\r\n \r\n loadDate();\r\n\r\n}", "function calculateAge(str){\n \n var a = new Date(),\n yearNow= a.getFullYear(),\n monthNow= a.getMonth()+1,\n dateNow= a.getDate();\n\n var b= new Date(str),\n yearB= b.getFullYear(str),\n monthB= b.getMonth(str)+1,\n dateB= b.getDate(str);\n\n var age= 0; \n if(monthNow > monthB){\n age =yearNow- yearB;\n } \n else if(monthNow == monthB){\n \n if(dateNow>= dateB){\n age = yearNow - yearB;\n }\n else {\n age = yearNow - yearB - 1;\n }\n }\n else {\n age = yearNow- yearB -1;\n }\n console.log(age) ;\n}", "function getYears (seconds) {\nreturn (seconds/31536000).toFixed(5) + \" number of years\";\n}", "function count_transitions(data_set, handling) {\r\n var sumData = d3.nest()\r\n .key(function(d) {return d.prev_state;})\r\n .key(function(d) {return d.curr_state;})\r\n .key(function(d) {return d.colour;})\r\n .rollup(function(values) {return {computer_count: d3.sum(values, function(d) {return +d.computer_count})}})\r\n .entries(data_set);\r\n\r\n return sumData;\r\n} //end count_states function", "function calcYearOverview(data) {\n var new_data = [];\n var current_day = data[0];\n current_day.date.setDate(1);\n var current_month = data[0].date.getMonth();\n for(var i = 1; i < data.length; ++i) {\n if(data[i].date.getMonth() == current_month) {\n current_day.killed += data[i].killed;\n current_day.injured += data[i].injured;\n } else {\n new_data.push(current_day);\n current_day = data[i];\n current_day.date.setDate(1);\n current_month = data[i].date.getMonth();\n }\n }\n new_data.push(current_day);\n return new_data;\n}", "function getYears () {\n var seconds = prompt(\"how many second?\");\n return((seconds/31536000).toFixed(5) + \" number of years\");\n }", "getYearNumerals(year) { return `${year}`; }", "function totalYearsLong(inventors) {\n var totalYears = 0;\n for (var i = 0; i < inventors.length; i++) {\n totalYears += inventors[i].year;\n }\n return totalYears;\n}", "function accumulateMalePopulationPerCounty(population_arr,counties_arr)\n{\n const male_population_pre_county = [];\n for (let i = 0; i < counties_arr.length; i++)\n {\n let male = 0;\n for (let j = i; j < population_arr.length; j++)\n {\n if (counties_arr[i] === population_arr[j].county)\n {\n male += population_arr[j].male; \n }\n }\n male_population_pre_county.push(male);\n }\n return male_population_pre_county;\n}", "updateYear() {\n const newYear = this.state.year + 1;\n this.setState({\n year: newYear\n })\n }", "function daysCountForaMonthinaYear(month, year) {\n return new Date(year, month, 0).getDate();\n}", "getYears(dates) {\n const year_array = [];\n dates.forEach((date) => {\n const dateKey = this.findKeyInObject(date);\n let curr_year = date[dateKey].slice(0, 4);\n if (year_array.length === 0) {\n year_array.push(curr_year);\n } else if (!this.checkIfExist(year_array, curr_year)) {\n year_array.push(curr_year);\n }\n });\n this.setState({\n years: year_array,\n });\n }", "function getCenturies(year) {\n if (year >= 1 && year <= 199) {\n return \"1st\"\n } else if (year >= 200 && year <= 299) {\n return \"2nd\"\n } else if (year >= 300 && year <= 399) {\n return \"3rd\"\n } else if (year >= 400 && year <= 499) {\n return \"4th\"\n } else if (year >= 500 && year <= 599) {\n return \"5th\"\n } else if (year >= 600 && year <= 699) {\n return \"6th\"\n } else if (year >= 700 && year <= 799) {\n return \"7th\"\n } else if (year >= 800 && year <= 899) {\n return \"8th\"\n } else if (year >= 900 && year <= 999) {\n return \"9th\"\n } else if (year >= 1000 && year <= 1199) {\n return \"11th\"\n } else if (year >= 1100 && year <= 1199) {\n return \"12th\"\n } else if (year >= 1200 && year <= 1299) {\n return \"13th\"\n } else if (year >= 1300 && year <= 1399) {\n return \"14rd\"\n } else if (year >= 1400 && year <= 1499) {\n return \"15th\"\n } else if (year >= 1500 && year <= 1599) {\n return \"16th\"\n } else if (year >= 1600 && year <= 1699) {\n return \"17th\"\n } else if (year >= 1700 && year <= 1799) {\n return \"18th\"\n } else if (year >= 1800 && year <= 1899) {\n return \"19th\"\n } else if (year >= 1900 && year <= 1999) {\n return \"20th\"\n } else if (year >= 2000 && year <= 2199) {\n return \"21th\"\n } else if (year >= 2200 && year <= 2299) {\n return \"22nd\"\n }\n\n\n const centuries = [\n {\n first: \"1st\",\n },\n {\n second: \"2nd\",\n },\n {\n thrid: \"3rd\",\n },\n {\n fourth: \"4th\",\n },\n {\n fifth: \"5th\",\n },\n {\n sixth: \"6th\",\n },\n {\n seventh: \"7th\",\n },\n {\n eight: \"8th\",\n },\n {\n ninth: \"9th\",\n },\n {\n ten: \"10th\",\n },\n {\n eleven: \"11th\",\n },\n {\n twelve: \"12th\",\n },\n {\n thriteen: \"13th\",\n },\n {\n fourteen: \"14th\",\n },\n {\n fifteen: \"15th\",\n },\n {\n sixteen: \"16th\",\n },\n {\n sevententh: \"17th\",\n },\n {\n eightenth: \"18th\",\n },\n {\n ninetenth: \"19th\",\n },\n {\n twenty: \"20th\",\n },\n {\n twentyone:\"21st\"\n }\n ];\n\n}", "function countByCity(city) {\n\n let cityCount = AddressBookArr.filter(contact => contact.city == city)\n .reduce((countOfContact) => countOfContact = countOfContact + 1, 0);\n console.log(\"\\nCount of Person by City : \" + cityCount);\n}", "function computeYear(inputYear) {\n if (inputYear) parseYear = `&primary_release_year=${inputYear}`;\n}", "function computeYear(inputYear) {\n if (inputYear) parseYear = `&primary_release_year=${inputYear}`;\n}", "function calculateYears(principal, interest, tax, desired) {\n let p = principal\n let int = interest\n let t = tax\n let d = desired\n if(d <= p){\n return 0\n }\n \n let years = 0\n \n for( let i = 0; i < desired; i++) {\n let bonus = p * int \n bonus -= (bonus * t)\n \n p += bonus\n years ++\n if(p >= d) {\n return years\n }\n }\n }", "function getPageCount(){\n\tlet studentCount = 0;\n\n\t//Loops through all students and for each which isn't deselected the loops adds one to the student counter.\n\tfor (var i = 0; i < studentList.length; i++) {\n\t\tif ($(studentList[i]).hasClass(\"deselected\") === false) {\n\t\t\tstudentCount++;\n\t\t}\n\t}\n\n\t//Calculates how many pages by taking the student count and divdeds it with studentsPerPage.\n\tpageCount = Math.ceil(studentCount / studentsPerPage);\n\n}", "function decades_(years){\r\n var dec = d3.split(years, function(d){return d%10==0;});\r\n dec.forEach(function(d,i){d.unshift(d[0]-1);});\r\n return dec;\r\n}", "function getMembersPerYear() {\n membersPerYear = d3.nest()\n .key(d => d.year).sortKeys(d3.ascending)\n .rollup(leaves => leaves.length)\n .entries(memberData);\n}", "function lifespan(person){\n var birth = new Date(person.getBirthDate()),\n death = new Date(person.getDeathDate());\n var lifespan = '';\n if(birth && birth.getFullYear()){\n lifespan += birth.getFullYear();\n }\n if(death && death.getFullYear()){\n if(lifespan){\n lifespan += ' - ';\n }\n lifespan += death.getFullYear();\n }\n return lifespan;\n }", "async function updateStatewiseDataFromCovid19IndiaOrg() {\n const valueMapper = (hdr, value) => {\n if (value === undefined) return undefined;\n\n hdr = hdr.toLowerCase().trim();\n if (hdr === \"state\") return [\"state\", value];\n else if (hdr === \"confirmed\") return [\"confirmed\", parseInt(value)];\n else if (hdr === \"recovered\") return [\"recovered\", parseInt(value)];\n else if (hdr === \"deaths\") return [\"deaths\", parseInt(value)];\n else if (hdr === \"active\") return [\"active\", parseInt(value)];\n };\n const sheetId = COVID19_DATASHEET_ID;\n const cellRange = \"Statewise!A:E\";\n let data = await getGoogleSheetData(sheetId, cellRange, valueMapper);\n let lastValidIndex = data.length;\n while (lastValidIndex-- > 0) {\n const record = data[lastValidIndex];\n if (Object.keys(record).length > 1) break;\n }\n data = data.slice(0, lastValidIndex+1);\n const totalEntry = data[0];\n delete totalEntry[\"state\"];\n data = data.slice(1, data.length);\n const statewiseResponse = { total: totalEntry, statewise: data };\n updateUnofficialSource(\"covid19india.org\", statewiseResponse, 'statewise');\n}", "function getYears(id) {\n for (var i = 0; i < peopleArray.length; i++) {\n if (peopleArray[i].id == id) {\n var today = new Date();\n var yearStarted = new Date(peopleArray[i].startDate);\n var years = today.getFullYear() - yearStarted.getFullYear();\n var m = today.getMonth() - yearStarted.getMonth();\n\n if (m < 0 || (m === 0 && today.getDate() < yearStarted.getDate())) {\n years--;\n }\n return years;\n }\n }\n return '404';\n}", "function calculateTotalExpenses(passedState) {\n console.log('calculateTotalExpenses ran.');\n // if state has been established, calculate total expenses\n if (Object.keys(passedState).length > 0) {\n let expenseTotal = 0;\n const getKeys = Object.keys(passedState);\n const getValues = Object.values(passedState);\n if (passedState[getKeys[0]][0] !== undefined) {\n for (let iterateIDs = 0; iterateIDs <= getValues.length - 1; iterateIDs++) {\n const getLengthOfExpenses = Object.keys(getValues[iterateIDs]).length;\n for (let iterateExpenses = 0; iterateExpenses <= getLengthOfExpenses - 1; iterateExpenses++) { // eslint-disable-line max-len\n expenseTotal += getValues[iterateIDs][`${iterateExpenses}`].expenseAmt;\n console.log(getValues[iterateIDs][`${iterateExpenses}`].expenseAmt);\n }\n }\n }\n return expenseTotal;\n } // else\n // if state is not yet a state array...\n return 0;\n }", "function yearX(d) {\n var years = (endYear + 1) - startYear;\n var yearWidth = (width - leftBuffer)/ years;\n var counter = d.Year - startYear;\n return leftBuffer + yearWidth * counter;\n}", "countBST(n) {\n // find nth catalan number \n let count = this.catalan(n);\n\n // return nth catalan number \n return count;\n}", "function getYear(dataItems) {\n\treturn dataItems.map(item => +item.substring(0, 4));\n}", "function years(yrs) {\n let growth = (basis * 0.05) * yrs;\n return growth;\n }", "async function getQuantityCitiesInStateByParameter(stateParam) {\n try {\n let numberOfCities = 0;\n\n const data = JSON.parse(\n await fs.readFile(`${CitiesByStatesJsonOutput}${stateParam}.json`)\n );\n\n numberOfCities = data.Cities.length;\n\n console.log('QUANTIDADE DE CIDADES DO ESTADO INFORMADO NO PARAMETRO----->');\n console.log(`The state of ${stateParam} has ${numberOfCities} cities.`);\n console.log('');\n\n } catch (err) {\n console.log('ERRO: ' + err);\n }\n}", "function centuryFromYear(year){\n var t=year%100;\n var rs=1;\n if(year<=100)\n return rs;\n else {\n if(t==0)\n rs=Math.round(year/100);\n else\n if(t>=50)\n rs=Math.round(year/100);\n else\n rs=Math.round(year/100)+1;\n }\n console.log(rs);\n return rs;\n}", "function calcAge(dateString) {\n\t\tvar today = new Date();\n\t\tvar birthDate = new Date(dateString);\n\t\tvar age = today.getFullYear() - birthDate.getFullYear();\n\t\tvar m = today.getMonth() - birthDate.getMonth();\n\t\tif (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n\t age--;\n\t }\n\t\n\t\treturn age;\n\t}", "getAcademicYear() {\n var today = new Date();\n var zero = '';\n var aneAca = {};\n var Day = today.getDate();\n var Month = today.getMonth() + 1;\n var Year = today.getFullYear();\n aneAcaP = Year - 1 + '-' + Year;\n aneAcaN = Year + '-' + (Year + 1);\n aneAca = { Previous: aneAcaP, Next: aneAcaN };\n return aneAca;\n }", "function calculateAge(year){\nconsole.log(2018-year); \n}", "function countCandies(students){\n students.forEach(function(value,index,array) {\n console.log(value.name +' have '+ value.candies + 'candies\\n');\n }, this);\n}", "function yearRate(array, year) {\n let ratesSum = array.reduce(function(prevVal, elem) {\n if (elem.year === year) {\n if (typeof(elem.rate) === \"undefined\") return prevVal;\n return prevVal + elem.rate;\n }\n return prevVal;\n }, 0);\n let count = array.reduce(function(prevVal, elem) {\n if (elem.year === year) {\n if (typeof(elem.rate) === \"undefined\") return prevVal;\n return prevVal + 1;\n }\n return prevVal;\n }, 0);\n if (count > 0) \n //return Math.round(100*(ratesSum / count)) / 100;\n return Number((ratesSum / count).toFixed(2));\n return 0;\n}", "function getCounties(state) {\n\tvar counties = [];\n\treturn $.get( \"/get_counties/\"+ state)\n \t.done(function( data ) {\n\t\t\t$.each(data['counties'], function(key, county) {\n\t\t\t\tcounties.push(county);\n\t\t\t});\n \t});\n}", "function hseSkills(branch, generation, sprint) {\n var students = data[branch][generation]['students'];\n var totalStudentsActive = 0;\n var totalStudentSprint = 0;\n for (var i = 0; i < students.length; i++) {\n var quantitySprints = students[i]['sprints'];\n if (students[i].active) {\n for (var j = 0; j < quantitySprints.length; j++) {\n if (quantitySprints[j]['number'] === sprint && quantitySprints[j]['score']['hse'] >= 840) {\n totalStudentSprint++;\n }\n }\n }\n }\n return totalStudentSprint;\n }", "function calculateAnnualPerf(years) {\n years.map(function (item, index) {\n const previousYear = years.find((q) => q.year == item.year - 1);\n // check if previous year available. present year and previous have 4 qtrs.\n if (\n isDefined(previousYear) &&\n item.qtrs4Year == 4 &&\n previousYear.qtrs4Year == 4\n ) {\n item.epsPerf = calculatePercentChange(item.eps, previousYear.eps);\n item.revPerf = calculatePercentChange(item.rev, previousYear.rev);\n }\n });\n}", "function nbYear(current, percentage, migration, goal) {\n let populace = current\n let result = 0\n let percent = percentage / 100;\n while (!(populace > goal - 1)) {\n populace += (populace * percent);\n populace += migration;\n result += 1;\n\n }\n return result;\n}", "function getCurrentTrends(currentProjectTrend, activityDates) {\n var yearly = getCurrentProject(activityDates);\n var year = 0;\n if (yearly != 0) {\n var diff = yearly[1] - yearly[0];\n for (var i = 0; i <= diff; i++) {\n year = parseInt(yearly[0]) + i;\n if (year in currentProjectTrend) {\n currentProjectTrend[year] = currentProjectTrend[year] + 1;\n }\n else {\n currentProjectTrend[year] = 1;\n }\n }\n }\n return currentProjectTrend;\n}", "_parseDailySummary(body) {\n const sentences = this._extractPdfSentences(body);\n // console.log(sentences);\n\n // Regex the items we want from the sentences.\n const stateDataREs = {\n cases: /were (\\d+) cases/,\n deaths: /with (\\d+) deaths/,\n hospitalized: /been (\\d+) of .* cases that have been hospitalized/,\n testedNeg: /(\\d+) negative tests/\n };\n\n const rawStateData = Object.keys(stateDataREs).reduce((hsh, key) => {\n const re = stateDataREs[key];\n const text = sentences.filter(s => {\n return re.test(s);\n });\n if (text.length === 0) console.log(`No match for ${key} re ${re}`);\n if (text.length > 1) console.log(`Ambiguous match for ${key} re ${re} (${text.join(';')})`);\n const m = text[0].match(re);\n\n return {\n ...hsh,\n [key]: parse.number(m[1])\n };\n }, {});\n\n rawStateData.tested = rawStateData.cases + rawStateData.testedNeg;\n delete rawStateData.testedNeg;\n\n const data = [];\n\n const countyRE = /^(.*) County (\\d+)$/;\n const countyData = sentences.filter(s => {\n return countyRE.test(s);\n });\n countyData.forEach(lin => {\n const cm = lin.trim().match(countyRE);\n // console.log(cm);\n const rawName = `${cm[1]} County`;\n const countyName = geography.addCounty(rawName);\n const cases = cm[2];\n if (this._counties.includes(countyName)) {\n data.push({\n county: countyName,\n cases: parse.number(cases)\n });\n }\n });\n\n const summedData = transform.sumData(data);\n data.push(summedData);\n\n data.push({ ...rawStateData, aggregate: 'county' });\n\n const result = geography.addEmptyRegions(data, this._counties, 'county');\n // no sum because we explicitly add it above\n\n return result;\n }", "function calculateInterest(start, years, interests) {\n let svar = start;\n let i = 0;\n while (i < years) {\n svar += svar * (interests / 100);\n i++;\n }\n\n svar = svar.toFixed(4);\n return parseFloat(svar);\n }", "function getYear() {\n var n = TAW.yearIndex;\n return TAW.allYears[n];\n }", "function getAge(dateString) {\n\n var dates = dateString.split(\"/\");\n var d = new Date();\n\n var userday = dates[0];\n var usermonth = dates[1];\n var useryear = dates[2];\n\n var curday = d.getDate();\n var curmonth = d.getMonth()+1;\n var curyear = d.getFullYear();\n\n var age = (curyear - useryear) + 1;\n\n if((curmonth < usermonth) || ( (curmonth == usermonth) && curday < userday )){\n\n age--;\n\n }\n\n return age;\n}", "function accumulateFemalePopulationPerCounty(population_arr,counties_arr)\n{\n const female_population_pre_county = [];\n for (let i = 0; i < counties_arr.length; i++)\n {\n let female = 0;\n for (let j = i; j < population_arr.length; j++)\n {\n if (counties_arr[i] === population_arr[j].county)\n {\n female += population_arr[j].female; \n }\n }\n female_population_pre_county.push(female);\n }\n return female_population_pre_county;\n}", "function allSchoolYearStarts(dateRange) {\n // dateRange: A 2-element array of Moment objects.\n // returns: An array of integers, each school year in the range.\n const schoolYearStarts = _.map(dateRange, toSchoolYear);\n return _.range(schoolYearStarts[0], schoolYearStarts[1] + 1);\n}", "function calculateAge(dateString) {\n var today = new Date();\n var birthDate = new Date(dateString);\n var age = today.getFullYear() - birthDate.getFullYear();\n var m = today.getMonth() - birthDate.getMonth();\n if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {\n age--;\n }\n return age;\n}", "function getYears(cb) {\n const finalsYears = cb.map((final) => {\n return final.Year;\n });\n // console.log(\"TASK #3\", finalsYears);\n return finalsYears\n}", "function getStarsCount (repos) {\n return repos.data.reduce(function (count, repo) {\n return count + repo.stargazers_count;\n }, 0)\n}", "function birthday(s, d, m) {\n // Corner case\n if (s.length === m && s[0] === d) return 1;\n\n let numOfWays = 0;\n\n for (let i = 0; i < s.length; i++) {\n let monthLength = 1;\n let sum = s[i];\n for (let j = i + 1; j < s.length; j++) {\n monthLength++;\n sum += s[j];\n if (sum === d && monthLength === m) {\n numOfWays++;\n }\n \n // To ignore irrelevant cases\n if (sum > d || monthLength > m) break;\n }\n }\n\n return numOfWays;\n}", "count(state) {\n const cart = state.cart || [];\n let count = 0;\n for (const slug in cart) {\n if (cart.hasOwnProperty(slug)) {\n count += cart[slug];\n }\n }\n return count;\n }" ]
[ "0.5795936", "0.5732486", "0.56506515", "0.5545493", "0.5542618", "0.54862535", "0.5450072", "0.54258454", "0.541889", "0.5409576", "0.54052836", "0.5378007", "0.5343427", "0.5323088", "0.52799714", "0.5271085", "0.52570367", "0.5251613", "0.5236614", "0.52238524", "0.5206901", "0.52052337", "0.5176251", "0.51592475", "0.5141795", "0.51289165", "0.5117869", "0.5099668", "0.5091842", "0.50799054", "0.5078087", "0.5057535", "0.5037121", "0.5028281", "0.4991224", "0.4989831", "0.49888867", "0.49789807", "0.49764025", "0.49326968", "0.49309415", "0.4914507", "0.49114808", "0.4879365", "0.48638108", "0.4862844", "0.48502645", "0.4843312", "0.48349205", "0.48269683", "0.48187938", "0.48051798", "0.47998962", "0.47988376", "0.47952148", "0.47881195", "0.4786736", "0.47866678", "0.47814238", "0.47758785", "0.47738537", "0.47727498", "0.47600743", "0.47560158", "0.47560158", "0.4754657", "0.4748586", "0.473999", "0.4731257", "0.47287896", "0.4728781", "0.4726072", "0.47226343", "0.47221518", "0.47028607", "0.4698153", "0.46953997", "0.46861446", "0.4673943", "0.4671776", "0.46679217", "0.46663752", "0.4665222", "0.46632463", "0.46624783", "0.466208", "0.46511796", "0.46506035", "0.46463925", "0.46450698", "0.46323398", "0.4627735", "0.46262106", "0.46140358", "0.46081644", "0.4605321", "0.4604309", "0.46028703", "0.45962647", "0.45933795" ]
0.5600465
3
adjust the thickness of lines when zooming
function zoomed() { var scale = Math.min(5, d3.event.scale); svg.selectAll(".unit").style("stroke-width", 1.0 / d3.event.scale + "px"); svg.selectAll(".coast").style("stroke-width", 0.9 / d3.event.scale + "px"); svg.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setLinezoomWidth() {\n let strokeW = [\n 15, 8.5, 8, 7.5, 7, 6.5, 6, 5.5, 5, 4.5, 4, 3.5, 3, 4, 2, 1.9, 1.8, 1.1\n ];\n let zoom = map.getZoom();\n let width = strokeW[zoom - 1];\n return width;\n}", "function getLineWidth(d) {\n //The min value of how thin the lines can become depends on the zoom level\n var min_edge = transform.k < 1 ? transform.k : 0.8;\n var line_width = 2 * Math.max(min_edge, zoom_edge_increase(transform.k) * (d.focus === 'primary' ? primary_line_width : secondary_line_width));\n return line_width;\n } //function getLineWidth", "function getLineWidth(d) {\n //The min value of how thin the lines can become depends on the zoom level\n var min_edge = transform.k < 1 ? transform.k : 0.8;\n var line_width = 2 * Math.max(min_edge, zoom_edge_increase(transform.k) * (d.focus === 'primary' ? primary_line_width : secondary_line_width));\n return line_width;\n } //function getLineWidth", "function updateStyles() {\n\tconsole.log('updateStyles');\n\tvar zoom = rkGlobal.leafletMap.getZoom();\n\tfor(const key of Object.keys(rkGlobal.segments)) {\n\t\tconsole.log(key);\n\t\tvar properties = JSON.parse(key);\n\t\tvar showFull = zoom >= rkGlobal.priorityFullVisibleFromZoom[properties.priority];\n\t\tvar showMinimal = zoom < rkGlobal.priorityFullVisibleFromZoom[properties.priority] && zoom >= rkGlobal.priorityReducedVisibilityFromZoom[properties.priority];\n\n\t\tvar lineStyle;\n\t\tif(showFull) {\n\t\t\tlineStyle = getLineStyle(zoom, properties);\n\t\t} else if(showMinimal) {\n\t\t\tlineStyle = getLineStyleMinimal(properties);\n\t\t}\n\n\t\tvar lines = rkGlobal.segments[key].lines;\n\t\tif(showFull || showMinimal) {\n\t\t\tlines.setStyle(lineStyle);\n\t\t\trkGlobal.leafletMap.addLayer(lines);\n\t\t} else {\n\t\t\trkGlobal.leafletMap.removeLayer(lines);\n\t\t}\n\n\t\t// steep lines are drawn twice, once regular,\n\t\t// a second time as bristles (that's what this copy is for)\n\t\tvar steepLines = rkGlobal.segments[key].steepLines;\n\t\tif(steepLines !== undefined) {\n\t\t\tif(showFull || showMinimal) {\n\t\t\t\tvar steepLineStyle;\n\t\t\t\tif(showFull) {\n\t\t\t\t\tsteepLineStyle = getSteepLineStyle(zoom, properties);\n\t\t\t\t} else {\n\t\t\t\t\tsteepLineStyle = getSteepLineStyleMinimal(properties);\n\t\t\t\t}\n\t\t\t\tsteepLines.setStyle(steepLineStyle);\n\t\t\t\trkGlobal.leafletMap.addLayer(steepLines);\n\t\t\t} else {\n\t\t\t\trkGlobal.leafletMap.removeLayer(steepLines);\n\t\t\t}\n\t\t}\n\n\t\tvar decorators = rkGlobal.segments[key].decorators;\n\t\tif((showFull || showMinimal) && zoom >= rkGlobal.onewayIconThreshold && properties.oneway === 'yes') {\n\t\t\tdecorators.setPatterns(getOnewayArrowPatterns(zoom, properties, lineStyle.weight));\n\t\t\trkGlobal.leafletMap.addLayer(decorators);\n\t\t} else {\n\t\t\trkGlobal.leafletMap.removeLayer(decorators);\n\t\t}\n\t}\n\n\tif(zoom >= rkGlobal.iconZoomThresholds[1]) {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerLowZoom);\n\t\trkGlobal.leafletMap.addLayer(rkGlobal.markerLayerHighZoom);\n\t} else if(zoom >= rkGlobal.iconZoomThresholds[0]) {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerHighZoom);\n\t\trkGlobal.leafletMap.addLayer(rkGlobal.markerLayerLowZoom);\n\t} else {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerHighZoom);\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerLowZoom);\n\t}\n}", "function zoomed() {\n canvas.style(\"stroke-width\", 1.5 / d3.event.scale + \"px\");\n canvas.attr(\"transform\", \"translate(\" + d3.event.translate + \")scale(\" + d3.event.scale + \")\");\n }", "setLineSize(size) {\n this.context.lineWidth = size;\n }", "function zoomed() {\n\n // Save the current zoom level to correctly scale items\n zoomLevel = d3.event.transform.k;\n\n // Allow all lines and circles to scale\n svg.selectAll(\".line-group\").attr(\"transform\", d3.event.transform);\n svg.selectAll(\".circle\").attr(\"transform\", d3.event.transform);\n\n let scaledStrokeWidth = (lineStroke/zoomLevel);\n let scaledCircleWidth = (circleRadius/zoomLevel);\n\n // Calculate new sizes to match the scale\n d3.selectAll(\".line\").style(\"stroke-width\", scaledStrokeWidth);\n d3.selectAll(\"circle\").attr(\"r\", scaledCircleWidth);\n d3.selectAll(\".popup-text\").style(\"font-size\", 23/zoomLevel);\n\n // Rescale axii\n gX.call(xAxisLine.scale(d3.event.transform.rescaleX(lineX)));\n gY.call(yAxisLine.scale(d3.event.transform.rescaleY(lineY)));\n}", "biggerLine() {\n this.ctx.lineWidth++\n }", "function zoomed() {\n const {transform} = d3.event;\n svg2.attr(\"transform\", transform);\n svg2.attr(\"stroke-width\", 1 / transform.k);\n }", "function setLineLength() {\n let speed = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 2, 2];\n let zoom = map.getZoom();\n let length = speed[zoom - 1];\n return length;\n}", "function change_thickness() {\n thickness = document.getElementById(\"slider\").value;\n ctx.lineWidth = thickness;\n }", "function zoomed() {\n\t\t\tcarto.style(\"stroke-width\", 1.5 / d3.event.transform.k + \"px\").\n\t\t\t\tattr(\"transform\", d3.event.transform);\n\t\t}", "function setLineWidth(width) {\n\tcontext.lineWidth = width;\n\tlineWidthLabel.innerHTML = \"Drawing Line \" + width + \" pixles wide\";\n}", "function setLineWidth() {\r\n\t\tlineWidth = $(this).attr('data-size');\t//choix d'une épaisseur prédéfinie\r\n\t\t$range.val(lineWidth);\t//mise à jour de l'affichage sur la réglette\r\n\t}", "function zoomed (event) {\n const { transform } = event\n g.attr('transform', transform)\n g.attr('stroke-width', 1 / transform.k)\n }", "function lowerLayerLineAttributes(width, color) {\n lowerLayerContext.lineWidth = width;\n lowerLayerContext.strokeStyle = color;\n}", "updateCanvasSize() {\n this.drawLines();\n }", "function setLineThickness(graph, lineThickness) {\n var className = \"amcharts-graph-\" + graph.id;\n var items = document.getElementsByClassName( className );\n if ( undefined === items )\n return;\n for ( var x in items ) {\n if ( \"object\" !== typeof items[x] )\n continue;\n var path = items[x].getElementsByTagName( \"path\" )[ 0 ];\n if ( undefined !== path ){\n $(path).attr('stroke-width', lineThickness);\n }\n }\n}", "function zoomed() {\n g.style(\"stroke-width\", 1.5 / d3.event.scale + \"px\");\n g.attr(\"transform\", \"translate(\" + d3.event.translate + \")scale(\" + d3.event.scale + \")\");\n}", "setWidth(width = 1) {\n this.ctx.lineWidth = width;\n }", "function increaseZoom() {\n var increaseZoomOriginalSize = 1.1;\n mainDiagram.commandHandler.increaseZoom(increaseZoomOriginalSize);\n}", "function getLineWeight(zoom, priority) {\n\tvar lineWeight = zoom - 10;\n\tlineWeight = (lineWeight <= 0 ? 1 : lineWeight) * 1.4;\n\tlineWeight *= rkGlobal.lineWidthFactor[priority];\n\treturn lineWeight;\n}", "function upperLayerLineAttributes(width, color) {\n upperLayerContext.lineWidth = width;\n upperLayerContext.strokeStyle = color;\n}", "function zoomed(event) {\n // Get the transform\n var transform = event.transform;\n var scale = event.transform.k;\n\n // THis is geometric re-scale:\n // (but note: CSS prevents lines from scaling)\n g.attr(\"transform\", event.transform);\n\n link.style(\"stroke-width\", function (d) {\n return Math.sqrt(2 * d.value);\n });\n\n node.style(\"stroke-width\", function (d) {\n return 1 / scale;\n });\n node.attr(\"r\", function (d) {\n var scount = d.scount;\n var iSize = Math.max(10, scount / 2);\n return iSize /scale;\n });\n\n // Semantic rescale: just the size of the circles\n //g.selectAll(\"circle\")\n // .attr('transform', event.transform);\n }", "function zoomed() {\r\n\t svgmap.style(\"stroke-width\", 1);\r\n\t k = d3.event.transform.k;\r\n\t svgmap.attr(\"transform\", d3.event.transform);\r\n\t drawmap.attr('stroke-width', (1/k));\r\n\t svgpoints.attr(\"transform\", d3.event.transform);\r\n\t circles.attr('r', (5/k) + \"px\");\r\n\t}", "function drawZoom() {\n\t\tvar text = 'x' + zoomMultiplier.toFixed(1);\n\n\t\tctx.beginPath();\n\t\tctx.textAlign = 'left';\n\t\tctx.textBaseline = 'top';\n\t\tctx.fillStyle = '#777';\n\t\tctx.font = zoomMultiplierFont();\n\t\tctx.fillText(text, 5, 5);\n\t}", "setExtent() {\n\n var tl = this.props.map.containerPointToLatLng(this.tl);\n var br = this.props.map.containerPointToLatLng(this.br);\n\n tl = this.projection([tl.lng, tl.lat]);\n br = this.projection([br.lng, br.lat]);\n\n this.extent.attr({\n x: tl[0],\n y: tl[1],\n height: br[1]-tl[1],\n width: br[0]-tl[0],\n });\n\n }", "function updateStrokeWidth() {\n var g = $('#planta');\n g.attr('stroke-width', (0.1 / scale));\n g.attr('transform', 'scale(' + size + ')');\n}", "function scaleDrawing() {\n 'use strict';\n var viewport = $('#model1').find('#viewport')[0];\n if (!viewport)\n return;\n var bbox = viewport.getBBox();\n // truncate to 2 decimal places\n var scale = ((($('.jumbotron').width()/bbox.width)*100)|0)/100;\n drawing.transform(scale, 0, 0);\n $('#model1').attr('height', ((bbox.height*scale)|0)+50);\n}", "size(_size) {\n this.penSize = parseFloat(_size);\n this.ctx.lineWidth = this.penSize;\n }", "get lineWrapping() { return this.viewState.heightOracle.lineWrapping; }", "function zoomed() {\n const transform = d3.event.transform;\n zx = transform.rescaleX(x).interpolate(d3.interpolateRound);\n zy = transform.rescaleY(y).interpolate(d3.interpolateRound);\n //const zradius = transform.rescaleY(radius).interpolate(d3.interpolateRound);\n\n gDot.attr(\"transform\", transform)\n .attr(\"stroke-width\", 5 / transform.k);\n gx.call(xAxis, zx);\n gy.call(yAxis, zy);\n gGrid.call(grid, zx, zy);\n}", "function updateLine() {\n\t\t\n\t\tvar linestyle = new ol.style.Stroke ({\n\t\t\t\tcolor: $('#Lcolor').val(),\n\t\t\t\twidth:Number( $('#Lwidth').val()),\n\t\t\t\t});\n\t\t\n\t\tvar style3 = new ol.style.Style ({\n\t\t\tstroke: linestyle,\n\t\t});\n\t\tlinestyle,\n\t\t\n\t\twindow.layer.setStyle(style3);\n\t\tmap.getView().fit(\n vectorSource.getExtent(),(map.getSize()));\n\t}", "function zoomed(event) {\n // Get the transform\n var transform = event.transform;\n var scale = event.transform.k;\n\n // THis is geometric re-scale:\n // (but note: CSS prevents lines from scaling)\n g.attr(\"transform\", event.transform);\n\n link.style(\"stroke-width\", function (d) {\n return Math.sqrt(2 * d.value) / scale;\n });\n\n // Make sure that the circle retain their size by dividing by the scale factor\n node.selectAll(\"circle\")\n .attr(\"r\", function (d) {\n var scount = d.scount;\n var iSize = Math.max(10, scount / 2);\n return iSize / scale;\n })\n .attr(\"stroke-width\", function (d) {\n return 3 / scale;\n });\n node.selectAll(\"text\")\n .attr(\"x\", function (d) {\n var scount = d.scount;\n var iSize = Math.max(10, scount / 2);\n return iSize / scale;\n })\n .style(\"font-size\", function (d) {\n var iSize = Math.round(14 / scale);\n return (scale < 1) ? \"14px\" : iSize.toString() + \"px\";\n });\n\n }", "function lines()\n{\n //line colour\n stroke(255);\n strokeWeight(5);\n //vertical lines\n line(100,200,400,200)\n line(100,300,400,300)\n //horizontal lines\n line(200,100,200,400)\n line(300,100,300,400)\n \n \n}", "function onChangeStrokeSize(size) {\n changeCurrMeme('stroke-size', size);\n renderStrokeSize(size);\n renderCanvas();\n}", "function drawLines() {\n}", "function drawLines() {\n}", "function zoomed() {\n draw();\n circlesTranslate();\n }", "function zoomed(event) {\n // Get the transform\n var transform = event.transform;\n var scale = event.transform.k;\n\n // THis is geometric re-scale:\n // (but note: CSS prevents lines from scaling)\n g.attr(\"transform\", event.transform);\n g.attr(\"scale\", scale.toString());\n\n // EK While looking at issue #510, #511, I saw that the code below\n // causes the 'hover' effect to disappear, which is a pity\n //\n // EK Possibly remove completely in time??\n //\n //link.style(\"stroke-width\", function (d) {\n // var width;\n // // Issue #510: used to be:\n // //width = widthrange(d.value);\n // width = fixed_width;\n // return width;\n //});\n //\n //link.style(\"stroke\", function (d) {\n // var m = ru.passim.seeker.overlap_stroke(d);\n // return m;\n //});*/\n\n // Make sure that the circle retain their size by dividing by the scale factor\n node.selectAll(\"circle\")\n .attr(\"r\", function (d) {\n var iSize = get_radius(d);\n return iSize / scale;\n })\n .attr(\"stroke-width\", function (d) {\n return 3 / scale;\n });\n node.selectAll(\"text\")\n .attr(\"x\", function (d) {\n var x = (-1 * (get_width(d) / Math.sqrt( scale)) / 2); // * scale;\n return x.toString();\n })\n .attr(\"y\", function (d) {\n var y = 2 + (4 * get_radius(d) / Math.sqrt(scale)); // * scale;\n return y.toString();\n })\n .style(\"font-size\", function (d) {\n var iSize = 2 + Math.round( 14 / scale);\n return (scale < 1) ? \"14px\" : iSize.toString() + \"px\";\n });\n\n // Semantic rescale: just the size of the circles\n //g.selectAll(\"circle\")\n // .attr('transform', event.transform);\n }", "static set niceMouseDeltaZoom(value) {}", "function updateLineWidth(width) { \n // Clamp the line width\n line_width = Math.min(Math.max(width, min_line_width), max_line_width);\n\n // Update range input values\n document.getElementById('line_width').value = line_width;\n document.getElementById('line_width_context').value = line_width;\n\n // Update previews\n var preview = document.getElementById('line_preview');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n preview = document.getElementById('line_preview_context');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n\n // Update cursor\n var cursor = document.getElementById('cursor');\n cursor.style.width = line_width + \"px\";\n cursor.style.height = line_width + \"px\";\n}", "function MouseWheelHandler(e) {\n // Prevent page from scrolling\n e.preventDefault();\n\n console.log(e.layerX + ' ' + e.layerY);\n\n /* Calculate scale */\n var scaleBy = e.wheelDeltaY/1000;\n\n /* Save scale for scrolling */\n canvas_scale *= 1+scaleBy;\n\n /* Translate and scale context */\n context.translate(e.layerX, e.layerY);\n context.scale(1+scaleBy, 1+scaleBy);\n context.translate(-e.layerX, -e.layerY);\n\n redraw(contex_line_data);\n}", "function zoom(event) \r\n {\r\n\r\n let delta = Math.sign(event.deltaY);\r\n\r\n if (delta > 0)\r\n {\r\n if (width <= 240)\r\n width += scale;\r\n\r\n if (height <= 260)\r\n height += scale;\r\n }\r\n\r\n if (delta < 0)\r\n {\r\n if (width >= 40)\r\n width -= scale;\r\n\r\n if (height >= 60)\r\n height -= scale;\r\n }\r\n\r\n\r\n lens.style.width = width + \"px\";\r\n lens.style.height = height + \"px\";\r\n }", "function viewport_line(e){\n\tsettings.colors.line=e.srcElement.value;\n\tvp.line=settings.colors.line;\t\n}", "function changeSize() {\n\tctx.beginPath();\n\tctx.lineWidth = selectElmt.options[selectElmt.selectedIndex].value;\n\tctx.stroke();\n}", "function drawline() {\n\n var start_in = win_height * .3;\n var start_out = win_height;\n\n if (scroll_top >= (start_in - 25) && scroll_top <= (start_out * 2)) {\n\n var svg_container = document.getElementById(\"whatwedo\");\n var svg_paths = svg_container.getElementsByTagNameNS(ns, \"path\");\n var svg_lines = svg_container.getElementsByTagNameNS(ns, \"line\");\n\n if (scroll_top - start_in < 0) {\n var percent_done = 0;\n } else {\n var percent_done = (scroll_top - start_in) / (start_out - start_in);\n }\n\n for (var x = 0; x < svg_paths.length; x++) {\n var path = svg_paths[x];\n var path_length = path.getTotalLength();\n var length = percent_done * path_length;\n\n path.style.strokeDasharray = [length, path_length].join(' ');\n path.style.fillOpacity = percent_done - .4;\n }\n\n for (var x = 0; x < svg_lines.length; x++) {\n\n var line = svg_lines[x];\n var line_height = path.getTotalLength();\n var length = percent_done * line_height + 36;\n\n line.style.strokeOpacity = percent_done;\n line.style.strokeDasharray = [length, path_length].join(' ');\n }\n }\n }", "getLineWidth() {\n return this.props.lineWidth || '50px';\n }", "function drawLTTLines(\n x1,\n x2,\n y1,\n y2,\n svg,\n xScale,\n yScale,\n color = \"black\",\n lwd = 3\n) {\n svg\n .append(\"line\")\n .attr(\"x1\", xScale(x1))\n .attr(\"x2\", xScale(x2))\n .attr(\"y1\", yScale(y1))\n .attr(\"y2\", yScale(y2))\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", lwd)\n .attr(\"stroke-linecap\", \"round\");\n}", "function zoomed() {\n var new_x = d3.event.transform.rescaleX(x);\n var new_y = d3.event.transform.rescaleY(y);\n // update axe\n gX.call(xAxis.scale(new_x));\n gY.call(yAxis.scale(new_y));\n dots.data(data)\n .attr('cx', function (d) {\n return new_x(d[labels.x])\n })\n .attr('cy', function (d) {\n return new_y(d[labels.y])\n });\n }", "function adjustlineheight(container){\n\t\t\tvar emWidth = parseInt($(container).width())/$.jqem.current();\n\t\t\t// Enforce minimum line-height\n\t\t\tif (emWidth <= settings.minWidth) emWidth = settings.minWidth;\n\t\t\tvar newLineHeight = settings.minLineHeight+((emWidth-settings.minWidth)*settings.ratio);\n\t\t\t$(container).css('line-height',newLineHeight);\n\t\t}", "function setStrokeWidth(element) {\r\n \t\twidth = element.value;\r\n \t\tvar object = canvas.getActiveObject();\r\n\r\n\r\n \t\tconsole.log(width) \r\n console.log(object)\r\n if (object.paths) {\r\n for (var i = 0; i < object.paths.length; i++) {\r\n object.paths[i].set({\r\n \r\n \r\n strokeWidth: width\r\n });\r\n }\r\n }\r\n\t \r\n \tcanvas.renderAll();\r\n\t}", "function debugResize(){\n ctx.strokeStyle = 'red';\n ctx.lineWidth = '5';\n ctx.strokeRect(0,0,window.innerWidth, window.innerHeight);\n }", "function thicknessFn(){\n // return true;\n // video.volume = volumeSlider.value / 100;\n // if(volumeSlider.value == 0){\n // mute.innerHTML = `<i class=\"fas fa-volume-mute fa-2x\"></i>`\n // } else {\n // mute.innerHTML = `<i class=\"fas fa-volume-up fa-2x\"></i>`\n // }\n // e.preventDefault();\n console.log(thickness.value);\n ctx.lineWidth = thickness.value;\n }", "updateLastLine(line) { // this is used when drawing with the pen\r\n if (line.length < 2) return;\r\n var point1 = line.points[line.points.length - 1];\r\n var point2 = line.points[line.points.length - 2];\r\n point1 = this.worldPointToChunkScreenPoint(point1);\r\n point2 = this.worldPointToChunkScreenPoint(point2);\r\n this.ctx.beginPath();\r\n this.ctx.lineWidth = Main.Camera.getRelativeWidth(line.width);\r\n this.ctx.strokeStyle = line.style;\r\n this.ctx.lineTo(point1.x, point1.y);\r\n this.ctx.lineTo(point2.x, point2.y);\r\n this.ctx.stroke();\r\n }", "function appSalesLines(element, height) {}", "function lines(){\n\n\tsetColors();\n\tstroke(colorOne,colorTwo,colorThree);\n\t//lines used to divide the space\n\t//line(0,0,500,500);\n\t//line(0,500,500,0);\n\t//line(0,250,500,250);\n\t//line(250,0,250,500);\n\n\t\n}", "function width_stroke(val1)\n{\n\tcurrent_element_stroke_width = val1;\n}", "function scaleLines() {\t\n\tconsole.log(\"> scaling...\");\n\t// DATA POINTS\n\tsvg.selectAll(\".data-point\")\n .each(function(i) {\n\t\t\t\td3.select(this)\n\t\t\t\t\t.transition()\n\t\t\t\t\t .duration(SCALE_DURATION)\n\t\t\t\t\t .attr(\"cx\", function (d) { return xScale(new Date(d.date)); })\n\t\t\t\t\t .attr(\"cy\", function (d) { return yScale(d.value); })\n\t\t\t\t\t .attr(\"opacity\", function (d) { \n\t\t\t\t\t \t\tif(xScale(new Date(d.date)) < xScale(xDomain.min)) {\n\t\t\t\t\t \t\t\treturn 0;\n\t\t\t\t\t \t\t} \n\t\t\t\t\t \t\treturn DATA_POINT_OPACITY;\n\t\t\t\t\t \t});\n });\t\t\t \n\t// DATA LINES\n\tvar line = d3.svg.line()\n\t\t\t\t\t .x(function (d) { return xScale(new Date(d.date)); })\n\t\t\t\t\t .y(function (d) { return yScale(d.value); });\n\tpathContainer.selectAll(\".line\")\n\t\t\t.each(function(i) {\n\t\t\t\td3.select(this)\n\t\t\t\t\t.transition()\n\t\t\t\t\t .attr(\"stroke-dasharray\", null)\n\t \t\t\t\t .attr(\"stroke-dashoffset\", null)\n\t\t\t\t\t .duration(SCALE_DURATION)\n\t\t\t\t .attr(\"d\", line);\n\t\t\t});\t\n\t// DATA ANALYSIS\n\tupdateAllDataAnalysis();\n}", "function smoothLine(id) {\n let index = indexArray.indexOf(id);\n let config = configArray[index];\n if (config.options.elements.line.tension == '0.4') {\n config.options.elements.line.tension = 0.000001;\n } else {\n config.options.elements.line.tension = 0.4;\n }\n chartsArray[indexArray.indexOf(id)].update();\n}", "function zoom() {\n \t\t\tsvg.selectAll(\".dot\")\n \t\t\t .attr(\"cx\", function(d) { return xScale(d[0]); })\n \t\t\t\t .attr(\"cy\", function(d) { return yScale(d[1]); });\n }", "function lineWidth(column) {\n var fs_scale = $('body').hasClass('fullscreen') ? 1.5 : 1,\n scale = chart.hasHighlight() ? chart.isHighlighted(column) ? 1 : 0.65 : 1;\n return theme.lineChart.strokeWidth * fs_scale * scale;\n }", "function stroke_width(d) {\n if (d.source.chosen && d.target.chosen) {\n return \"5px\";\n }\n else {\n return \"1.5px\";\n }\n}", "function PatchLine() { }", "function drawFixation() {\n let ctx = document.getElementById('canvas').getContext('2d');\n ctx.lineWidth = prms.fixWidth;\n ctx.moveTo(-prms.fixSize, 0);\n ctx.lineTo( prms.fixSize, 0);\n ctx.stroke(); \n ctx.moveTo(0, -prms.fixSize);\n ctx.lineTo(0, prms.fixSize);\n ctx.stroke(); \n}", "function setLineSize(intLineSize){\r\n\tif (intLineSize == 2){\r\n\t\tintNumberOfColumns = 80; // 24X80\r\n\t\tintNumberOfRows = 24;\r\n\t} else if (intLineSize == 3){\r\n\t\tintNumberOfColumns = 80; // 32X80\r\n\t\tintNumberOfRows = 32;\r\n\t} else if (intLineSize == 4){\r\n\t\tintNumberOfColumns = 80; // 43X80\r\n\t\tintNumberOfRows = 43;\r\n\t} else if (intLineSize == 6){\r\n\t\tintNumberOfColumns = 132; // 27X132\r\n\t\tintNumberOfRows = 27;\r\n\t} else if (intLineSize == 5){\r\n\t\tintNumberOfColumns = 132; // 24X132\r\n\t\tintNumberOfRows = 24;\r\n\t}else if (intLineSize == 17){\r\n\t\tintNumberOfColumns = 160; // 62X160\r\n\t\tintNumberOfRows = 62;\r\n\t}\r\n\tnrtc = intNumberOfRows*intNumberOfColumns;\r\n}", "lines(list, thickness=1) {\n\t\tctx.lineWidth = thickness/ctxtransform[0];\n\t\tif (list.length < 2) return;\n\t\tctx.beginPath();\n\t\tfor (let i=0; i<list.length; i+=2) {\n\t\t\tctx.moveTo(list[i][0], list[i][1]);\n \tctx.lineTo(list[i+1][0], list[i+1][1]);\n\t\t}\n ctx.stroke();\n }", "get xAxisAnnotationStrokeThickness() {\r\n return this.i.nk;\r\n }", "function mouseZoomer(options) {\n\tvar obj = this; \n\tobj.loadOptions(options);\n\td3VizObj.controls.push(obj); obj.id = d3VizObj.controls.length-1;\n\tif(typeof obj.click_event==\"undefined\") obj.click_event = \"click\";\n\tif(typeof obj.zoom_factor==\"undefined\") obj.zoom_factor = 3;\n\tif(typeof obj.positions_zoom_factor==\"undefined\") obj.positions_zoom_factor = 5;\n\tobj.centered = null;\n\tobj.strokes = [];\n\tif(typeof obj.svg==\"undefined\") obj.svg = \"stage\";\n\n\tthis.addZoomEvents = function() {\n\t\tif(debug) console.log(\"Attaching zoom events\");\n\t\tfor(var i in obj.zoom_if_clicked) {\n\t\t\tif(debug) console.log(\"Attaching to \"+obj.zoom_if_clicked[i]);\n\t\t\tobj.map[obj.svg].selectAll(obj.zoom_if_clicked[i])\n\t\t\t\t.on(obj.click_event, obj.zoom) //let it take clicks\n\t\t\t;\n\t\t}\n\t\tif(debug) console.log(\"Done attaching\");\n\t}\n\tthis.preserveStrokes = function() {\n\t\tif(debug) console.log(\"Zoomer: Preserving strokes\");\n\t\tfor(var i in obj.preserve_strokes) {\n\t\t\tif((typeof window[obj.preserve_strokes[i]] !=\"undefined\")||(typeof obj.preserve_strokes[i] !=\"undefined\")||(obj.map[obj.svg].selectAll(obj.preserve_strokes[i]).length>0)) {\n\t\t\t try {\n\t\t\t \td3.selectAll(obj.preserve_strokes[i]).attr(\"_z_stroke-width\",function(d) { return parseFloat(window.getComputedStyle(this).strokeWidth); });\n\t\t\t\tobj.strokes[i] = parseFloat(obj.map[obj.svg].select(obj.preserve_strokes[i]).style(\"stroke-width\"));\n\t\t\t } catch(err) {\n\t\t\t\tif(debug) console.log(\"Mouse zoomer tried to get the stroke of items '\" + obj.preserve_strokes[i]+\"' but failed (it might not exist)\");\n\t\t\t }\n\t\t\t}\n\t\t}\n\t}\n\tthis.zoom = function(d) {\n\t\tvar x, y;\n\t\t//x and y are the pixel positions to center on\n\t\t//k is the zoom level\n\t\tif(!d&& !obj.centered) {\n\t\t\tx = d3.mouse(this)[0];\n\t\t\ty = d3.mouse(this)[1];\n\t\t\tobj.map.zoom_factor = obj.zoom_factor;\n\t\t\tobj.centered = true;\n\t\t} else if(!d && obj.centered) {\t//special case for clicking on things without positions\n\t\t\tx = obj.map.width / 2;\n\t\t\ty = obj.map.height / 2;\n\t\t\tobj.map.zoom_factor = 1;\n\t\t\tobj.centered = null;\n\t\t} else if(d.positions && obj.centered !==d) { //if you click on something that has a \"positions\" property, it will center on it — this makes circles clickable\n\t\t\tx = d.positions[0];\n\t\t\ty = d.positions[1];\n\t\t\tobj.map.zoom_factor = obj.positions_zoom_factor;\n\t\t\tobj.centered = d;\n\t\t} else if (d && obj.centered !== d) { //if you click on anything else that had position data (like a landform), it will figure out the center of it and them zoom on it\n\t\t\tif(obj.zoom_to_centroid) {\n\t\t\t\tvar centroid = obj.map.path.centroid(d);\n\t\t\t\tx = centroid[0];\n\t\t\t\ty = centroid[1];\n\t\t\t} else {\n\t\t\t\tx = d3.mouse(this)[0];\n\t\t\t\ty = d3.mouse(this)[1];\n\t\t\t}\n\t\t\tobj.map.zoom_factor = obj.zoom_factor;\n\t\t\tobj.centered = d;\n\t\t} else { //if it detects it is already zoomed it, it zooms back out\n\t\t\tx = obj.map.width / 2;\n\t\t\ty = obj.map.height / 2;\n\t\t\tobj.map.zoom_factor = 1;\n\t\t\tobj.centered = null;\n\t\t}\n\n\t\tobj.map[obj.svg].selectAll(\"path\")\n\t\t .classed(\"active\", obj.centered && function(d) { return d === obj.centered; });\n\t\tif(obj.preserve_strokes.length) {\n\t\t\tobj.map[obj.svg]\n\t\t\t .transition()\n\t\t\t .duration(obj.zoom_transition_speed)\n\t\t\t .attr(\"transform\", \"translate(\" + obj.map.width / 2 + \",\" + obj.map.height / 2 + \")scale(\" + obj.map.zoom_factor + \")translate(\" + -x + \",\" + -y + \")\")\n\t\t\t .selectAll(obj.preserve_strokes[0])\n\t\t\t\t.style(\"stroke-width\",function() {\n\t\t\t\t\t\tif(typeof d3.select(\"#\"+this.id).attr(\"_z_stroke-width\")!==\"undefined\") {\n\t\t\t\t\t\treturn d3.select(\"#\"+this.id).attr(\"_z_stroke-width\")/obj.map.zoom_factor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn obj.strokes[0]/obj.map.zoom_factor;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t;\n\t\t\tif(obj.preserve_strokes.length>1) {\n\t\t\t\tfor(var i in obj.preserve_strokes) {\n\t\t\t\t\tif(i>0) {\n\t\t\t\t\t\tobj.map[obj.svg].selectAll(obj.preserve_strokes[i])\n\t\t\t\t\t\t\t.transition()\n\t\t\t\t\t\t\t.duration(obj.zoom_transition_speed)\n\t\t\t\t\t\t\t.style(\"stroke-width\",function() {\n\t\t\t\t\t\t\t\tif(typeof d3.select(\"#\"+this.id).attr(\"_z_stroke-width\")!==\"undefined\") {\n\t\t\t\t\t\t\t\t\treturn d3.select(\"#\"+this.id).attr(\"_z_stroke-width\")/obj.map.zoom_factor;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn obj.strokes[0]/obj.map.zoom_factor;\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; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tobj.map[obj.svg].transition()\n\t\t\t .duration(obj.zoom_transition_speed)\n\t\t\t .attr(\"transform\", \"translate(\" + obj.map.width / 2 + \",\" + obj.map.height / 2 + \")scale(\" + obj.map.zoom_factor + \")translate(\" + -x + \",\" + -y + \")\")\n\t\t}\t\n\t}\n\td3VizObj.addHook(\"run_after_everything\",this.addZoomEvents);\n\td3VizObj.addHook(\"run_after_everything\",this.preserveStrokes);\t\n}", "get strokeWidth() {\n return this._strokeWidth || this.diameter / 10;\n }", "function addZoom() {\n svg.call(d3.zoom()\n .extent([\n [0,0],\n [1000,1000],\n ])\n .scaleExtent([1,8])\n .on(\"zoom\", zoomed)\n );\n}", "drawLineCanvas() {\n var minimumLineWidth = 25;\n var maximumLineWidth = 100;\n var lineWidthRange = maximumLineWidth - minimumLineWidth;\n var maximumSpeed = 50;\n \n this.lineCanvasContext.clearRect(0, 0, this.lineCanvas.width, this.lineCanvas.height);\n this.lineCanvasContext.lineCap = 'round';\n this.lineCanvasContext.shadowBlur = 30;\n this.lineCanvasContext.shadowColor = '#FFF';\n \n for (var i = 1; i < this.state.points.length; i++) {\n var point = this.state.points[i];\n var previousPoint = this.state.points[i - 1];\n \n // Change line width based on speed\n var distance = this.getDistanceBetween(point, previousPoint);\n var speed = Math.max(0, Math.min(maximumSpeed, distance));\n var percentageLineWidth = (maximumSpeed - speed) / maximumSpeed;\n this.lineCanvasContext.lineWidth = minimumLineWidth + percentageLineWidth * lineWidthRange;\n \n // Fade points as they age\n var age = Date.now() - point.time;\n var opacity = (this.pointLifetime - age) / this.pointLifetime;\n this.lineCanvasContext.strokeStyle = 'rgba(0, 0, 0, ' + opacity + ')';\n \n this.lineCanvasContext.beginPath();\n this.lineCanvasContext.moveTo(previousPoint.x, previousPoint.y);\n this.lineCanvasContext.lineTo(point.x, point.y);\n this.lineCanvasContext.stroke();\n }\n }", "function drawLine(name,x0, y0, x1, y1, thickness, color, emit){\n listOfCanvas[name].context.beginPath();\n\t\tlistOfCanvas[name].context.globalCompositeOperation=\"source-over\";\n\t\tlistOfCanvas[name].context.moveTo((x0 + $(\"#canvasContainer\" + listOfCanvas[name].container).scrollLeft()), y0);\n\t\tlistOfCanvas[name].context.lineTo((x1 + $(\"#canvasContainer\" + listOfCanvas[name].container).scrollLeft()), y1);\n\t\tlistOfCanvas[name].context.strokeStyle = color;\n\t\tlistOfCanvas[name].context.lineWidth = thickness*scale;\n\t\tlistOfCanvas[name].context.stroke();\n listOfCanvas[name].context.closePath();\n }", "function drawLine(){\n d3.select(\".content\").selectAll(\"line[del=snapline]\").remove();\n\n var sc = $(\"div.posts\");\n\t var ids = $(\".snapLine\");\n for(var i=0;i<allData.length;i++){\n var item=$(\"g[name=\"+allData[i].name+\"]\");\n for(var j=0;j<item.length-1;j++){\n var off1 = $(item[j]).offset().left;\n var off2 = $(item[j+1]).offset().left;\n if (off2-off1 >750){continue;}\n var x1 = 0;\n var x2 = 100;//$(\"#snapLine1\").width();\n var y1 = $(item[j]).position().top;// - $(sc[j]).scrollTop();\n var y2 = $(item[j+1]).position().top;// - $(sc[j+1]).scrollTop();\n var mid_h = winSize.height*0.8;//$(\"#snapLine1\").height();\n var o = 1 - Math.max(Math.abs(y1-mid_h/2), Math.abs(y2-mid_h/2))*2/mid_h;\n o = Math.sqrt(o);\n //动了这里\n\n var marginTop = 20, eachgHeight = 30;\n\n y1-= (marginTop+2*eachgHeight);\n y2-= (marginTop+2*eachgHeight);\n\n if((y1 < 0 || y1 > mid_h) || (y2 < 0 || y2 > mid_h))\n {continue;}\n\n y1+=eachgHeight;\n y2+=eachgHeight;\n\n console.log($(ids[j]).attr(\"id\"));\n d3.select(\"#\"+$(ids[j]).attr(\"id\")).select(\"svg\").append(\"line\")\n .attr(\"del\",\"snapline\")\n .attr(\"name\",function(){return allData[i].name;})\n .attr(\"x1\",x1)\n .attr(\"x2\",x2)\n .attr(\"y1\",y1)\n .attr(\"y2\",y2)//到这里,然后是这个y1y2的值取错了,这里取得的是相对浏览器的绝对位置,需要一个相对于自身svg的相对位置\n .attr(\"opacity\",function(){\n if (o>=0.1)\n {\n return o;\n }else{\n return 0.1;\n }\n }).attr(\"stroke\",\"black\");\n }\n }\n}", "function line_options(element,data,canvas_id,chart_id,chart_datas){\n y_subset_max = 0\n y_overall_max = 0\n data.datas.forEach(function(item,i){\n if(i==0){\n y_subset_max = Math.max(...item.data) \n }else{\n y_overall_max = Math.max(...item.data) \n }\n })\n y_max = 0\n if(Math.abs(y_overall_max-y_subset_max)>10000000){\n y_max = y_subset_max\n\n }else{\n y_max = (y_overall_max>y_subset_max)?y_overall_max:y_subset_max\n }\n \n var options = { \n // Container for pan options\n plugins: {\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n rangeMin: {\n y: 0\n },\n },\n zoom: {\n enabled: true,\n sensitivity: 0.001,\n speed: 10,\n mode: 'x',\n rangeMin: {\n y: 0\n },\n rangeMax: {\n y: 500\n },\n \n }\n }\n },\n legend:{\n display:false\n },\n elements: {\n line: {\n tension: 0\n }\n },\n tooltips:{\n displayColors: false,\n callbacks:{\n title:function(tooltipItem){\n let title = data.labels[tooltipItem[0].index]\n if(title.length>20){\n start = 0\n valid = true\n result = []\n while(valid){\n if((start + 20)<title.length){\n result.push(title.substring(start,start+20))\n start +=20 \n }else{\n valid = false\n }\n }\n return result\n }else{\n return title\n } \n },\n label:function(tooltipItem,data){\n var chart_id ='a_chart_'+element.getAttribute('id').substring(10)\n chart_data = chart_datas[curr_dataset][chart_id]\n \n if (chart_data){\n var modify_labels = Object.keys(chart_data.otherInfo).map(function(item){\n item = item.toString()\n if(item.length>10){\n return item.substring(0,10) + '...'\n }else{\n return item\n } \n })\n \n if(modify_labels.includes(tooltipItem.xLabel)){\n var multistringText = [tooltipItem.yLabel] \n //產生tooltip\n var label_index = modify_labels.indexOf(tooltipItem.xLabel)\n var one2oneList = Object.values(chart_data.otherInfo)[label_index]\n Object.keys(one2oneList).forEach(function(key){\n let text = key + '=' + one2oneList[key]\n text = (text.length>20)? text.substring(0,20):text\n multistringText.push(text)\n })\n \n return multistringText\n \n }else{\n if (tooltipItem.yLabel == \"\"){\n value = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]\n return Math.floor(value*100) + \"%\"\n }\n return tooltipItem.yLabel\n } \n }else{\n if (tooltipItem.yLabel == \"\"){\n value = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]\n return Math.floor(value*100) + \"%\"\n }\n return tooltipItem.yLabel\n }\n \n }\n }\n },\n responsive: true,\n maintainAspectRatio: false,\n scales: {\n xAxes: [{\n scaleLabel: {\n display: true,\n labelString: data.x,\n fontStyle: \"bold\",\n },\n ticks: {\n autoSkip: true,\n maxTicksLimit: 15\n },\n afterTickToLabelConversion : function(q){\n for(var tick in q.ticks){\n if(q.ticks[tick].length>10){\n q.ticks[tick] = q.ticks[tick].substring(0,10) + '...'\n }\n }\n }\n }],\n yAxes: [{\n scaleLabel: {\n display: true,\n labelString: data.y,\n fontStyle: \"bold\"\n },\n position:\"left\",\n ticks: {\n min: 0\n },\n afterTickToLabelConversion : function (q){\n for(var tick in q.ticks){\n if(data.y_glo_aggre == \"per\"){\n var value = parseFloat(q.ticks[tick])\n q.ticks[tick] = Math.round((value*100)).toString() + \"%\" ;\n }else{\n var value = parseInt(q.ticks[tick]) \n if(value>=1000 && value<1000000){\n q.ticks[tick] = parseInt(value / 1000).toString() + \"K\" ;\n }else if(value>=1000000){\n q.ticks[tick] = parseInt(value / 1000000).toString() + \"M\" ;\n }\n }\n \n }\n }\n },{\n id: 'overall',\n position:\"right\",\n display: false,\n ticks: {\n min: 0\n },\n afterTickToLabelConversion : function (q){\n for(var tick in q.ticks){\n if(data.y_glo_aggre == \"per\"){\n var value = parseFloat(q.ticks[tick])\n q.ticks[tick] = Math.round((value*100)).toString() + \"%\" ;\n }else{\n var value = parseInt(q.ticks[tick]) \n if(value>=1000 && value<1000000){\n q.ticks[tick] = parseInt(value / 1000).toString() + \"K\" ;\n }else if(value>=1000000){\n q.ticks[tick] = parseInt(value / 1000000).toString() + \"M\" ;\n }\n }\n \n }\n }\n }\n ],\n }\n }\n\n \n //show second y-axes if there are two dataset\n if(data.datas.length>1){\n options.scales.yAxes[1].display = true\n }\n \n return options\n}", "function drawLines() {\n ctx.lineWidth = 0.5;\n\n for (var i = 0; i < numOfDots; i++) {\n for (var j = i + 1; j < numOfDots; j++) {\n\n var dot1 = dots[i];\n var dot2 = dots[j];\n var distance = Math.hypot(Math.abs(dot1.x - dot2.x),\n Math.abs(dot1.y - dot2.y));\n\n if (distance <= 200) {\n\n var saturation = 1 - distance / 200;\n saturation = Math.floor(saturation * 100) / 100;\n ctx.strokeStyle = `rgba(255, 255, 255, ${saturation})`;\n\n ctx.beginPath();\n ctx.moveTo(dot1.x, dot1.y);\n ctx.lineTo(dot2.x, dot2.y);\n ctx.stroke();\n }\n }\n }\n}", "function jt(e,t,a){var n=e.options.lineWrapping,r=n&&zt(e);if(!t.measure.heights||n&&t.measure.width!=r){var f=t.measure.heights=[];if(n){t.measure.width=r;for(var o=t.text.firstChild.getClientRects(),i=0;i<o.length-1;i++){var s=o[i],c=o[i+1];Math.abs(s.bottom-c.bottom)>2&&f.push((s.bottom+c.top)/2-a.top)}}f.push(a.bottom-a.top)}}", "function lineWidth(w) {\n if (isDef(w))\n _g.lineWidth = w;\n return _g.lineWidth;\n }", "function lines(){\n\tctx.beginPath();\n\tctx.moveTo(0,h/2);\n\tctx.lineTo(w,h/2);\n\tctx.lineWidth=\"3\";\n\tctx.strokeStyle = \"white\"\n\tctx.stroke();\n}", "function LineStyle() {\n\tthis.thickness=1.5;\n\tthis.endCap = 'round';\n\tthis.setThickness = function(thickness) {\n\t\tthis.thickness = thickness;\n\t\treturn this;\n\t};\n\tthis.setEndCap = function(endCap) {\n\t\tthis.endCap = endCap;\n\t\treturn this;\n\t};\n}", "zoomIn() {\n this.zoomWithScaleFactor(0.5)\n }", "onConfigurationChanged(e) {\n this._visibleLines.onConfigurationChanged(e);\n if (e.hasChanged(116 /* wrappingInfo */)) {\n this._maxLineWidth = 0;\n }\n const options = this._context.configuration.options;\n const fontInfo = options.get(36 /* fontInfo */);\n const wrappingInfo = options.get(116 /* wrappingInfo */);\n this._lineHeight = options.get(51 /* lineHeight */);\n this._typicalHalfwidthCharacterWidth = fontInfo.typicalHalfwidthCharacterWidth;\n this._isViewportWrapping = wrappingInfo.isViewportWrapping;\n this._revealHorizontalRightPadding = options.get(81 /* revealHorizontalRightPadding */);\n this._cursorSurroundingLines = options.get(20 /* cursorSurroundingLines */);\n this._cursorSurroundingLinesStyle = options.get(21 /* cursorSurroundingLinesStyle */);\n this._canUseLayerHinting = !options.get(23 /* disableLayerHinting */);\n configuration_1.Configuration.applyFontInfo(this.domNode, fontInfo);\n this._onOptionsMaybeChanged();\n if (e.hasChanged(115 /* layoutInfo */)) {\n this._maxLineWidth = 0;\n }\n return true;\n }", "function strokeWidth(thickness) {\n var maxAllowedWidth = 6, minAllowedWidth = 1;\n return Math.max(minAllowedWidth, Math.min(maxAllowedWidth, thickness));\n }", "function move() {\r\n var t = d3.event.translate;\r\n var s = d3.event.scale; \r\n\r\n zoom.translate(t);\r\n g.style(\"stroke-width\", 1 / s).attr(\"transform\", \"translate(\" + t + \")scale(\" + s + \")\");\r\n }", "line(...args) {\n let thickness = args[args.length-1];\n if (typeof thickness != \"number\") {\n thickness = 1;\n }\n let p1 = args[1];\n if (typeof p1 != \"object\") {\n p1 = [0, 0];\n }\n let p0 = args[0];\n if (typeof p0 != \"object\") {\n p0 = [0, 0];\n }\n ctx.lineWidth = thickness/ctxtransform[0];\n ctx.beginPath();\n ctx.moveTo(p0[0], p0[1]);\n ctx.lineTo(p1[0], p1[1]);\n ctx.stroke();\n\t}", "function setZoom() {\r\n zoom = 2.0;\r\n}", "function setZoom() {\r\n zoom = 2.0;\r\n}", "function line_positions() {\n\n line_one_x = win_width * .7;\n line_one_y = win_height * .8;\n\n line_two_x = win_width * .75;\n line_two_y = -(line_two.getBBox().height / 2);\n\n line_three_x = win_width * .65;\n line_three_y = win_height * .6;\n\n line_one.attr({\n transform: 't' + line_one_x + ' ' + line_one_y\n });\n line_two.attr({\n transform: 't' + line_two_x + ' ' + line_two_y\n });\n line_three.attr({\n transform: 't' + line_three_x + ' ' + line_three_y\n })\n }", "dxdy_lines() {\r\n\t\t//Now add the lines and text underneath and on the side of the slope line so show d(x) and d(y)\r\n\t\tlet oldLines = this.dxdy.selectAll('line');\r\n\t\toldLines.remove();\r\n\t\tlet oldText = this.dxdy.selectAll('text');\r\n\t\toldText.remove();\r\n\t\t//Line for d(x)\r\n\t\tlet left = this.endPointA, right = this.endPointB;\r\n\t\tlet high = this.endPointA, low = this.endPointB;\r\n\t\tif(this.endPointB.x < this.endPointA.x) {\r\n\t\t\tleft = this.endPointB;\r\n\t\t\tright = this.endPointA;\r\n\t\t}\r\n\t\tif(this.endPointA.y > this.endPointB.y) {\r\n\t\t\tlow = this.endPointA;\r\n\t\t\thigh = this.endPointB;\r\n\t\t}\r\n\t\t//Dealing with the bottom d(x) lines and text\r\n\t\tthis.handle_distance.x = Number(Math.abs(left.x - right.x) * this.unit_per_square.x).toFixed(1);\r\n\t\tthis.dxdy.append('line') //Bottom Left x line\r\n\t\t\t.attr('x1', left.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y1', low.y * this.cell_size + this.offset.y + this.cell_size / 3)\r\n\t\t\t.attr('x2', left.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y2', low.y * this.cell_size + this.offset.y + this.cell_size / 3 * 2)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('line') //Bottom Right x line\r\n\t\t\t.attr('x1', right.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y1', low.y * this.cell_size + this.offset.y + this.cell_size / 3)\r\n\t\t\t.attr('x2', right.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y2', low.y * this.cell_size + this.offset.y + this.cell_size / 3 * 2)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('line') //Bottom x line\r\n\t\t\t.attr('x1', left.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y1', low.y * this.cell_size + this.offset.y + this.cell_size / 2)\r\n\t\t\t.attr('x2', right.x * this.cell_size + this.offset.x)\r\n\t\t\t.attr('y2', low.y * this.cell_size + this.offset.y + this.cell_size / 2)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('text')\r\n\t\t\t.attr('x', (left.x * this.cell_size + this.offset.x) + (right.x - left.x) * this.cell_size / 2 - 5)\r\n\t\t\t.attr('y', low.y * this.cell_size + this.offset.y + this.cell_size)\r\n\t\t\t.attr('font-family', 'sans-serif')\r\n\t\t\t.attr('font-size', this.text_sizes.normal)\r\n\t\t\t.text(this.handle_distance.x);\r\n\r\n\t\t//Dealing with the side d(y) lines and text\r\n\t\tlet side = left;\r\n\t\tlet side_multiplier = -1;\r\n\t\tif(left.y > right.y) { //Find out which side to draw this line on\r\n\t\t\tside = right;\r\n\t\t\tside_multiplier = 1;\r\n\t\t}\r\n\t\tthis.handle_distance.y = Number(Math.abs(low.y - high.y) * this.unit_per_square.y).toFixed(1);\r\n\t\tthis.dxdy.append('line') //Top Side y line\r\n\t\t\t.attr('x1', side.x * this.cell_size + this.offset.x + this.cell_size / 3 * 2 * side_multiplier)\r\n\t\t\t.attr('y1', high.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('x2', side.x * this.cell_size + this.offset.x + this.cell_size / 3 * side_multiplier)\r\n\t\t\t.attr('y2', high.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('line') //Bottom Side y line\r\n\t\t\t.attr('x1', side.x * this.cell_size + this.offset.x + this.cell_size / 3 * 2 * side_multiplier)\r\n\t\t\t.attr('y1', low.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('x2', side.x * this.cell_size + this.offset.x + this.cell_size / 3 * side_multiplier)\r\n\t\t\t.attr('y2', low.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('line') //Side y line\r\n\t\t\t.attr('x1', side.x * this.cell_size + this.offset.x + this.cell_size / 2 * side_multiplier)\r\n\t\t\t.attr('y1', high.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('x2', side.x * this.cell_size + this.offset.x + this.cell_size / 2 * side_multiplier)\r\n\t\t\t.attr('y2', low.y * this.cell_size + this.offset.y)\r\n\t\t\t.attr('stroke', '#595959');\r\n\t\tthis.dxdy.append('text')\r\n\t\t\t.attr('x', (side.x * this.cell_size + this.offset.x + this.cell_size * side_multiplier))\r\n\t\t\t.attr('y', (high.y * this.cell_size + this.offset.y) + (low.y - high.y) * this.cell_size / 2)\r\n\t\t\t.attr('font-family', 'sans-serif')\r\n\t\t\t.attr('font-size', this.text_sizes.normal)\r\n\t\t\t.text(this.handle_distance.y);\r\n\r\n\t\tthis.footer.change_question(this.x_units, this.y_units, this.handle_distance.x, this.handle_distance.y);\r\n\t}", "setRendererSize(w,h) {\n\n }", "updateLines(lines) {\n const webgl = this.webgl;\n lines.forEach((line) => {\n if (line.visible) {\n webgl.useProgram(this.progThinLine);\n const uscale = webgl.getUniformLocation(this.progThinLine, \"uscale\");\n webgl.uniformMatrix2fv(uscale, false, new Float32Array([\n line.scaleX * this.gScaleX,\n 0,\n 0,\n line.scaleY * this.gScaleY * this.gXYratio,\n ]));\n const uoffset = webgl.getUniformLocation(this.progThinLine, \"uoffset\");\n webgl.uniform2fv(uoffset, new Float32Array([line.offsetX + this.gOffsetX, line.offsetY + this.gOffsetY]));\n const uColor = webgl.getUniformLocation(this.progThinLine, \"uColor\");\n webgl.uniform4fv(uColor, [line.color.r, line.color.g, line.color.b, line.color.a]);\n webgl.bufferData(webgl.ARRAY_BUFFER, line.xy, webgl.STREAM_DRAW);\n webgl.drawArrays(line.loop ? webgl.LINE_LOOP : webgl.LINE_STRIP, 0, line.webglNumPoints);\n }\n });\n }", "function zoom(factor) {\n // TODO:\n // Some bug here when decreasing the spacing\n\n var time = getTime(0.5);\n\n if (scale * factor >= 2048 || scale * factor <= (1 / 128)) return;\n\n scale *= factor;\n\n rescale();\n setTime(time);\n refresh();\n}", "_recalculateDyValues(){\n const windowSize = this.yMax - this.yMin;\n this.dyZoom = windowSize * this.ZOOM_Y_PERCENTAGE;\n this.dyMove = windowSize * this.MOVE_Y_PERCENTAGE;\n }", "function resetZoom() {\n\tdocument.querySelector('meta[name=\"viewport\"]').setAttribute(\"content\", \"user-scalable=yes\")\n\twindow.myLine.resetZoom();\n\tdocument.querySelector('meta[name=\"viewport\"]').setAttribute(\"content\", \"user-scalable=no\")\n}", "function mxLine(bounds, stroke, strokewidth)\r\n{\r\n\tthis.bounds = bounds;\r\n\tthis.stroke = stroke;\r\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\r\n}", "function adjustSize() {\n var\n prevW = canvasW,\n prevH = canvasH;\n canvasW = $(svgContainer).innerWidth();\n canvasH = $(svgContainer).innerHeight();\n canvasR = canvasW / canvasH;\n boxW *= canvasW / prevW ;\n boxH *= canvasH / prevH ;\n svgRoot.setAttribute( 'width', canvasW );\n svgRoot.setAttribute( 'height', canvasH );\n //console.log('called adjustSize: '+canvasW+' '+canvasH);\n }", "function AdjustZoomLevel() {\n\tcurrentZoomLevel = map.getZoom();\n}", "function zoomed() {\n container.attr(\"transform\", d3.event.transform + \" translate(\" + width / 2 + \",\" + height / 2 + \") scale(0.2)\")\n }", "function computeTSpanDy(fontSize, line, lines) {\nif ( fontSize === null || isNaN(fontSize)) fontSize = 18;\nreturn fontSize * 4.5 / 13 * ( line - .2 - lines / 2 ) * 3.5;\n}", "function canvasZoomAnnotation(uuid, show_line_height, show_bottom_pad) {\n var row = this.annotations.rows.find(function (item) {\n return item.uuid === uuid;\n });\n if (!row) return;\n var focus_line_points = getFocusLinePoints(row, show_line_height, show_bottom_pad, this.scope.view.viewSize);\n var start_x = focus_line_points[0];\n var end_x = focus_line_points[1];\n var y = focus_line_points[2];\n\n if (!this.scope.view.zoom_animation.on && !this.scope.view.translate_animation.on) {\n this.scope.view.zoom_animation.reset();\n this.scope.view.zoom_animation.start_zoom = this.scope.view.zoom;\n this.scope.view.zoom_animation.end_zoom = this.scope.view.zoom * (this.scope.view.bounds.width / (end_x - start_x));\n this.scope.view.zoom_animation.p = 3;\n this.scope.view.zoom_animation.total_time = 0.5;\n this.scope.view.zoom_animation.on = true;\n this.scope.view.translate_animation.reset();\n this.scope.view.translate_animation.start_point = this.scope.view.center;\n this.scope.view.translate_animation.end_point = new paper.Point((end_x - start_x) / 2, y);\n this.scope.view.translate_animation.p = 3;\n this.scope.view.translate_animation.total_time = 0.5;\n this.scope.view.translate_animation.on = true;\n }\n}" ]
[ "0.7376246", "0.7234858", "0.7234858", "0.6784313", "0.6778145", "0.6720486", "0.6601283", "0.65776503", "0.6557231", "0.6552513", "0.64704573", "0.646643", "0.64166343", "0.6410832", "0.6406606", "0.6386942", "0.63588965", "0.63342446", "0.6314451", "0.6284003", "0.61899793", "0.61358094", "0.6107685", "0.60820085", "0.6076264", "0.60401726", "0.60205436", "0.59958214", "0.5970841", "0.5913735", "0.5889073", "0.58836025", "0.58803606", "0.58795714", "0.58771", "0.5875107", "0.5840762", "0.5840762", "0.5838182", "0.58014905", "0.5778934", "0.5777637", "0.5771636", "0.5766022", "0.5761974", "0.575083", "0.57470816", "0.5743648", "0.57385635", "0.57162493", "0.5709626", "0.56838286", "0.566534", "0.5659524", "0.56542546", "0.5648996", "0.5647316", "0.5645573", "0.56382394", "0.56267697", "0.56260353", "0.56226385", "0.56055534", "0.56010866", "0.55982596", "0.55971557", "0.5591662", "0.55908996", "0.5584288", "0.5583741", "0.5583513", "0.5583298", "0.5572089", "0.5571018", "0.55677944", "0.55664235", "0.5563926", "0.5550416", "0.55488586", "0.5537603", "0.5531772", "0.55145127", "0.55051565", "0.5504656", "0.549585", "0.54806787", "0.54806787", "0.5478266", "0.54779327", "0.54759353", "0.5474838", "0.5467181", "0.54610664", "0.5458316", "0.54524386", "0.5452375", "0.54516757", "0.54495704", "0.54483616", "0.5448225" ]
0.62184566
20
vuex v3.1.3 (c) 2020 Evan You
function n(t){var e=Number(t.version.split(".")[0]);if(e>=2)t.mixin({beforeCreate:i});else{var n=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[i].concat(t.init):i,n.call(this,t)}}function i(){var t=this.$options;t.store?this.$store="function"===typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFieldVuex() {\n return store.getters.dataField;\n }", "function vuexInit(){var options=this.$options;// store injection\n\tif(options.store){this.$store=options.store;}else if(options.parent&&options.parent.$store){this.$store=options.parent.$store;}}", "function U(He){Le&&(He._devtoolHook=Le,Le.emit('vuex:init',He),Le.on('vuex:travel-to-state',function(Ne){He.replaceState(Ne)}),He.subscribe(function(Ne,je){Le.emit('vuex:mutation',Ne,je)}))}", "getProfileVuex() {\n return store.getters.dataProfile;\n }", "function vuexInit () {\n\t var options = this.$options;\n\t // store injection\n\t if (options.store) {\n\t this.$store = options.store;\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store;\n\t }\n\t }", "function vuexInit () {\n\t var options = this.$options;\n\t // store injection\n\t if (options.store) {\n\t this.$store = options.store;\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store;\n\t }\n\t }", "function vuexInit () {\n\t var options = this.$options;\n\t // store injection\n\t if (options.store) {\n\t this.$store = options.store;\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store;\n\t }\n\t }", "function vuexInit() {\n\t var options = this.$options;\n\t var store = options.store;\n\t var vuex = options.vuex;\n\t // store injection\n\t\n\t if (store) {\n\t this.$store = store;\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store;\n\t }\n\t // vuex option handling\n\t if (vuex) {\n\t if (!this.$store) {\n\t console.warn('[vuex] store not injected. make sure to ' + 'provide the store option in your root component.');\n\t }\n\t var state = vuex.state;\n\t var getters = vuex.getters;\n\t var actions = vuex.actions;\n\t // handle deprecated state option\n\t\n\t if (state && !getters) {\n\t console.warn('[vuex] vuex.state option will been deprecated in 1.0. ' + 'Use vuex.getters instead.');\n\t getters = state;\n\t }\n\t // getters\n\t if (getters) {\n\t options.computed = options.computed || {};\n\t for (var key in getters) {\n\t defineVuexGetter(this, key, getters[key]);\n\t }\n\t }\n\t // actions\n\t if (actions) {\n\t options.methods = options.methods || {};\n\t for (var _key in actions) {\n\t options.methods[_key] = makeBoundAction(this.$store, actions[_key], _key);\n\t }\n\t }\n\t }\n\t }", "function vuexInit () {\n\t var options = this.$options\n\t // store injection\n\t if (options.store) {\n\t this.$store = options.store\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store\n\t }\n\t }", "function vuexInit () {\n\t var options = this.$options;\n\t // store injection\n\t if (options.store) {\n\t this.$store = typeof options.store === 'function'\n\t ? options.store()\n\t : options.store;\n\t } else if (options.parent && options.parent.$store) {\n\t this.$store = options.parent.$store;\n\t }\n\t }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\r\n var options = this.$options;\r\n // store injection\r\n if (options.store) {\r\n this.$store = typeof options.store === 'function'\r\n ? options.store()\r\n : options.store;\r\n } else if (options.parent && options.parent.$store) {\r\n this.$store = options.parent.$store;\r\n }\r\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexlocal() {\n return store => {\n // 判断是否有本地缓存如果有就取本地缓存的如果没有就取自身初始值\n let local = JSON.parse(localStorage.getItem('myVuex')) || store.replaceState(state)\n store.replaceState(local); // 替换state的数据\n store.subscribe((mutation,state) => { // 监听\n // 替换之前先取一次防止数据丢失\n let newstate = JSON.parse(JSON.stringify(state))\n localStorage.setItem('myVuex',JSON.stringify(newstate))\n })\n }\n}", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "getTokenVuex() {\n return store.getters.jwt;\n }", "loadVuex() {\n let keys = Object.keys(settings)\n keys.forEach(this.__loadVuexModule)\n }", "function t(e){var l=Number(e.version.split(\".\")[0]);if(l>=2)e.mixin({beforeCreate:t});else{var a=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[t].concat(e.init):t,a.call(this,e)}}function t(){var e=this.$options;e.store?this.$store=\"function\"===typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function' ? options.store() : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function' ? options.store() : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function' ? options.store() : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function' ? options.store() : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit() {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function' ? options.store() : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }", "function vuexInit () {\n var options = this.$options;\n // store injection\n if (options.store) {\n this.$store = typeof options.store === 'function'\n ? options.store()\n : options.store;\n } else if (options.parent && options.parent.$store) {\n this.$store = options.parent.$store;\n }\n }" ]
[ "0.711758", "0.6952523", "0.67182934", "0.6706392", "0.6582922", "0.6582922", "0.6582922", "0.65800726", "0.6554717", "0.6455266", "0.6320404", "0.63193226", "0.6311852", "0.6311852", "0.6311852", "0.6311852", "0.6311852", "0.6307827", "0.6299624", "0.6255294", "0.6249346", "0.62177896", "0.6217117", "0.6217117", "0.6217117", "0.6217117", "0.6217117", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982", "0.6198982" ]
0.0
-1
! vuerouter v3.1.6 (c) 2020 Evan You
function i(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function BO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function version(){ return \"0.13.0\" }", "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "vampireWithName(name) {\n \n }", "function Uk(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function Qw(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function iP(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function fyv(){\n \n }", "function yh(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"graticule.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "transient private internal function m185() {}", "upgrade() {}", "function cO(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Wx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function SigV4Utils() { }", "function vT(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function ow(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "transient final protected internal function m174() {}", "function Ak(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "protected internal function m252() {}", "function Rb(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "updated() {}", "function dp(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function Bv(e){let{basename:t,children:n,window:r}=e,l=X.exports.useRef();l.current==null&&(l.current=gv({window:r}));let o=l.current,[i,u]=X.exports.useState({action:o.action,location:o.location});return X.exports.useLayoutEffect(()=>o.listen(u),[o]),X.exports.createElement(Fv,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:o})}", "function jx(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function PD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "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 }", "transient protected internal function m189() {}", "function Ek(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function VI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"layer.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function Bevy() {}", "transient private protected internal function m182() {}", "function hA(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"geom.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function test_candu_graphs_datastore_vsphere6() {}", "function Hr(e,t){\"undefined\"!==typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "added(vrobject){}", "function $S(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function uf(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"layer.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "function JV(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function vI(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"style.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "transient final private internal function m170() {}", "function comportement (){\n\t }", "function VO(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};VO.installed||(VO.installed=!0,t.use(i,e),t.use(r,e),t.use(o,e),t.use(a,e),t.use(s,e),t.use(u,e),t.use(l,e),t.use(c,e),t.use(d,e),t.use(h,e),t.use(f,e),t.use(p,e),t.use(m,e),t.use(v,e),t.use(g,e),t.use(_,e),t.use(y,e),t.use(b,e),t.use(x,e),t.use(w,e),t.use(A,e),t.use(M,e),t.use(S,e),t.use(T,e),t.use(k,e),t.use(O,e),t.use(C,e),t.use(L,e),t.use(E,e),t.use(D,e),t.use(j,e),t.use(I,e),t.use(P,e),t.use(Y,e),t.use(F,e),t.use(R,e),t.use(N,e),t.use(B,e),t.use($,e),t.use(z,e),t.use(H,e),t.use(V,e),t.use(G,e))}", "function v71(v72) {\n }", "transient final private protected internal function m167() {}", "function Vt(){this.__data__=[]}", "function qv() {}", "static get tag(){return\"hal-9000\"}", "function test_candu_graphs_vm_compare_host_vsphere65() {}", "function ea(){}", "function vB_PHP_Emulator()\n{\n}", "static final private internal function m106() {}", "__previnit(){}", "static transient final private internal function m43() {}", "function __vue_normalize__(a,b,c,d,e){var f=(\"function\"==typeof c?c.options:c)||{};// For security concerns, we use only base name in production mode.\nreturn f.__file=\"/Users/hadefication/Packages/vue-chartisan/src/components/Pie.vue\",f.render||(f.render=a.render,f.staticRenderFns=a.staticRenderFns,f._compiled=!0,e&&(f.functional=!0)),f._scopeId=d,f}", "function v77(v78,v79,v80,v81,v82) {\n }", "function vinewx(t=\"untitled\",s=!1){return new class{constructor(t,s){this.name=t,this.debug=s,this.isQX=\"undefined\"!=typeof $task,this.isLoon=\"undefined\"!=typeof $loon,this.isSurge=\"undefined\"!=typeof $httpClient&&!this.isLoon,this.isNode=\"function\"==typeof require,this.isJSBox=this.isNode&&\"undefined\"!=typeof $jsbox,this.node=(()=>this.isNode?{request:\"undefined\"!=typeof $request?void 0:require(\"request\"),fs:require(\"fs\")}:null)(),this.cache=this.initCache(),this.log(`INITIAL CACHE:\\n${JSON.stringify(this.cache)}`),Promise.prototype.delay=function(t){return this.then(function(s){return((t,s)=>new Promise(function(e){setTimeout(e.bind(null,s),t)}))(t,s)})}}get(t){return this.isQX?(\"string\"==typeof t&&(t={url:t,method:\"GET\"}),$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.get(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}post(t){return this.isQX?(\"string\"==typeof t&&(t={url:t}),t.method=\"POST\",$task.fetch(t)):new Promise((s,e)=>{this.isLoon||this.isSurge?$httpClient.post(t,(t,i,o)=>{t?e(t):s({status:i.status,headers:i.headers,body:o})}):this.node.request.post(t,(t,i,o)=>{t?e(t):s({...i,status:i.statusCode,body:o})})})}initCache(){if(this.isQX)return JSON.parse($prefs.valueForKey(this.name)||\"{}\");if(this.isLoon||this.isSurge)return JSON.parse($persistentStore.read(this.name)||\"{}\");if(this.isNode){const t=`${this.name}.json`;return this.node.fs.existsSync(t)?JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)):(this.node.fs.writeFileSync(t,JSON.stringify({}),{flag:\"wx\"},t=>console.log(t)),{})}}persistCache(){const t=JSON.stringify(this.cache);this.log(`FLUSHING DATA:\\n${t}`),this.isQX&&$prefs.setValueForKey(t,this.name),(this.isLoon||this.isSurge)&&$persistentStore.write(t,this.name),this.isNode&&this.node.fs.writeFileSync(`${this.name}.json`,t,{flag:\"w\"},t=>console.log(t))}write(t,s){this.log(`SET ${s} = ${JSON.stringify(t)}`),this.cache[s]=t,this.persistCache()}read(t){return this.log(`READ ${t} ==> ${JSON.stringify(this.cache[t])}`),this.cache[t]}delete(t){this.log(`DELETE ${t}`),delete this.cache[t],this.persistCache()}notify(t,s,e,i){const o=\"string\"==typeof i?i:void 0,n=e+(null==o?\"\":`\\n${o}`);this.isQX&&(void 0!==o?$notify(t,s,e,{\"open-url\":o}):$notify(t,s,e,i)),this.isSurge&&$notification.post(t,s,n),this.isLoon&&$notification.post(t,s,e),this.isNode&&(this.isJSBox?require(\"push\").schedule({title:t,body:s?s+\"\\n\"+e:e}):console.log(`${t}\\n${s}\\n${n}\\n\\n`))}log(t){this.debug&&console.log(t)}info(t){console.log(t)}error(t){console.log(\"ERROR: \"+t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){this.isQX||this.isLoon||this.isSurge?$done(t):this.isNode&&!this.isJSBox&&\"undefined\"!=typeof $context&&($context.headers=t.headers,$context.statusCode=t.statusCode,$context.body=t.body)}}(t,s)}", "static get elvl_info() {return 0;}", "function i(t,e,n){if(o(t,e))return void(t[e]=n);if(t._isVue)return void i(t._data,e,n);var r=t.__ob__;if(!r)return void(t[e]=n);if(r.convert(e,n),r.dep.notify(),r.vms)for(var s=r.vms.length;s--;){var a=r.vms[s];a._proxy(e),a._digest()}return n}", "function WD(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"geom.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function setup() {\n\n\n}", "function setup() {\n\n\n}" ]
[ "0.60304916", "0.59034866", "0.5846233", "0.57243824", "0.571982", "0.56857914", "0.5651773", "0.5592403", "0.55827314", "0.557127", "0.55548024", "0.55528164", "0.55521166", "0.5507836", "0.55053294", "0.54622334", "0.5425695", "0.5423413", "0.54185784", "0.5409354", "0.5386182", "0.53813505", "0.5380393", "0.53652644", "0.5347872", "0.5346356", "0.53463364", "0.534455", "0.53432804", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5332032", "0.5324568", "0.5314403", "0.52954614", "0.5290287", "0.52738947", "0.5272305", "0.52631354", "0.52521294", "0.5245931", "0.5233628", "0.522601", "0.52217096", "0.5203266", "0.51943785", "0.5188831", "0.518228", "0.5166432", "0.5154078", "0.5148975", "0.5139292", "0.51381", "0.5136476", "0.51179713", "0.5117839", "0.51131344", "0.5110005", "0.5091488", "0.50900054", "0.50885546", "0.5088285", "0.5086107", "0.50846267", "0.5082102", "0.50749713", "0.50749713" ]
0.0
-1
given restrictions provided, make a reduced list of products prices should be included in this list, as well as a sort based on price
function restrictListProducts(prods, restriction, organic) { var product_information = []; if (organic){ for (let i=0; i<prods.length; i+=1) { if ((restriction == "lactosenutfree") && (prods[i].lactosefree) && (prods[i].nutfree) && (prods[i].organic)){ product_information.push([prods[i].price, prods[i].name]); } else if ((restriction == "lactosefree") && (prods[i].lactosefree) && (prods[i].organic)){ product_information.push([prods[i].price, prods[i].name]); } else if ((restriction == "nutfree") && (prods[i].nutfree) && (prods[i].organic)){ product_information.push([prods[i].price, prods[i].name]); } else if ((restriction == "None") && (prods[i].organic)){ product_information.push([prods[i].price, prods[i].name]); } } return product_information.sort(function sortListProducts(valA, valB) { return valA[0] - valB[0]; }); }else{ for (let i=0; i<prods.length; i+=1) { if ((restriction == "lactosenutfree") && (prods[i].lactosefree) && (prods[i].nutfree)){ product_information.push([prods[i].price, prods[i].name]); } else if ((restriction == "lactosefree") && (prods[i].lactosefree)){ product_information.push([prods[i].price, prods[i].name]); } else if ((restriction == "nutfree") && (prods[i].nutfree)){ product_information.push([prods[i].price, prods[i].name]); } else if (restriction == "None"){ product_information.push([prods[i].price, prods[i].name]); } } return product_information.sort(function sortListProducts(valA, valB) { return valA[0] - valB[0]; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"lactose\") &&(prods[i].LactoseFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"noix\") && (prods[i].noixfree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"vegetarian\")&& (prods[i].vegetarian == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"gluten\") && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"jus\") && (prods[i].type == \"jus\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"legume\") && (prods[i].type == \"legume\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"fruit\") && (prods[i].type == \"fruit\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"laitier\") && (prods[i].type == \"laitier\")){\n\t\t product_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction == \"orga\") && (prods[i].organic == true)){\n\t\t product_names.push(prods[i]);\n\t\t}\n\n\n\t}\n\n\tvar sorted = product_names.sort((a, b) => a.price - b.price);\n\treturn sorted;\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif(restriction==\"None\"){\n\t\t\tproduct_names.push({name:prods[i].name, price:prods[i].price});\n\t\t}else if(prods[i][restriction]){\n\t\t\tproduct_names.push({name:prods[i].name, price:prods[i].price});\n\t\t}\n\t}\n\tproduct_names.sort((a,b)=>{return a.price - b.price;});\n\treturn product_names;\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 restrictList(product, restriction, is_organic, type){\n let temp;\n for (let i = 0; i < product.length; i++) {\n for (let j = 0; j < product.length; j++) {\n if (product[i].price < product[j].price) {\n temp = product[i]\n product[i] = product[j]\n product[j] = temp\n }\n }\n }\n let product_names = [];\n if (type==\"all\") {\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\") {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n else{\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\" &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n return product_names;\n}", "function restrictListProducts(prods, restriction) {\r\n\tlet product_names = [];\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n\t\tprods.sort(function(a, b){return a.price - b.price}); //sort product list by price\r\n\t\tif ((restriction == \"Lactose\") && (prods[i].lactoseF == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if ((restriction == \"Nuts\") && (prods[i].nutsF == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if ((restriction == \"Organic\") && (prods[i].org == true)){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t\telse if (restriction == \"None\"){\r\n\t\t\tproduct_names.push(prods[i].name);\r\n\t\t}\r\n\t}\r\n\treturn product_names;\r\n}", "function restrictListProducts(prods, lactose, nut, organic) {\n\tlet products = [];\n\n\tprods.sort(function(a, b){\n\t\t\treturn a.price - b.price;\n\t})\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif (lactose && !prods[i].lactose) continue;\n\t\tif (nut && !prods[i].nutFree) continue;\n\t\tif (organic && !prods[i].organic) continue;\n\t\tproducts.push(prods[i]);\n\n\t}\n\treturn products;\n}", "function restrictListProducts(prods, lactoseIntolerant, nutFree, organic, sorter) {\n\tlet products = [];\n\tfor (let i = 0; i < prods.length; i += 1) {\n\t\tif (ableToEat(prods[i], lactoseIntolerant, nutFree, organic)) {\n\t\t\tproducts.push(prods[i]);\n\t\t}\n\t}\n\treturn products.sort(sorter);\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\t/*for (let i=0; i<prods.length; i+=1) {\n\t\tif (restriction==\"None\"){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n }\n\t\telse if ((restriction == \"Lactose-intolerant Nutallergy and Organic\") && (prods[i].lactoseFree == true && (prods[i].nutFree == true)&& (prods[i].organic== true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant and Nutallergy\") && (prods[i].lactoseFree == true && (prods[i].nutFree == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant and Organic\") && (prods[i].lactoseFree == true && (prods[i].organic == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Nutallergy and Organic\") && (prods[i].organic == true && (prods[i].nutFree == true))){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Lactose-intolerant\") && (prods[i].lactoseFree == true)){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if ((restriction == \"Nutallergy\") && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\n\t\t}\n\t\telse if (restriction == \"Organic\" && prods[i].organic==true){\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t\t}\n\t}*/\n\tif(restriction[\"None\"]==true){\n\t\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t}}else{\n\t\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tconsole.log(restriction[\"Organic\"]+ \"==\"+ prods[i].organic+ \" \"+ restriction[\"Nutallergt\"]+ \"==\"+ prods[i].nutFree+ \" \"+ restriction[\"Lactose-intolerant\"]+ \"==\"+ prods[i].lactoseFree+ \" \");\n\t\t\tif((restriction[\"Organic\"]==prods[i].organic|| restriction[\"Organic\"]==false) &&(restriction[\"Nutallergy\"]==prods[i].nutFree|| restriction[\"Nutallergy\"]==false) && (restriction[\"Lactose-intolerant\"]==prods[i].lactoseFree|| restriction[\"Lactose-intolerant\"]==false)){\n\t\t\t\tproduct_names.push([prods[i].name, prods[i].price]);\t\n\t\t\t}\n\t\t}\n\t}\n\treturn product_names.sort(function([a,b], [c,d]){ // method taken from https://stackoverflow.com/a/50415269\n\t\treturn b-d;\n\t});;\n}", "function restrictListProducts(prods, restriction) {\r\n\tlet product_names = [];\r\n var restrictions = restriction.split(',');\r\n// console.log(restrictions);\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n var productVegetarian = prods[i].vegetarian;\r\n var productGlutenFree = prods[i].glutenFree;\r\n var productOrganic = prods[i].organic;\r\n var restrictVeg = false;\r\n var restrictGlu = false;\r\n var restrictOrg = false;\r\n var None = false;\r\n// console.log(restrictions.length);\r\n \r\n if(restrictions.length >= 2){\r\n for(let j = 0; j < restrictions.length; j++){\r\n if(restrictions[j] == \"Vegetarian\") restrictVeg = true;\r\n if(restrictions[j] == \"GlutenFree\") restrictGlu = true;\r\n if(restrictions[j] == \"Organic\") restrictOrg = true;\r\n }\r\n if ((restrictVeg && restrictOrg && restrictGlu) && (productVegetarian && productOrganic && productGlutenFree)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictGlu && restrictVeg && !restrictOrg) && (productVegetarian && productGlutenFree)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n\t\t }else if ((restrictGlu && restrictOrg && !restrictVeg) && (productGlutenFree&& productOrganic)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictVeg && restrictOrg && !restrictGlu) && (productVegetarian && productOrganic)){\r\n\t\t\t product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }\r\n }else{\r\n if ((restrictions[0] == \"Vegetarian\") && (productVegetarian)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictions[0] == \"GlutenFree\") && (productGlutenFree)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if ((restrictions[0] == \"Organic\") && (productOrganic)){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }else if (restrictions[0] == \"None\"){\r\n product_names.push(prods[i].name + \":\" + prods[i].price);\r\n }\r\n }\r\n \r\n\r\n\t}\r\n\treturn product_names;\r\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n\t\t}\n\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if ((restriction == \"Vegetarian&GlutenFree\") && (prods[i].vegetarian == true) && (prods[i].glutenFree == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if ((restriction == \"Organic\") && (prods[i].Organic == true)){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n\t\telse if (restriction == \"None\"){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n }\n else if (restriction == \"\"){\n\t\t\tproduct_names.push([prods[i].name,prods[i].price,prods[i].category,prods[i].img]);\n\t\t}\n }\n product_names.sort(compareSecondColumn);\n\treturn product_names;\n}", "function restrictListProducts(prods, restrictions) {\n\tvar lactoseFree = false;\n\tvar nutFree = false;\n\tvar organic = false;\n\tif (restrictions.length > 0){\n\t\tfor (i = 0; i < restrictions.length; i++) { \n\t\t\tif (restrictions[i] == \"organic\"){\n\t\t\t\torganic = true;\n\t\t\t}\n\t\t\telse if (restrictions[i] == \"nutFree\"){\n\t\t\t\tnutFree = true;\n\t\t\t}\n\t\t\telse if (restrictions[i] == \"lactoseFree\"){\n\t\t\t\tlactoseFree = true;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tlet product_names = [];\n\t\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((lactoseFree == true) && (nutFree == true)&& (organic == true) && (prods[i].lactoseFree == true) && (prods[i].organic == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (nutFree == true) && (organic == false) && (prods[i].lactoseFree == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (organic == true) && (nutFree == false) && (prods[i].lactoseFree == true) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((nutFree == true) && (organic == true) && (lactoseFree == false) && (prods[i].organic == true) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == true)&& (organic == false) && (prods[i].nutFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == true) && (nutFree == false)&& (organic == false) && (prods[i].lactoseFree == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == false)&& (organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((lactoseFree == false) && (nutFree == false)&& (organic == true) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t}\n\treturn product_names;\n}", "getPrices(restrictions = []) {\n if (!this.prices) {\n throw new Error('We do not have pricing data yet');\n }\n let prices = this.prices.slice();\n\n return prices.filter(price => {\n for (let {key, restriction} of restrictions) {\n if (key === 'minPrice' || key === 'maxPrice' || key === 'price') {\n // We need to handle minPrice, maxPrice and price differently because\n // they are numerical comparisons\n restriction = toFloat(restriction);\n if (key === 'minPrice' && price.price < restriction) {\n return false;\n } else if (key === 'maxPrice' && price.price > restriction) {\n return false;\n } else if (key === 'price' && restriction !== price.price) {\n return false;\n }\n } else {\n // For string values, we just want simple comparisons. When the\n // restriction is a list, we say that any matching value is allowed\n let allowedValues = restriction;\n\n if (!Array.isArray(restriction)) {\n allowedValues = [restriction];\n }\n\n if (!allowedValues.includes(price[key])) {\n return false;\n }\n }\n }\n return true;\n });\n\n return prices;\n }", "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 restrictListProducts(prods, restriction, organicProduct) {\n\tlet product_names = [];\n\tconsole.log(organicProduct, restriction);\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tvar product = { name: null, price: null };\n\n\t\tif (organicProduct == true && prods[i].organic == true){\n\t\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"VegetarianANDGlutenFree\") && (prods[i].glutenFree == true && prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t }\n\t\t\telse if (restriction == \"None\"){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t}\n\t\telse if (organicProduct == false) {\n\t\t\tif ((restriction == \"Vegetarian\") && (prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"GlutenFree\") && (prods[i].glutenFree == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t\telse if ((restriction == \"VegetarianANDGlutenFree\") && (prods[i].glutenFree == true && prods[i].vegetarian == true)){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t }\n\t\t\telse if (restriction == \"None\"){\n\t\t\t\tproduct.name = prods[i].name;\n\t\t\t\tproduct.price = prods[i].price;\n\t\t\t\tproduct_names.push(product);\n\t\t\t}\n\t\t}\n\t}\n\treturn product_names;\n}", "function restrictListProducts(prods, restriction, organic) {\n\tlet product_names = new Map();\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((organic == true) && (prods[i].organic == true)) {\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t} else if((organic == false) && (prods[i].organic == false)){\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t} else if((organic == null)){\n\t\t\tif ((restriction == \"Both Restrictions\") && !prods[i].containLactose && !prods[i].containNuts) {\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Lactose Free\") && !prods[i].containLactose){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if ((restriction == \"Nuts Free\") && !prods[i].containNuts){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t\telse if (restriction == \"No Restrictions\"){\n\t\t\t\tproduct_names.set(prods[i].name, prods[i].price);\n\t\t\t}\n\t\t}\n\t}\n\n\tproduct_names[Symbol.iterator] = function* () {\n\t\tyield* [...this.entries()].sort((a, b) => a[1] - b[1]);\n\t}\n\n\treturn product_names;\n}", "function FilterPrice(listingsArray) {\n setPulled(listingsArray.sort((a, b) => a.price > b.price));\n }", "function restrictListProducts(prods, restriction) {\n\tlet restrictedProduct = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t//Vegetarian\n\t\tif ((restriction[0]) && (!prods[i].vegetarian)){\n\t\t\tcontinue;\n\t\t}\n\t\t//Gluten-Free\n\t\tif ((restriction[1]) && (!prods[i].glutenFree)){\n\t\t\tcontinue;\n\t\t}\n\t\t//organic\n\t\tif ((restriction[2]) && (!prods[i].organic)){\n\t\t\tcontinue;\n\t\t}\n\t\t//vegan \n\t\tif ((restriction[3]) && (!prods[i].vegan)){\n\t\t\tcontinue;\n\t\t}\n\t\t//dairy Free\n\t\tif ((restriction[4]) && (!prods[i].dairyF)){\n\t\t\tcontinue;\n\t\t}\n\t\trestrictedProduct.push(prods[i]);\n\t}\n\treturn restrictedProduct;\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}", "function reasonable_products(products){\n let res=[];\n products.forEach((product, i) => {\n if(product.price<=100){\n res.push(product);\n }\n });\n return res;\n}", "function FilterByPrice(price) {\n return products.filter(function (item) {\n return item.price <= price;\n });\n}", "function findProductByPriceRange(a, b, c) {\nvar result = a.filter(function(value){\n //return b <= value.price >= c;\n return value.price >= b && value.price <= c\n});\nreturn result;\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction == \"NutFree\") && (prods[i].nutfree == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if ((restriction == \"LactoseFree\") && (prods[i].lactosefree == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if ((restriction == \"Include Baby supplies\") && (prods[i].babysupplies == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if ((restriction == \"Include carrot\") && (prods[i].lactosefree == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\n\t\telse if (restriction == \"None\"){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t}\n\treturn product_names;\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction.includes(\"nutAllergy\")) && (restriction.includes(\"lactoseIntolerant\")) && (prods[i].lactoseIntolerant == true) && (prods[i].nutAllergy == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"lactoseIntolerant\")) && !(restriction.includes(\"nutAllergy\")) && !(restriction.includes(\"organic\")) && (prods[i].lactoseIntolerant == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"nutAllergy\")) && !(restriction.includes(\"lactoseIntolerant\")) && (prods[i].nutAllergy == true) && (prods[i].organic == false)){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t\telse if ((restriction.includes(\"organic\")) && (prods[i].organic == true)){\n\t\t\tproduct_names.push(prods[i]); \n\t\t}\n\t\telse if (restriction.includes(\"none\")){\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\t}\n\treturn product_names;\n}", "function restrictListProducts(prods, restriction, organic) {\n\trestricted_prods = [];\n\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\tif ((restriction[\"nut-free\"] == true && restriction[\"lactose-free\"] == false) && (prods[i].nut == false)){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if ((restriction[\"lactose-free\"] == true && restriction[\"nut-free\"] == false) && (prods[i].lactose == false)){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if((restriction[\"lactose-free\"] == true && restriction[\"nut-free\"] == true) && (prods[i].lactose == false && prods[i].nut == false)) {\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t\telse if(restriction[\"none\"] == true){\n\t\t\t_organicCheck(prods[i],organic);\n\t\t}\n\n\t}\n\treturn restricted_prods;\n}", "function filterProductsByPriceRange(products, min, max) {\n const result = [];\n if(products.length === 0){\n throw \"Error with products!\";\n }\n if(typeof min !== \"number\" || typeof max !== \"number\"){\n throw \"Error with input!\";\n }\n if(min > max || min < 0){\n throw \"Error with min!\";\n }\n if(max <= 0){\n throw \"Error with max!\";\n }\n for (let product of products) {\n if(!product.priceInCents){\n throw \"Error with price!\";\n }\n if (product.priceInCents >= min && product.priceInCents <= max) {\n result.push(product);\n }\n }\n return result;\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}", "function venue_with_price_and_rating(venues,price,rating)\n{\n filtered_list=[];\n \n var isValid = function(param) {\n \treturn typeof param!='undefined' && param!=\"\";\n }; \n \n _.each(venues,\n \tfunction(venue,i,venues) {\n \tvenue_price = venues[i]['price'];\n \tvenue_rating = venues[i]['rating'];\n \t\n \tif ( (!isValid(price) || (isValid(price) && (!isValid(venue_price) || venue_price.tier == price)))\n \t\t\t&&\n \t\t (!isValid(rating) || (isValid(rating) && (!isValid(venue_rating) || venue_rating >= rating))) ) {\n \t\t\tfiltered_list.push(venues[i]);\n \t}\t\t \t\t\n \t}\n );\n \n final_list = parse_venue_object(filtered_list);\n return final_list;\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}", "sortProducts() {}", "function filterHotels (hotelList, options) {\n hotelList.forEach(hotel => {\n hotel.own_rating = hotel.rating_value\n if (hotel.superior) {\n hotel.own_rating += 3\n }\n if (hotel.rating_count < 50) {\n hotel.own_rating -= 5\n }\n hotel.deal = hotel.deals.reduce((cur, deal) => {\n // Strip currency values for comparison\n const curPrice = +cur.price.formatted.replace(/[^0-9]/g, '')\n const dealPrice = +deal.price.formatted.replace(/[^0-9]/g, '')\n if (curPrice > dealPrice) {\n return deal\n }\n return cur\n })\n delete hotel.deals\n hotel.deal.rate_attributes.forEach(rateAttribute => {\n if (rateAttribute.positive) {\n hotel.own_rating++\n }\n })\n hotel.own_rating += Math.floor((+options.max_price - (+hotel.deal.price.formatted.replace(/[^0-9]/g, ''))) / 3)\n })\n\n return hotelList.sort((a, b) => {\n if (a.own_rating < b.own_rating) {\n return 1\n }\n return -1\n }).slice(0, 5)\n}", "function filter(products, collections, appender){\n \n var minmax = getMinMax(products);\n function priceFilter(products, event, ui){\n var arr = [];\n products.forEach(function(product, i, products){\n for (var i=0; i < product.variants.length; i++){\n if (product.variants[i].price >= ui.values[ 0 ] && product.variants[i].price <= ui.values[ 1 ]){\n if(!arr.includes(product)){\n arr.push(product);\n }\n }\n }\n });\n return arr; \n }\n\n function uniq_fast(a) {\n var seen = {};\n var values = {};\n var out = [];\n var len = a.length;\n var j = 0;\n for(var i = 0; i < len; i++) {\n var item = a[i];\n if(seen[item.name] !== 1) {\n seen[item.name] = 1;\n out[j] = a[i];\n values[item.name] = item.values;\n j++;\n } else {\n values[item.name] = values[item.name].concat(item.values);\n }\n }\n for(var val in values) {\n for(var i = 0; i < out.length; i++){\n if(val == out[i].name){\n out[i].values = values[val];\n }\n }\n }\n return out;\n }\n renderOptions(products, collections); \n bindOptions(products);\n $(function(){\n $( \"#slider-range\" ).slider({\n range: true,\n min: Math.round(minmax[0]),\n max: Math.round(minmax[1]),\n values: [ Math.round(minmax[0]), Math.round(minmax[1]) ],\n slide: function( event, ui ) {\n $( \"#min-price\" ).text( \"$\" + ui.values[ 0 ]);\n $( \"#max-price\" ).text( \"$\" + ui.values[ 1 ] );\n },\n change: function( event, ui ) {\n var newProducts = priceFilter(products, event, ui);\n renderProducts(newProducts, '#product-container');\n }\n });\n });\n\nfunction renderPrice(products){\n var minmax = getMinMax(products); \n $( \"#slider-range\" ).slider({\n range: true,\n min: Math.round(minmax[0]),\n max: Math.round(minmax[1]),\n values: [ Math.round(minmax[0]), Math.round(minmax[1]) ],\n slide: function( event, ui ) {\n $( \"#min-price\" ).text( \"$\" + ui.values[ 0 ]);\n $( \"#max-price\" ).text( \"$\" + ui.values[ 1 ] );\n },\n change: function( event, ui ) {\n var newProducts = priceFilter(products, event, ui);\n renderProducts(newProducts, '#product-container'); \n }\n });\n\n $( \"#min-price\" ).text( \"$\" + $( \"#slider-range\" ).slider( \"values\", 0 ));\n $( \"#max-price\" ).text( \"$\" + $( \"#slider-range\" ).slider( \"values\", 1 ));\n}\nfunction renderOptions(newProducts, collections){\n\n let options = [];\n newProducts.forEach(function(product, i){\n if ( product.options[0].values[0] != 'Default Title' ) {\n product.options.forEach(function(PrOption, i, PrOptions){\n options.push(PrOption); \n });\n }\n });\n options = uniq_fast(options);\n let slider_range = '<div id=\"slider-range\"></div>';\n let button = '<button class=\"accordion\">Price</button>';\n let accordion = '<div class=\"panel\"><div id=\"price-filter\" style=\"padding: 25px 10px 70px;\" class=\"contain\">' + slider_range + '<span id=\"min-price\" ></span> <span id=\"max-price\" ></span></div></div>';\n let block = button + accordion;\n let priceContainer = '<div id=\"price-filter-container\">' + block + '</div>'; \n jQuery('#price-filter-container').remove();\n jQuery(appender).append(priceContainer);\n renderPrice(newProducts);\n \n options.forEach(function(item, i ,options){\n \n button = '<button class=\"accordion\">'+ item.name +'</button>';\n accordion = '<div class=\"panel\"><div id=\"'+ handelize(item.name) +'-filter\" style=\"padding: 0px 0px 45px;\" class=\"contain\"></div></div>';\n block = button + accordion;\n \n jQuery(appender).append(block);\n let accordionContainer = jQuery('#'+handelize(item.name)+'-filter'); \n item.values.forEach(function(value, i){\n if (item.name == 'Color'){\n var label = '<label class=\"filter-color-label\" style=\"background-color: ' + handelizeSpaces(value) + '\" for=\"'+ handelize(value) + '_' + i + '\"><span class=\"filter-color-label-span\">' + value + '</span></label>'; \n var input = '<input style=\"display: none;\" class=\"filter\" id=\"' + handelize(value) + '_' + i + '\" type=\"checkbox\" value=\"' + value + '\" />'; \n } else {\n var label = '<label class=\"filter-label\" for=\"'+ handelize(value) + '_' + i + '\"><span class=\"filter-label-span\">' + value + '</span></label>'; \n var input = '<input style=\"display: none;\" class=\"filter\" id=\"' + handelize(value) + '_' + i + '\" type=\"checkbox\" value=\"' + value + '\" />'; \n }\n var filterCheck = '<div class=\"filter-tag filter-check\">' + input + label + '</div>';\n jQuery(accordionContainer).append(filterCheck);\n });\n });\n button = '<button class=\"accordion\">Collections</button>';\n accordion = '<div class=\"panel\" id=\"collections-filter\"><a class=\"filter-collection-link\" data-collection=\"All\" href=\"#\">All</a></div>';\n block = button + accordion;\n jQuery(appender).append(block);\n let types = [];\n newProducts.forEach(function(product, i){\n if(!types.includes(product.product_type)){\n types.push(product.product_type); \n } \n });\n\n function filterByCollection(product_type_filter){\n\n let filteredProducts = [];\n newProducts.forEach(function(product, i){\n if(product.product_type == product_type_filter ){\n filteredProducts.push(product); \n } \n });\n if (filteredProducts.length == 0) {\n filteredProducts = newProducts;\n }\n renderProducts(filteredProducts, '#product-container');\n }\n types.forEach(function(type, i){\n let collectionLink = '<a class=\"filter-collection-link\" data-collection=\"'+type+'\" href=\"#\">'+type+'</a>';\n jQuery('#collections-filter').append(collectionLink);\n });\n initAccordeon();\n $('a[data-collection]').click(function() {\n filterByCollection($(this).data('collection'));\n });\n}\n\nfunction filterByValues(products){\n var arr = [];\n let options = [];\n\n $('.active-filter:checked').each(function(index){\n options.push($(this).val());\n });\n console.log(options);\n console.log(products);\n if (options.length > 0){\n products.forEach(function(product){\n product.options.forEach(function(option){\n options.forEach(function(currentOpt){\n if (option.values.includes(currentOpt) && !arr.includes(product)){\n arr.push(product);\n }\n });\n });\n });\n } else {\n arr = products;\n }\n return arr;\n}\n\nfunction bindOptions(products, collections){\n var filters = document.getElementsByClassName(\"filter\");\n for (var c = 0; c < filters.length; c++) {\n filters[c].onchange = function() {\n $(this).toggleClass('active-filter');\n $(this).toggleClass('active');\n var newProducts = filterByValues(products);\n renderPrice(newProducts); \n renderProducts(newProducts, '#product-container');\n }\n }\n}\n\n /* End of Check box filters */\n \n /* End of Bind filter actions */\n \n /* Accordion filters */\nfunction initAccordeon(){\n var acc = document.getElementsByClassName(\"accordion\");\n var i;\n \n for (i = 0; i < acc.length; i++) {\n acc[i].onclick = function() {\n this.classList.toggle(\"active\");\n var panel = this.nextElementSibling;\n if (panel.style.maxHeight){\n panel.style.maxHeight = null;\n } else {\n panel.style.maxHeight = panel.scrollHeight + 15 + \"px\";\n } \n }\n }\n}\n /* End of Accordion filters */\n \n}", "function listFilterHandler(listingsArray) {\n //setListing(listingsArray.sort((a, b) => a.price < b.price))\n listingsArray.sort((a, b) => a.price < b.price);\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 filterProduce() {\n let filteredListings = sortedListings;\n if (checkedSeasonFilters.length > 0) {\n filteredListings = filteredListings.filter(\n (listing) => checkedSeasonFilters.includes(listing.season),\n );\n }\n if (checkedProdFilters.length > 0) {\n filteredListings = filteredListings.filter(\n (listing) => checkedProdFilters.includes(listing.produceType),\n );\n }\n // If applied range exists, hard limit to min/max\n if (appliedRange.length > 0) {\n filteredListings = filteredListings.filter(\n (listing) => inAppliedRange(listing.palletPrice),\n );\n }\n if (checkedPriceFilters.length > 0) {\n filteredListings = filteredListings.filter(\n (listing) => inFilterPriceRange(listing.palletPrice),\n );\n }\n // Only filter if 1 of standard/agency options checked (if both, filtering is redundant)\n if (checkedItemTypes.length === 1) {\n if (checkedItemTypes[0] === 'Agency Price') {\n filteredListings = filteredListings.filter(\n (listing) => listing.hasAgencyPrice === true,\n );\n } else {\n filteredListings = filteredListings.filter(\n (listing) => listing.hasAgencyPrice === false,\n );\n }\n }\n setFilteredProduce(filteredListings);\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 filterPrice(min, max){\r\n for(let i = 0; i < listings.length; i++){\r\n let l = listings[i].val;\r\n listings[i].visible = l.price >= min && l.price <= max && listings[i].visible;\r\n }\r\n}", "function searchingProducts(listToFilter) {\n\n if (searchValue.value) {\n listToFilter = listToFilter.filter(availProduct => {\n return availProduct.name.toLowerCase().includes(searchValue.value.toLowerCase());\n });\n }\n\n if (countryValue.options[countryValue.selectedIndex].value) {\n listToFilter = listToFilter.filter(availProduct => {\n return availProduct.shipsTo.map(selectOption => selectOption.toLowerCase()).includes(countryValue.options[countryValue.selectedIndex].value.toLowerCase());\n });\n } \n\n sortProducts(listToFilter);\n\n renderProducts(listToFilter);\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 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}", "sortProductByExpensive () {\n this.params.sort = 'expensive'\n this.submitting = { ...this.submitting, dropshipProducts: true, sortStatus: true }\n let params = this.generateParamsUrl()\n Router.replace(`/dropship?${params}`)\n this.props.getDropshipProducts(this.params)\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 }", "async findPriceList(code) {\n //\n // QUERY for exact DENOM\n const feasiblePacks = await CatalogDetail.query()\n .where(\"product_code\", code)\n .where(\"status\", \"ENABLE\")\n .orderBy(\"min\", \"asc\")\n .fetch();\n /// no records\n if (feasiblePacks.length === 0) {\n return null;\n }\n // console.log(feasiblePacks);\n // record exists\n const formattedSet = feasiblePacks.toJSON().map((val) => {\n // In DB, if val.min is NULL, then reference = denom in MY. Else, reference = kurs.\n let finalPrice = \"\";\n let reference = \"\";\n if (val.method === \"ABSOLUTE\") {\n if (!val.min) {\n finalPrice = parseFloat(val.value).toFixed(2);\n reference = parseFloat(val.reference).toFixed(2);\n } else {\n finalPrice = `${Number(val.min / val.reference) + Number(val.value)} - ${Number(\n\t\t\t\t\t\tval.denom / val.reference,\n\t\t\t\t\t) + Number(val.value)}`;\n reference = `${Number(val.min / val.reference)} - ${Number(val.denom / val.reference)}`;\n }\n } else {\n if (!val.min) {\n finalPrice = parseFloat(val.value * val.reference / 100).toFixed(2);\n reference = parseFloat(val.reference).toFixed(2);\n } else {\n const lower = val.value * (val.min / val.reference) / 100;\n const upper = val.value * (val.denom / val.reference) / 100;\n const lower_ref = val.min / val.reference;\n const upper_ref = val.denom / val.reference;\n finalPrice = `${lower.toFixed(2)} - ${upper.toFixed(2)}`;\n reference = `${lower_ref.toFixed(2)} - ${upper_ref.toFixed(2)}`;\n }\n }\n return {\n denomination: val.min ? `${val.min} - ${val.denom}` : val.denom,\n price: finalPrice,\n rrp: reference,\n };\n });\n formattedSet.sort(\n (a, b) =>\n Number(a.denomination) < Number(b.denomination) ?\n -1 :\n Number(b.denomination) < Number(a.denomination) ? 1 : 0,\n );\n return formattedSet;\n }", "function sortFruitMarketTableByFruitNameAndPrice() {\n\n}", "function fliter_price_items(db, min_price, max_price){\n document.querySelectorAll('.item_div').forEach(item =>{\n \n for (j=0; j<db.length; j++){\n if(db[j]['pk'].toString() === item.id){ // find div item in db\n item_price=db[j]['fields']['price'];\n \n if (item_price < min_price || item_price > max_price){\n item.style.display= \"none\";\n\n }else{\n item.style.display= \"flex\"\n\n }\n }\n }\n \n })\n }", "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}", "static byPrice(){\n return store.meals.sort((a, b) => b.price - a.price)\n }", "static byPrice() {\n return store.meals.sort((meal1, meal2) => {\n return meal1.price < meal2.price;\n });\n }", "filterByCost() {\n let minValue = this.minFilter.value;\n let maxValue = this.maxFilter.value;\n\n if (!minValue && !maxValue) {\n this.filters.filterByCost = () => {};\n return;\n } else if (minValue && !maxValue) {\n maxValue = Infinity;\n }\n\n // Agrega el filtro al objeto filters\n this.filters.filterByCost = (products) => {\n return products.filter(\n ({ cost }) => minValue <= cost && maxValue >= cost\n );\n };\n }", "static byPrice () {\n console.log(store.meals)\n console.log(store.meals.sort(compare))\n return store.meals.sort(compare)\n }", "function compareByPrice(prod1, prod2)\n{\n return prod1.price - prod2.price;\n}", "getFilterProductList(appliedFilters, sortBy = \"\", customOptions = {}) {\n let result = PRODUCT_LIST;\n if (appliedFilters.length > 0) {\n // NOTE: getting the key to search for\n const appliedFiltersKeys = appliedFilters.map(af => af[\"type\"]);\n appliedFiltersKeys.forEach(fk => {\n const searchKey = FILTER_KEY_MAPPER[fk];\n const searchInValue = CommonHelper.getByKeyValFromObject(appliedFilters, \"type\", fk)[\"filters\"];\n if (searchInValue && searchInValue.constructor === Array) {\n if (searchInValue.length > 0) {\n result = result.filter(pl => {\n const val = pl[searchKey];\n if (val && (val.constructor === String || val.constructor === Number)) {\n return searchInValue.includes(pl[searchKey]);\n } else if (val && val.constructor === Array) {\n return val.some(ele => searchInValue.includes(ele));\n }\n });\n }\n } else if (searchInValue && (searchInValue.constructor === String || searchInValue.constructor === Number)) {\n result = result.filter(pl => pl[searchKey].toString() === searchInValue.toString());\n }\n });\n }\n\n result = this.getSortedList(result, sortBy);\n // NOTE: check this for pagination\n if (customOptions && Object.keys(customOptions).length > 0) {\n const { id = \"\" } = customOptions;\n const indexOfCurrentListLastElement = result.findIndex(p => p[\"id\"] === id) + 1;\n const endIndex = indexOfCurrentListLastElement + LIST_LIMIT;\n if (indexOfCurrentListLastElement >= 0) {\n result = CommonHelper.getListWithLimit(result, indexOfCurrentListLastElement, endIndex);\n }\n } else {\n result = CommonHelper.getListWithLimit(result, 0, LIST_LIMIT);\n }\n return result;\n }", "function add_to_product_list (data, categorie, criteria) {\n\t//Sort the data depending on selected criteria\n\tswitch(criteria) {\n case \"bas-haut\":\n data = data.slice(0).sort(function(a,b) {\n return a.price - b.price;\n });\n break;\n\t \n case \"haut-bas\":\n data = data.slice(0).sort(function(a,b) {\n return b.price - a.price;\n });\n break;\n\t \n\tcase \"a-z\":\n data = data.slice(0).sort(function(a,b) {\n\t\tvar nameA=a.name.toLowerCase(), nameB=b.name.toLowerCase();\n\t\tif (nameA < nameB)\n\t\t return -1;\n\t\tif (nameA > nameB)\n\t\t return 1;\n\t\treturn 0;\n });\n\t break;\n\t \n\tcase \"z-a\":\n data = data.slice(0).sort(function(a,b) {\n\t\tvar nameA=a.name.toLowerCase(), nameB=b.name.toLowerCase();\n\t\tif (nameA < nameB)\n\t\t return 1;\n\t\tif (nameA > nameB)\n\t\t return -1;\n\t\treturn 0;\n\t });\n break;\n\t}\n\t \n\t//Display the data depending on criteria and categorie\n\tswitch(categorie) {\n case \"appareils_photo\":\n\tproduct_count = 0;\n\tvar html_product_list = [];\n\t $.each(data, function(key, value){\n if(value.category == \"cameras\") {\n html_product_list += '<div class=\"product\">';\n\t html_product_list += '<a href=./product.html?id='+value.id+'>';\n\t html_product_list += '<h2>'+value.name+'</h2>';\n\t html_product_list += '<img alt='+value.name+' src=\"./assets/img/'+value.image+'\">';\n\t html_product_list += '<p><small>Prix</small> '+value.price+'&thinsp;$</p>';\n\t html_product_list += '</a>';\n\t html_product_list += '</div>';\n\t\tproduct_count++;\n\t }\n });\n $('#products-list').html(html_product_list); \n break;\n\t \n case \"consoles\":\n\tproduct_count = 0;\n\tvar html_product_list = [];\n\t $.each(data, function(key, value){\n if(value.category == \"consoles\") {\n html_product_list += '<div class=\"product\">';\n\t html_product_list += '<a href=./product.html?id='+value.id+'>';\n\t html_product_list += '<h2>'+value.name+'</h2>';\n\t html_product_list += '<img alt='+value.name+' src=\"./assets/img/'+value.image+'\">';\n\t html_product_list += '<p><small>Prix</small> '+value.price+'&thinsp;$</p>';\n\t html_product_list += '</a>';\n\t html_product_list += '</div>';\n\t\tproduct_count++;\n\t }\n });\n $('#products-list').html(html_product_list); \n break;\n\t \n\tcase \"ecrans\":\n\tproduct_count = 0;\n\tvar html_product_list = [];\n\t $.each(data, function(key, value){\n if(value.category == \"screens\") {\n html_product_list += '<div class=\"product\">';\n\t html_product_list += '<a href=./product.html?id='+value.id+'>';\n\t html_product_list += '<h2>'+value.name+'</h2>';\n\t html_product_list += '<img alt='+value.name+' src=\"./assets/img/'+value.image+'\">';\n\t html_product_list += '<p><small>Prix</small> '+value.price+'&thinsp;$</p>';\n\t html_product_list += '</a>';\n\t html_product_list += '</div>';\n\t\tproduct_count++;\n\t }\n });\n $('#products-list').html(html_product_list); \n\t break;\n\t \n\tcase \"ordinateurs\":\n\tproduct_count = 0;\n\tvar html_product_list = [];\n\t $.each(data, function(key, value){\n if(value.category == \"computers\") {\n html_product_list += '<div class=\"product\">';\n\t html_product_list += '<a href=./product.html?id='+value.id+'>';\n\t html_product_list += '<h2>'+value.name+'</h2>';\n\t html_product_list += '<img alt='+value.name+' src=\"./assets/img/'+value.image+'\">';\n\t html_product_list += '<p><small>Prix</small> '+value.price+'&thinsp;$</p>';\n\t html_product_list += '</a>';\n\t html_product_list += '</div>';\n\t\tproduct_count++;\n\t }\n });\n $('#products-list').html(html_product_list); \n break;\n\n\tcase \"tous_les_produits\":\n\tproduct_count = 0;\n\tvar html_product_list = [];\n $.each(data, function(key, value){\n html_product_list += '<div class=\"product\">';\n\t html_product_list += '<a href=./product.html?id='+value.id+'>';\n\t html_product_list += '<h2>'+value.name+'</h2>';\n\t html_product_list += '<img alt='+value.name+' src=\"./assets/img/'+value.image+'\">';\n\t html_product_list += '<p><small>Prix</small> '+value.price+'&thinsp;$</p>';\n\t html_product_list += '</a>';\n\t html_product_list += '</div>';\n\t\tproduct_count++;\n });\n $('#products-list').html(html_product_list);\n break;\n\t}\t \n}", "function descendProducts(data){\n data.sort((a, b) => (b.price) - (a.price));\n show(data);\n}", "applyFiltersAndSorts() {\n var list = this.props.list.filter(this.matchesFilterEnergyLevel);\n list = list.filter(this.matchesFilterFunLevel)\n var sort_type = this.getSortFunction()\n if(sort_type != null){\n list = list.sort(sort_type)\n }\n return list\n\n }", "function populateListProductChoices( order ) {\t\n var s2 = document.getElementById('displayProduct');\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();\n\n if ( order !== undefined ) {\n \tconst ord = JSON.parse(order);\n\t sortArrayByAttribute( ord.sort, optionArray, ord.ascending );\n }\n\n // quantityMap = {};\n // for ( const o of optionArray ) {\n // \tquantityMap[o.name] = 0;\n // }\n\n\tfor (let p of optionArray ) {\n\t\tinjectProduct(s2, p);\t\t \n\t}\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 comparePrice(a,b){\r\n return a.price - b.price; console.log(hats.sort(comparePrice));\r\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 createRecommendedList(orgPlanList, keywords, maxSize) {\n console.log('===originalList===');\n console.log(orgPlanList);\n const contentFiltered = filterByContent(orgPlanList);\n console.log('===contentFiltered===');\n console.log(contentFiltered);\n const keywordFiltered = filterByKeywords(contentFiltered, keywords);\n console.log('===keywordFiltered===');\n console.log(keywordFiltered);\n console.log('===========================');\n let ret = _.sample(keywordFiltered, maxSize);\n if (ret.length <= maxSize) {\n const ext = _.sample(contentFiltered, maxSize - ret.length);\n ret = _.union(ret, ext);\n }\n return ret;\n}", "function getTotalOfAllProductsByPriceRange(products, min, max) {\n try {const filteredProducts = filterProductsByPriceRange(products, min, max);\n\n const total = getCartTotal(filteredProducts); \n return total;\n} catch (err){\n return 0;\n};\n}", "function filterPrice(inputData) {\n var tempData = JSON.parse(inputData.body).Objects;\n\n // Applies filter if minimum price exists in GET request\n if (req.query.priceMin) {\n tempData = tempData.filter(function(object) {\n if (object.Koopprijs && !object.Huurprijs) {\n return object.Koopprijs > req.query.priceMin;\n } else {\n return object.Huurprijs > req.query.priceMin;\n }\n });\n }\n // Applies filter if maximum price exists in GET request\n if (req.query.priceMax) {\n tempData = tempData.filter(function(object) {\n if (object.Koopprijs && !object.Huurprijs) {\n return object.Koopprijs < req.query.priceMax;\n } else {\n return object.Huurprijs < req.query.priceMax;\n }\n });\n }\n\n // return inputData;\n return JSON.stringify(tempData);\n }", "function sortByPriceDesc(a,b)\n{\n return b.price - a.price\n}", "function requestData() {\n let product = [];\n $(\"#byLists td\").remove();\n $(\"#itemsLists td\").remove();\n data.buyList.map((value) => {\n let raw = \"\";\n raw = `\n <tr>\n <td>${value.totalPrice}</td>\n <td>${value.totalPayPrice}</td>\n <td>${value.deliveryFees}</td>\n <td>${value.farmName}</td>\n </tr>\n `;\n $(\"#byLists\").append(raw);\n value.productList.map((values) => {\n product.push({\n name: values.productName,\n quantity: values.productQuantity,\n price: values.productPrice,\n perPrice: values.totalPayPrice,\n });\n });\n });\n\n let seen = {};\n // filter and merge the duplicate product\n product = product.filter(function (entry) {\n let previous;\n // Have we seen this label before?\n if (seen.hasOwnProperty(entry.name)) {\n // Yes, grab it and add this data to it\n previous = seen[entry.name];\n previous.quantity.push(entry.quantity);\n previous.price.push(entry.price);\n previous.perPrice.push(entry.perPrice);\n // Don't keep this entry, we've merged it into the previous one\n return false;\n }\n // entry.data probably isn't an array; make it one for consistency\n if (!Array.isArray(entry.quantity)) {\n entry.quantity = [entry.quantity];\n }\n if (!Array.isArray(entry.price)) {\n entry.price = [entry.price];\n }\n if (!Array.isArray(entry.perPrice)) {\n entry.perPrice = [entry.perPrice];\n }\n // Remember that we've seen it\n seen[entry.name] = entry;\n // Keep this one, we'll merge any others that match into it\n return true;\n });\n\n // loop over the product => item\n product.forEach((val) => {\n let rows = \"\";\n if (val.perPrice.length > 1) {\n // if item contain array then merging them and calculating avarage\n // else append the item as it is!\n\n let totalPrice = val.perPrice.reduce((acc, cu) => {\n return acc + cu;\n });\n let totalQuantity = val.quantity.reduce((acc, cu) => {\n return acc + cu;\n });\n let payPerPrice = val.price.reduce((acc, cu) => {\n return acc + cu;\n });\n raws = `\n <tr>\n <td>${totalQuantity}</td>\n <td>${totalPrice}</td>\n <td>${totalPrice/totalQuantity}</td>\n <td>${val.name}</td>\n </tr>\n `;\n } else {\n raws = `\n <tr>\n <td>${val.quantity}</td>\n <td>${val.perPrice}</td>\n <td>${val.price}</td>\n <td>${val.name}</td>\n </tr>\n `;\n }\n $(\"#itemsLists\").append(raws);\n });\n}", "function reorderPrices()\n{\n // Order followed by the client depending on the language.\n let order = [\n 'Member Adult',\n 'Member Senior (65+)',\n 'Member Tiny Tot (0–2)',\n 'Member Child (3–12)',\n 'Member Student (13+)',\n 'Member Student (18+)',\n 'Adult',\n 'Senior (65+)',\n 'Tiny Tot (0–2)',\n 'Child (3–12)',\n 'Student (13+)',\n 'Student (18+)',\n 'Post-Doc',\n 'Staff/Volunteer',\n 'Staff Volunteer',\n 'Discounted Adult',\n 'Adult combo',\n 'Senior (65+) combo',\n 'Tiny Tot (0–2) combo',\n 'Child (3–12) combo',\n 'Student (13+) combo',\n 'Student (18+) combo',\n 'Complimentary Adult',\n 'Complimentary Senior (65+)',\n 'Complimentary Tiny Tot (0–2)',\n 'Complimentary Child (3–12)',\n 'Complimentary Student (13+)',\n 'Complimentary Student (18+)',\n ];\n\n if (translator.to() === 'fr') {\n order = [\n 'Membre adulte',\n 'Membre aîné (65+)',\n 'Membre tout-petit (0 à 2)',\n 'Membre enfant (3 à 12)',\n 'Membre étudiant (13+)',\n 'Membre étudiant (18+)',\n 'Adulte',\n 'Aîné (65+)',\n 'Tout-petit (0 à 2)',\n 'Enfant (3 à 12)',\n 'Étudiant (13+)',\n 'Étudiant (18+)',\n 'Universitaire postdoctoral',\n '*Postdoctoral',\n 'Employé/Bénévole',\n 'Employée Bénévole',\n 'Rabais adulte',\n 'Adulte forfait',\n 'Aîné (65+) forfait',\n 'Tout-petit (0 à 2) forfait',\n 'Enfant (3 à 12) forfait',\n '*Child/Enfant',\n 'Étudiant (13+) forfait',\n 'Étudiant (18+) forfait',\n 'Gratuit adulte',\n 'Gratuit aîné (65+)',\n 'Gratuit tout-petit (0 à 2)',\n 'Gratuit enfant (3 à 12)',\n 'Gratuit étudiant (13+)',\n 'Gratuit étudiant (18+)',\n ];\n }\n\n let sortedItems = [];\n let priceListSelector = '';\n\n const isPackagePage = $('.tn-flex-package-detail-page').length > 0;\n\n if (isPackagePage) {\n priceListSelector = 'fieldset .tn-ticket-selector__pricetype-container .tn-ticket-selector__pricetype-list li';\n } else {\n priceListSelector = 'fieldset .tn-ticket-selector__pricetype-container:first-child .tn-ticket-selector__pricetype-list li';\n }\n\n // Push the nodes onto an array so that we can use the sort method.\n document.querySelectorAll(priceListSelector).forEach((item, i) => {\n sortedItems.push(item)\n })\n\n let itemOrder = (item) => {\n if (isPackagePage) {\n return order.indexOf(\n item.querySelector('h4').innerText.trim()\n )\n } else {\n return order.indexOf(\n item.innerText.split('$')[0].trim()\n )\n }\n }\n\n // Sort the array based on the content of the node.\n sortedItems.sort((a, b) => {\n a = itemOrder(a);\n b = itemOrder(b);\n\n if (a == b) {\n return 0\n }\n\n if (a < b) {\n return -1\n }\n\n return 1\n })\n\n // Append the childresn ordered to the prices list.\n .forEach((item) => {\n document.querySelector('.tn-ticket-selector__pricetype-list').appendChild(item)\n })\n}", "function refreshProductsView() {\n let filteredProducts = filterByCountryName(products, countrySelect.value);\n filteredProducts = filterByName(filteredProducts, searchInput.value);\n filteredProducts = sortList(filteredProducts, sortSelect.value);\n filteredProducts = filterByRangeOfPrice(filteredProducts, priceRange.value);\n console.log(filterByRangeOfPrice(filteredProducts, priceRange.value));\n\n renderProducts(filteredProducts);\n}", "function searchProductsByPrice(price, difference) {\n\t\t\tvar promise = new Promise((resolve, reject) => {\n\t\t\t\tlet i = 0;\n\t\t\t\tlet priceArray = [];\n\t\t\t\t//Handle invalid price\n\t\t\t\tif (!isFinite(price)) reject('Invalid Price: ' + price);\n\t\t\t\t//Otherwise, search catalog\n\t\t\t\telse {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\twhile (i < catalog.length) {\n\t\t\t\t\t\t\tif (Math.abs(catalog[i].price - price) <= difference) {\n\t\t\t\t\t\t\t\tpriceArray.push({\n\t\t\t\t\t\t\t\t\tid: catalog[i].id,\n\t\t\t\t\t\t\t\t\tprice: catalog[i].price,\n\t\t\t\t\t\t\t\t\ttype: catalog[i].type\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//After searching entire catalog, return matching products\n\t\t\t\t\t\tresolve(priceArray);\n\t\t\t\t\t}, 1000);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn promise;\n\t\t}", "function search(budget, prices) {\n // return array of prices that are within budget\n return prices\n .filter(price => price <= budget)\n .sort((a, b) => a - b)\n .join(',');\n}", "function updateProductList()\n{\n var itemSort = '';\n var itemFilter = '';\n\n if (typeof document.filterForm != 'undefined') {\n itemSort = document.filterForm.sortBy.value;\n itemFilter = document.filterForm.filterBy.value;\n }\n\n // pageProduct\n var prodList = createProductList(itemSort, itemFilter);\n\n updateItemContainer(prodList);\n}", "function createProductList(itemSort, itemFilter) {\n var productList;\n var productListType;\n\n // filter the products based on type, pageProductType defined in HTML <script> element\n productListType = products;\n if (typeof pageProductType != 'undefined') {\n if (pageProductType.length != 0) {\n productListType = products.filter(function(product) {\n return product.productType == pageProductType;\n });\n }\n }\n\n // filter the products based on category\n if (itemFilter.length == 0) {\n productList = productListType;\n } else {\n productList = productListType.filter(function(product) {\n return product.category == itemFilter;\n });\n }\n\n // sort the products based on sorting specified by itemSort\n switch (itemSort) {\n case 'priceA':\n productList = productList.sort(compareByPrice);\n break;\n case 'priceD':\n productList = productList.sort(compareByPrice).reverse();\n break;\n case 'name':\n productList = productList.sort(compareByName);\n break;\n default:\n // do nothing\n break;\n }\n\n return productList;\n}", "function filterItems() {\n //returns newPropList, array of properties\n var newPropList = featured;\n //Beds\n console.log(1, newPropList);\n if(currentFilters.beds == 5) {\n newPropList = newPropList.filter(item => item.bedrooms >= currentFilters.beds);\n }\n else if (currentFilters.beds == 0) {\n\n }\n else {\n newPropList = newPropList.filter(item => item.bedrooms == currentFilters.beds);\n }\n console.log(2, newPropList);\n //Baths\n if(currentFilters.baths == 5) {\n newPropList = newPropList.filter(item => item.fullBaths >= currentFilters.baths);\n }\n else if (currentFilters.baths == 0) {\n\n }\n else {\n newPropList = newPropList.filter(item => item.fullBaths == currentFilters.baths);\n }\n console.log(3, newPropList);\n //Price\n if(currentFilters.max == 0) {\n\n }\n else if(currentFilters.min == 1000000) {\n newPropList = newPropList.filter(item => item.rntLsePrice >= currentFilters.min);\n }\n else {\n newPropList = newPropList.filter(item => item.rntLsePrice >= currentFilters.min && item.rntLsePrice <= currentFilters.max);\n }\n console.log(4, newPropList);\n //Type\n console.log(currentFilters.type);\n if(currentFilters.type == \"All\") {\n console.log('all');\n }\n else if(currentFilters.type == \"Other\") {\n newPropList = newPropList.filter(item => item.idxPropType == \"Residential Income\" || item.idxPropType == \"Lots And Land\");\n console.log('other');\n }\n else {\n newPropList = newPropList.filter(item => item.idxPropType == currentFilters.type);\n console.log('normal');\n }\n //Search Term\n console.log(5, newPropList);\n if(currentFilters.term != '')\n {\n newPropList = newPropList.filter(item => \n item.address.toLowerCase().indexOf(currentFilters.term.toLowerCase()) != -1 ||\n item.cityName.toLowerCase().indexOf(currentFilters.term.toLowerCase()) != -1\n );\n }\n console.log(6, newPropList);\n return newPropList;\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 filterProductShop() {\n let minPrice = parseInt($('#price-min').val()),\n maxPrice = parseInt($('#price-max').val()),\n cat_lv1_list = [],\n sort = $('.store-sort .input-select option:selected').val(),\n id = window.location.pathname.split(\"/\")[2];\n\n if (!minPrice) {\n return false;\n }\n\n $('.checkbox-filter .input-checkbox input:checked').each(function () {\n cat_lv1_list.push($(this).data('id'));\n });\n\n axios({\n method: 'POST',\n url: `/shop/${id}/search`,\n data: {\n minPrice: minPrice,\n maxPrice: maxPrice,\n cat_lv1: cat_lv1_list,\n sort: sort\n }\n }).then(function (res) {\n document.querySelector('#store > .row').innerHTML = '';\n if (res.data.length > 0) {\n res.data.forEach(product => {\n let tpl = document.querySelector('#product-div'),\n clone = tpl.content.cloneNode(true),\n p_link = clone.querySelector('.product-link'),\n p_img = clone.querySelector('.product-img'),\n p_sale = clone.querySelector('.product-label .sale'),\n p_purchased = clone.querySelector('.product-purchased'),\n p_name = clone.querySelector('.product-name a'),\n price_1 = clone.querySelector('.product-price span'),\n price_2 = clone.querySelector('.product-old-price');\n p_link.href = `/product/${product.id}/show`;\n p_img.style.backgroundImage = `url(${product['img']})`;\n if (product.sale_percent) {\n p_sale.textContent = `${product.sale_percent}%`;\n } else {\n p_sale.style.display = 'none';\n }\n p_purchased.textContent = `Đã bán ${product.purchased_number}`;\n p_name.textContent = product.name;\n p_name.href = `/product/${product.id}/show`;\n price_1.textContent = product.sale_price;\n price_2.textContent = (product.sale_price === product.price) ? '' : product.price;\n document.querySelector('#store > .row').appendChild(clone);\n });\n } else {\n $('#store > .row').html('<p class=\"no-products\">Không có sản phẩm nào.</p>');\n }\n })\n }", "async getProductListByFilter(req, res, next) {\n try {\n // - filter by cateogry and price\n let filter = {};\n const { filtertype } = req.headers;\n\n if (filtertype) {\n const filterPriceValue = this.filterProductByPrice(filtertype);\n const filterCategoryValue = this.filterProductByCategory(filtertype);\n\n if (filterPriceValue) {\n filter = {\n order: [[\"price\", filterPriceValue]],\n };\n } else if (filterCategoryValue) {\n filter = {\n where: {\n category: +filterCategoryValue,\n },\n };\n }\n }\n\n const results = await ProductService.getProductByFilter(filter);\n return res.json({\n success: true,\n results,\n });\n } catch (err) {\n next(err);\n }\n }", "static byPrice(){\n return store.meals.sort(function(a,b){\n return b.price-a.price\n });\n }", "function filterRealty(realty) {\n\t\tif (!document.getElementById('imoveis').checked) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (!realty.price) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar minPrice = document.getElementById('min_price').value;\n\t\tvar maxPrice = document.getElementById('max_price').value;\n\n\t\tif (Number(realty.price) < minPrice || Number(realty.price) > maxPrice) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "function filterByPrice(){\n // inputRange = document.querySelector(\".slider\")\n inputRange.setAttribute(\"min\",min);\n inputRange.setAttribute(\"max\",max)\n // console.log(min ,max )\n var result = resultHotel.filter((hotel)=> {\n return hotel.price >= inputRange.value;\n })\n display(result);\n}", "function searchProductsByPrice(price,difference){\n var promise = new Promise(function(resolve,reject){\n var i = 0;\n var priceArray = [];\n if(!isFinite(price)){\n reject(\"Invalid Price: \" + price)\n }\n else{\n setTimeout(function(){\n while (i < catalog.length){\n if (Math.abs(catalog[i].price - price) < difference){\n priceArray.push({id:catalog[i].id,price:catalog[i].price,type:catalog[i].type});\n }\n i++;\n }\n resolve(priceArray);\n },1000);\n }\n });\n return promise;\n }", "async function getProducts(){\n var result=await Product.\n find()\n .limit(2) // Number of records required\n .sort({name:1}) // sort in ascending order w.r.t name\n .select({author:\"Hamad\"}); // properties required by items\n\n console.log(\" \\n\\nGet all records, then sort ascendingly on name, pick top 2 elements, and display whose author is hamad\\n\\n \"+result);\n\n result=await Product.\n find({price:{$lt:70,$gt:30}}); // price less than 70 and greator than 30\n console.log(\" \\n\\nprice less than 70 and greator than 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$ne:30}}); // whose price is not equal to 30\n console.log(\" \\n\\nwhose price is not equal to 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$in:[40,30]}}); // whose price is 40 or 30\n console.log(\"\\n\\n whose price is 40 or 30 \\n\\n\"+result);\n\n result=await Product.\n find({price:{$nin:[40,30]},name:\"rice\"}); // price is neither 40 nor 30 and name is rice \n console.log(\"\\n\\n price is neither 40 nor 30 and name is rice \\n\\n \"+result);\n\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 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 gather_categories_price()\n\t\t{\n\n\t\tvar labels = ['0-5','5-8','8-10','10-13','13-15','15-18','18-20','20-23','23-25','25-28','28-30','30-35','35-40','40-50','50-60','60+']\n\t\tvar price_buckets = {};\n\t\tfor (var i=0;i<labels.length;i=i+1)\n\t\t\t{\n\t\t\tprice_buckets[(k = labels[i])] = {'name':k,'order':i+1,'totalOrders':0};\n\t\t\t}\n\n\t\tfor (var each in $scope.DATA['ordersByPrice'])\n\t\t\t{\n\t\t\tvar el = $scope.DATA['ordersByPrice'][each];\n\t\t\tprice_buckets[el['name']]['totalOrders'] = el['totalOrders'];\n\t\t\t}\n\t\t$scope.DATA['ordersByPrice'] = $.map(price_buckets,function(el){return el});\n\n\t\t}", "filterByCost() {}", "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}", "filterTopProducts() {\n const result = [];\n if (!this.searchResults) return;\n this.topProducts = [];\n const sr = this.searchResults;\n for (let i = 0; i < 3; i += 1) {\n result.push(new TopProduct(sr[i].itemId, sr[i].name, sr[i].productUrl, sr[i].thumbnailImage));\n }\n this.topProducts = result;\n }", "function preRenderFilteredItems(animal, type, priceRange) {\r\n for (let i in accessoriesArr) {\r\n if (animal === accessoriesArr[i].animal) {\r\n if (type === accessoriesArr[i].type) {\r\n if (accessoriesArr[i].price >= parseInt(priceRange) && accessoriesArr[i].price < (parseInt(priceRange) + 25)) {\r\n renderFilteredAccessories(i);\r\n } else if (priceRange === '-1') {\r\n renderFilteredAccessories(i);\r\n }\r\n } else if (type === '0') {\r\n if (accessoriesArr[i].price >= parseInt(priceRange) && accessoriesArr[i].price < (parseInt(priceRange) + 25)) {\r\n renderFilteredAccessories(i);\r\n } else if (priceRange === '-1') {\r\n renderFilteredAccessories(i);\r\n }\r\n }\r\n } else if (animal === 'Select') {\r\n if (accessoriesArr[i].type.includes(type)) {\r\n if (accessoriesArr[i].price >= parseInt(priceRange) && accessoriesArr[i].price < (parseInt(priceRange) + 25)) {\r\n renderFilteredAccessories(i);\r\n } else if (priceRange === '-1') {\r\n renderFilteredAccessories(i);\r\n }\r\n } else if (type === '0') {\r\n if (accessoriesArr[i].price >= parseInt(priceRange) && accessoriesArr[i].price < (parseInt(priceRange) + 25)) {\r\n renderFilteredAccessories(i);\r\n } else if (priceRange === '-1') {\r\n renderFilteredAccessories(i);\r\n }\r\n }\r\n }\r\n }\r\n}", "filterCatalog() {\n\t\tlet filteredCatalog = [];\n\t\tthis.postFiltered({}); // clean previous filtered catalog\n\n\t\tfor (let i = 0; i < this.catalog.length; i++) { // and filter with them catalog. Intermediate results put\n\t\t\t// check if the product satisfy all filters\n\t\t\tif (\n\t\t\t\t\tthis.checkProdWithFilter(this.filters.catItem, this.catalog[i].catItem) &&\n\t\t\t\t\tthis.checkProdWithFilter(this.filters.category, this.catalog[i].category) &&\n\t\t\t\t\tthis.checkProdWithFilter(this.filters.brand, this.catalog[i].brand) &&\n\t\t\t\t\tthis.checkProdWithFilter(this.filters.designer, this.catalog[i].designer) &&\n\t\t\t\t\tthis.checkProdBySize(this.filters.size, this.catalog[i].size) &&\n\t\t\t\t\tthis.checkProdByPrice(this.filters.price, this.catalog[i].price)\n\t\t\t) {\n\n\t\t\t\tfilteredCatalog.push(this.catalog[i]); // add this product to this.filteredCatalog\n\t\t\t}\n\t\t}\n\n\t\tthis.paginate(filteredCatalog);\n\n\t\t// this.postFiltered(this.filteredCatalog); // this.filteredCatalog сохраняется правильно\n\t}", "function filterResults() {\n var filteredHotels = hotels.filter(function(hotel) {\n if(\n hotel.stars >= rating &&\n hotel.distance <= distance &&\n (hotel.ppn >= minPrice && hotel.ppn <=maxPrice)\n ) {\n return hotel\n }\n });\n \n //If facilities filter present filter results accordingly.\n if(!document.getElementById('ignore_facilities').checked) {\n if(wifi || pool) {\n filteredHotels = filteredHotels.filter((function (hotel) {\n if(wifi && pool) {\n if((wifi && hotel.wifi) && (pool && hotel.pool) ) return hotel;\n }\n else{\n if(wifi && hotel.wifi) return hotel;\n if(pool && hotel.pool) return hotel;\n }\n }));\n }\n }\n \n //Remove previous results\n var node = document.getElementById('results');\n while (node.hasChildNodes()) {\n node.removeChild(node.lastChild);\n }\n if(order === \"desc\") {\n filteredHotels.sort(descending);\n }\n else {\n filteredHotels.sort(ascending);\n }\n if(filteredHotels.length === 0) {\n var noResults = document.createElement('div');\n noResults.className = 'text-center col-12 pt-5';\n noResults.innerHTML = '<p>No results match your search criteria.</p>\\n';\n document.getElementById('results').appendChild(noResults);\n }\n else {\n loadHotels(filteredHotels);\n }\n}", "noOfferProducts(productsListFromProps) {\n if (productsListFromProps.length > 0 && this.props.company && this.props.company.offers.items.length > 0) {\n let coOffers;\n this.props.company.offers.items.forEach((item) => { coOffers = coOffers + item.productID + ';;' });\n const l = productsListFromProps.length;\n let indexedProductsNoOffer = [];\n let count = 0;\n for (let x = 0; x < l; x++) {\n if (!coOffers.includes(productsListFromProps[x].id)) {\n indexedProductsNoOffer.push({\n seqNumb: count++,\n details: productsListFromProps[x]\n })\n }\n }\n return indexedProductsNoOffer;\n } else {\n return this.allProducts(productsListFromProps);\n }\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 getPriceGroups(){\n\tlet result = _.groupBy(pizzaToppingPrices, (item) => {\n\t\t//this will return based on item passes in and value\n return Math.floor(item.price / 1.0) \n })\n\treturn result;\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 findItemsOver(list, bar){\n var expensive = [];\n for(i in list){\n if(list[i].price > bar){\n expensive.push(list[i]);\n }\n }\n return expensive;\n}", "filterData(sortData) {\n let finishData = [], filterData = [];\n sortData.forEach(\n data => {\n if(!finishData.includes(data.date)) {\n let same = sortData.filter(e => e.date == data.date);\n if(same.length > 1) {\n let cheapest = same[0];\n same.forEach(e => {cheapest = e.price < cheapest.price ? e : cheapest})\n filterData.push(cheapest)\n }\n else {\n filterData.push(data);\n }\n finishData.push(data.date);\n }\n }\n )\n return filterData\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 }", "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 carryToOrders(pProducts, pOrders) {\n let productsList = document.querySelectorAll(\"#allProducts li\");\n console.log(productsList.item(2));\n for (let i = 0; i < products.length; i++) {\n productsList[i].addEventListener(\"click\", function () {\n let productsListItem = productsList[i].innerText;\n let index = pProducts.indexOf(productsListItem);\n pProducts.splice(index, 1);\n productsList[i].remove();\n pOrders.push(productsListItem);\n pOrders.sort();\n addProducts(pOrders, \"#allOrders\")\n });\n\n }\n}", "function filterProductCategory() {\n let minPrice = parseInt($('#price-min').val()),\n maxPrice = parseInt($('#price-max').val()),\n cat_lv2_list = [],\n sort = $('.store-sort .input-select option:selected').val(),\n id = $('input#page-category-id').val(),\n level = $('#category-level').val();\n\n if (!minPrice) {\n return false;\n }\n\n $('.checkbox-filter .input-checkbox input:checked').each(function () {\n cat_lv2_list.push($(this).data('id'));\n });\n\n axios({\n method: 'POST',\n url: `/category/${id}/search`,\n data: {\n minPrice: minPrice,\n maxPrice: maxPrice,\n cat_lv2: cat_lv2_list,\n sort: sort,\n level: level\n }\n }).then(function (res) {\n document.querySelector('#store > .row').innerHTML = '';\n if (res.data.length > 0) {\n res.data.forEach(product => {\n let tpl = document.querySelector('#product-div'),\n clone = tpl.content.cloneNode(true),\n p_link = clone.querySelector('.product-link'),\n p_img = clone.querySelector('.product-img'),\n p_sale = clone.querySelector('.product-label .sale'),\n p_purchased = clone.querySelector('.product-purchased'),\n p_name = clone.querySelector('.product-name a'),\n price_1 = clone.querySelector('.product-price span'),\n price_2 = clone.querySelector('.product-old-price');\n p_link.href = `/product/${product.id}/show`;\n p_img.style.backgroundImage = `url(${product['img']})`;\n if (product.sale_percent) {\n p_sale.textContent = `${product.sale_percent}%`;\n } else {\n p_sale.style.display = 'none';\n }\n p_purchased.textContent = `Đã bán ${product.purchased_number}`;\n p_name.textContent = product.name;\n p_name.href = `/product/${product.id}/show`;\n price_1.textContent = product.sale_price;\n price_2.textContent = (product.sale_price === product.price) ? '' : product.price;\n document.querySelector('#store > .row').appendChild(clone);\n });\n } else {\n $('#store > .row').html('<p class=\"no-products\">Không có sản phẩm nào.</p>');\n }\n\n })\n }", "function price2(rentals)\n{\n for (var i = 0; i < rentals.length; i++)\n {\n var time = getDays(rentals[i].pickupDate, rentals[i].returnDate);\n\n if (time < 1)\n {\n rentals[i].price = (time * getPricePerDay(rentals[i].carId)) + (rentals[i].distance * getPricePerKm(rentals[i].carId));\n }\n if (time >= 1 && time < 4)\n {\n rentals[i].price = (time * getPricePerDay(rentals[i].carId) * 0.9) + (rentals[i].distance * getPricePerKm(rentals[i].carId));\n }\n if (time >= 4 && time < 10)\n {\n rentals[i].price = (time * getPricePerDay(rentals[i].carId) * 0.7) + (rentals[i].distance * getPricePerKm(rentals[i].carId));\n }\n if (time >= 10)\n {\n rentals[i].price = (time * getPricePerDay(rentals[i].carId) * 0.5) + (rentals[i].distance * getPricePerKm(rentals[i].carId));\n }\n }\n}", "function PricePerUnit() { \r\n // The PricePer function grabs all the prices and does calculations on them when Auction House pages load.\r\n var pricePer = function(descending)\r\n {\r\n // Get the listed sales.\r\n var sales = $('div[id^=\"sale\"]');\r\n var isFood = $($('#search_food')[0]).attr('style').indexOf('font-weight: bold') > -1;\r\n \r\n var pricesPer = [];\r\n \r\n for (var i = 0; i < sales.length; i++)\r\n {\r\n // For each sale, get the item counts and pricing - then divide!\r\n var sale = $(sales[i]);\r\n var count = $(sale.find('div span span')[0]).text().trim();\r\n if (isFood)\r\n {\r\n var id = $(sales.find('div > span > span')[0]).text();\r\n \r\n var foodRate = getFoodPointsById(id);\r\n if (foodRate)\r\n count *= foodRate;\r\n }\r\n var priceEl = $(sale.find('div[id^=\"buy_button\"]')[0]);\r\n var price = priceEl.text().trim();\r\n \r\n // Convert the treasure totals into friendly values (k, Mil, and various decimal counts)\r\n if (count > 1)\r\n {\r\n var pricePer = price/count;\r\n pricesPer.push(pricePer);\r\n \r\n if (pricePer > 1000000)\r\n {\r\n pricePer = Math.round(pricePer / 100000) / 10 + ' Mil';\r\n }\r\n else if (pricePer > 1000)\r\n {\r\n pricePer = Math.round(pricePer / 100) / 10 + 'k';\r\n }\r\n else if (pricePer > 10)\r\n {\r\n pricePer = Math.round(pricePer);\r\n }\r\n else if (pricePer > 3)\r\n {\r\n pricePer = Math.round((price/count) * 10) / 10;\r\n }\r\n else {\r\n pricePer = Math.round((price/count) * 100) / 100;\r\n }\r\n priceEl.html(priceEl.html().replace(price + '<br>', pricePer + ' <span style=\"color: #008000;\">x' + count + (isFood ? ' pt' : '') + '</span><br>'));\r\n }\r\n else\r\n {\r\n pricesPer.push(parseInt(price));\r\n }\r\n }\r\n \r\n // Sort the listings by price per (can't sort all items at once, but no reason not to sort each page).\r\n // This is basically an insertion sort - I don't know if this is poor or not, but I really don't care about performance when sorting ~10 items.\r\n for (var i = 0; i < sales.length; i++)\r\n {\r\n for (var j = i + 1; j < sales.length; j++)\r\n {\r\n if (!descending && pricesPer[j] < pricesPer[i] || descending && pricesPer[j] > pricesPer[i])\r\n {\r\n $(sales[i]).before($(sales[j]));\r\n \r\n // Reload my query since things moved.\r\n sales = $('div[id^=\"sale\"]');\r\n \r\n var pricePerToMove = pricesPer.splice(j, 1)[0];\r\n pricesPer.splice(i, 0, pricePerToMove);\r\n }\r\n }\r\n }\r\n }\r\n \r\n // Actually call the price per item function when the Auction House pages stop loading.\r\n $(document).ajaxSuccess(function(e, xhr, options) {\r\n if (options.url.indexOf('ah_buy_') > -1)\r\n {\r\n if (options.data.order == 'DESC')\r\n {\r\n pricePer(true);\r\n }\r\n else\r\n {\r\n pricePer(false);\r\n }\r\n }\r\n });\r\n}", "function salesByProduct(products, lineItems){\n //TODO\n}" ]
[ "0.74831665", "0.74503493", "0.73820394", "0.7317847", "0.7304312", "0.7155821", "0.6997339", "0.6922627", "0.69088805", "0.687862", "0.68585145", "0.6805897", "0.6664231", "0.66454655", "0.6577675", "0.6494552", "0.6344502", "0.6343082", "0.6342061", "0.62489545", "0.6230538", "0.622366", "0.6206647", "0.620099", "0.6084965", "0.60845923", "0.60522", "0.604287", "0.60266054", "0.6005471", "0.5993183", "0.5966021", "0.5911064", "0.59010196", "0.5809158", "0.580035", "0.57898575", "0.5789548", "0.5752925", "0.574233", "0.5729882", "0.56848335", "0.5663699", "0.5654877", "0.5643211", "0.5624905", "0.5622661", "0.5547878", "0.5534749", "0.5524379", "0.55165654", "0.5515639", "0.55151826", "0.5478013", "0.5474213", "0.54628956", "0.54581577", "0.5456348", "0.5455063", "0.54536283", "0.5451175", "0.54364896", "0.5431845", "0.5427744", "0.5423485", "0.54054755", "0.54037756", "0.53977674", "0.53856593", "0.53822136", "0.5365523", "0.5356004", "0.5355411", "0.53528833", "0.5349195", "0.5339606", "0.5336276", "0.5324852", "0.52968806", "0.5288971", "0.5287761", "0.527774", "0.5263878", "0.5257659", "0.52491796", "0.5243013", "0.52413315", "0.52330774", "0.5231667", "0.5220414", "0.52198976", "0.52009165", "0.5193918", "0.51818436", "0.5179022", "0.5170485", "0.5164054", "0.5161168", "0.51610035", "0.5155381" ]
0.7156894
5
Calculate the total price of items, with received parameter being a list of products
function getTotalPrice(chosenProducts) { totalPrice = 0; for (let i=0; i<products.length; i+=1) { if (chosenProducts.indexOf(products[i].name) > -1){ var productName = totalPrice += products[i].price; } } return totalPrice; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateTotalPrice(orderedItems) {\n let totalPrice = 0;\n // Пиши код ниже этой строки\n\n \n\n orderedItems.forEach(function( orderedItems, index,){\n \ttotalPrice += orderedItems;\n }); \n // Пиши код выше этой строки\n return totalPrice;\n}", "function calcTotalPrice(products) {\n\t// YOUR CODE HERE\n}", "total() {\n var total = 0.0\n for (var sku in this.items) {\n var li = this.items[sku]\n var price = li.quantity * li.price\n total += price\n }\n return total\n }", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<chosenProducts.length; i+=1) {\n\t\ttotalPrice+=chosenProducts[i].price;\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(items) {\n return _.reduce(items, function(memo, item) {\n return memo + item.quantity * item.price;\n }, 0);\n }", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn Math.round((totalPrice * 100)) /100;\n}", "function calcTotal() {\n let total = 0;\n for (let item of itemList) {\n total += Number(item.price);\n }\n console.log(\"this is the total\", total);\n return total;\n }", "function getTotalPrice(chosenProducts) {\n var totalPrice = 0;\n\n for (i = 0; i < chosenProducts.length; i++) {\n var prod = chosenProducts[i];\n var prodPrice = prod.split('$').pop().split('(')[0]; // get price from product string\n totalPrice = parseFloat(totalPrice) + parseFloat(prodPrice);\n }\n\n return \"$\" + totalPrice.toFixed(2);\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "totalPrice() {\n let sum = 0;\n\n for(let i = 0; i < this.state.items.length; i++){\n sum += this.totalItemPrice(this.state.items[i]);\n }\n return sum;\n }", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function calculateTotalCart () {\n let totalPrice = 0;\n for (product of products) {\n totalPrice += product.price;\n }\n return totalPrice/100;\n}", "function totalCart(products) {\n let totalPrice = 0;\n if (products) {\n for (product of products) {\n totalPrice += parseInt(product.price);\n }\n return totalPrice;\n } else {\n return totalPrice\n }\n}", "totalPrice() {\n var total = 0;\n for (var i = 0; i < this.listItems.length; i++) {\n total += parseFloat(this.listItems[i].price);\n }\n return total.toFixed(2);\n }", "function productTotal() {\n for (let i = 0; i < basket.length; i++) {\n let price = Number(basket[i].price.replace(/[^0-9.-]+/g,\"\"));\n let totalPrice = price * basket[i].quantity;\n basket[i].totalPrice = totalPrice\n } \n}", "updateTotal() {\n let total = 0;\n for (let index in this.items) {\n let item = this.items[index];\n total += item.price * item.quantity;\n }\n this.total = total;\n }", "function totalSales(products, lineItems){\n var allProducts = generateProductsMap(products);\n var totalSales = lineItems.reduce(function(total, current) {\n currentPrice = allProducts[current['productId']]['price'];\n total += current['quantity'] * currentPrice;\n return total;\n }, 0)\n return totalSales;\n}", "totalCart()\n {\n let total = 0;\n for (let i = 0; i < this.itemlist.length; i++)\n {\n total += this.itemList[1].price * this.itemQuantity[i];\n }\n return total;\n }", "function getTotalPrice(itemNode) {\n var price = getPriceByProduct(itemNode);\n var qty = getQuantityByProduct(itemNode);\n return price * qty;\n}", "function getTotalPrice() {\n var products = document.querySelectorAll('.product');\n var priceTotal = 0;\n for (var i = 0, l = products.length; i < l; i++){\n var productPrice = getPriceByProduct(products[i]);\n updatePriceByProduct(products[i], productPrice);\n priceTotal += productPrice;\n }\n document.querySelector('h2 span').innerHTML = priceTotal;\n}", "function totalPrice(list) {\n return (\n (list.length && parseFloat(list[0]) + totalPrice(list.slice(1))) || 0\n );\n }", "function totalSales(products, lineItems){\n //TODO\n\n}", "function calcTotalCart(item){\n //console.log(\"item count\" + item.count);\n total = total + item.count;\n var productName = products.find(y => y.id == item.id).name;\n //Display each individual item name and it's individual count\n console.log(productName + \" - Quantity = \" + item.count);\n }", "function getTotalPrice(foodList) {\n let totalPrice = 0;\n if(Array.isArray(foodList)) {\n for(let i = 0; i < foodList.length; i++) {\n totalPrice = totalPrice + (foodList[i].price * foodList[i].quantity);\n }\n return totalPrice;\n } else {\n return foodList;\n }\n}", "function total() {\n var total = 0\n for(var i = 0; i < cart.length; i++){\n total += cart[i].itemPrice\n }\n return total\n}", "function compute_subtotal(items) {\n\t$(\".wddp-shopping-cart\").text(\"Shopping cart total: $\" + Object.values(items).reduce((x, y) => (x + y), 0));\n}", "function getTotalForItem(inputItem,itemValue){\n const items = inputItem;\n const value = itemValue;\n const total = items * value;\n return total;\n}", "function total() {\n var totalValue = 0;\n for (var i = 0; i < cart.length; i++) {\n totalValue += cart[i].itemPrice\n }\n return totalValue;\n}", "function total() {\n for (var i = 0; i < cart.length; i++){\n \n getCart()[i].itemPrice\n return \n }\n}", "static getTotalPrice(data) {\n let totalPrice = 0\n data.forEach(product => {\n totalPrice += product.totalHarga\n })\n return totalPrice\n }", "calculateTotal() {\n\t\t//Réinitialise le total\n\t\tthis.total = 0\n\t\tfor (let product of this.products) {\n\t\t\tthis.total += product.price * product.number\n\t\t}\n\t}", "function getTotalPrice(chosen_products){\n let total_price = 0;\n for (let i=0; i<products.length;i+=1){\n if (chosen_products.indexOf(products[i].name+\" $\"+products[i].price)> -1){\n total_price += products[i].price;\n }\n }\n return total_price.toFixed(2);\n}", "totalItemPrice(item) {\n if(undefined === item.price || undefined === item.quantity){\n return 0;\n }\n return item.price * item.quantity;\n }", "total (itens) {\n prod1 = list[0].amount\n prod2 = list[1].amount\n prod3 = list[2].amount\n prod4 = list[3].amount\n\n itens = prod1 + prod2 + prod3 + prod4\n\n return itens\n }", "function getTotalPrice(cart) {\n\tvar sum = 0\n\tcart.forEach(p => {\n\t\tsum += p.price;\n\t})\n\treturn sum\n}", "function total() {\n let totalVal = 0;\n for (var i = 0; i < cartItems.length; i++) {\n totalVal += cartItems[i].price * cartItems[i].quantity\n }\n setCartTotal(totalVal)\n }", "function calcTotalPriceByCategory(products, category) {\n\t// YOUR CODE HERE\n}", "function totalProducts(sold,item,id){\n\titem.map(function(e){\n\t\tvar totalSold = Number(e.price) * Number(sold) + e.product_sales;\n\t\tconnection.query(\n\t\t\t\"update products set product_sales=? where item_id =?\",\n\t\t\t[totalSold,id],\n\t\t\tfunction(err){\n\t\t\t\tif(err){\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t});\n\t});\n}", "function totalPrice() {\n var sum = 0.0;\n for(let i = 0; i < cart.length; i++){\n if(cart.prodSalePrice != null){\n sum += (Number(cart[i].prodSalePrice) * Number(cart[i].prodQty));\n }else{\n sum += (Number(cart[i].prodPrice) * Number(cart[i].prodQty));\n }\n }\n return sum;\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 totalValue($arr) {\n var $totalProductValue = 0; // create variable to hold total value\n for (i=0;i<$arr.length;i++) { // loop through every item in the $products array\n $productObj = $arr[i]; // get each product object from the array\n $perItemCost = $productObj['unit_price']; // create variable for individual item cost and get each product object's unit_price value\n $perItemInventory = $productObj['inventory']; // create variable for individual item inventory and get each product object's inventory value\n $perItemValue = $perItemCost * $perItemInventory; // calculate total value of each item's inventory \n $totalProductValue += $perItemValue; // add indiv item's value to the totalProductValue variable\n }\n return $totalProductValue; // returns the total value after the loop is complete\n }", "function getTotalPrice(shoppingCart){\n return shoppingCart.reduce((sum, current) => sum + current.price * current.quantity, 0);\n}", "function totalValue(prods) {\n let inventoryValue = 0;\n for (i = 0; i < prods.length; i += 1 ) {\n inventoryValue += prods[i].inventory * prods[i].unit_price;\n }\n return inventoryValue;\n}", "function totale(price) {\n tot += price;\n }", "function calcTotalPrice() {\n let totalPricePrev = 0;\n cartItems.forEach((item) => {\n prices.forEach((price) => {\n if (price.beername === item.beer) {\n totalPricePrev += item.amount * price.price;\n }\n });\n });\n setTotalPrice(totalPricePrev);\n }", "function calcInventoryValue(items) {\n let totalValue = 0;\n for (const inventories of inventory) {\n totalValue += (inventories.product.price * inventories.quantity);\n }\n ;\n // console.log(totalValue);\n return totalValue;\n}", "function totalPriceIntoCart(panier) {\n let total = 0;\n\n for (let index = 0; index < panier.length; index++) {\n let articleQuantity = panier[index].quantity;\n let articlePrice = priceById[panier[index].id];\n\n total = total + articleQuantity * articlePrice;\n\n }\n\n return total;\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 totalSales(shirtQuantity, pantQuantity, shoeQuantity) {\n const cart = [\n { name: 'shirt', price: 100, quantity: shirtQuantity },\n { name: 'pant', price: 200, quantity: pantQuantity },\n { name: 'shoe', price: 500, quantity: shoeQuantity }\n ];\n let cartTotal = 0;\n for (const product of cart) {\n const productTotal = product.price * product.quantity;\n cartTotal = cartTotal + productTotal;\n }\n return cartTotal;\n}", "function getTotal() {\n\t\treturn cart.reduce((current, next) => {\n\t\t\treturn current + next.price * next.count;\n\t\t}, 0);\n\t}", "function getTotal(price, quantity){\n const total = price * quantity;\n return total;\n}", "function calcTotal(itemId, itemPrice, orderQty) {\n var total = orderQty * itemPrice;\n console.log(\"Total Cost is $\" + total.toFixed(2));\n}", "function getOrderTotal(products) {\n return products.reduce((total, product) => {\n total += product.price * product.orderProduct.quantity\n return total\n }, 0)\n}", "function calculateTotalCost(shoppingCart) {\n let total = 0;\n for (let product of shoppingCart) {\n total += product.price * product.count\n }\n\n return total\n}", "function getPriceByProduct(itemNode){\n var prices = itemNode.getElementsByClassName(\"value\")[0].innerHTML;\n var qty = itemNode.getElementsByClassName(\"quantity\")[0].value;\n var total = itemNode.getElementsByClassName(\"total-price\")[0];\n total.innerHTML = (prices * qty);\n}", "calculateTotal() {\n let products = this.state.invoiceItems;\n let total = 0;\n products.forEach((el) => {\n total += el.price * el.quantity\n });\n\n if (this.state.discount) {\n total *= (100 - this.state.discount) / 100;\n }\n\n this.setState({\n total: (total).toFixed(2)\n }, this.updateInvoiceAPI);\n }", "function totalPriceSingle() {\n // let value = $('#input_quantitys').val();\n for(let i = 0; i < cart.length; i++){\n return Number(cart[i].prodQty) * Number(cart[i].prodPrice);\n }\n }", "function calcTotalPriceByCategory(products, category) {\r\n\t// YOUR CODE HERE\r\n return products.filter(el => el.category === category).map(el => el.price).reduce((a, b) => a + b, 0)\r\n}", "getTotalWithTax() {\n \n // total individual items from getPriceWithTax\n let totWithTax = 0;\n this.items.forEach((net) => {\n totWithTax += net.getPriceWithTax();\n });\n return totWithTax;\n }", "function getTotal(cart) {\n return totalPrice = cart.reduce((total, currentItem) => total + (currentItem.quantity * currentItem.price), 0).toFixed(2);\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 totalPrice (arr) {\n var total = 0;\n arr.forEach(function (element) {\n return total += element.price; \n }) \n return total; \n}", "function priceCalculation() {\n\n const bestPrice = getValue('primary-price');\n const extraMemory = getValue('extra-memory');\n const extraStorage = getValue('extra-storage');\n const fastDelivery = getValue('extra-delivery');\n const priceTotal = bestPrice + extraStorage + fastDelivery + extraMemory;\n return priceTotal;\n}", "function sumShoppingBag(shoppingBag){\n //var shoppingBagJson = shoppingBag.shopping_bag;\n var sum = 0;\n for (var i = 0; i < shoppingBag.length; i++) {\n //TODO think if to change to sum only without calc\n sum += shoppingBag[i].quantity * shoppingBag[i].price;\n }\n return sum;\n}", "updateSum () {\n const totals = document.getElementsByClassName('product__price')\n let productsPrice = 0\n\n // Add all the total prices of the products\n for (const total of totals) {\n productsPrice += parseInt(total.textContent.replace('€', ''), 10)\n }\n\n // Updates the subtotal and total in the summary\n const productsTotal = app.getProductsCount()\n document.querySelector('.products__total').textContent = productsTotal + ' article' + (productsTotal > 1 ? 's' : '')\n document.querySelector('.subtotal__price').textContent = '€ ' + productsPrice\n document.querySelector('.total__price').textContent = '€ ' + productsPrice\n }", "function getCartTotalAmount(){\n var total = 0;\n for(var i =0; i < cart_items.length; i++){\n var item = getItemById(cart_items[i][0]);\n total += item[4] * cart_items[i][1];\n }\n return total;\n}", "function updateTotal(){\n\t\tvar sum = 0;\n\t\t$(\".cart_items>.item\").each(function(i,v){\n\t\t\tsum += $(v).data(\"price\") * $(v).find(\".cart_cloth_num\").text();\n\t\t});\n\t\t$(\".cart_total\").text(sum);\n\t}", "getTotalPrice () {\n return _.reduce(this.options.data, (total, option) => total + option.quantity * option.price, 0).toFixed(2);\n }", "function calculateTotal(arr){\n \n //Command won't work if no items are in list\n if (nameAndPrice.length == 0){\n println(\"Invalid Command\");\n } else {\n var taxed = [];\n var final = 0;\n \n for (var i = 0; i < arr.length; i++){\n if (arr.indexOf(arr[i]) % 2 == 0){\n //Excludes product names from final price\n } else if (arr.indexOf(arr[i]) % 2 != 0){\n var temp = arr[i]*1.1; //Finds the taxed price of the item and stores it in a temporary variable\n taxed.push(temp); //Stores that in a new array consisting of taxed prices\n } \n }\n \n for (var i = 0; i < taxed.length; i++){\n final += taxed[i]; //Adds every taxed price to a single integer (final price)\n }\n \n //Applies any available discount to the final price\n var discount = readInt('How much discount did you recieve on your final purchase? If none, enter zero. %')\n final *= ((100 - discount)*0.01);\n \n return final;\n }\n}", "function getTotal() {\n let total = 0;\n\n shoppingCart.forEach(product => {\n total += product.price * product.stock_quantity;\n });\n console.log(\"this is the total\", total);\n return total;\n }", "function calculatePrice(size, paper, frame, quantity){\n \n // add the items costs' up and multiply the result by the quantity then return it. \n let itemPrice = size + paper + frame;\n return itemPrice * quantity;\n }", "function getPrices(){\n\n\t\t//cost of shop items\n\t\tprice1=75.00; price2=116; price3=44; price4=5.25; price5=3.75; price6=12.75; price7=4.10;\n\n\t\t//ammount of items chosen\n\t\titem_1=0; item2=0; item3=0; item4=0; item5=0; item6=0; item6=0; item7=0;\n\n\t\t//sub-total for each item\n\t\tsubTot_1 = 0; subTot_2=0; subTot_3=0; subTot_4=0; subTot_5=0; subTot_6=0; subTot_7=0;\n\n\t\t//get number of items\n\t\titem_1 = document.getElementById(\"item_1\").value;\n\t\titem_2 = document.getElementById(\"item_2\").value;\n\t\titem_3 = document.getElementById(\"item_3\").value;\n\t\titem_4 = document.getElementById(\"item_4\").value;\n\t\titem_5 = document.getElementById(\"item_5\").value;\n\t\titem_6 = document.getElementById(\"item_6\").value;\n\t\titem_7 = document.getElementById(\"item_7\").value;\n\n\n\t\t//subtotal for item\n\t\tsubTot_1 = eval(item_1) * eval(price1);\n\t\tsubTot_1 = subTot_1.toFixed(2);\n\t\tdocument.getElementById(\"subTot_1\").value = subTot_1;\n\n\t\t//subtotal for item 2\n\t\tsubTot_2 = eval(item_2) * eval(price2);\n\t\tsubTot_2 = subTot_2.toFixed(2);\n\t\tdocument.getElementById(\"subTot_2\").value = subTot_2;\n\n\t\t//subtotal for item 3\n\t\tsubTot_3 = eval(item_3) * eval(price3);\n\t\tsubTot_3 = subTot_3.toFixed(2);\n\t\tdocument.getElementById(\"subTot_3\").value = subTot_3;\n\n\t\t//subtotal for item 4\n\t\tsubTot_4 = eval(item_4) * eval(price4);\n\t\tsubTot_4 = subTot_4.toFixed(2);\n\t\tdocument.getElementById(\"subTot_4\").value = subTot_4;\n\n\t\t//subtotal for item 5\n\t\tsubTot_5 = eval(item_5) * eval(price5);\n\t\tsubTot_5 = subTot_5.toFixed(2);\n\t\tdocument.getElementById(\"subTot_5\").value = subTot_5;\n\n\t\t//subtotal for item 6\n\t\tsubTot_6 = eval(item_6) * eval(price6);\n\t\tsubTot_6 = subTot_6.toFixed(2);\n\t\tdocument.getElementById(\"subTot_6\").value = subTot_6;\n\n\t\t//subtotal for item 7\n\t\tsubTot_7 = eval(item_7) * eval(price7);\n\t\tsubTot_7 = subTot_7.toFixed(2);\n\t\tdocument.getElementById(\"subTot_7\").value = subTot_7;\n\n\t\t//work out total for all items\n\t\tTotamt = eval(subTot_1)+eval(subTot_2)+eval(subTot_3)+eval(subTot_4)+eval(subTot_5)+eval(subTot_6)+eval(subTot_7);\n\t\tTotamt = Totamt.toFixed(2);\n\t\tdocument.getElementById(\"GrandTotal\").value = Totamt;\n\n}//end getPrices", "getOrderTotal() {\n\n return Object.values(this.lineItems).reduce(\n (total, {product, sku, quantity}) =>\n total + quantity * this.plans[0].amount,\n 0\n );\n }", "checkout(){\n\n let total = 0\n this.products.forEach(item =>{\n GRAPHQL.decrementQuantity(item.id)\n total += item.price\n })\n\n return total\n }", "function muestroTotalProductos() {\r\n var subTotalCompleto = 0;\r\n subTotalCompletoImporte = 0;\r\n if ($('.articuloDeLista').length > 0) {\r\n $('.articuloDeLista').each(function () {\r\n subTotalCompleto = parseFloat($(this).children('.productSubtotal').text());\r\n subTotalCompletoImporte += subTotalCompleto;\r\n document.getElementById(\"productCostText\").innerHTML = subTotalCompletoImporte;\r\n });\r\n }\r\n }", "function calTotal() {\n var ttotal = 0;\n var total = \"\"\n // totalDiv.innerHTML =total\n for (var x = 0; x < cart.length; x++) {\n var skuu = cart[x].sku;\n // console.log(skuu)\n var cat = cart[x].categoryId\n // console.log(cat)\n var pret;\n\n // console.log(pret)\n for (var j = 0; j < products[cat].length; j++) {\n // console.log(products[cat][j])\n if (products[cat][j].sku == skuu) {\n pret = products[cat][j].price;\n // console.log(pret)\n // console.log(pret)\n\n ttotal += pret * cart[x].qty\n //console.log(\"ttotal= \"+ttotal)\n }\n }\n }\n totalDiv.innerHTML = \"total = \" + ttotal + \" lei\";\n }", "function calculateTotalPrice (product) {\n let quantity = JSON.parse(localStorage.getItem(product._id));\n return quantity * product.price / 100;\n\n}", "function updateSubTotal() {\r\n\r\nlet subTotal = 0;\r\ncartItems.forEach(function(item){\r\n subTotal = subTotal + item.price;\r\n console.log(subTotal);\r\n});\r\n document.getElementById(\"val\").innerHTML = \"Total = N\" + subTotal.toFixed(2);\r\n}", "function updatePrice() {\n var sum = 0;\n for(var i = 0; i < $scope.currentItems.length; i++) {\n sum += $scope.currentItems[i].price;\n }\n\n $scope.totalCost = sum + (sum * taxRate);\n $scope.totalCost = Math.floor($scope.totalCost);\n console.log($scope.totalCost);\n }", "function calcularPrecioItem(item){\n return item.producto.precioProducto * item.cantidad;\n}", "function calculateTotal() {\n\n var price = 0;\n\n $('.order-list .product-price').each(function (index) {\n\n price += parseInt($(this).html());\n\n }); //end of product price\n\n //$('.total-price').html(price);\n $('.total-price').val(price);\n\n} //end of calculate total", "rawTotal() {\n return this._checkoutProducts\n .map((checkoutProduct) => checkoutProduct.count * checkoutProduct.price.value)\n .reduce((total, productPrice) => total + productPrice, 0);\n }", "get amount() {\n\t\t\treturn this.items\n\t\t\t\t.map(item => item.qty * item.price)\n\t\t\t\t.reduce((total, qty) => total += qty, 0);\n\t\t}", "function getTotal() {\n const { cart } = state;\n\n const res = cart.reduce((prev, product) => {\n return (prev + (product.price * product.count));\n }, 0);\n\n dispatch({\n type: 'TOTAL',\n payload: res\n });\n }", "function calcularTotal(){\n //borrar el precio \n total=0;\n //recorrer el array de la cesta y obtener el precio de cada producto\n for(let item of arrayCesta){\n let itemcesta=productos.filter(function(objetoproductos){\n return objetoproductos['tag']==item;\n });\n //se suma el total\n total=total+itemcesta[0]['precio'];\n }\n //mostrar el precio\n $total.textContent=total.toFixed(2);\n}", "function getTotalQuantity(items) {\n return _.reduce(items, function(memo, item) {\n return memo + item.quantity;\n }, 0);\n }", "function calcItemPrice(baseCost, quantity, frameCost, glassCost, mattID) {\n var cost = (baseCost + frameCost + glassCost) * quantity;\n if(mattID != 35) { cost += (10 * quantity);}\n return formatMoney(cost);\n }", "function getPriceEstimate(items) {\n\t\tvar sumPrices = 0;\n\t\t$(items).each(function(i) {\n\t\t\tsumPrices += parseFloat(items[i].sellingStatus.convertedCurrentPrice);\n\t\t});\n\t\treturn sumPrices/items.length; // Return average price\n\t}" ]
[ "0.7825455", "0.78026843", "0.7787457", "0.7775041", "0.77605176", "0.7616255", "0.7599534", "0.7494437", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74280393", "0.74079514", "0.7370472", "0.7370472", "0.7370472", "0.7370472", "0.7343978", "0.73438394", "0.7340361", "0.72692806", "0.724777", "0.7244927", "0.7242876", "0.72261316", "0.72252077", "0.7211995", "0.71572703", "0.7149481", "0.70934165", "0.7086884", "0.7084904", "0.7075416", "0.70683885", "0.7058922", "0.7053742", "0.7050546", "0.704885", "0.7038357", "0.69879687", "0.6961905", "0.69541013", "0.6927736", "0.6919815", "0.6916174", "0.69154924", "0.69146496", "0.69067335", "0.68840986", "0.68708587", "0.6867846", "0.6867167", "0.68518996", "0.6834535", "0.680135", "0.67820114", "0.67782", "0.676797", "0.67550665", "0.6725643", "0.6723351", "0.67120343", "0.6704655", "0.6702227", "0.6678052", "0.66764086", "0.66565835", "0.6643619", "0.66434723", "0.66349566", "0.6627634", "0.66168326", "0.6615497", "0.6605419", "0.6597779", "0.65798336", "0.6571032", "0.6563609", "0.65620947", "0.6560466", "0.6559716", "0.65410125", "0.6538047", "0.6533705", "0.65233386", "0.65181947", "0.65173113", "0.6511352", "0.64905465", "0.6479217", "0.6476551", "0.6473324", "0.64637744", "0.6457817" ]
0.7339509
26
git foreachref format="%(if)%(upstream)%(then)%(refname:short)=====%(upstream:short)%(else)%(refname:short)%(end)" refs/heads Output: brancha conflictbranch=====origin/conflictbranch master=====origin/master orangebranch1=====origin/orangebranch1 origin/testbranch3=====origin/origin/testbranch3 test1=====origin/test1 test2=====origin/test2 test3 test7 testbranch2=====origin/testbranch2
function getLocalAndRemoteBranches(repo) { const child = spawnGitProcess(repo, ['for-each-ref', '--format="%(refname:short)===XXX===%(if)%(upstream)%(then)%(upstream:short)%(end)===XXX===%(if)%(HEAD)%(then)HEAD%(end)"', 'refs/heads']); return redirectIO(child, null, null).then(function (res) { if (!res.errorCode) { let localAndRemoteBranches = res.output.join('\n').trim().split('\n'); let allBranches = []; localAndRemoteBranches.forEach((b) => { b = b.substring(1, b.length - 1); // because they are enclosed in double quotes // console.log(b); let branchSplit = b.split(/===XXX===/g); let branchInfo = {}; if(branchSplit[0]) { branchInfo.local = branchSplit[0]; } if(branchSplit[1]) { branchInfo.remote = branchSplit[1]; } if(branchSplit[2]) { branchInfo.isCurrent = true; } allBranches.push(branchInfo); }); return allBranches; } // TODO: handle error here. }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function print_with_commit(base_body){\r\n var msg = \"Issue co maju commit: \";\r\n for(var i in base_body) {\r\n if (base_body[i].pull_request != undefined) {\r\n msg += \" \" + i;\r\n }\r\n }\r\n console.log(msg);\r\n}", "function talk_to_git (refs) {\n process.stdin.setEncoding('utf8')\n var didFetch = false\n process.stdin.on('readable', function () {\n var chunk = process.stdin.read()\n if (chunk === 'capabilities\\n') {\n process.stdout.write('fetch\\n\\n')\n } else if (chunk === 'list\\n') {\n Object.keys(refs).forEach(function (branch, i) {\n process.stdout.write(refs[branch] + ' ' + branch + '\\n')\n })\n process.stdout.write('\\n')\n } else if (chunk && chunk.search(/^fetch/) !== -1) {\n didFetch = true\n chunk.split(/\\n/).forEach(function (line) {\n if (line === '') {\n return\n }\n // Format: \"fetch sha branch\"\n line = line.split(/\\s/)\n get_infohash(line[1], line[2])\n })\n } else if (chunk && chunk !== '' && chunk !== '\\n') {\n console.warn('unhandled command: \"' + chunk + '\"')\n }\n if (chunk === '\\n') {\n process.stdout.write('\\n')\n if (!didFetch) {\n // If git already has all the refs it needs, we should exit now.\n process.exit()\n }\n return\n }\n })\n process.stdout.on('error', function () {\n // stdout was closed\n })\n}", "function doGitCommand (commit, targetBranch) {\n childProcess.exec('git branch -r --contains ' + commit.sha, function (error, stdout, stderr) {\n if (error) {\n if (stderr.indexOf('malformed')) {\n if (commit.isAlias) {\n console.log(chalk.bold.red('The commit ' + chalk.bold.magenta(commit.alias) + ' (' + chalk.bold.cyan(commit.sha) + ') was not found in this repository.'));\n } else {\n console.log(chalk.bold.red('The commit (' + chalk.bold.cyan(commit.sha) + ') was not found in this repository.'));\n }\n }\n } else {\n var branches = stdout.split('\\n');\n\n if (commit.isAlias) {\n console.log('Branches that contain commit ' + chalk.magenta.bold(commit.alias) + ' (' + chalk.cyan.bold(commit.sha) + '):');\n } else {\n console.log('Branches that contain the commit (' + chalk.cyan.bold(commit.sha) + '):');\n }\n\n branches.forEach(branch => {\n if (branch !== '') {\n \n if (!targetBranch) {\n console.log(' * ' + chalk.green.bold(branch.trim()));\n } else if (branch.trim().indexOf(targetBranch) > -1) {\n console.log(' * ' + chalk.green.bold(branch.trim())); \n }\n }\n });\n }\n });\n}", "function processBranch(refs,parentPath,branch) {\n Object.keys(branch).forEach(function (key) {\n let element = branch[key]\n let typ = typeof(element)\n\n switch (typ) {\n case \"object\" :\n if (Array.isArray(element)){\n if (debug) {console.log(parentPath, key,'array',element.length)}\n element.forEach(function (child) {\n let path = parentPath + \".\" + key\n //console.log('child',path,child,)\n //if the content of the array element is a string, then forEach will iterate over each character\n if (typeof(child) == 'string') {\n if (debug) {console.log('---leaf:',path,child)}\n if (hashResources[child]) {\n //the assumption is that this is a canonical reference...\n let item={source:resource, path:path,url:child,target : hashResources[child]}\n refs.push(item)\n }\n } else {\n processBranch(refs,path,child)\n }\n })\n } else {\n if (debug) {console.log(parentPath, key,'object')}\n let path = parentPath + \".\" + key\n processBranch(refs,path,element)\n }\n break\n case \"string\" :\n //want the value...\n let path = parentPath + '.' + key\n if (hashResources[element]) {\n //the assumption is that this is a canonical reference...\n let item={source:resource, path:path,url:element,target : hashResources[element]}\n refs.push(item)\n }\n\n let display = element.substr(0,80)\n if (debug) {console.log('---leaf:',path,display)}\n //console.log(key,element)\n break\n default :\n if (debug) {console.log('===========>',key,typ)}\n\n }\n //console.log(key, typeof(element) )\n })\n\n }", "async function getRef() {\n // Will be in the form \"refs/heads/master\" on a push event\n // or in the form \"refs/pull/N/merge\" on a pull_request event\n const ref = getRequiredEnvParam(\"GITHUB_REF\");\n // For pull request refs we want to detect whether the workflow\n // has run `git checkout HEAD^2` to analyze the 'head' ref rather\n // than the 'merge' ref. If so, we want to convert the ref that\n // we report back.\n const pull_ref_regex = /refs\\/pull\\/(\\d+)\\/merge/;\n const checkoutSha = await exports.getCommitOid();\n if (pull_ref_regex.test(ref) &&\n checkoutSha !== getRequiredEnvParam(\"GITHUB_SHA\")) {\n return ref.replace(pull_ref_regex, \"refs/pull/$1/head\");\n }\n else {\n return ref;\n }\n}", "printDebugString() {\n for (let i = 0; i < this.branches.length; i++) {\n if (this.branches[i] != null) {\n this.branches[i].printDebugString();\n }\n else {\n console.log(\"branch \" + i + \" hasn't been created yet.\");\n }\n }\n }", "checkoutUpstreamBranch(branchName) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n this.git.run(['fetch', '-q', this.git.repoGitUrl, branchName]);\n this.git.run(['checkout', 'FETCH_HEAD', '--detach']);\n });\n }", "async function doGitStuff(branch) {\n await git()\n .push('origin', branch)\n .checkout('master', (err) => console.error(err))\n .mergeFromTo(branch, 'master', (err) => console.error(err))\n .push('origin', 'master')\n}", "function printCompareCommits(repo_name, commit1, commit2) {\n var compare_commit_info = compareCommitsComplete(repo_name, commit1, commit2);\n \n //ERROR HANDLING\n if (compare_commit_info == null) {\n showError(\"Bad request: the commit reference number or branches names are not correct or in the incorrect order.\");\n return;\n }\n \n if (compare_commit_info == null) return;\n var files = compare_commit_info.files;\n \n var body = DocumentApp.getActiveDocument().getBody();\n \n // Use editAsText to obtain a single text element containing\n // all the characters in the document.\n var text = body.editAsText();\n \n for (var i = 0; i < files.length; i++) {\n \n text.appendText(\"\\nCommit patch: \\n\"+ files[i].patch);\n text.appendText(\"\\nFilename:\"+ JSON.stringify(files[i].filename));\n text.appendText(\"\\nStatus:\"+ JSON.stringify(files[i].status));\n text.appendText(\"\\nAdditions:\"+ JSON.stringify(files[i].additions));\n text.appendText(\"\\nDeletions:\"+ JSON.stringify(files[i].deletions));\n text.appendText(\"\\nChanges:\"+ JSON.stringify(files[i].changes));\n text.appendText(\"\\nURL:\"+ JSON.stringify(files[i].raw_url));\n text.appendText(\"\\n--------------------------------------------------------------\");\n \n }\n}", "function gitBranchName() {\n return utils.run('git rev-parse --abbrev-ref HEAD', {silent: true});\n}", "function getListCommitsInBranchUrl(_a, branchName) {\n var remoteParams = _a.remoteParams;\n return \"https://github.com/\" + remoteParams.owner + \"/\" + remoteParams.repo + \"/commits/\" + branchName;\n}", "getShaForBranchLatest(branch) {\n const { owner, name } = this.git.remoteConfig;\n /** The result fo the fetch command. */\n const fetchResult = this.git.runGraceful(['fetch', '-q', `https://github.com/${owner}/${name}.git`, branch]);\n if (fetchResult.status !== 0 &&\n fetchResult.stderr.includes(`couldn't find remote ref ${branch}`)) {\n debug(`No '${branch}' branch exists on upstream, skipping.`);\n return null;\n }\n return this.git.runGraceful(['rev-parse', 'FETCH_HEAD']).stdout.trim();\n }", "function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) return cb(null, currentTree.sha);\n that.getRef(\"heads/\"+branch, function(err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }", "function branchText(){\n var branch = '';\n if(vm.clientmanagement.airForce){\n branch += 'Air Force, ';\n }\n if(vm.clientmanagement.army){\n branch += 'Army, ';\n }\n if(vm.clientmanagement.coastGuard){\n branch += 'Coast Guard, ';\n }\n if(vm.clientmanagement.marines){\n branch += 'Marines, ';\n }\n if(vm.clientmanagement.nationalGuard){\n branch += 'National Guard, ';\n }\n if(vm.clientmanagement.navy){\n branch += 'Navy, ';\n }\n if(branch){\n branch = branch.substring(0, branch.length-2);\n }\n return branch;\n }", "function branchHyperlink(ix){\n var br = tx.rowinfo[ix].br\n var dest = tx.baseUrl + \"/timeline?r=\" + encodeURIComponent(br)\n dest += tx.fileDiff ? \"&m&cf=\" : \"&m&c=\"\n dest += encodeURIComponent(tx.rowinfo[ix].h)\n return dest\n }", "function getRef (branch, repo) {\n\tvar b = branch || 'master';\n\tvar r = repo || repoFullname;\n\tvar options = {\n\t\theaders: {'Accept': 'application/vnd.github.v3+json'},\n\t\tcache: 'no-cache'\n\t};\n\tif (logged) options.headers.Authorization = 'token ' + localStorage.getItem('naledi|token');\n\treturn fetch([apiRepos, r, 'git/refs/heads', b].join('/'), options)\n\t\t.then(dataHandler)\n\t\t.then(function (head) {\n\t\t\t// get ref\n\t\t\treturn head.object.sha;\n\t\t})\n\t\t.catch(function () {\n\t\t\t// fallback ref\n\t\t\treturn b;\n\t\t})\n\t\t.then(function (ref) {\n\t\t\t// store ref\n\t\t\t// example {starsystem/naledi/master: \"0ba93cd72ba2017f923bceb3c3a685deedbf5629\"}\n\t\t\tbranchRef[[r, b].join('/')] = ref;\n\t\t\treturn ref;\n\t\t})\n\t\t.catch(errore);\n}", "function listBranches(owner,repo)\r\n{\r\n\tvar options = {\r\n\t\turl: urlRoot + '/repos/' + owner + \"/\" + repo +\"/branches\",\r\n\t\tmethod: 'GET',\r\n\t\theaders: {\r\n\t\t\t\"User-Agent\": \"EnableIssues\",\r\n\t\t\t\"content-type\": \"application/json\",\r\n\t\t\t\"Authorization\": token\r\n\t\t}\r\n\t};\r\n\r\n\t// Send a http request to url and specify a callback that will be called upon its return.\r\n\trequest(options, function (error, response, body) \r\n\t{\r\n\t\tvar obj = JSON.parse(body);\r\n\t\tfor( var i = 0; i < obj.length; i++ )\r\n\t\t{\r\n\t\t\tvar name = obj[i].name;\r\n\t\t\tconsole.log( name );\r\n\t\t}\r\n\t});\r\n}", "function getCurrentBranch() {\n return exec$1(`git symbolic-ref --short HEAD`);\n}", "async function merge ({\n dir,\n gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),\n fs: _fs,\n ours,\n theirs,\n fastForwardOnly\n}) {\n const fs = new FileSystem(_fs);\n let ourOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: ours\n });\n let theirOid = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: theirs\n });\n // find most recent common ancestor of ref a and ref b\n let baseOid = await findMergeBase({ gitdir, fs, refs: [ourOid, theirOid] });\n // handle fast-forward case\n if (baseOid === theirOid) {\n console.log(`'${theirs}' is already merged into '${ours}'`);\n return {\n oid: ourOid,\n alreadyMerged: true\n }\n }\n if (baseOid === ourOid) {\n console.log(`Performing a fast-forward merge...`);\n await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid });\n return {\n oid: theirOid,\n fastForward: true\n }\n } else {\n // not a simple fast-forward\n if (fastForwardOnly) {\n throw new Error('A simple fast-forward merge was not possible.')\n }\n throw new Error('Non-fast-forward merges are not supported yet.')\n }\n}", "function getBranchInfo(folderName){\n return new Promise(\nfunction(resolve, reject){\n\n let command = 'cd ' + folderName + ' && git branch ';\n let currentBranch = '';\n let branchList = [];\n\n exec(command, function (error, stdout, stderr) {\n if (error !== null) {\n reject(stderr);\n }\n // stdout = stdout.split(os.EOL);\n stdout = stdout.split(\"\\n\");\n\n for(let idx in stdout){\n let line = stdout[idx].trim();\n if(!line) continue;\n if(line.substr(0, 1).toString() == '*'){\n line = line.substr(2);\n currentBranch = line;\n }\n branchList.push(line);\n }\n\n resolve({currentBranch : currentBranch, branchList : branchList});\n });\n\n});\n}", "repositoriesWorkspaceRepoSlugRefsGet(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = defaultClient.authentications['api_key'];\n api_key.apiKey = incomingOptions.apiKey;\n // Uncomment the following line to set a prefix for the API key, e.g. \"Token\" (defaults to null)\n api_key.apiKeyPrefix = incomingOptions.apiKeyPrefix || 'Token';\n // Configure HTTP basic authorization: basic\n let basic = defaultClient.authentications['basic'];\n basic.username = 'YOUR USERNAME';\n basic.password = 'YOUR PASSWORD';\n // Configure OAuth2 access token for authorization: oauth2\n let oauth2 = defaultClient.authentications['oauth2'];\n oauth2.accessToken = incomingOptions.accessToken;\n\n let apiInstance = new Bitbucket.RefsApi(); // String | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`. // String | This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. // String | This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.\n /*let workspace = \"workspace_example\";*/ /*let username = \"username_example\";*/ /*let repoSlug = \"repoSlug_example\";*/ let opts = {\n // 'q': \"q_example\", // String | Query string to narrow down the response as per [filtering and sorting](../../../../meta/filtering).\n // 'sort': \"sort_example\" // String | Field by which the results should be sorted as per [filtering and sorting](../../../../meta/filtering). The `name` field is handled specially for refs in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['1.1', '1.2', '1.10'] instead of ['1.1', '1.10', '1.2'].\n };\n\n if (incomingOptions.opts)\n Object.keys(incomingOptions.opts).forEach(\n (key) =>\n incomingOptions.opts[key] === undefined &&\n delete incomingOptions.opts[key]\n );\n else delete incomingOptions.opts;\n incomingOptions.opts = Object.assign(opts, incomingOptions.opts);\n\n apiInstance.repositoriesWorkspaceRepoSlugRefsGet(\n incomingOptions.workspace,\n incomingOptions.username,\n incomingOptions.repoSlug,\n incomingOptions.opts,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, data, response);\n }\n }\n );\n }", "function printCommit(repo_name, commit_ref){\n var commit_info = getCommit(repo_name, commit_ref);\n \n if (commit_info == null) {\n showError(\"Could not retrieve commit, check your branch name or commit ref.\");\n return;\n }\n var body = DocumentApp.getActiveDocument().getBody();\n \n body.appendParagraph(\"COMMIT REF: \" + commit_ref);\n body.appendParagraph(\"Commit author:\"+ JSON.stringify(commit_info.commit.author.name));\n body.appendParagraph(\"Author email:\"+ JSON.stringify(commit_info.commit.author.email));\n body.appendParagraph(\"Commit date:\"+ JSON.stringify(commit_info.commit.author.date));\n body.appendParagraph(\"Commit message:\"+ JSON.stringify(commit_info.commit.message));\n body.appendParagraph(\"URL:\"+ JSON.stringify(commit_info.url));\n body.appendParagraph(\"----------------\");\n}", "function getNumberOfCommitsOnBranch(branch) {\r\n const refArgument = `$(git for-each-ref '--format=%(refname)' refs/ | grep /${branch} | head -1)`\r\n const notArgument = `$(git for-each-ref '--format=%(refname)' refs/ | grep -v /${branch})`\r\n const gitCommand = `git log ${refArgument} --oneline --not ${notArgument} | wc -l`\r\n const result = exec(\r\n `C:/cygwin/bin/bash -lc \"cd $APPVEYOR_BUILD_FOLDER && ${gitCommand}\"`\r\n ).toString()\r\n console.log(result);\r\n return _.toNumber(result)\r\n}", "async function pull ({\n dir,\n gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),\n fs: _fs,\n ref,\n fastForwardOnly = false,\n emitter,\n authUsername,\n authPassword,\n singleBranch\n}) {\n const fs = new FileSystem(_fs);\n // If ref is undefined, use 'HEAD'\n if (!ref) {\n ref = await GitRefManager.resolve({\n fs,\n gitdir,\n ref: 'HEAD',\n depth: 1\n });\n }\n console.log(`Using ref=${ref}`);\n // Fetch from the correct remote.\n let remote = await config({\n gitdir,\n fs,\n path: `branch.${ref}.remote`\n });\n let { fetchHead } = await fetch({\n dir,\n gitdir,\n fs,\n emitter,\n ref,\n remote,\n authUsername,\n authPassword,\n singleBranch\n });\n // Merge the remote tracking branch into the local one.\n await merge({\n gitdir,\n fs,\n ours: ref,\n theirs: fetchHead,\n fastForwardOnly\n });\n await checkout({\n dir,\n gitdir,\n fs,\n ref\n });\n}", "pullRequestUrl(info) {\n let url = this.url(info);\n let targetBranch = info.targetBranch || info.base;\n return `${url}/compare/${targetBranch}...${info.currBranch}`;\n }", "function checkGitStatus( next ) {\n\tchild.execFile( \"git\", [ \"status\" ], function( error, stdout ) {\n\t\tvar onBranch = ( ( stdout || \"\" ).match( /On branch (\\S+)/ ) || [] )[ 1 ];\n\t\tif ( onBranch !== branch ) {\n\t\t\tdie( \"Branches don't match: Wanted \" + branch + \", got \" + onBranch );\n\t\t}\n\t\tif ( /Changes to be committed/i.test( stdout ) ) {\n\t\t\tdie( \"Please commit changed files before attemping to push a release.\" );\n\t\t}\n\t\tif ( /Changes not staged for commit/i.test( stdout ) ) {\n\t\t\tdie( \"Please stash files before attempting to push a release.\" );\n\t\t}\n\t\tnext();\n\t} );\n}", "async function log$1 ({\n dir,\n gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),\n fs: _fs,\n ref = 'HEAD',\n depth,\n since, // Date\n signing = false\n}) {\n const fs = new FileSystem(_fs);\n let sinceTimestamp =\n since === undefined ? undefined : Math.floor(since.valueOf() / 1000);\n // TODO: In the future, we may want to have an API where we return a\n // async iterator that emits commits.\n let commits = [];\n let start = await GitRefManager.resolve({ fs, gitdir, ref });\n let { type, object } = await GitObjectManager.read({ fs, gitdir, oid: start });\n if (type !== 'commit') {\n throw new Error(\n `The given ref ${ref} did not resolve to a commit but to a ${type}`\n )\n }\n let commit = GitCommit.from(object);\n let currentCommit = Object.assign({ oid: start }, commit.parse());\n if (signing) {\n currentCommit.payload = commit.withoutSignature();\n }\n commits.push(currentCommit);\n while (true) {\n if (depth !== undefined && commits.length === depth) break\n if (currentCommit.parent.length === 0) break\n let oid = currentCommit.parent[0];\n let gitobject;\n try {\n gitobject = await GitObjectManager.read({ fs, gitdir, oid });\n } catch (err) {\n commits.push({\n oid,\n error: err\n });\n break\n }\n let { type, object } = gitobject;\n if (type !== 'commit') {\n commits.push({\n oid,\n error: new Error(`Invalid commit parent ${oid} is of type ${type}`)\n });\n break\n }\n commit = GitCommit.from(object);\n currentCommit = Object.assign({ oid }, commit.parse());\n if (signing) {\n currentCommit.payload = commit.withoutSignature();\n }\n if (\n sinceTimestamp !== undefined &&\n currentCommit.author.timestamp <= sinceTimestamp\n ) {\n break\n }\n commits.push(currentCommit);\n }\n return commits\n}", "encode_ref(ref) {\n if (ref.index < 0) {\n // Special handles are stored with negative reference numbers.\n this.write_tag(7, -ref.index);\n } else {\n // Output reference to previous object.\n this.write_tag(0, ref.index);\n }\n }", "async function doFetchBranches() {\n const args = ['fetch', '-pq'];\n\n await execGit(args);\n}", "function dumpGitInfo(gitInfo) {\n var repo = gitInfo.repository.name;\n console.log(\"activity in repo '\"+repo+\"'\");\n\n for (var i = 0; i < gitInfo.commits.length; i++) {\n console.log(\"commit by: \"+gitInfo.commits[i].author.name);\n console.log(\"--> msg: \"+gitInfo.commits[i].message);\n console.log(\"--> id : \"+gitInfo.commits[i].id);\n }\n\n storeInMongo(gitInfo);\n}", "function convertReferenceChainToString(chain) {\n return chain.join(' → ');\n}", "branch(props) {\n const { required, scrollIntoView } = this.props\n\n return (\n <Branch\n name={props.name}\n label={props.label}\n labelSize={props.labelSize}\n className={props.className}\n help={props.help}\n {...props.value || {}}\n warning={props.warning}\n onUpdate={props.onUpdate}\n required={required}\n onError={props.onError}\n scrollIntoView={scrollIntoView}\n >\n {props.children}\n </Branch>\n )\n }", "function updateBranches(baseBranch, featureBranch) {\n if (ADD_VERBOSE_LOGGING) {\n console.log(\n `\\n\\nStep 1: Switch branch to ${baseBranch} and update ${baseBranch} and ${featureBranch}`\n );\n }\n checkErrorCode(\n shell.exec(`git checkout ${baseBranch}`).code,\n `\\n\\nAn error occurred switching your current branch to ${baseBranch}. Exitting.`\n );\n checkErrorCode(\n shell.exec(`git pull`).code,\n `\\n\\nAn error occurred updating your base branch ${baseBranch}. Exitting.`\n );\n checkErrorCode(\n shell.exec(`git fetch . origin/${featureBranch}:${featureBranch}`).code,\n \"\\n\\nAn error occurred updating your feature branch. Exitting.\"\n );\n}", "async updateTrackerGitInfo(branch, branchData, remote) {\n // Get the repository data for the project.\n let repositoryUrl = DevConfig.get(branchData.project + '.repositoryUrl');\n let diffUrlTemplate = DevConfig.get(branchData.project + '.diffUrlTemplate', '');\n\n if (!repositoryUrl) {\n // Calculate the repositoryUrl based on the remote URL.\n repositoryUrl = await Git.getRemoteUrl(remote);\n }\n\n // Make sure the repository URL uses the regular format.\n repositoryUrl = repositoryUrl.replace(/^(git@|git:\\/\\/)/, 'https://')\n .replace(/\\.git$/, '')\n .replace('github.com:', 'github.com/');\n\n if (!diffUrlTemplate) {\n diffUrlTemplate = Utils.concatenatePaths([repositoryUrl, 'compare/%headcommit%...%branch%']);\n }\n\n // Now create the git URL for the repository.\n const repositoryGitUrl = repositoryUrl.replace(/^https?:\\/\\//, 'git://') + '.git';\n\n // Search HEAD commit to put in the diff URL.\n console.log ('Searching for head commit...');\n let headCommit = await Git.getHeadCommit(branch, branchData);\n\n if (!headCommit) {\n throw new Error('Head commit not resolved, aborting update of tracker fields');\n }\n\n headCommit = headCommit.substr(0, 10);\n console.log(`Head commit resolved to ${headCommit}`);\n\n // Calculate last properties needed.\n const diffUrl = diffUrlTemplate.replace('%branch%', branch).replace('%headcommit%', headCommit);\n const fieldRepositoryUrl = DevConfig.get('tracker.fieldnames.repositoryurl', 'Pull from Repository');\n const fieldBranch = DevConfig.get('tracker.fieldnames.branch', 'Pull Master Branch');\n const fieldDiffUrl = DevConfig.get('tracker.fieldnames.diffurl', 'Pull Master Diff URL');\n\n // Update tracker fields.\n const updates = {};\n updates[fieldRepositoryUrl] = repositoryGitUrl;\n updates[fieldBranch] = branch;\n updates[fieldDiffUrl] = diffUrl;\n\n console.log('Setting tracker fields...');\n await Jira.setCustomFields(branchData.issue, updates);\n }", "displayRepo(value) {\n for (let i = 0; i < value.length; i++) {\n var repo = `<li>\n <span><a href= \"${value[i].html_url}\" target=\"_blank\">${value[i].name}</a></span>\n <span>Fork:${value[i].fork}</span>\n <span>Watchers:${value[i].watchers_count}</span>\n <span>Stars:${value[i].stargazers_count}</span>\n \n </li>`;\n userRepo.innerHTML += repo;\n }\n }", "function getProjectInfo(folderName){\n return new Promise(\nfunction(resolve, reject){\n\n let command = 'cd ' + folderName + ' && git remote -v ';\n let currentBranch = '';\n let branchList = [];\n\n exec(command, function (error, stdout, stderr) {\n if (error !== null) {\n reject(stderr);\n }\n let patt = /\\/[a-zA-Z0-9-.]{1,30}(?= \\(fetch\\))/;\n let regres = patt.exec(stdout);\n let projectName = regres.toString().substr(1);\n // console.log(\"\\r\\n\"+moment().format('Y/MM/DD HH:mm:ss\\t\\t\\t\\t')+__filename);console.log('\\tINFO:\\tprojectName = '+projectName );\n resolve({projectName : projectName});\n\n });\n});\n}", "function getCurrentBranch() {\n return new Promise( ( resolve, reject ) => {\n exec( 'git branch | grep \"*\"', {}, ( err, stdout, stderr ) => {\n let branchName = '';\n\n if ( err ) {\n reject( branchName );\n }\n\n // Sanitize/format `branchName`.\n branchName = ( stdout + '' ).substring( stdout.lastIndexOf( ' ' ) + 1 );\n branchName = branchName.replace( /(\\n|\\r)/gmi, '' );\n\n resolve( branchName );\n } );\n } )\n}", "_findAvailableBranchName(repo, baseName) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n let currentName = baseName;\n let suffixNum = 0;\n while (yield this._isBranchNameReservedInRepo(repo, currentName)) {\n suffixNum++;\n currentName = `${baseName}_${suffixNum}`;\n }\n return currentName;\n });\n }", "repositoriesWorkspaceRepoSlugRefsTagsGet(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = defaultClient.authentications['api_key'];\n api_key.apiKey = incomingOptions.apiKey;\n // Uncomment the following line to set a prefix for the API key, e.g. \"Token\" (defaults to null)\n api_key.apiKeyPrefix = incomingOptions.apiKeyPrefix || 'Token';\n // Configure HTTP basic authorization: basic\n let basic = defaultClient.authentications['basic'];\n basic.username = 'YOUR USERNAME';\n basic.password = 'YOUR PASSWORD';\n // Configure OAuth2 access token for authorization: oauth2\n let oauth2 = defaultClient.authentications['oauth2'];\n oauth2.accessToken = incomingOptions.accessToken;\n\n let apiInstance = new Bitbucket.RefsApi(); // String | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`. // String | This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. // String | This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.\n /*let workspace = \"workspace_example\";*/ /*let username = \"username_example\";*/ /*let repoSlug = \"repoSlug_example\";*/ let opts = {\n // 'q': \"q_example\", // String | Query string to narrow down the response as per [filtering and sorting](../../../../../meta/filtering).\n // 'sort': \"sort_example\" // String | Field by which the results should be sorted as per [filtering and sorting](../../../../../meta/filtering). The `name` field is handled specially for tags in that, if specified as the sort field, it uses a natural sort order instead of the default lexicographical sort order. For example, it will return ['1.1', '1.2', '1.10'] instead of ['1.1', '1.10', '1.2'].\n };\n\n if (incomingOptions.opts)\n Object.keys(incomingOptions.opts).forEach(\n (key) =>\n incomingOptions.opts[key] === undefined &&\n delete incomingOptions.opts[key]\n );\n else delete incomingOptions.opts;\n incomingOptions.opts = Object.assign(opts, incomingOptions.opts);\n\n apiInstance.repositoriesWorkspaceRepoSlugRefsTagsGet(\n incomingOptions.workspace,\n incomingOptions.username,\n incomingOptions.repoSlug,\n incomingOptions.opts,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, data, response);\n }\n }\n );\n }", "commitToLink(commit) {\n const url = `https://github.com/${this.data.github.owner}/${this.data.github.name}/commit/${commit.hash}`;\n return `[${commit.shortHash}](${url})`;\n }", "async branch({ branchName, commitHash }) {\r\n if (!branchName || !commitHash) return;\r\n\r\n await spawnGit([\"branch\", branchName, commitHash]);\r\n }", "function setUpstreamBranch(remoteName, remoteBranch) {\n if (!remoteName) { throw new TypeError(\"remoteName argument is missing!\"); }\n if (!remoteBranch) { throw new TypeError(\"remoteBranch argument is missing!\"); }\n return svn([\"branch\", \"--no-color\", \"-u\", remoteName + \"/\" + remoteBranch]);\n }", "function getCommitMessageForExceptionalNextVersionBump(newVersion) {\n return `release: bump the next branch to v${newVersion}`;\n}", "_getCommitOfBranch(branchName) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n const { data: { commit } } = yield this.git.github.repos.getBranch(Object.assign(Object.assign({}, this.git.remoteParams), { branch: branchName }));\n return commit.sha;\n });\n }", "static async writeRef ({ fs: _fs, gitdir, ref, value }) {\n const fs = new FileSystem(_fs);\n // Validate input\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new Error(`Unexpected ref contents: '${value}'`)\n }\n const normalizeValue = value => value.trim() + '\\n';\n await fs.write(path__WEBPACK_IMPORTED_MODULE_0___default.a.join(gitdir, ref), normalizeValue(value), 'utf8');\n }", "function formatClues(clues) {\n\t\t\t\tvar retString = \"\";\n\t\t\t\tfor (var i = 0; i < clues.length; i++) {\n\t\t\t\t\tif (clues[i] !== \"\") {\n\t\t\t\t\t\tretString += \"> \" + clues[i] + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn retString;\n\t\t\t}", "getGitChannelBranches(variables) {\n return client.query({ query: Query.gitChannelBranches, variables })\n }", "createBranch(user, repo, branch, sha, accessToken) {\n const path = API_URL_TEMPLATES.CREATE_REF\n .replace('${owner}', user)\n .replace('${repo}', repo)\n const payload = {\n ref: `refs/heads/${branch}`,\n sha\n }\n\n return this.fetchPath('POST', path, payload, accessToken)\n }", "async function resolveRef ({\n dir,\n gitdir = path__WEBPACK_IMPORTED_MODULE_0___default.a.join(dir, '.git'),\n fs: _fs,\n ref,\n depth\n}) {\n const fs = new FileSystem(_fs);\n return GitRefManager.resolve({\n fs,\n gitdir,\n ref,\n depth\n })\n}", "function convertTagToUrl(parsedTag, repo) {\n const description = parsedTag.description ? ` - ${parsedTag.description}` : '';\n return `[${parsedTag.prefix}${parsedTag.stepNumber}${description}](${STACKBLITZ_URL}/${repo}/tree/${parsedTag.tag})\n`;\n}", "function processRef(group, info) {\n if (!info.href || !info.title) {\n return;\n }\n\n function entryFromGitHubIO(url) {\n console.assert(url.hostname.endsWith('.github.io'));\n\n const id = url.pathname.split('/')[1];\n\n return {\n id: id,\n name: info.title\n .replace(/ Level \\d+$/, '')\n .replace(/ Module$/, '')\n .replace(/ \\d+(\\.\\d+)?$/, '')\n .replace(/ Specification$/, '')\n .replace(/ -$/, ''),\n href: url.href,\n specrepo: `${url.hostname.split('.')[0]}/${id}`,\n };\n }\n\n function entryFromDraftsOrg(url) {\n console.assert(url.hostname == 'drafts.css-houdini.org' ||\n url.hostname == 'drafts.csswg.org' ||\n url.hostname == 'drafts.fxtf.org');\n\n const org = url.hostname.split('.')[1];\n const match = /^\\/(.*)\\/$/.exec(url.pathname);\n let id = match[1];\n console.assert(!id.includes('/'));\n // no versions thanks\n if (id.startsWith('css3')) {\n if (id == 'css3-background') {\n id = 'css-backgrounds'; // plural\n } else {\n id = id.replace('css3', 'css');\n }\n } else {\n id = id.replace(/-\\d$/, '');\n }\n url.pathname = `/${id}/`;\n\n const testpolicy = {\n 'drafts.css-houdini.org': 'https://github.com/w3c/css-houdini-drafts#tests',\n 'drafts.csswg.org': 'https://github.com/w3c/csswg-drafts/blob/HEAD/CONTRIBUTING.md',\n 'drafts.fxtf.org': 'https://github.com/w3c/fxtf-drafts/blob/HEAD/CONTRIBUTING.md',\n }[url.hostname];\n\n return {\n id: id,\n name: info.title\n .replace(/ Level \\d+$/, '')\n .replace(/ Module$/, ''),\n href: url.href,\n specrepo: `w3c/${org}-drafts`,\n // Note: mediaqueries-5 has the highest level on 2017-09-30\n specpath: `${id} ${id}-1 ${id}-2 ${id}-3 ${id}-4 ${id}-5`,\n testpath: `${id} css/${id} css/${id}-1 css/${id}-2 css/${id}-3 ` +\n `css/${id}-4 css/${id}-5`,\n testpolicy: testpolicy,\n };\n }\n\n function entryFromSvgwgOrg(url) {\n console.assert(url.hostname == 'svgwg.org');\n\n const entry = {\n id: undefined, // just for the order\n name: info.title,\n href: url.href,\n specrepo: 'w3c/svgwg',\n testpolicy: 'https://github.com/w3c/csswg-drafts/blob/HEAD/CONTRIBUTING.md',\n };\n\n if (url.pathname == '/svg2-draft/') {\n entry.id = 'svg',\n entry.name = 'SVG';\n entry.specpath = 'master';\n } else {\n console.assert(url.pathname.startsWith('/specs/') &&\n url.pathname.endsWith('/'));\n const id = url.pathname.split('/')[2];\n entry.id = `svg-${id}`;\n entry.specpath = `specs/${id}`;\n }\n\n return entry;\n }\n\n function entryFromTC39(url) {\n console.assert(url.hostname == 'tc39.es');\n\n const repoURL = new URL(info.repository);\n console.assert(repoURL.hostname == 'github.com');\n\n const [org, repo] = repoURL.pathname.split('/').filter((s) => s);\n\n return {\n id: repo,\n name: info.title,\n href: url.href,\n specrepo: `${org}/${repo}`,\n };\n }\n\n switch (group) {\n case 'biblio': {\n const url = new URL(info.href);\n if (url.hostname.endsWith('.github.io')) {\n return entryFromGitHubIO(url);\n }\n\n if (url.hostname == 'tc39.es') {\n return entryFromTC39(url);\n }\n\n // TODO: handle more interesting things, like WebGL\n return;\n }\n\n case 'w3c': {\n // ignore everything that isn't maintained\n if (info.status != 'ED' && !info.edDraft) {\n return;\n }\n if (info.status == 'NOTE') {\n return;\n }\n\n let url = info.edDraft || info.href;\n\n // workaround before fix in https://www.w3.org/2002/01/tr-automation/tr.rdf\n const OLD_CSS_PREFIX = 'http://dev.w3.org/csswg/';\n if (url.startsWith(OLD_CSS_PREFIX)) {\n url = 'https://drafts.csswg.org/' + url.substr(OLD_CSS_PREFIX.length);\n }\n\n url = new URL(url);\n\n const HOSTNAMES = [\n 'drafts.css-houdini.org',\n 'drafts.csswg.org',\n 'drafts.fxtf.org',\n 'heycam.github.io',\n 'immersive-web.github.io',\n 'svgwg.org',\n 'w3c.github.io',\n 'webaudio.github.io',\n ];\n\n if (!HOSTNAMES.some((hostname) => url.hostname == hostname)) {\n return;\n }\n\n if (url.hostname.endsWith('.github.io')) {\n const entry = entryFromGitHubIO(url);\n\n // the webappsec prefix isn't used in the wpt dirname\n if (entry.id.startsWith('webappsec-')) {\n entry.testpath = entry.id.substr(10);\n }\n\n // the Web Performance WG has a testing policy\n if (info.deliveredBy &&\n info.deliveredBy.includes('https://www.w3.org/webperf/')) {\n entry.testpolicy = 'https://github.com/w3c/web-performance/blob/HEAD/CONTRIBUTING.md';\n }\n\n return entry;\n }\n\n if (url.hostname.startsWith('drafts.')) {\n return entryFromDraftsOrg(url);\n }\n\n console.assert(url.hostname == 'svgwg.org');\n return entryFromSvgwgOrg(url);\n }\n\n case 'whatwg': {\n if (info.obsoletedBy) {\n return;\n }\n\n const url = new URL(info.href);\n\n console.assert(url.hostname.endsWith('.idea.whatwg.org') ||\n url.hostname.endsWith('.spec.whatwg.org'));\n\n const id = url.hostname.split('.')[0];\n\n return {\n id: id,\n name: info.title.replace(/ Standard$/, ''),\n href: url.href,\n specrepo: 'whatwg/' + id,\n testpolicy: 'https://github.com/whatwg/meta/blob/HEAD/CONTRIBUTING.md',\n };\n }\n\n case 'wicg': {\n const url = new URL(info.href);\n console.assert(url.hostname.endsWith('.github.io'));\n const entry = entryFromGitHubIO(url);\n // TODO: it might be simpler to just use the specref ids more\n if (entry.href == 'https://wicg.github.io/shape-detection-api/text.html') {\n entry.id = 'text-detection-api';\n }\n return entry;\n }\n }\n\n throw new Error(`Unknown group: ${group}`);\n}", "* listChangedFiles() {\n if (!this.activeProject) return [];\n\n var diff = yield* this.__github.compareBranches(\n this.repository,\n 'master',\n this.activeProject.ref)\n return diff.files.map(file => {\n return { // TODO this translation should bbe in github.js\n path: file.filename,\n name: file.filename.substring(file.filename.lastIndexOf('/') + 1),\n hash: file.sha,\n }\n });\n }", "function step () {\n branches.forEach(b => b.update())\n}", "function expandRefs(refs) {\n refs = _cloneJSON(refs);\n Object.keys(refs).forEach(function(key) {\n var ref = refs[key];\n if (ref.aliasOf) {\n var obj = ref,\n lastKey = key;\n while (obj && refs[obj.aliasOf]) {\n lastKey = obj.aliasOf;\n obj = refs[lastKey];\n }\n }\n if (obj && key !== lastKey) {\n obj.aliases = obj.aliases || [];\n obj.aliases.push(key);\n }\n });\n\n Object.keys(refs).forEach(function(key) {\n var ref = refs[key];\n var versions = ref.versions\n if (versions) {\n Object.keys(versions).forEach(function(subKey) {\n var ver = versions[subKey];\n if (ver.aliasOf) {\n refs[key + '-' + subKey] = ver;\n } else {\n var obj = {\n versionOf: key\n };\n // Props fallback to main entry.\n _copyProps(ref, obj);\n _copyProps(ver, obj);\n delete obj.versions;\n delete obj.obsoletes;\n refs[key + '-' + subKey] = obj;\n }\n });\n if (ref.aliases) {\n ref.aliases.forEach(function(aliasKey) {\n Object.keys(versions).forEach(function(subKey) {\n // Watch out not to overwrite existing aliases.\n if (!refs[aliasKey + '-' + subKey]) {\n refs[aliasKey + '-' + subKey] = { aliasOf: key + '-' + subKey };\n }\n });\n });\n }\n }\n });\n return refs;\n}", "getBranchStatusFromCi(branch) {\n return __awaiter(this, void 0, void 0, function* () {\n const { owner, name } = this.git.remoteConfig;\n const url = `https://circleci.com/gh/${owner}/${name}/tree/${branch}.svg?style=shield`;\n const result = yield fetch(url).then(result => result.text());\n if (result && !result.includes('no builds')) {\n return result.includes('passing') ? 'success' : 'failed';\n }\n return 'not found';\n });\n }", "repositoriesWorkspaceRepoSlugDiffSpecGet(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = defaultClient.authentications['api_key'];\n api_key.apiKey = incomingOptions.apiKey;\n // Uncomment the following line to set a prefix for the API key, e.g. \"Token\" (defaults to null)\n api_key.apiKeyPrefix = incomingOptions.apiKeyPrefix || 'Token';\n // Configure HTTP basic authorization: basic\n let basic = defaultClient.authentications['basic'];\n basic.username = 'YOUR USERNAME';\n basic.password = 'YOUR PASSWORD';\n // Configure OAuth2 access token for authorization: oauth2\n let oauth2 = defaultClient.authentications['oauth2'];\n oauth2.accessToken = incomingOptions.accessToken;\n\n let apiInstance = new Bitbucket.CommitsApi(); // String | // String | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`. // String | This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.\n /*let spec = \"spec_example\";*/ /*let workspace = \"workspace_example\";*/ /*let repoSlug = \"repoSlug_example\";*/ let opts = {\n context: 56, // Number | Generate diffs with <n> lines of context instead of the usual three\n // 'path': \"path_example\", // String | Limit the diff to a particular file (this parameter can be repeated for multiple paths)\n ignoreWhitespace: true, // Boolean | Generate diffs that ignore whitespace\n binary: true, // Boolean | Generate diffs that include binary files,true if omitted.\n };\n\n if (incomingOptions.opts)\n Object.keys(incomingOptions.opts).forEach(\n (key) =>\n incomingOptions.opts[key] === undefined &&\n delete incomingOptions.opts[key]\n );\n else delete incomingOptions.opts;\n incomingOptions.opts = Object.assign(opts, incomingOptions.opts);\n\n apiInstance.repositoriesWorkspaceRepoSlugDiffSpecGet(\n incomingOptions.spec,\n incomingOptions.workspace,\n incomingOptions.repoSlug,\n incomingOptions.opts,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, '', response);\n }\n }\n );\n }", "function getBranchAbbr(branch) {\n\tlet result;\n\tswitch(branch) {\n\t\tcase 'isArmy':\n\t\t\tresult = 'USA';\n\t\t\tbreak;\n\t\tcase 'isNavy':\n\t\t\tresult = 'USN';\n\t\t\tbreak;\n\t\tcase 'isMarines':\n\t\t\tresult = 'USMC';\n\t\t\tbreak;\n\t\tcase 'isAirforce':\n\t\t\tresult = 'USAF';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log('This will not happen!');\n\t}\n\treturn result;\n}", "onCommit(id, options = {}) {\n const rule = this.onReferenceUpdated(id, options);\n if (options.branches) {\n rule.addEventPattern({ detail: { referenceName: options.branches } });\n }\n return rule;\n }", "_verifyRunningFromNextBranch() {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n const headSha = this._git.run(['rev-parse', 'HEAD']).stdout.trim();\n const { data } = yield this._git.github.repos.getBranch(Object.assign(Object.assign({}, this._git.remoteParams), { branch: nextBranchName }));\n if (headSha !== data.commit.sha) {\n error(red(' ✘ Running release tool from an outdated local branch.'));\n error(red(` Please make sure you are running from the \"${nextBranchName}\" branch.`));\n return false;\n }\n return true;\n });\n }", "async function compare() {\n let branchDir = path.join(__dirname, '..', 'dist', 'branch-api');\n let publishedDir = path.join(__dirname, '..', 'dist', 'published-api');\n if (!(fs.existsSync(branchDir) && fs.existsSync(publishedDir))) {\n console.log(chalk.redBright(`you must have both a branchDir ${branchDir} and publishedDir ${publishedDir}`));\n return;\n }\n let summaryMessages = [];\n\n let branchAPIs = fg.sync(`${branchDir}/**/api.json`);\n let publishedAPIs = fg.sync(`${publishedDir}/**/api.json`);\n let pairs = [];\n // we only care about changes to already published APIs, so find all matching pairs based on what's been published\n for (let pubApi of publishedAPIs) {\n let pubApiPath = pubApi.split(path.sep);\n let sharedPath = path.join(...pubApiPath.slice(pubApiPath.length - 4));\n let matchingBranchFile;\n for (let branchApi of branchAPIs) {\n if (branchApi.includes(sharedPath)) {\n matchingBranchFile = branchApi;\n pairs.push({pubApi, branchApi});\n break;\n }\n }\n if (!matchingBranchFile) {\n summaryMessages.push({msg: `removed module ${pubApi}`, severity: 'error'});\n }\n }\n let privatePackages = [];\n // don't care about not private APIs, but we do care if we're about to publish a new one\n for (let branchApi of branchAPIs) {\n let branchApiPath = branchApi.split(path.sep);\n let sharedPath = path.join(...branchApiPath.slice(branchApiPath.length - 4));\n let matchingPubFile;\n for (let pubApi of publishedAPIs) {\n if (pubApi.includes(sharedPath)) {\n matchingPubFile = pubApi;\n // don't re-add to pairs\n break;\n }\n }\n if (!matchingPubFile) {\n let json = JSON.parse(fs.readFileSync(path.join(branchApi, '..', '..', 'package.json')), 'utf8');\n if (!json.private) {\n summaryMessages.push({msg: `added module ${branchApi}`, severity: 'warn'});\n } else {\n privatePackages.push(branchApi);\n }\n }\n }\n\n let count = 0;\n let diffs = {};\n for (let pair of pairs) {\n let diff = getDiff(summaryMessages, pair);\n if (diff.diff.length > 0) {\n count += 1;\n diffs[diff.name] = diff.diff;\n }\n }\n let modulesAdded = branchAPIs.length - privatePackages.length - publishedAPIs.length;\n if (modulesAdded !== 0) {\n summaryMessages.push({msg: `${Math.abs(modulesAdded)} modules ${modulesAdded > 0 ? 'added' : 'removed'}`, severity: modulesAdded > 0 ? 'warn' : 'error'});\n } else {\n summaryMessages.push({msg: 'no modules removed or added', severity: 'info'});\n }\n if (count !== 0) {\n summaryMessages.push({msg: `${count} modules had changes to their API ${Object.keys(diffs).map(key => `\\n - ${simplifyModuleName(key)}`)}`, severity: 'warn'});\n } else {\n summaryMessages.push({msg: 'no modules changed their API', severity: 'info'});\n }\n summaryMessages.push({});\n let matches = analyzeDiffs(diffs);\n let moreMessages = generateMessages(matches);\n [...summaryMessages, ...moreMessages].forEach(({msg, severity}) => {\n if (!msg) {\n console.log('');\n return;\n }\n let color = 'default';\n switch (severity) {\n case 'info':\n color = 'greenBright';\n break;\n case 'log':\n color = 'blueBright';\n break;\n case 'warn':\n color = 'yellowBright';\n break;\n case 'error':\n color = 'redBright';\n break;\n default:\n color = 'defaultBright';\n break;\n }\n console[severity](chalk[color](msg));\n });\n}", "static getRemoteMasterBranch(repositoryUrl) {\r\n if (repositoryUrl) {\r\n const output = child_process\r\n .execSync(`git remote`)\r\n .toString();\r\n const normalizedRepositoryUrl = repositoryUrl.toUpperCase();\r\n const matchingRemotes = output.split('\\n').filter((remoteName) => {\r\n if (remoteName) {\r\n const remoteUrl = child_process.execSync(`git remote get-url ${remoteName}`)\r\n .toString()\r\n .trim();\r\n if (!remoteUrl) {\r\n return false;\r\n }\r\n const normalizedRemoteUrl = remoteUrl.toUpperCase();\r\n if (normalizedRemoteUrl.toUpperCase() === normalizedRepositoryUrl) {\r\n return true;\r\n }\r\n // When you copy a URL from the GitHub web site, they append the \".git\" file extension to the URL.\r\n // We allow that to be specified in rush.json, even though the file extension gets dropped\r\n // by \"git clone\".\r\n if (`${normalizedRemoteUrl}.GIT` === normalizedRepositoryUrl) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n if (matchingRemotes.length > 0) {\r\n if (matchingRemotes.length > 1) {\r\n console.log(`More than one git remote matches the repository URL. Using the first remote (${matchingRemotes[0]}).`);\r\n }\r\n return `${matchingRemotes[0]}/${DEFAULT_BRANCH}`;\r\n }\r\n else {\r\n console.log(colors.yellow(`Unable to find a git remote matching the repository URL (${repositoryUrl}). ` +\r\n 'Detected changes are likely to be incorrect.'));\r\n return DEFAULT_FULLY_QUALIFIED_BRANCH;\r\n }\r\n }\r\n else {\r\n console.log(colors.yellow('A git remote URL has not been specified in rush.json. Setting the baseline remote URL is recommended.'));\r\n return DEFAULT_FULLY_QUALIFIED_BRANCH;\r\n }\r\n }", "function gitMyVersion(file) {\n var PLACEHOLDER = '__GIT_MY_VERSION__';\n var root = findRoot(file);\n var commitHash = null;\n var packageVersion = require(path.join(root, 'package.json')).version\n var regex = new RegExp(PLACEHOLDER, 'g');\n\n return through.obj(function fileStream(chunk, enc, cb) {\n if(commitHash) {\n cb(null, replaceChunk(chunk, regex, packageVersion + '-' + commitHash));\n } else {\n gitRev.short(function getShortCommitHash(hash) {\n commitHash = hash;\n\n cb(null, replaceChunk(chunk, regex, packageVersion + '-' + commitHash));\n });\n }\n });\n}", "referenceToString(value, wrapper) {\n let [left, right] = this.toStringOptions.referenceWrapper;\n return `${left}${value}${right}`;\n }", "formatLastSolution ( includeSlackVariables = false, mode = 0 ) {}", "function objectTerritorialConflictResolver(objects) {\r\n\tvar currentDiffSum = \"nope\";\r\n\tvar prevDiffSum = \"nope\";\r\n\tvar prevPrevDiffSum;\r\n\tvar iterationCount = 1;\r\n\twhile (prevPrevDiffSum != 0 && iterationCount < 8) {\r\n\t\tprevPrevDiffSum = prevDiffSum;\r\n\t\tprevDiffSum = currentDiffSum;\r\n\t\tcurrentDiffSum = 0;\r\n\t\tfor (i = 0; i < objects.length; i++) {\r\n\t\t\tvar objectArray = objects;\r\n\t\t\tvar currentObject = objectArray[i];\r\n\t\t\tcurrentDiffSum += moveIfOverlapsAndReturnDiff(currentObject, objectArray);\r\n\t\t}\r\n\t\titerationCount++;\r\n\t}\r\n\tconsole.log(\"Labels settled after \"+iterationCount+\" iterations\");\r\n}", "function accum(input){\n<<<<<<< HEAD\n var res=\"\"\n str=input.split('')\n\n for(var i=0;i<str.length;i++){\n \t var count=0\n \t \n \t \n upper=str[i].toUpperCase()\n\n \twhile(count<=i){\n \n res=res+upper+str[i]+\"-\"\n\n count=count+1\n \n \t\n }\n }\n\n return res\n=======\n //your code is here\n>>>>>>> f347da1f79e381ff1db6b5d93ff64fe7dadba6f5\n }", "repositoriesWorkspaceRepoSlugRefsBranchesNameDelete(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = defaultClient.authentications['api_key'];\n api_key.apiKey = incomingOptions.apiKey;\n // Uncomment the following line to set a prefix for the API key, e.g. \"Token\" (defaults to null)\n api_key.apiKeyPrefix = incomingOptions.apiKeyPrefix || 'Token';\n // Configure HTTP basic authorization: basic\n let basic = defaultClient.authentications['basic'];\n basic.username = 'YOUR USERNAME';\n basic.password = 'YOUR PASSWORD';\n // Configure OAuth2 access token for authorization: oauth2\n let oauth2 = defaultClient.authentications['oauth2'];\n oauth2.accessToken = incomingOptions.accessToken;\n\n let apiInstance = new Bitbucket.RefsApi(); // String | The name of the branch // String | This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: `{workspace UUID}`. // String | This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`.\n /*let name = \"name_example\";*/ /*let workspace = \"workspace_example\";*/ /*let repoSlug = \"repoSlug_example\";*/ apiInstance.repositoriesWorkspaceRepoSlugRefsBranchesNameDelete(\n incomingOptions.name,\n incomingOptions.workspace,\n incomingOptions.repoSlug,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, '', response);\n }\n }\n );\n }", "function printResults(owner, repo, results) {\n console.log(owner + '/' + repo + ':');\n\n results.forEach(function (result) {\n var mark = result.result ? '✓' : '✖';\n var output = util.format(' %s %s', mark, result.message);\n if (colors.enabled) {\n output = output[result.result ? 'green' : 'red'];\n }\n console.log(output);\n });\n}", "getBranchStatusFromCi(branch) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n const { owner, name } = this.git.remoteConfig;\n const url = `https://circleci.com/gh/${owner}/${name}/tree/${branch}.svg?style=shield`;\n const result = yield fetch(url).then(result => result.text());\n if (result && !result.includes('no builds')) {\n return result.includes('passing') ? 'success' : 'failed';\n }\n return 'not found';\n });\n }", "function replace_decoys(bracket){\n if(bracket.is_decoy){\n return bracket.match;\n }else{\n bracket.branch_1 = replace_decoys(bracket.branch_1);\n bracket.branch_2 = replace_decoys(bracket.branch_2);\n return bracket;\n }\n }", "static async writeRef({ fs, gitdir, ref, value }) {\n // Validate input\n if (!value.match(/[0-9a-f]{40}/)) {\n throw new InvalidOidError(value)\n }\n await fs.write(join(gitdir, ref), `${value.trim()}\\n`, 'utf8');\n }", "function commitBump() {\n return gulp.src([\n './package.json',\n './bower.json',\n './README.md'\n ]).pipe(git.commit('Bump version to ' + packageJson().version));\n}", "function printListCommits(repo_name, branch_name, attributes) {\n var commits = listCommitsComplete(repo_name, branch_name, attributes);\n \n //ERROR HANDLING\n if (commits != null) {\n if (commits.length < 0) {\n showError(\"No commits found\");\n }\n }\n else {\n showError(\"No commits found\");\n }\n \n var textList = [];\n for (var i = 0; i < commits.length; i++) {\n var sha = commits[i].sha;\n var contributor = commits[i].commit.committer.name;\n var message = commits[i].commit.message;\n var date = commits[i].commit.committer.date;\n var body = DocumentApp.getActiveDocument().getBody();\n \n var text = \"COMMIT REF ID: \" + sha + \"\\n\";\n text += \"CONTRIBUTOR: \" + contributor + \"\\n\";\n text += \"COMMIT MESSAGE: \" + message + \"\\n\";\n text += \"DATE: \" + date + \"\\n\";\n textList.push(text);\n }\n \n var curPrintFormat = PropertiesService.getScriptProperties().getProperty('curPrintFormat');\n if (curPrintFormat == null) setCurrentPrintFormat(\"TABLE\");\n Logger.log(\"TESTING HERE\");\n Logger.log(curPrintFormat);\n \n switch (curPrintFormat){\n case \"TABLE\":\n var table = [[\"COMMIT REF ID\", \"CONTRIBUTOR\", \"COMMIT MESSAGE\", \"DATE\"]];\n for (var i = commits.length - 1; i >= 0; i--) {\n var sha = commits[i].sha;\n var contributor = commits[i].commit.committer.name;\n var message = commits[i].commit.message;\n var date = commits[i].commit.committer.date;\n var body = DocumentApp.getActiveDocument().getBody();\n table.push([sha, contributor, message, date]);\n }\n body.appendTable(table);\n break;\n case \"LIST\":\n for (var i = textList.length - 1; i >= 0 ; i--) {\n body.appendListItem(textList[i]);\n }\n break;\n case \"BULLETS\":\n for (var i = textList.length - 1; i >= 0 ; i--) {\n body.appendParagraph(\"*\\n\" + textList[i]);\n }\n break;\n default:\n body.appendParagraph(\"*\\n ERROR\" );\n }\n \n \n}", "async function displayCommits(){\n\n //Aunqye el codigo parezca sincrono se ejecuta de froma asincrona.\n // En este caso el hilo va a buscar el usuario, va a dejar ejecutando la tarea y va a ejecutar otra cosa\n //una vez se resuelva y se obtenga el usuario va a ir a buscar los repo, se va a liberr para ejecutar otra tarea, \n //una vez se obtenga el repo vuelve acá, y asi sucesivamente.\n try{\nconst user = await getUser(1);\nconst repos = await getRepositories(user.gitHubUsername);\nconst commits = await getCommits(repos[0]);\nconsole.log(commits);\n}\ncatch(err){\n console.log('Error', err);\n}\n}", "function cloneAndMerge() {\n if (!which('git')) {\n echo('!!! Botio error: Could not find git');\n exit(1);\n }\n\n if (!jobInfo.base_url || !jobInfo.head_url || !jobInfo.head_sha) {\n echo('!!! Botio error: Missing head/base information');\n exit(1);\n }\n\n execWrap('git clone '+jobInfo.base_url+' .'); // clone upstream\n execWrap('git checkout '+jobInfo.base_ref); // checkout the base ref in the pull request\n execWrap('git remote add requester '+jobInfo.head_url); // add pull requester's repo\n execWrap('git fetch requester '+jobInfo.head_ref); // fetch only PR branch\n execWrap('git branch PR '+jobInfo.head_sha); // this is so we can merge the given SHA below\n\n // Merge PR branch into upstream's master\n debug('Running command: git merge PR');\n if (exec('git merge PR', {silent:true}).code !== 0) {\n echo('!!! Botio error: cannot merge pull request into upstream. Please fix conflicts and try again.');\n exit(1);\n }\n}", "replaceCommitHeaderPullRequestNumber(header) {\n return header.replace(/\\(#(\\d+)\\)$/, (_, g) => `(${this.pullRequestToLink(+g)})`);\n }", "function finalClueTweaks() {\n for (let clueIndex of allClueIndices) {\n let theClue = clues[clueIndex]\n setClueSolution(clueIndex)\n if (addSolutionToAnno && theClue.solution && !isOrphan(clueIndex) &&\n !roughlyStartsWith(theClue.anno, theClue.solution)) {\n // For orphans, we reveal in their placeholder blanks.\n theClue.anno = '<span class=\"solution\">' + theClue.solution +\n '</span>. ' + theClue.anno;\n }\n if (theClue.anno) {\n hasReveals = true\n }\n if (!theClue.fullDisplayLabel) {\n continue\n }\n let label = theClue.fullDisplayLabel\n let l = label.length\n if (l < 1) {\n continue\n }\n let last = label.charAt(l - 1).toLowerCase()\n if ((last >= 'a' && last <= 'z') || (last >= '0' && last <= '9')) {\n label = label + '. '\n } else {\n label = label + ' '\n }\n if (!allCellsKnown(clueIndex)) {\n theClue.fullDisplayLabel = '<span class=\"clickable\">' +\n '<span id=\"current-clue-label\" ' +\n ' title=\"' + MARK_CLUE_TOOLTIP +\n '\" onclick=\"toggleClueSolvedState(\\'' + clueIndex + '\\')\">' +\n label + '</span></span>';\n } else {\n theClue.fullDisplayLabel = '<span id=\"current-clue-label\">' +\n label + '</span>';\n }\n }\n}", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n if (state.level >= state.options.maxNesting) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n state.push({\n type: 'footnote_ref',\n id: footnoteId,\n subId: footnoteSubId,\n level: state.level\n });\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n}", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n token,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n token = state.push('footnote_ref', '', 0);\n token.meta = { id: footnoteId, subId: footnoteSubId, label: label };\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n }", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n token,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n token = state.push('footnote_ref', '', 0);\n token.meta = { id: footnoteId, subId: footnoteSubId, label: label };\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n }", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n token,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n token = state.push('footnote_ref', '', 0);\n token.meta = { id: footnoteId, subId: footnoteSubId, label: label };\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n }", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n token,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n token = state.push('footnote_ref', '', 0);\n token.meta = { id: footnoteId, subId: footnoteSubId };\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n }", "function footnote_ref(state, silent) {\n var label,\n pos,\n footnoteId,\n footnoteSubId,\n token,\n max = state.posMax,\n start = state.pos;\n\n // should be at least 4 chars - \"[^x]\"\n if (start + 3 > max) { return false; }\n\n if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\n for (pos = start + 2; pos < max; pos++) {\n if (state.src.charCodeAt(pos) === 0x20) { return false; }\n if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n break;\n }\n }\n\n if (pos === start + 2) { return false; } // no empty footnote labels\n if (pos >= max) { return false; }\n pos++;\n\n label = state.src.slice(start + 2, pos - 1);\n if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n if (!silent) {\n if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n if (state.env.footnotes.refs[':' + label] < 0) {\n footnoteId = state.env.footnotes.list.length;\n state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n state.env.footnotes.refs[':' + label] = footnoteId;\n } else {\n footnoteId = state.env.footnotes.refs[':' + label];\n }\n\n footnoteSubId = state.env.footnotes.list[footnoteId].count;\n state.env.footnotes.list[footnoteId].count++;\n\n token = state.push('footnote_ref', '', 0);\n token.meta = { id: footnoteId, subId: footnoteSubId };\n }\n\n state.pos = pos;\n state.posMax = max;\n return true;\n }", "async function compare() {\n let branchDir = path.join(__dirname, '..', 'dist', 'branch-api');\n let publishedDir = path.join(__dirname, '..', 'dist', 'published-api');\n if (!(fs.existsSync(branchDir) && fs.existsSync(publishedDir))) {\n if (!fs.existsSync(publishedDir) && fs.existsSync(branchDir)) {\n console.log('not showing private package', branchDir);\n } else if (fs.existsSync(publishedDir) && !fs.existsSync(branchDir)) {\n console.log('something has probably gone wrong, the package exists published but not locally', publishedDir);\n } else {\n console.log('something has probably gone wrong, the package does not exist in either place, this should be impossible', publishedDir);\n }\n return;\n }\n let summaryMessages = [];\n // don't worry about private packages, they don't make it through the build\n let branchAPIs = fg.sync(`${branchDir}/**/api.json`);\n let publishedAPIs = fg.sync(`${publishedDir}/**/api.json`);\n let pairs = [];\n for (let pubApi of publishedAPIs) {\n let pubApiPath = pubApi.split(path.sep);\n let sharedPath = path.join(...pubApiPath.slice(pubApiPath.length - 4));\n let matchingBranchFile;\n for (let branchApi of branchAPIs) {\n if (branchApi.includes(sharedPath)) {\n matchingBranchFile = branchApi;\n pairs.push({pubApi, branchApi});\n break;\n }\n }\n if (!matchingBranchFile) {\n summaryMessages.push({msg: `removed module ${pubApi}`, severity: 'error'});\n }\n }\n for (let branchApi of branchAPIs) {\n let branchApiPath = branchApi.split(path.sep);\n let sharedPath = path.join(...branchApiPath.slice(branchApiPath.length - 4));\n let matchingPubFile;\n for (let pubApi of publishedAPIs) {\n if (pubApi.includes(sharedPath)) {\n matchingPubFile = pubApi;\n // don't re-add to pairs\n break;\n }\n }\n if (!matchingPubFile) {\n summaryMessages.push({msg: `added module ${branchApi}`, severity: 'warn'});\n }\n }\n\n let count = 0;\n for (let pair of pairs) {\n console.log(`comparing ${pair.branchApi.replace(/.*branch-api/, '')}`);\n let publishedApi = fs.readJsonSync(pair.pubApi);\n delete publishedApi.links;\n walkObject(publishedApi, ({value, location, isLeaf}) => {\n if (!isLeaf && value.id && typeof value.id === 'string') {\n value.id = value.id.replace(/.*(node_modules|packages)/, '');\n }\n });\n let branchApi = fs.readJsonSync(pair.branchApi);\n delete branchApi.links;\n walkObject(branchApi, ({value, location, isLeaf}) => {\n if (!isLeaf && value.id && typeof value.id === 'string') {\n value.id = value.id.replace(/.*(node_modules|packages)/, '');\n }\n });\n let diff = changesets.diff(publishedApi, branchApi);\n if (diff.length > 0) {\n count += 1;\n console.log(util.inspect(diff, {depth: null}));\n }\n\n let publishedExports = publishedApi.exports;\n let branchExports = branchApi.exports;\n let addedExports = Object.keys(branchExports).filter(key => !publishedExports[key]);\n let removedExports = Object.keys(publishedExports).filter(key => !branchExports[key]);\n if (addedExports.length > 0) {\n summaryMessages.push({msg: `added exports ${addedExports} to ${pair.branchApi}`, severity: 'warn'});\n }\n if (removedExports.length > 0) {\n summaryMessages.push({msg: `removed exports ${removedExports} from ${pair.branchApi}`, severity: 'error'});\n }\n }\n summaryMessages.forEach(({msg, severity}) => {\n console[severity](chalk[severity === 'warn' ? 'yellow' : 'red'](msg));\n });\n let modulesAdded = branchAPIs.length - publishedAPIs.length;\n if (modulesAdded !== 0) {\n console.log(chalk[modulesAdded > 0 ? 'yellow' : 'red'](`${Math.abs(modulesAdded)} modules ${modulesAdded > 0 ? 'added' : 'removed'}`));\n } else {\n console.log(chalk.green('no modules removed or added'));\n }\n if (count !== 0) {\n console.log(chalk.yellow(`${count} modules had changes to their API`));\n } else {\n console.log(chalk.green('no modules changed their API'));\n }\n}", "function createBranchMessageElementsHtml(elementsFromCommitMessages) {\n\t\tvar commitsHtml = document.createElement(\"div\"); // for all commits of branch\n\t\tif (elementsFromCommitMessages.length === 0) {\n\t\t\treturn commitsHtml;\n\t\t}\n\t\tvar commitMessagesHeader = document.createElement(\"h4\");\n\t\tcommitMessagesHeader.innerText = \"Decision Knowledge Captured in Commit Messages\";\n\t\tcommitsHtml.appendChild(commitMessagesHeader);\n\n\t\tvar commitId = \"\"; // commit hash\n\t\tvar commitHtml = null; // for single commit\n\t\tfor (element of elementsFromCommitMessages) {\n\t\t\tif (commitId !== element.source) {\n\t\t\t\tcommitId = element.source;\n\t\t\t\tcommitHtml = document.createElement(\"div\");\n\t\t\t\tcommitHtml.className = \"condec-box\";\n\t\t\t\tcommitHtml.id = commitId;\n\n\t\t\t\tcommitLabel = document.createElement(\"i\");\n\t\t\t\tcommitLabel.innerText = \"Commit \" + commitId + \" --- \";\n\t\t\t\tcommitHtml.appendChild(commitLabel);\n\n\t\t\t\tvar link = document.createElement(\"a\");\n\t\t\t\tlink.innerHTML = \"<span class='aui-icon aui-icon-small aui-iconfont-shortcut'></span> Navigate to Commit in Git\";\n\t\t\t\tlink.href = decodeURIComponent(element.url);\n\t\t\t\tlink.target = \"_blank\";\n\t\t\t\tcommitHtml.appendChild(link);\n\t\t\t}\n\t\t\tvar messageElementHtml = getElementAsHTML(element);\n\t\t\tmessageElementHtml.title = \"Commit \" + commitId;\n\t\t\tcommitHtml.appendChild(messageElementHtml);\n\t\t\tcommitsHtml.appendChild(commitHtml);\n\t\t}\n\t\treturn commitsHtml;\n\t}", "function tagBump(cb) {\n var version = packageJson().version;\n git.checkout('master', function(error) {\n if (error) {\n return cb(error);\n }\n git.tag(version, 'Tag version ' + version, function(error) {\n if (error) {\n return cb(error);\n }\n git.push('origin', 'master', {\n args: '--tags'\n }, cb);\n });\n });\n}", "render() {\n const pathName = this.props.location.pathname.split('/');\n pathName.shift();\n const pathLength = pathName.length;\n const { branch, repo } = this.props;\n\n return (\n <header>\n {Object.keys(branch).length || typeof branch === 'string' ? (\n <div>\n <NavItem path=\"/repos\" name=\"Repositories > \" repository={true} />\n <NavItem\n path={`/repos/${repo}`}\n name={`${repo} > `}\n isRepo={true}\n breadcrumb={true}\n />\n <i className=\"fas fa-code-branch\" />\n <span> branches</span>\n <NavItem\n path={`/repos/${repo}/branches/${branch.name}`}\n name={` > ${this.renderBranchName(branch)}`}\n isBranch={true}\n branch={branch}\n breadcrumb={true}\n />\n </div>\n ) : repo ? (\n <div>\n <NavItem\n path=\"/repos\"\n name=\"Repositories > \"\n repository={true}\n breadcrumb={true}\n />\n <NavItem\n path={`/repos/${repo}`}\n name={`${repo}`}\n isRepo={true}\n breadcrumb={true}\n />\n </div>\n ) : (\n <div>\n <NavItem\n path=\"/repos\"\n name=\"Repositories\"\n repository={true}\n breadcrumb={true}\n />\n </div>\n )}\n </header>\n );\n }", "function getBranches(mat) {\n // Start at a node with 1 or 3 branches.\n let startNode = find_node_1.default(mat, function (node) {\n return node.branches.length !== 2;\n });\n let branchCount = 0;\n g(startNode, undefined, 0);\n //console.log(branchCount);\n function g(matNode, priorNode, depth) {\n for (let i = 0; i < matNode.branches.length; i++) {\n let node = matNode.branches[i];\n if (node === priorNode) {\n // Don't go back in tracks.\n continue;\n }\n branchCount++;\n let branch = traverseSingleBranch(matNode, i);\n //console.log(branch);\n for (let node of branch) {\n let color = ['red', 'blue', 'green'][i];\n /*\n if (typeof FloMat !== 'undefined' && FloMat._debug_ && !FloMat._debug_.config.isTiming) {\n FloMat._debug_.draw.dot(node.matCircle.circle.center, 1, color);\n }\n */\n }\n let endNode = branch[branch.length - 1];\n let prevNode = branch[branch.length - 2];\n /*\n if (typeof FloMat !== 'undefined' && FloMat._debug_ && !FloMat._debug_.config.isTiming) {\n FloMat._debug_.draw.dot(endNode.matCircle.circle.center, 2, 'yellow');\n }\n */\n g(endNode, prevNode, depth + 1);\n }\n }\n}", "static async getCurrentBranch(context, prNumber) {\n // I couldn't find an API call that filters this properly\n let prs = await context.github.pullRequests.list(context.repo())\n prs = prs[\"data\"]\n for (var key in prs) {\n if (prs[key][\"number\"] == prNumber) {\n return prs[key][\"head\"][\"ref\"]\n }\n }\n context.log.error(\"pr not found!\")\n }", "function finishWithGitResult(repo, resolve, reject, failMsg) {\n return (err) => {\n if (err) {\n reject(failMsg ? new Error(failMsg) : err);\n } else {\n resolve(repo);\n }\n };\n}", "async function getCurrentBranch() {\n const args = ['rev-parse', '--abbrev-ref', 'HEAD'];\n\n const currentBranch = await execGit(args);\n\n return currentBranch;\n}", "function footnote_ref(state, silent) {\n\t var label,\n\t pos,\n\t footnoteId,\n\t footnoteSubId,\n\t max = state.posMax,\n\t start = state.pos;\n\n\t // should be at least 4 chars - \"[^x]\"\n\t if (start + 3 > max) { return false; }\n\n\t if (!state.env.footnotes || !state.env.footnotes.refs) { return false; }\n\t if (state.src.charCodeAt(start) !== 0x5B/* [ */) { return false; }\n\t if (state.src.charCodeAt(start + 1) !== 0x5E/* ^ */) { return false; }\n\t if (state.level >= state.options.maxNesting) { return false; }\n\n\t for (pos = start + 2; pos < max; pos++) {\n\t if (state.src.charCodeAt(pos) === 0x20) { return false; }\n\t if (state.src.charCodeAt(pos) === 0x0A) { return false; }\n\t if (state.src.charCodeAt(pos) === 0x5D /* ] */) {\n\t break;\n\t }\n\t }\n\n\t if (pos === start + 2) { return false; } // no empty footnote labels\n\t if (pos >= max) { return false; }\n\t pos++;\n\n\t label = state.src.slice(start + 2, pos - 1);\n\t if (typeof state.env.footnotes.refs[':' + label] === 'undefined') { return false; }\n\n\t if (!silent) {\n\t if (!state.env.footnotes.list) { state.env.footnotes.list = []; }\n\n\t if (state.env.footnotes.refs[':' + label] < 0) {\n\t footnoteId = state.env.footnotes.list.length;\n\t state.env.footnotes.list[footnoteId] = { label: label, count: 0 };\n\t state.env.footnotes.refs[':' + label] = footnoteId;\n\t } else {\n\t footnoteId = state.env.footnotes.refs[':' + label];\n\t }\n\n\t footnoteSubId = state.env.footnotes.list[footnoteId].count;\n\t state.env.footnotes.list[footnoteId].count++;\n\n\t state.push({\n\t type: 'footnote_ref',\n\t id: footnoteId,\n\t subId: footnoteSubId,\n\t level: state.level\n\t });\n\t }\n\n\t state.pos = pos;\n\t state.posMax = max;\n\t return true;\n\t}", "function handlGetReferences(req, res, filter) {\n async.waterfall([\n req.repo.getReferences.bind(req.repo, git.Reference.Type.All),\n function (refNames, cb) {\n if (filter) {\n refNames = _.filter(refNames, filter);\n }\n // convert reference names to references\n async.map(refNames, refNameToJSON.bind(req.repo), cb);\n }\n ], function (err, refs) {\n if (err) {\n res.status(500).json({ error: err.toString() });\n } else {\n res.status(200).json(refs);\n }\n });\n}", "function ref(list, name, loose) {\n return contains(list, name) ? \"variable-2\" : (loose ? \"variable\" : \"variable-2 error\");\n }", "async function revertLatestRef() {\n const existingTags = await octokit.repos.listTags({\n owner: GH_OWNER,\n repo: GH_REPO,\n per_page: 5,\n })\n\n const updatedExistingTags = existingTags.data.filter(\n (obj) => obj.name != 'latest',\n )\n\n const latestRefSha = updatedExistingTags[0].commit.sha\n\n const updateRefResponse = await octokit.rest.git.updateRef({\n owner: GH_OWNER,\n repo: GH_REPO,\n ref: 'tags/latest',\n sha: latestRefSha,\n })\n\n if (updateRefResponse.status === 200) {\n console.log('Reverted previous tag ref!')\n } else {\n console.error(updateRefResponse)\n throw new Error('Something went wrong when reverting the previous tag ref.')\n }\n}", "async function MergeBranches( access_token, from, to ){\n return new Promise( async function( resolve, reject ){\n if( access_token && from && to ){\n var data0 = {\n base: to,\n head: from,\n commit_message: 'merge from ' + from + ' to ' + to\n };\n var option0 = {\n url: 'https://api.github.com/repos/' + settings.repo_name + '/merges',\n headers: { 'Authorization': 'token ' + access_token, 'User-Agent': 'githubapi' },\n json: data0,\n method: 'POST'\n };\n request( option0, async function( err0, res0, body0 ){\n if( err0 ){\n console.log( { err0 } );\n resolve( false );\n }else{\n //body0 = JSON.parse( body0 );\n console.log( { body0 } );\n resolve( true );\n }\n });\n }else{\n resolve( false );\n }\n });\n}", "function getRebuildBranchName() {\n var date = new Date();\n var mm = date.getMonth() + 1; // Month, 0-11\n var dd = date.getDate(); // Day of the month, 1-31\n var yyyy = date.getFullYear();\n return 'rebuild_' + mm + '_' + dd + '_' + yyyy;\n}", "function createBlitzList(args) {\n const tagRegExp = new RegExp(`${args.prefix}${TAG_PORTION}`);\n // For now we are simply returning the promise to test this half of the process\n return git.Repository.open(args.pathToRepo)\n .then(filterTags(tagRegExp))\n .catch(err => {\n console.error(`Unabled to open repository at: ${args.pathToRepo}`, err);\n return [];\n })\n .then(processTags(args.prefix, tagRegExp, args.githubRepo))\n .then(links => links.join('\\n'))\n .then(stringToWrite => {\n const options = {\n files: args.pathToOutfile,\n from: args.marker,\n to: stringToWrite\n };\n return replace(options)\n .catch((error) => console.error('unable to replace within file', error));\n });\n}", "getBranch(user, repo, branch, accessToken) {\n debug(`${user}/${repo}: Fetching branch ${branch}`)\n const url = API_URL_TEMPLATES.BRANCH\n .replace('${owner}', user)\n .replace('${repo}', repo)\n .replace('${branch}', branch)\n return this.fetchPath('GET', url, null, accessToken)\n }", "function addBeauty(prefix, buf) {\n let out = prefix + ' ' + buf\n .toString()\n .replace(/\\s+$/, '')\n .replace(/\\n/g, '\\n' + prefix);\n return out.green;\n}" ]
[ "0.54114103", "0.5204545", "0.50449944", "0.49945587", "0.49767423", "0.49517336", "0.49473965", "0.49467558", "0.49040538", "0.48349437", "0.48229373", "0.48080593", "0.47618443", "0.4715491", "0.47031298", "0.467832", "0.46716523", "0.46553308", "0.46229312", "0.46035722", "0.46003002", "0.45884657", "0.45548227", "0.453112", "0.45240274", "0.45184106", "0.44566357", "0.44382712", "0.44143015", "0.44116023", "0.44111818", "0.4407316", "0.44032553", "0.4392415", "0.43906567", "0.43776986", "0.4375169", "0.43596774", "0.43583885", "0.43452197", "0.43307993", "0.43296626", "0.43250766", "0.43201476", "0.43122828", "0.42941567", "0.42869052", "0.42854533", "0.4279998", "0.42799625", "0.42566994", "0.42417422", "0.4241638", "0.4231751", "0.4224773", "0.4224504", "0.42233205", "0.42183506", "0.42123815", "0.42008707", "0.41988066", "0.41974503", "0.41963544", "0.4194708", "0.41925102", "0.41881227", "0.41870782", "0.4182087", "0.41804647", "0.41681227", "0.41658413", "0.41606605", "0.41538462", "0.4152254", "0.41516662", "0.41492087", "0.41442803", "0.4143425", "0.4139931", "0.4139931", "0.4139931", "0.41394058", "0.41394058", "0.41349536", "0.41297352", "0.4126297", "0.41234797", "0.41226822", "0.4122224", "0.411798", "0.41132826", "0.41020715", "0.4079167", "0.4078741", "0.40755737", "0.40715414", "0.40632042", "0.40619084", "0.4060523", "0.4059374" ]
0.5440312
0
Checks if rebase, interactive rebase, merge or revert are in progress.
function getLocalProgressStatus(repo) { let rebaseHeadPromise = utils.progressFileExists(utils.getRebaseHeadPath(repo)); let interactiveRebaseHeadPromise = utils.progressFileExists(utils.interactiveRebaseHeadPath(repo)); let mergeHeadPromise = utils.progressFileExists(utils.getMergeHeadPath(repo)); let revertHeadPromise = utils.progressFileExists(utils.getRevertHeadPath(repo)); // no way yet to see stash in progress. // we'll detect these by checking UU on file status. return Promise.all([rebaseHeadPromise, mergeHeadPromise, revertHeadPromise, interactiveRebaseHeadPromise]).then((heads) => { if (heads[0] || heads[1] || heads[2]) { // there is something in progress! if (heads[0]) { return 'rebase-progress'; } if (heads[1]) { return 'merge-progress'; } if (heads[2]) { return 'revert-progress'; } if (heads[3]) { return 'interactive-rebase-progress'; } } return; }).catch((err) => { console.log(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shouldContinued(){\n // Check one : Any pending setTimeout,setInterval,setImmediate?\n // Check two : Any pending Os tasks? (Like server listening port)\n // Check tree: Any pending long running operations? (Like fs module)\n\n return pendingTimers.length || pendingOSTask.length ||\n pendingOperations.length\n}", "function shouldContinue() {\n return (\n pendingTimers.length || pendingOSTasks.length || pendingOperations.length\n );\n}", "function checkStatus() {\n checkWin();\n checkLose();\n }", "get navigationInProgress() {\n if (!this.regions || !this.regions.length || !this.isElementValid(this.activeRegion)) {\n return false;\n }\n if (!this.lastInputEventIsKeyboard) {\n return false;\n }\n if (this.modalIsOpen || this.popupIsOpen) {\n return false;\n }\n if (!this.isElementValid(this.activeElement)) {\n return false;\n }\n return true;\n }", "async function reconcileComplete() {\n //let the user know reconciliation is complete and ask them if they \n //want to continue using Storyteller\n const options = ['Continue using Storyteller', 'Stop using Storyteller'];\n const selectedOption = await vscode.window.showQuickPick(options, {placeHolder: `Reconcile complete. Do you want to continue using Storyteller?`});\n\n //if the user does not choose an option OR they want to continue using st\n if(!selectedOption || options.indexOf(selectedOption) === 0) {\n //turn on file watching since reconciliation is complete\n turnOnFSWatcherAndTextHandler();\n } else if(options.indexOf(selectedOption) === 1) { //stop using st\n projectManager.stopStoryteller();\n }\n}", "function checkStatus() {\n flushMonitoringOperations(self.queue);\n\n if(self.queue.length == 0) {\n // Get all the known connections\n var connections = self.availableConnections\n .concat(self.inUseConnections)\n .concat(self.nonAuthenticatedConnections)\n .concat(self.connectingConnections);\n\n // Check if we have any in flight operations\n for(var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if(connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections);\n // } else if (self.queue.length > 0 && !this.reconnectId) {\n\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "function checkStatus() {\n flushMonitoringOperations(self.queue);\n\n if (self.queue.length === 0) {\n // Get all the known connections\n var connections = self.availableConnections\n .concat(self.inUseConnections)\n .concat(self.nonAuthenticatedConnections)\n .concat(self.connectingConnections);\n\n // Check if we have any in flight operations\n for (var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if (connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections);\n // } else if (self.queue.length > 0 && !this.reconnectId) {\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "function checkSucess() {\n setTimeout(function() {\n var change = readerOperations[0];\n var submit = readerOperations[1];\n\n if (answered && authenticated &&\n change === 'changeFolder' && submit === 'previousMenu') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function checkStatus() {\n if (self.state === DESTROYED || self.state === DESTROYING) {\n if (typeof callback === 'function') {\n callback();\n }\n\n return;\n }\n\n flushMonitoringOperations(self.queue);\n\n if (self.queue.length === 0) {\n // Get all the known connections\n var connections = self.availableConnections.concat(self.inUseConnections);\n\n // Check if we have any in flight operations\n for (var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if (connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections, { force: false }, callback);\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "function checkStatus() {\n if (self.state === DESTROYED || self.state === DESTROYING) {\n if (typeof callback === 'function') {\n callback();\n }\n\n return;\n }\n\n flushMonitoringOperations(self.queue);\n\n if (self.queue.length === 0) {\n // Get all the known connections\n var connections = self.availableConnections.concat(self.inUseConnections);\n\n // Check if we have any in flight operations\n for (var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if (connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections, { force: false }, callback);\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "function checkFormChangeInProgress(actionYes, actionNo) {\r\n if (waitingForReply) {\r\n showInfo(i18n(\"alertOngoingQuery\"));\r\n return true;\r\n } else if (formChangeInProgress) {\r\n if (multiSelection) {\r\n endMultipleUpdateMode();\r\n return false;\r\n }\r\n if (actionYes) {\r\n if (!actionNo) {\r\n actionNo = function() {\r\n };\r\n }\r\n showQuestion(i18n(\"confirmChangeLoosing\"), actionYes, actionNo);\r\n } else {\r\n showAlert(i18n(\"alertOngoingChange\"));\r\n }\r\n return true;\r\n } else {\r\n if (actionYes) {\r\n actionYes();\r\n }\r\n return false;\r\n }\r\n}", "function checkSucess() {\n setTimeout(function() {\n var change = readerOperations[0];\n var submit = readerOperations[1];\n\n if (answered && authenticated &&\n change === 'changeFolder' && submit === 'repeatMenu') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function isComplete(){\n if(rootCheck.checked && relativeCheck.checked){\n return rootSelAnswer != -1 && modeSelAnswer != -1 && relativeSelAnswer != -1;\n }else if (rootCheck.checked) {\n return rootSelAnswer != -1 != -1 && modeSelAnswer != -1;\n }else if (relativeCheck.checked) {\n return modeSelAnswer != -1 && relativeSelAnswer != -1;\n }else {\n return modeSelAnswer != -1;\n }\n}", "function checkWaiters() {\n if (!callbacks.length) {\n return false;\n }\n for (var i = 0; i < callbacks.length; i++) {\n var context = contexts[i];\n var callback = callbacks[i];\n if (!callback.call(context)) {\n return true;\n }\n }\n return false;\n }", "function checkWaiters() {\n if (!callbacks.length) {\n return false;\n }\n for (var i = 0; i < callbacks.length; i++) {\n var context = contexts[i];\n var callback = callbacks[i];\n if (!callback.call(context)) {\n return true;\n }\n }\n return false;\n }", "function checkWaiters() {\n if (!callbacks.length) {\n return false;\n }\n for (var i = 0; i < callbacks.length; i++) {\n var context = contexts[i];\n var callback = callbacks[i];\n if (!callback.call(context)) {\n return true;\n }\n }\n return false;\n }", "function checkConflicts() {\r\n // checks if a conflict exists\r\n var conflict = false;\r\n for (var i = 0; i < tempNodes.length; i++) {\r\n var tempNode = tempNodes[i];\r\n if (tempNode.checkIncomingLinks() === true) {\r\n conflict = true;\r\n }\r\n }\r\n if (conflict === true) {\r\n // todo conflict alert\r\n // actually conflicts are allowed to show problems\r\n confirmChanges(true);\r\n } else {\r\n confirmChanges(true);\r\n }\r\n }", "function checkSucess() {\n setTimeout(function() {\n var lastOperation = readerOperations.pop();\n\n if (answered && authenticated && lastOperation === 'replay') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function checkQueriesStatus() {\n\t\t\tfor (i=queriesToMonitor.length-1;i>=0;i--) {\n\t\t\t\tvar query = queriesToMonitor[i];\n\t\t\t\tif (query.state===QUERY_STATUS.IN_PROGRESS) {\n\t\t\t\t\tcheckQueryStatus(query);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tqueriesToMonitor.splice(i,1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}", "function checkSucess() {\n setTimeout(function() {\n var change = readerOperations[0];\n var submit = readerOperations[1];\n\n if (answered && authenticated &&\n change === 'changeFolder' && submit === 'submitFolder') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "checkReadyForSubmit(){\n if(this.checkAnswersReady() && this.checkAddressReady() && this.checkMembership()){\n return true;\n }\n else{\n return false;\n }\n }", "function checkSucess() {\n setTimeout(function() {\n var lastOperation = readerOperations.pop();\n\n if (answered && authenticated && lastOperation === 'previousMenu') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "canUndo() {\n return !isNullOrUndefined(this.undoStack) && this.undoStack.length > 0;\n }", "_verifyNoUncommittedChanges() {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n if (this._git.hasUncommittedChanges()) {\n error(red(' ✘ There are changes which are not committed and should be discarded.'));\n return false;\n }\n return true;\n });\n }", "checkLoadCompletion() {\n if (this.loading && this.commentCount >= this.expectedComments) {\n if (process.env.NODE_ENV !== 'production') {\n console.info(\n 'Initial load of ' +\n this.commentCount + ' comment' + pluralise(this.commentCount) +\n ' for ' + this.itemId + ' took ' +\n ((Date.now() - this.startedLoading) / 1000).toFixed(2) + 's'\n )\n }\n\n this.loading = false\n if (this.isFirstVisit) {\n this.firstLoadComplete()\n } else if (SettingsStore.autoCollapse && this.newCommentCount > 0) {\n this.collapseThreadsWithoutNewComments()\n }\n this._storeState()\n }\n }", "checkIsBusy() { \r\n const self = this;\r\n\r\n let isRunning = false;\r\n\r\n self.menus.forEach( menu => {\r\n if ( menu.name in self.actions ) {\r\n isRunning = true;\r\n }\r\n } );\r\n\r\n return isRunning;\r\n }", "canRedo() {\n return !isNullOrUndefined(this.redoStack) && this.redoStack.length > 0;\n }", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function checkSucess() {\n setTimeout(function() {\n var lastOperation = readerOperations.pop();\n\n if (answered && authenticated && lastOperation === 'prev') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "function gameInProgressCheck(level){\n if (1 <= game1.toprow.length + game1.midrow.length + game1.botrow.length){\n if (confirm(\"This will restart your game. Do you wish to continue?\")){\n aiPlayer(level);\n newRound(game1.ai);\n }\n } else {\n aiPlayer(level);\n }\n}", "checkIsReviewPhaseComplete() {\n const {\n challenge,\n } = this.props;\n\n const allPhases = challenge.phases || [];\n\n let isReviewPhaseComplete = false;\n _.forEach(allPhases, (phase) => {\n if (phase.name === 'Review' && !phase.isOpen && moment(phase.scheduledStartDate).isBefore()) {\n isReviewPhaseComplete = true;\n }\n });\n return isReviewPhaseComplete;\n }", "async function isJobRunning(){\n\tconst brandsRef = firestore.collection('brands');\n\tvar snapshot = await brandsRef.where('status', '==', 'progress').get();\n\tif (!snapshot.empty) return true;\n\n\tconst productsRef = firestore.collection('products');\n\tvar snapshot = await productsRef.where('status', '==', 'progress').get();\n\tif (!snapshot.empty) return true;\n\n return false; // we are good to go \t\n}", "isReconciling() {\n let reconciling = false;\n this.backingStatuses.forEach(s => {\n reconciling = reconciling || (s.currentStatus !== s.requestedStatus);\n });\n\n return reconciling;\n }", "function checkSucess() {\n setTimeout(function() {\n var lastOperation = readerOperations.pop();\n\n if (answered && authenticated && lastOperation === 'repeatMenu') {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "async function haveChangesOccurred() {\n const parentPackage = core.getInput('parent-package');\n const versionResult = await exec(`npm view ${parentPackage}@latest version`);\n const version = versionResult.stdout.trim();\n const diffResult = await exec(`git diff --stat v${version}..master frontend-shared/`)\n return diffResult.stdout.length > 0;\n}", "isWork() {\n\t\tlet self=this;\n\t\tlet count=0;\n\t\tfor(let item in self.queue) {\n\t\t\tif(self.queue[item].state!==self.DEFINE.QUEUE_FINISHED&&self.queue[item].state!==self.DEFINE.QUEUE_ERROR)\n\t\t\t\tcount++;\n\t\t}\n\t\treturn count;\n\t}", "function shouldEventLoopContinue(){\n // Check one: Any pending setTimeout, setInterval, setIntermediate?\n // Check two: Any pending OS tasks? (like server listenning to port)\n // Check three: Any pending long running operations? (like fs module)\n\n return pendingTimers.length || pendingOSTasks.length || pendingOperations.length\n}", "function checkStatus() {\n var allDone = true;\n\n for (var _i = 0; _i < layers.length; _i++) {\n if (layers[_i].loaded === false) {\n allDone = false;\n break;\n }\n }\n\n if (allDone) finish();else setTimeout(checkStatus, 500);\n }", "canRedo() {\n return this.undidStack.length != 0;\n }", "function checkIfComplete(){\n\t\tif(isComplete == false){\n\t\t\tisComplete = true;\n\t\t} else {\n\t\t\tplace = ' SEGUNDO ';\n\t\t}\n\t}", "function checkGitStatus( next ) {\n\tchild.execFile( \"git\", [ \"status\" ], function( error, stdout ) {\n\t\tvar onBranch = ( ( stdout || \"\" ).match( /On branch (\\S+)/ ) || [] )[ 1 ];\n\t\tif ( onBranch !== branch ) {\n\t\t\tdie( \"Branches don't match: Wanted \" + branch + \", got \" + onBranch );\n\t\t}\n\t\tif ( /Changes to be committed/i.test( stdout ) ) {\n\t\t\tdie( \"Please commit changed files before attemping to push a release.\" );\n\t\t}\n\t\tif ( /Changes not staged for commit/i.test( stdout ) ) {\n\t\t\tdie( \"Please stash files before attempting to push a release.\" );\n\t\t}\n\t\tnext();\n\t} );\n}", "function _checkComplete() {\n\t\t\tif (!_config) _complete();\n\t\t\tif (!_iscomplete && !_errorState) {\n\t\t\t\tvar incomplete = 0, plugins = model.getPlugins();\n\t\t\t\t\n\t\t\t\tutils.foreach(_config, function(plugin, val) {\n\t\t\t\t\tvar pluginName = utils.getPluginName(plugin),\n\t\t\t\t\t\tpluginObj = plugins[pluginName],\n\t\t\t\t\t\tjs = pluginObj.getJS(),\n\t\t\t\t\t\ttarget = pluginObj.getTarget(),\n\t\t\t\t\t\tstatus = pluginObj.getStatus(); \n\n\t\t\t\t\tif (status == utils.loaderstatus.LOADING || status == utils.loaderstatus.NEW) {\n\t\t\t\t\t\tincomplete++;\n\t\t\t\t\t} else if (js && (!target || parseFloat(target) > parseFloat(jwplayer.version))) {\n\t\t\t\t\t\t_errorState = true;\n\t\t\t\t\t\t_errorMessage = \"Incompatible player version\";\n\t\t\t\t\t\t_complete();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (incomplete == 0) {\n\t\t\t\t\t_complete();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "isInactive() {\n return this.workStatus == 0;\n }", "function checkSucess() {\n setTimeout(function() {\n if (answered && authenticated && readerOperations.length === 0) {\n done();\n } else {\n checkSucess();\n }\n }, asyncDelay);\n }", "async function hasReverted(contractCall) {\n try {\n await contractCall;\n return false;\n } catch (e) {\n return /revert/.test(e.message);\n }\n}", "async function hasReverted(contractCall) {\n try {\n await contractCall;\n return false;\n } catch (e) {\n return /revert/.test(e.message);\n }\n}", "_checkIfComplete() {\n\n\t\tif(this._matchedCards === this.rows*this.cols) {\n\n\t\t\t// Delay for the animations\n\t\t\tsetTimeout(() => {\n\n\t\t\t\talert(`You have scored ${this._score} points`);\n\n\t\t\t\tclearInterval(this._timer);\n\n\t\t\t\tthis.initGame();\n\t\t\t}, 400);\n\t\t}\n\t}", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "get isDirty() {\n return this._additionsHead !== null || this._movesHead !== null ||\n this._removalsHead !== null || this._identityChangesHead !== null;\n }", "function needsControls() {\n for(let taskName in allTasksObject) {\n if(allTasksObject[getHomeName(taskName)]) {\n return true;\n }\n }\n return false;\n }", "function checkActivity() {\n\t//console.log(\"checkActivity initialized\");\n\t// Check for changing tab\n\tchrome.tabs.onActivated.addListener(\n\tfunction(tabs) {\n\t\tcurTabId = tabs.tabId;\n\t\tconsole.log(\"Tab changed - \" + tabs.tabId);\n\t\tupdateInfo();\n\t\t\n\t});\n\t\n\t// Check for tabs updating\n\tchrome.tabs.onUpdated.addListener(\n\tfunction(tabId, changeInfo, tab) {\n\t\tif (tabId == curTabId) {\n\t\t\tconsole.log(\"Tabs updated - \" + tabId);\n\t\t\tupdateInfo();\n\t\t}\n\t});\n\t\n\t// Query info for tabs.query\n\tvar queryInfo = {\n\t\tactive: true,\n\t\tcurrentWindow: true\n\t};\n\t\n\t// check for window focus changing (different window or closing)\n\tchrome.windows.onFocusChanged.addListener(\n\tfunction(windowId) {\n console.log(\"Detected window focus changed\");\n chrome.tabs.query(queryInfo,\n function(tabs) {\n\t\tconsole.log(\"Window or Tab changed\");\n\t\t// Make sure tabs is defined\n\t\tif (typeof tabs[0] != 'undefined') {\n\t\t\tvar tab = tabs[0]; // only one active tab at a time\n\t\t\tcurTabId = tab.id;\n\t\t\tupdateInfo();\n\t\t}\n\t });\n\t});\t\n}", "function isCallInProgress(xmlhttp) {\r\n\tswitch ( xmlhttp.readyState ) {\r\n case 1, 2, 3:\r\n return true;\r\n \tbreak;\r\n default: // Case 4 and 0\r\n return false;\r\n \tbreak;\r\n }\r\n}", "function hasLocalChanges() {\n return !!exec$1(`git status --untracked-files=no --porcelain`);\n}", "function check_if_deployed(e, attempt){\r\n\tif(e){\r\n\t\tcb_deployed(e);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//looks like an error pass it along\r\n\t}\r\n\telse if(attempt >= 15){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//tried many times, lets give up and pass an err msg\r\n\t\tconsole.log('[preflight check]', attempt, ': failed too many times, giving up');\r\n\t\tvar msg = 'chaincode is taking an unusually long time to start. this sounds like a network error, check peer logs';\r\n\t\tif(!process.error) process.error = {type: 'deploy', msg: msg};\r\n\t\tcb_deployed(msg);\r\n\t}\r\n\telse{\r\n\t\tconsole.log('[preflight check]', attempt, ': testing if chaincode is ready');\r\n\t\tchaincode.query.read(['_marbleindex'], function(err, resp){\r\n\t\t\tvar cc_deployed = false;\r\n\t\t\ttry{\r\n\t\t\t\tif(err == null){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//no errors is good, but can't trust that alone\r\n\t\t\t\t\tif(resp === 'null') cc_deployed = true;\t\t\t\t\t\t\t\t\t//looks alright, brand new, no marbles yet\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tvar json = JSON.parse(resp);\r\n\t\t\t\t\t\tif(json.constructor === Array) cc_deployed = true;\t\t\t\t\t//looks alright, we have marbles\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch(e){}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//anything nasty goes here\r\n\r\n\t\t\t// ---- Are We Ready? ---- //\r\n\t\t\tif(!cc_deployed){\r\n\t\t\t\tconsole.log('[preflight check]', attempt, ': failed, trying again');\r\n\t\t\t\tsetTimeout(function(){\r\n\t\t\t\t\tcheck_if_deployed(null, ++attempt);\t\t\t\t\t\t\t\t\t\t//no, try again later\r\n\t\t\t\t}, 10000);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tconsole.log('[preflight check]', attempt, ': success');\r\n\t\t\t\tcb_deployed(null);\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//yes, lets go!\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n}", "canUndo() {\n return this.didStack.length != 0;\n }", "isComplete() {\n return (this.title === this.titleComplete) &&\n (this.labo === this.laboComplete) &&\n (this.univ === this.univComplete) &&\n (this.coAuthor === this.coAuthorComplete)\n }", "checkQuestResets() {\n // Get quests from done (and now since you could have partially done dailies/monthlies)\n\n // Get time now\n\n // Get time after the last reset\n\n // Map through all the quests from the done list and compare to last reset\n\n // if reset has gone by, add the new timestamp to the quests and add them to active quests\n\n // Weekly\n\n // Check if the week has changed since the old timestamp\n }", "function commandHasChanges() {\n if (jumbotronIsOpen) {\n if (document.getElementById(\"commitChanges\").disabled) {\n //no changes\n return false;\n } else {\n //changes\n return true;\n }\n } else {\n return false;\n }\n}", "function checkStatus() {\n \n if (currentQuestionIndex >= questions.length) {\n endGame();\n }\n \n}", "function check_for_completion()\n{\n\tvar $btn_complete = $(\"#btn-complete\"),\n\t\t$tasks = $(\"#project .tasks li.task\"),\n\t\t$complete_tasks = $(\"#project .tasks li.task.complete\"),\n\t\ttask_len = $tasks.length,\n\t\tcomplete_task_len = $complete_tasks.length,\n\t\tis_complete = false;\n\t\t\n\tif(complete_task_len >= task_len)\n\t{\n\t\t$btn_complete.removeClass(\"disable\");\n\t\tis_complete = true;\n\t}\n\telse\n\t{\n\t\t$btn_complete.addClass(\"disable\");\n\t\tis_complete = false;\n\t}\n\t\n\treturn is_complete;\n}", "function checkState3(newState, req) {\n\tvar result = true;\n\tvar i;\n\tvar closedTasks;\n\tif ((newState != 'waiting') && (req != '')) {\n\t\treq = req.split(',');\n\t\tclosedTasks = getClosedTasks();\n\t\tfor (i=0; i<req.length; i++) {\n\t\t\tif (closedTasks.indexOf(req[i]) < 0) {\n\t\t\t\tresult = false;\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\tif (!result) {\n\t\tglobal.alert(\"<?php echo NOTSTARTING; ?>\");\t\n\t}\n\treturn result; \n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function checkStatus() {\n\n }", "checkComplete() {\n let result = true;\n for (let i = 0; i < this.solution.length; i++) {\n result = result && this.solution[i] === this.inputGates[i];\n }\n let oldComplete = this.complete;\n this.complete = result;\n if ((this.complete !== oldComplete) && this.complete) {\n bing.play();\n }\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function checkCompletion() {\n\tif (levelCompleted()) {\n\t\tincreasePoints();\n\t\tinitLevel(currentLevel + 1);\n\t\tinitValues();\n\t\tinitCells();\n\t}\n}", "function RoundIsReadyForReplay()\n{\n\t// Get number of opponents that have submitted their turn\n\tvar opponentsReady = 0;\n\tfor ( var i = 0; i < opponents.length; ++i )\n\t{\n\t\tif ( opponents[ i ].imageSubmitted )\n\t\t\t++opponentsReady;\n\t}\n\n\treturn opponentsReady == opponents.length && _imageSubmitted;\n}", "isComplete() {\n return this.selection != null;\n }", "isComplete() {\n return this.selection != null;\n }", "checkSharing() {\n if(this.state.incomingPods.length !== 0 || this.state.outgoingPods.length !== 0 )\n return true;\n }", "checkAvailability() {\n if(!this.sourceBranch || !this.toBranch) {\n this.title = '';\n this.available = false;\n\n return;\n }\n\n $.getJSON(app.getUri('h-gitter-repo-merge-request-availability', {\n repoId : this.repoId,\n from : this.sourceBranch,\n to : this.toBranch\n }))\n\n .done((response) => {\n this.available = response.available;\n this.title = response.title;\n });\n }", "function tabsReady() {\n // If the user has already interacted, then disable the automatic tab selection behavior\n if(userInteracted) return false;\n\n // If the user isn't logged in, set recsReady as true for conformity\n if( !$rootScope.isUserLogged() ) {\n recsReady = true;\n }\n // console.log('tabsReady', recsReady, promosReady, episodesReady, webReady);\n // Mark all tabs as ready by checking their individual states\n var tabsReady = ( recsReady && promosReady && episodesReady && webReady );\n\n // We don't want one delayed request to cause a blank screen, so show the first\n // tab that is visible on each check.\n $timeout(function(){\n var tabCount = $tabTriggers.length;\n for(var i = 0; i < tabCount; i++) {\n if( $tabTriggers.eq(i).is(':visible') ) {\n // console.log($tabTriggers.eq(i), i);\n showTab(i);\n break;\n } else {\n // console.log('Index', i, 'is hidden');\n }\n }\n });\n\n // Return the value of tabsReady for debugging purposes\n return tabsReady;\n }", "review() {\n if (this.complete) {\n this.complete = !this.complete;\n }\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }", "function activeShutter_haveValidSelection()\r\n\t\t{\r\n\t\t\tif (app.project == null)\r\n\t\t\t{\r\n\t\t\t\tasPal.grp.statusBar.msg.text = activeShutterData.strErrNoProj;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tif ((app.project.activeItem == null) || ((app.project.activeItem != null) && !(app.project.activeItem instanceof CompItem)))\r\n\t\t\t{\r\n\t\t\t\tasPal.grp.statusBar.msg.text = activeShutterData.strErrNoActiveComp;\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}", "_shouldCheckForUpdateOnStart() {\n const isColdStart = !localStorage.getItem('reloaderWasRefreshed');\n return isColdStart &&\n (\n this._options.check === 'everyStart' ||\n (\n this._options.check === 'firstStart' &&\n !localStorage.getItem('reloaderLastStart')\n )\n );\n }", "_waitingForQuiescence() {\n return (\n !isEmpty(this._subsBeingRevived) ||\n !isEmpty(this._methodsBlockingQuiescence)\n );\n }", "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "isComplete() {\n return this.selection.start != null && this.selection.end != null;\n }", "function _checkTriggerScan () {\n if (\n StateManager.comesFrom( StateManager.MOBIDUL ) &&\n !!StateManager.getParams().triggerScan\n ) {\n scan();\n }\n }", "@api hasChanges() {\n console.log('[hasChanges]');\n\n connection.trigger('setActivityDirtyState', true);\n }", "isValidated() {\n\t\tif (this.currentStage.currentState.isValidated()) {\n\t\t\tthis.log(\"Progressing\");\n\t\t\tthis.progressGameMode();\n\t\t}\n\t}" ]
[ "0.5947662", "0.58700025", "0.5604672", "0.5598895", "0.5570141", "0.553819", "0.54924464", "0.53769654", "0.5329995", "0.5329995", "0.5321498", "0.53044164", "0.5281371", "0.52276486", "0.52276486", "0.52276486", "0.5204006", "0.517064", "0.5136094", "0.51291984", "0.5114911", "0.51089686", "0.51027197", "0.50857013", "0.50815624", "0.5078813", "0.5073618", "0.5071561", "0.5071561", "0.5071561", "0.5071561", "0.5071561", "0.50625163", "0.506221", "0.5060945", "0.5060575", "0.5059163", "0.504286", "0.50325596", "0.5028132", "0.5004485", "0.4999501", "0.49992037", "0.49677262", "0.49491084", "0.4942736", "0.4942481", "0.49393758", "0.4932083", "0.4932083", "0.49177355", "0.49170876", "0.49170876", "0.49170876", "0.49170876", "0.49170876", "0.49170876", "0.49160272", "0.48950917", "0.48922664", "0.4891966", "0.48826382", "0.48814836", "0.48639297", "0.48617813", "0.4845581", "0.48394966", "0.48348728", "0.48292258", "0.48290545", "0.48260885", "0.4824891", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.4812952", "0.48075593", "0.47980684", "0.4795253", "0.4795253", "0.47834638", "0.47788534", "0.47617826", "0.47535744", "0.4750176", "0.47422743", "0.4739393", "0.47393245", "0.4736449", "0.4736449", "0.47240147", "0.47218373", "0.47159573" ]
0.0
-1
return; / Identify the cluster and the client/server container: Figure out if the host has a parent lookup the most recent entry in hosts table. Maybe not the most recent... just overwrite them as new relationships are made If yes, figure out parent chain from container to cluster Insert into TIME MAP database using the current timestamp. Insert all parents up to and including cluster Insert rest of config using simple loop. Or maybe insert the whole JSON for the host as one line to save time If NOT: the host doesn't have a parent. Need to determine the cluster how? Step 0: Identify IPs (done above) and subnets of the host Step 1 worst: lookup subnets each cluster is responsible for. If found use that cluster What if several subnets are found belonging to different clusters? Step 2 better: lookup "unknown peers" IPs created when sockets are recorded, and remote is not found. If found, Use cluster of known peer This is bad idea. Sockets could be very remote... strike step 2 Step 3 best: lookup "unknown peers" WWNs created when disk (FC/IB) I/O is recored. If found, use cluster of known peer Only works for storage devices Step 4: If not found use default cluster
function retrieveClusters(currentId){ function data(currentId){//Define closure function to pass current variables to callback. Don't ask how //debugger; return currentId; } var params = []; for (var a = 0; a<hostAttrs[currentId].subnets.length; a++){params.push('?')}; var params = params.join(); var subnetClusterQuery = 'select subnet,cluster_id,parent from subnets where subnet in (' + params + ')'; db.execute(subnetClusterQuery,hostAttrs[currentId].subnets,function(err,result){ var id = data(currentId); //debugger; //currentData.originalString = JSON.parse(currentData.originalString); var cluster = ''; var parent; //debugger; if(err){console.log('Could not select clusters; Error: ',err);debugger} else{ //console.log(clusters); var clusters = result.rows; //debugger; if (clusters.length == 0) { //cluster = 'defaut'; //insertConfig() } else{ for (var z = 0; z < clusters.length; z++){ if (hostAttrs[id].subnets.indexOf(clusters[z]['subnet']) == -1) { var error = new Error('DB result is not in list of subnets...'); //debugger; console.log(error); //console.log(currentData); console.log(result); } else if (clusters[z]['cluster_id'] == null) { //cluster = 'id_default_cluster'; } else{ cluster = clusters[z]['cluster_id']; parent = clusters[z]['parent']; } } } } if (cluster == '') { cluster = defaultClusterId;//'id_cluster_default'; parent = mapRoot;//'viewport' } hostAttrs[id].cluster = {'id':cluster,'parent':parent}; retrieveContainers(id); //debugger; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_cluster_graph_by_host_tag_vsphere65() {}", "function main(user, hostname, hostAndPort)\n{\n\n var result = {};\n if (user.toString() == \"\" || user.toString() == \"#N/A\" ||\n user.empty())\n {\n result[\"error_msg\"] = \"Argument 'user' not specified\"; \n print(result[\"error_msg\"]);\n exit(result);\n }\n \n if (hostname.toString() == \"\" || hostname.toString() == \"#N/A\" ||\n hostname.empty())\n {\n result[\"error_msg\"] = \"Argument 'hostname' not specified\"; \n print(result[\"error_msg\"]);\n exit(result);\n }\n var hosts = cluster::mySqlNodes();\n \n for (idx = 0; idx < hosts.size(); ++idx)\n {\n host = hosts[idx];\n \n map = host.toMap();\n connected = map[\"connected\"];\n if (!connected)\n continue;\n \n isGalera = map[\"isgalera\"];\n \n if (isGalera) {\n localState = map[\"galera\"][\"localstatusstr\"];\n if (localState != \"Synced\")\n continue;\n query = \"SET WSREP_ON=ON;SET SQL_LOG_BIN=ON;\";\n retval2 = executeSqlCommand2(host, query);\n }\n else\n {\n isReadOnly = map[\"readonly\"].toBoolean();\n if (isReadOnly)\n {\n // print(host, \": is not a master\");\n continue;\n }\n query = \"SET SQL_LOG_BIN=ON;\";\n retval2 = executeSqlCommand2(host, query);\n }\n \n executeSqlCommand2(host, query);\n if (user == \"*\")\n user = \"\";\n query = \"DROP USER '\" + user + \"'@'\" + hostname + \"'\";\n //print(query);\n var retval = executeSqlCommand2(host, query);\n print(retval);\n if (!retval[\"success\"])\n result[\"error_msg\"] = retval[\"errorMessage\"];\n else\n result[\"error_msg\"] = \"Dropped user \" + user + \"'@'\" + hostname + \"'\";\n print(host, \":\");\n print(result[\"error_msg\"]);\n if (isGalera)\n {\n query = \"SET WSREP_ON=OFF;SET SQL_LOG_BIN=OFF;\";\n }\n else\n {\n query = \"SET SQL_LOG_BIN=OFF;\";\n }\n executeSqlCommand2(host, query);\n break;\n }\n exit(result);\n}", "gridbasedClientServer () {\n\t\tlet clustersOrder = [];\n\n\t\tlet representType = this.params.representativeType;\n\n\t\tlet numRow = Math.ceil( (this.params.maxY - this.params.minY) / this.params.cellHeight );\n\t\tlet numColumn = Math.ceil( (this.params.maxX - this.params.minX) / this.params.cellWidth );\n\n\t\tlet newClusters = [];\n\t\tlet dataSize = 0;\n\t\tfor ( let [ i, cluster ] of this.dataIn.entries() ) {\n\t\t\tnewClusters[] = {\n\t\t\t\tclusterSize: cluster.n,\n\t\t\t\tn: cluster.n, // original cluster size for cells\n\t\t\t\tvalid: true,\n\t\t\t\trepresent: [ cluster.x, cluster.y ],\n\n\t\t\t\tlatMin: cluster.latMin,\n\t\t\t\tlatMax: cluster.latMax,\n\t\t\t\tlngMin: cluster.lngMin,\n\t\t\t\tlngMax: cluster.lngMax,\n\n\t\t\t\t// original bounding box for a clusetr before merge\n\t\t\t\togLatMin: cluster.latMin,\n\t\t\t\togLatMax: cluster.latMax,\n\t\t\t\togLngMin: cluster.lngMin,\n\t\t\t\togLngMax: cluster.lonMax,\n\n\t\t\t\tchild: -1,\n\t\t\t\tsibling: -1,\n\n\t\t\t\tthumburl: cluster.thumburl,\n\t\t\t\tphotourl: cluster.photourl,\n\t\t\t\tid: cluster.id,\n\t\t\t}\n\t\t\tdataSize += cluster.n;\n\n\t\t\tclustersOrder[i] =\n\t\t\t\tthis.getCellNum( cluster.x, cluster.y, numColumn, numRow );\n\t\t}\n\t\tlet clusters = {\n\t\t\tdataSize: dataSize,\n\t\t\tnumColumn: numColumn,\n\t\t\tnumRow: numRow,\n\t\t\tnumCells: numRow * numColumn,\n\t\t\tclusters: newClusters,\n\t\t}\n\n\t\tthis.handleOverlappedClusters( clusters, clustersOrder, representType );\n\t\tthis.dataOut = this.constructOutputClusters( clusters );\n\t}", "function resolveClusters() {\n \n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "function getClusterData (datacenter) {\n let query = 'SELECT cluster.externalIP,cluster.clusterID,cluster.name ' +\n 'FROM cluster LEFT OUTER JOIN equipmentGroup ON cluster.groupUUID=equipmentGroup.uuid ' +\n 'LEFT OUTER JOIN datacenter ON datacenter.uuid=equipmentGroup.datacenterUUID ' +\n 'WHERE datacenter.name=\"' + datacenter + '\"'\n q(query)\n .then(clusters => {\n totalClusters = clusters.length\n for(var c in clusters) {\n let thisCluster = clusters[c]\n cluster.getHosts(thisCluster)\n .then(newClusterData => {\n masterCollection.clusters.push(newClusterData)\n if (done(null,true)) {\n aggregate(masterCollection)\n }\n })\n .catch(err => {\n console.log('Failed to query cluster: ' + thisCluster + ' with err: ' + err)\n if (done(null, true)) {\n aggregate(masterCollection)\n }\n })\n }\n })\n .catch(err => {\n console.log('ERROR querying db: ' + err)\n process.exit()\n })\n}", "function main(hostlist, section, key, newValue)\n{\n var hosts = cluster::mySqlNodes();\n var result = {};\n \n if (hostlist == #N/A || \n section == #N/A ||\n key == #N/A ||\n newValue == #N/A)\n {\n result[\"success\"] = false;\n\n result[\"errorMessage\"] = \"Wrong arguments.\";\n exit(result);\n }\n \n var changeHostsArray = hostlist.split(\",\");\n var hostName = \"\";\n var found;\n for (i = 0; i < changeHostsArray.size(); i++)\n {\n found = false;\n hostName = changeHostsArray[i];\n \n for (idx = 0; idx < hosts.size(); ++idx)\n {\n host = hosts[idx];\n if( host.hostName() != hostName )\n continue;\n else\n {\n map = host.toMap();\n connected = map[\"connected\"];\n found = true;\n break;\n }\n } \n if (!found)\n continue;\n \n result[i]={};\n result[i][\"result\"] = {};\n result[i][\"result\"][\"hostname\"] = hostName;\n \n if (connected)\n {\n var oldValue = readVariable(host, key);\n if (oldValue == false)\n {\n result[i][\"result\"][\"success\"] = false ; \n result[i][\"result\"][\"errorMessage\"] = host.hostName() + \":\" + \n host.port() + \n \": Variable \" + \n key.toString() + \n \" not found.\";\n continue; \n }\n if (oldValue.toString() == newValue.toString())\n {\n result[i][\"result\"][\"success\"] = true; \n result[i][\"result\"][\"errorMessage\"] = host.hostName() + \":\" + \n host.port() + \n \": Ignoring change of \" + \n key + \", since \" + \n newValue + \n \" = (current \" + \n oldValue + \").\";\n continue;\n }\n result[i][\"result\"][\"restartNeeded\"] = false; \n\n retval = setGlobalVariable2(host,key, newValue);\n if (!retval[\"success\"])\n {\n errorMsg = retval[\"errorMessage\"].toString();\n if (errorMsg.contains(\"read only variable\"))\n {\n result[i][\"result\"][\"success\"] = true; \n result[i][\"result\"][\"restartNeeded\"] = true; \n }\n else\n {\n result[i][\"result\"][\"success\"] = retval[\"success\"];\n result[i][\"result\"][\"errorMessage\"] = retval[\"errorMessage\"];\n print(retval[\"errorMessage\"]);\n return false;\n }\n }\n result[i][\"result\"][\"errorMessage\"] = host.hostName() + \n \":\" + host.port() + \": Setting \" + \n key + \"=\" + newValue + \n \" (previous = \" + oldValue + \") in configuration file.\";\n var config = host.config();\n value = config.setVariable(section, key, newValue);\n config.save();\n result[i][\"result\"][\"success\"] = true; \n }\n else\n {\n result[i][\"result\"][\"errorMessage\"] = host.hostName() + \":\" + \n host.port() + \" : not connected.\";\n result[i][\"result\"][\"success\"] = true; \n }\n }\n return result;\n}", "async function load_clusters() {\n\n}", "function makeCluster(json) {\n var _at = Object(lodash[\"at\"])(json, ['created_by', 'created', 'domain', 'labels', 'local', 'location', 'provider', 'releases', 'state']),\n _at2 = makeCluster_slicedToArray(_at, 9),\n created_by = _at2[0],\n created = _at2[1],\n domain = _at2[2],\n labels = _at2[3],\n local = _at2[4],\n location = _at2[5],\n provider = _at2[6],\n releases = _at2[7],\n state = _at2[8];\n\n var _at3 = Object(lodash[\"at\"])(json, ['app.manifest.extensions.monitoring.disabled', 'app.manifest.extensions.kubernetes.disabled', 'app.manifest.extensions.logs.disabled']),\n _at4 = makeCluster_slicedToArray(_at3, 3),\n monitoringDisabled = _at4[0],\n k8sDisabled = _at4[1],\n logsDisabled = _at4[2];\n\n var _at5 = Object(lodash[\"at\"])(json, ['app.manifest.logo', 'app.manifest.webConfig', 'app.manifest.nodeProfiles']),\n _at6 = makeCluster_slicedToArray(_at5, 3),\n logo = _at6[0],\n webConfigJsonStr = _at6[1],\n profiles = _at6[2];\n\n var _at7 = Object(lodash[\"at\"])(json, ['app.package.name', 'app.package.version']),\n _at8 = makeCluster_slicedToArray(_at7, 2),\n packageName = _at8[0],\n packageVersion = _at8[1];\n\n var _at9 = Object(lodash[\"at\"])(json, 'cluster_state.servers'),\n _at10 = makeCluster_slicedToArray(_at9, 1),\n servers = _at10[0];\n\n var license = makeLicense(json);\n var webConfig = Object(paramUtils[\"b\" /* parseWebConfig */])(webConfigJsonStr);\n var installerUrl = config[\"a\" /* default */].getSiteInstallerRoute(domain);\n var siteUrl = config[\"a\" /* default */].getSiteRoute(domain);\n var apps = Object(lodash[\"keyBy\"])(Object(lodash[\"map\"])(releases, makeRelease), 'id');\n var nodeProfiles = Object(lodash[\"map\"])(profiles, applications[\"c\" /* makeNodeProfile */]);\n return {\n id: domain,\n apps: apps,\n packageName: packageName,\n packageVersion: packageVersion,\n labels: labels,\n location: location,\n logo: logo,\n license: license,\n provider: provider,\n webConfig: webConfig,\n installerUrl: installerUrl,\n siteUrl: siteUrl,\n state: state,\n local: local,\n nodeProfiles: nodeProfiles,\n serverCount: Array.isArray(servers) ? servers.length : 0,\n status: makeStatus(state),\n created: new Date(created),\n createdText: Object(dateUtils[\"b\" /* displayDateTime */])(created),\n createdBy: created_by,\n features: {\n monitoringEnabled: !monitoringDisabled,\n k8sEnabled: !k8sDisabled,\n logsEnabled: !logsDisabled\n }\n };\n}", "function resolveClusters() {\n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "function resolveClusters() {\n // Check for clusters\n findClusters();\n \n // While there are clusters left\n while (clusters.length > 0) {\n \n // Remove clusters\n removeClusters();\n \n // Shift tiles\n shiftTiles();\n \n // Check if there are clusters left\n findClusters();\n }\n }", "function reformat(data, callback){\n\n\tdata.name = \"Cluster root\";\n\n\tdata.children = data.getAvailabilityZones();\n\tdelete data.zones;\n\n\tdata.children.forEach(function(z){\n\t\tz.children = z.getSubnets();\n\t\tdelete z.subnets;\n\t\tz.children.forEach(function(net){\n\t\t\tnet.name = net.netid;\n\t\t\tdelete net.netid;\n\n\t\t\tnet.children = net.getInstances();\n\t\t\tdelete net.instances;\n\n\t\t\tnet.children.forEach(function(inst){\n\t\t\t\tinst.name = inst.id;\n\t\t\t\tdelete inst.id;\n\t\t\t\tinst.children = inst.getNodes();\n\t\t\t\tdelete inst.nodes;\n\n\t\t\t\tinst.children.forEach(function(n){\n\t\t\t\t\tn.name = n.port;\n\t\t\t\t\tn.children = null;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tcallback(data);\n}", "function resolveClusters() {\n //Encontra os Matchs\n findClusters();\n //Enquanto houver Matchs\n while (clusters.length > 0) {\n //Remove-os\n removeClusters();\n //Desce os tiles\n shiftTiles();\n //Verifica a formação de mais\n findClusters();\n }\n }", "getCluster(params) {\n //params.region\n //params.deployment\n //params.cluster\n console.log(\"[DataProvider][getCluster] begin\")\n return Promise.timeout(1)\n .then(() => {\n console.log(\"[DataProvider][getCluster] inside begin\")\n if (params.cluster == 'hello') {\n return {\n name: params.cluster,\n state: \"deploy\",\n status: \"processing\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'deploy'\n }]\n };\n }\n return {\n name: params.cluster,\n state: \"undeploy\",\n status: \"completed\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'deploy'\n }]\n };\n });\n\n }", "function cluster(children){\n\tvar MAX_CHILDREN = 14;\n\tvar result = [];\n\tchildren.sort(function(a, b){\n\t\t\t\tif (a.name < b.name)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (a.name > b.name)\n\t\t\t\t\treturn 1;\n\t\t\t\treturn 0;\n\t\t\t});\n\tif (children.length > MAX_CHILDREN){\n\t\tvar parents = Math.ceil(children.length/MAX_CHILDREN); // get how many parents there will be.\n\t\t\n\t\t\n\n\t\tfor (var i = 0; i < parents; i++){ // for each parent, create its children\n\t\t\tvar group = {};\n\t\t\tvar begin = i*MAX_CHILDREN;\n\t\t\tvar end = begin+MAX_CHILDREN-1;\n\t\t\t\n\t\t\tend = end < children.length ? end : children.length-1; // check to avoid inexistent position\n\t\t\tgroup['name'] = children[begin].name.charAt(0).toUpperCase()+'-'+children[end].name.charAt(0).toUpperCase() + ' Group'; // creates the name for the cluster\n\t\t\tgroup['children'] = children.slice(begin, end+1); //make a copy of the array\n\t\t\tgroup['children'].sort(function(a, b){\n\t\t\t\tif (a.name < b.name)\n\t\t\t\t\treturn -1;\n\t\t\t\tif (a.name > b.name)\n\t\t\t\t\treturn 1;\n\t\t\t\treturn 0;\n\t\t\t});\n\t\t\t// console.log(children[begin].name);\n\t\t\t// console.log(children[end].name);\n\t\t\t// console.log(group);\n\t\t\tresult.push(group);\n\t\t}\n\t\t\n\t\t// Cluster the cluster of parents when there are more than the maximum allowed.\n\t\tif (parents > MAX_CHILDREN){\n\t\t\tresult = cluster(result);\n\t\t}\n\n\t\treturn result;\n\n\n\t}else{\n\t\treturn children;\t\n\t}\n\t\n}", "function main()\n{\n var hosts = cluster::mySqlNodes();\n var advisorMap = {};\n\n for (idx = 0; idx < hosts.size(); ++idx)\n {\n host = hosts[idx];\n map = host.toMap();\n connected = map[\"connected\"];\n var advice = new CmonAdvice();\n print(\" \");\n print(host);\n print(\"==========================\");\n\n if (!connected)\n {\n print(\"Not connected\");\n continue;\n }\n var logbin = \n readVariable(host, \"log_bin\").toString();\n \n severity = Ok; \n if (logbin == \"ON\")\n {\n\n var expire_logs_days = \n readVariable(host, \"expire_logs_days\").toInt(); \n if ( expire_logs_days == 0 ) \n {\n msg = \"Set expire_logs_days in my,cnf.\"\n \" Go to Manage -> Configuration -> Change Parameter,\"\n \" and set expire_logs_days=7 in group mysqld.\";\n justification = \"expire_logs_days is not set.\" \n \" Set it to e.g expire_logs_days=7 to purge logs older than 7\"\n \" days. Otherwise binary logs will grow forever.\";\n severity = Warning;\n }\n else\n {\n msg = \"No advice, no action needed. expire_logs_days is set.\";\n justification = \"expire_logs_days=\" + expire_logs_days + \". Setting is ok.\";\n }\n }\n else\n {\n msg = \"No advice, no action needed.\";\n justification = \"log_bin is not enabled on this server,\"\n \" so advisor does not apply.\";\n }\n advice.setSeverity(severity);\n advice.setHost(host);\n advice.setTitle(TITLE);\n advice.setJustification(justification);\n advice.setAdvice(msg);\n advisorMap[idx]= advice;\n print(advice.toString(\"%E\"));\n }\n return advisorMap;\n}", "function getServers(db) {\n var nodeRect = {'startX': 0, 'x': 0, 'startY': 0, 'y': 0, 'h': 150, 'w': 150, 'offset': 10, 'color': '#FFF'};\n var nodeTitle = {'startX': 0, 'x': 0, 'startY': 0, 'y': 0, 'h': 15, 'w': 0, 'offset': 10, 'color': '#000', 'text': 'none'};\n var rows = 1;\n nodeArr = []; // Reset Servers Array\n nodesUp = []; // Save nodes which are up\n nodesDown = []; // Save nodes which are down\n\n docUrl = cloudant_url + '/_membership'; // CouchDB URL for servers\n ajaxGet(docUrl, parse); // Make Request\n\n function parse(data) { // Parse request\n var myData = JSON.parse(data); // Parse data\n\n var nodes = myData.cluster_nodes.length;\n rows = Math.ceil( ( (nodes+0.5)*(nodeRect.w + nodeRect.offset)) / c.width );\n\n c.width = $('#wrapper-main').width()-20; // Calculate Canvas width based on total width\n c.height = rows*(nodeRect.h+nodeRect.offset); // Change canvas height based on number of rows\n cState = new CanvasState(document.getElementById('nodesCanvas')); // Create new CanvasState\n\n var y = 0; // Count active(all)_nodes\n for(var x in myData.cluster_nodes) {\n if(nodeRect.x + nodeRect.w >= 800) { // Check if yPos need to be changed\n nodeRect.y += nodeRect.h + nodeRect.offset;\n nodeRect.x = nodeRect.startX; // Reset xPos\n rows ++;\n }\n\n if(myData.cluster_nodes[x] == myData.all_nodes[y]) { // Detect if server is down or not\n nodeRect.color = \"#FFF\"; // Boxes Style + Pos\n nodesUp.push(myData.cluster_nodes[x]);\n }else{\n nodeRect.color = \"#CCC\"; // Boxes Style + Pos\n nodesDown.push(myData.cluster_nodes[x]);\n y--;\n\n }\n\n nodeTitle.x = nodeRect.x;\n nodeTitle.y = nodeRect.y;\n nodeTitle.text = myData.cluster_nodes[x];\n\n var currentNode = new Node(x); // Create a new Node Object\n currentNode.addNode({'shape': nodeRect, 'title': nodeTitle}); // Add Rectangle\n var btnStop = new cButton({'x': nodeRect.x+10, 'y': nodeRect.y+nodeRect.h-30, 'color': '#CCC', 'size': 14, 'text': 'Shutdown', 'id': x});\n btnStop.addListener(\"foo\", function(data) {\n docUrl = \"http://\"+nodeArr[data.target.getID()].nodeTitle.text+\":4730/stop\";\n ajaxGet(docUrl, parseIt);\n function parseIt(data) {\n console.log(data);\n }\n });\n currentNode.addButton(btnStop); // Button: x, y, bg-color, textSize, text\n\n var btnStart = new cButton({'x': currentNode.buttons[0].x+ctx.measureText(currentNode.buttons[0].text).width+40, 'y': nodeRect.y+nodeRect.h-30, 'color': '#CCC', 'size': 14, 'text': 'Start', 'id': x})\n btnStart.addListener(\"foo\", function(data) {\n docUrl = \"http://\"+nodeArr[data.target.getID()].nodeTitle.text+\":4730/start\";\n ajaxGet(docUrl, parseIt);\n function parseIt(data) {\n console.log(data);\n }\n });\n currentNode.addButton(btnStart); // Button: x, y, bg-color, textSize, text\n\n nodeArr.push(currentNode); // Save the Node Object\n\n // Change Positions\n nodeRect.x += nodeRect.w + nodeRect.offset;\n y++;\n }\n\n if( (db == '-nodes-') ) {\n for(var count in nodeArr) {\n nodeArr[count].draw(cState); // Draw everything\n }\n }else{\n getDbNumber(db); // Now find the Db and the shards\n }\n }\n }", "function processClusterData(data,status){\n var array = [];\n\n retstuff=JSON.parse(data);\n if(retstuff.rowcount===0 || retstuff.data.length===0)\n return;\n if(retstuff.status===\"ok\"){\n array=retstuff.data;\n queryString = [];\n if (platform === 2)\n var bounds = new plugin.google.maps.LatLngBounds();\n else\n var bounds = new google.maps.LatLngBounds();\n array = _.sortBy(array,\"name\");\n //note that this should go through the array and remove duplicate place_id's\n //and combine event_name/event_description into an array for vendorData.\nvenueDetails=[];\n for(var i=0;i<array.length;i++){\n var placeObject = new placeDetailObject(array[i]);\n //this data is retrieved from process cluster query similar to tier data\n placeObject.index=i;\n copyPlaceData(placeObject);\n\tplaceObject.imageArray=checkImagePlaceObject(placeObject);\n var position2;\n var position=new google.maps.LatLng(array[i].lat,array[i].lng);\n if(platform===2)\n position2 = convert2pluglatLng(position);\n\n /*******************************************/\n //note that unlike google we do not have venueDetails[i].phpos\n //placeObject.marker=marker;\n venueDetails.push(placeObject);\n queryString.push(placeObject.placeId);\n if(platform===2)\n bounds.extend(position2);\n else\n bounds.extend(position);\n }\n //center the map on the data\n//note that this is similar to function in getcluterdata()\n if(displayInfo.staticZoom===true){\n //center on starting 1 and setZoom\n map.setCenter(displayInfo.start);\n map.setZoom(displayInfo.defaultZoom);\n updateSearchBox(displayInfo.start,'#startInput1');\n updateSearchBounds();\n }else{\n if (platform !== 2){\n map.fitBounds(bounds);\n updateSearchBounds();\n }else\n map.moveCamera({\n 'target': bounds\n }, function () {\n updateSearchBounds();\n });\n }\n }\n\n //checkAdditionalVenues(results);\n createVenueList();\n if(displayInfo.touristData)\n touristData=venueDetails;\n //processExtendedData(queryString);\n}", "function network(sanguo, cluster, prevNet, index, expandedClusters) {\r\n var groupMap = {}, // group map\r\n nodeMap = {}, // node map\r\n linkMap = {}, // link map\r\n prevGroupNodes = {}, // previous group nodes\r\n prevGroupCentroids = {}, // previous group centroids\r\n vertices = [], // output nodes\r\n edges = []; // output links\r\n\r\n // process previous nodes for reuse or centroid calculation\r\n if (prevNet) {\r\n prevNet.vertices.forEach(function(node) {\r\n var i = index(node), o;\r\n if (node.size > 0) {\r\n prevGroupNodes[i] = node;\r\n node.size = 0;\r\n } else {\r\n o = prevGroupCentroids[i] || (prevGroupCentroids[i] = {x:0,y:0,count:0});\r\n o.x += node.x;\r\n o.y += node.y;\r\n o.count += 1;\r\n }\r\n });\r\n }\r\n\r\n // Determine nodes\r\n for (var k = 0; k < cluster.vertices.length; ++k) {\r\n var n = cluster.vertices[k],\r\n i = index(n),\r\n l = groupMap[i] || (groupMap[i] = prevGroupNodes[i]) || (groupMap[i] = { group: i, size: 0, vertices: [] });\r\n\r\n if (expandedClusters[i]) {\r\n // the node should be directly visible\r\n nodeMap[n.id] = vertices.length;\r\n vertices.push(n);\r\n if (prevGroupNodes[i]) {\r\n // place new nodes at cluster location (plus jitter)\r\n n.x = prevGroupNodes[i].x + Math.random();\r\n n.y = prevGroupNodes[i].y + Math.random();\r\n }\r\n } else {\r\n // the node is part of a collapsed cluster\r\n if (l.size == 0) {\r\n // if new cluster, add to set and position at centroid of leaf nodes\r\n nodeMap[i] = vertices.length;\r\n vertices.push(l);\r\n if (prevGroupCentroids[i]) {\r\n l.x = prevGroupCentroids[i].x / prevGroupCentroids[i].count;\r\n l.y = prevGroupCentroids[i].y / prevGroupCentroids[i].count;\r\n }\r\n }\r\n l.vertices.push(n);\r\n }\r\n\r\n // Always count group size as we also use it to tweak the force graph strengths/distances\r\n l.size += 1;\r\n n.group_data = l;\r\n }\r\n\r\n for (i in groupMap) {\r\n groupMap[i].edgeCount = 0;\r\n }\r\n\r\n var map = new Map(cluster.vertices.map(vertex => [vertex.id, vertex]));\r\n\r\n // Determine edges\r\n for (k = 0; k < sanguo.edges.length; ++k) {\r\n const e = sanguo.edges[k];\r\n const source = map.get(e.source);\r\n const target = map.get(e.target);\r\n let u = index(source);\r\n let v = index(target);\r\n if (u != v) {\r\n groupMap[u].edgeCount++;\r\n groupMap[v].edgeCount++;\r\n }\r\n u = expandedClusters[u] ? nodeMap[source.id] : nodeMap[u];\r\n v = expandedClusters[v] ? nodeMap[target.id] : nodeMap[v];\r\n if (u === undefined || v === undefined) {\r\n debugger;\r\n }\r\n var i = (u<v ? u+\"|\"+v : v+\"|\"+u),\r\n l = linkMap[i] || (linkMap[i] = {source:u, target:v, size:0});\r\n l.size += 1;\r\n }\r\n for (i in linkMap) { edges.push(linkMap[i]); }\r\n\r\n return { vertices: vertices, edges: edges };\r\n}", "function RedisCluster(startup_nodes,opts,callback) {\n \n if (!(this instanceof RedisCluster)) {\n return new RedisCluster(startup_nodes,opts, callback);\n }\n EventEmitter.call(this);\n \n //accept null cb\n callback = callback || function nif(){};\n\n //accept no options parameters calling\n if(typeof opts == \"function\")\n callback = opts;\n\n\n var that = this;\n this.opts = extend(true, {}, defaults, opts);\n this.startup_nodes = extend(true,[],startup_nodes || [{host:this.opts.host,port:this.opts.port}])\n \n this.slots = []; //slot -> addr key value ()\n this.connections={}; //where we store our open connections\n this.sub_conn = null //special conn for subscription purposes\n\n this.max_connections = this.opts.max_connections; //max allowed conns to cluster\n this.cluster_ready = false;\n this.queue = [];\n \n \n this.on('error',function(err){\n \n // var isClusterDown = /CLUSTERDOWN/.exec(err);\n // if(isClusterDown){\n // this.disconnect(); \n // } //throw err; //cluster is down, cant continue!\n console.log(err.stack); \n callback(err,null); \n \n });\n \n // when we are aware of the cluster and slots sharding\n this.once('ready',function (nodes) {\n console.log('ready');\n that.startup_nodes = nodes;\n callback(null,that);\n that.cluster_ready = true;\n that.flush_queue(); // execute commands received before cluster being connected\n });\n\n //get nodes info and slots mapping!\n this.initialize_slots_cache(function(nodes){\n that.emit('ready',nodes);\n });\n\n}", "function cluster(zonesArr, clustersArr) {\n var _zonesArr = zonesArr || [],\n _clustersArr = clustersArr || [];\n \n var _currentClusterIndex = 0;\n \n var _rectA = { x:0, y:0, width:0, height:0 },\n _rectB = { x:0, y:0, width:0, height:0 };\n \n var _firstElementPushed = false;\n \n // begin loop through all zones\n for (var zai = 0, zal = _zonesArr.length; zai < zal; zai++) {\n // loop through current zone blips\n for (var zi = 0, zil = _zonesArr[zai].length; zi < zil; zi++) {\n // if clusters arr is empty, push the first blip in initial array\n // this will only happen once per cluster call\n if (!_firstElementPushed) {\n _firstElementPushed = true;\n _clustersArr.push([_zonesArr[zai][zi]]);\n } else {\n // iterate through each blip in the current cluster\n // and see if the current blip intersects with blips \n // in current cluster\n \n for (var ci = 0, cil = _clustersArr[_currentClusterIndex].length; ci < cil; ci++) {\n // current blip in the current zone arr\n // we assume we have only center (from element state object)\n _rectA = { x:_zonesArr[zai][zi].state.center.x - (_zonesArr[zai][zi].state.width / 2), y:_zonesArr[zai][zi].state.center.y - (_zonesArr[zai][zi].state.height / 2), width:_zonesArr[zai][zi].state.width, height:_zonesArr[zai][zi].state.height},\n // this is the current blip in the current cluster arr\n _rectB = { x:_clustersArr[_currentClusterIndex][ci].state.center.x - (_clustersArr[_currentClusterIndex][ci].state.width / 2), y:_clustersArr[_currentClusterIndex][ci].state.center.y - (_clustersArr[_currentClusterIndex][ci].state.height / 2), width:_clustersArr[_currentClusterIndex][ci].state.width, height:_clustersArr[_currentClusterIndex][ci].state.height };\n\n \n if (notIntersecting(_rectA, _rectB)) {\n // push to new cluster arr\n _currentClusterIndex ++;\n _clustersArr.push([_zonesArr[zai][zi]]);\n \n // we need to update cached arr length\n cil = _clustersArr[_currentClusterIndex].length;\n } else {\n // push to current cluster arr\n _clustersArr[_currentClusterIndex].push(_zonesArr[zai][zi]);\n break;\n }\n }\n }\n }\n }\n}", "async function createClusterWithEncryptionAtHost() {\n const subscriptionId = process.env[\"HDINSIGHT_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"HDINSIGHT_RESOURCE_GROUP\"] || \"rg1\";\n const clusterName = \"cluster1\";\n const parameters = {\n properties: {\n clusterDefinition: {\n configurations: {\n gateway: {\n \"restAuthCredential.isEnabled\": true,\n \"restAuthCredential.password\": \"**********\",\n \"restAuthCredential.username\": \"admin\",\n },\n },\n kind: \"Hadoop\",\n },\n clusterVersion: \"3.6\",\n computeProfile: {\n roles: [\n {\n name: \"headnode\",\n hardwareProfile: { vmSize: \"Standard_DS14_v2\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 2,\n },\n {\n name: \"workernode\",\n hardwareProfile: { vmSize: \"Standard_DS14_v2\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 3,\n },\n {\n name: \"zookeepernode\",\n hardwareProfile: { vmSize: \"Standard_DS14_v2\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 3,\n },\n ],\n },\n diskEncryptionProperties: { encryptionAtHost: true },\n osType: \"Linux\",\n storageProfile: {\n storageaccounts: [\n {\n name: \"mystorage.blob.core.windows.net\",\n container: \"default8525\",\n enableSecureChannel: true,\n isDefault: true,\n key: \"storagekey\",\n },\n ],\n },\n tier: \"Standard\",\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new HDInsightManagementClient(credential, subscriptionId);\n const result = await client.clusters.beginCreateAndWait(\n resourceGroupName,\n clusterName,\n parameters\n );\n console.log(result);\n}", "function infrastructure_info(host, type) {\r\n\tget_host(host, function(err, result) {\r\n\t\t//If Error\r\n\t\tif(err){\r\n\t\t\tconsole.log(\"ERROR\");\r\n\t\t\tconsole.log(err);\r\n\t\t}\r\n\t\t//Success\r\n\t\telse{\r\n\t\t\t//just the websphere information(HTTPS and WAS)\r\n\t\t\tvar info = result['data']['nodes'][host];\r\n\t\t\t\r\n\t\t\tvar row = \"<tr id=\\\"INSTANCE_HOST\\\" class=\\\"COLOR\\\"><td>INSTANCE</td><td>HOST</td><td id=\\\"INSTANCE_HOST_status\\\">STATUS</td><td id=\\\"INSTANCE_HOST_date\\\">DATE</td></tr>\";\r\n\t\t\t\r\n\t\t\tfor (var trigram in info) {\r\n\t\t\t\t//status is not a trigram :)\r\n\t\t\t\tif (trigram != \"status\") {\r\n\t\t\t\t\tfor (var instance in info[trigram]) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (instance.startsWith(type)) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//change line\r\n\t\t\t\t\t\t\tif($('#' +instance+\"_\"+host).length) {\r\n\t\t\t\t\t\t\t\t$(\"#\"+instance+\"_\"+host+\"_status\").text(info[trigram][instance]['status']);\r\n\t\t\t\t\t\t\t\t$(\"#\"+instance+\"_\"+host+\"_date\").text(get_seconds_now(result['date']));\r\n\r\n\t\t\t\t\t\t\t\t//STOPPED or NOT\r\n\t\t\t\t\t\t\t\tif(info[trigram][instance]['status'] == \"STOPPED\") {\r\n\t\t\t\t\t\t\t\t\t$('#' +instance+\"_\"+host).attr('class', 'danger');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse{\r\n\t\t\t\t\t\t\t\t\t$('#' +instance+\"_\"+host).attr('class', 'success');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//add line\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tvar new_row = row;\r\n\t\t\t\t\t\t\t\tnew_row = new_row.split(\"INSTANCE\").join(instance);\r\n\t\t\t\t\t\t\t\tnew_row = new_row.split(\"HOST\").join(host);\r\n\t\t\t\t\t\t\t\tnew_row = new_row.split(\"STATUS\").join(info[trigram][instance]['status']);\r\n\t\t\t\t\t\t\t\tnew_row = new_row.split(\"DATE\").join(get_seconds_now(result['date']));\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t//STOPPED or NOT\r\n\t\t\t\t\t\t\t\tif (info[trigram][instance]['status'] == \"STOPPED\") {\r\n\t\t\t\t\t\t\t\t\tnew_row = new_row.split(\"COLOR\").join('danger');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tnew_row = new_row.split(\"COLOR\").join('success');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t$('#'+type+'-'+host+'_info tr:last').after(new_row);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n)}", "function fixCluster() {\n if (g_clusterTimer) {\n window.clearTimeout(g_clusterTimer);\n }\n g_clusterTimer = window.setTimeout(function() {\n if (g_first) {\n markerclusterer.repaint();\n g_first = false;\n\t // hide the loading animation\n onReady(function () {\n show('loading', false);\n });\n }\n }, 500);\n}", "function test_bottleneck_cluster() {}", "buildNodes(data) {\n var id_counter = 1;\n var nodes = [];\n\n for (var i = 0; i < data.length; i++) {\n //by paulio: qui chiamerei una funzia che genera un candidato, tipo buildCandidate(data[i]), che costruisce un candidato e poi chiama checkIfNodeIsNotPresent su nodes e il candidato, perchè cosi fa abba cagare\n if (data[i]['type'] == \"jdbc\") {\n var candidate = {\n \"name\": data[i]['db.type'],\n \"type\": \"Database\",\n \"id\": id_counter\n }\n if (this.checkIfNodeIsNotPresent(this.graph.getNodes(), candidate)) {\n // nodes.push(candidate);\n this.graph.addNode(candidate);\n id_counter++;\n }\n\n }\n\n if (data[i]['type'] == \"http\") {\n var candidate = {\n \"name\": data[i][\"application\"],\n \"type\": \"Server\",\n \"id\": id_counter\n }\n if (this.checkIfNodeIsNotPresent(this.graph.getNodes(), candidate)) {\n this.graph.addNode(candidate);\n id_counter++;\n }\n }\n }\n return this.graph.getNodes();\n\n }", "function groupNodeToParent(){\n\t\tvar filterNodesReturn = filterNodes();\n\t\tvar nodesKeepAfterFilter = filterNodesReturn[\"nodesKeepAfterFilter\"];\n\t\t// console.log(\"begin groupNodeToParent\");\n\t\tvar newNodeArray = {};\n\t\tvar newConnectionInfo = {};\n\t\tnewNodeArray[0] = nodesKeepAfterFilter[0];\n\t newConnectionInfo[0] = connectionInfo[0];\n\t\tvar treeLevels = Object.keys(nodesKeepAfterFilter);\n\n\t\ttreeLevels.forEach(function(treeLev, idx){\n\t\t\tif(idx > 0){ //skip root\n\t\t\t\tnewNodeArray[treeLev] = {};\n\t\t\t\tnewConnectionInfo[treeLev] = {};\n\t\t\t\tvar lmAtLevelList = Object.keys(nodesKeepAfterFilter[treeLev]);\n\t\t\t\tvar currentTreeLev = treeLev;\n\t\t\t\tlmAtLevelList.forEach(function(currentLMAtLevel){\n\t\t\n\t\t\t\t\tvar mySpecialID = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"specialID\"];\n\n\t //taking care of the easy case first, which has more than one parents\n\t if(nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"].length > 1){\n\n\n\t var canMergeBool = false;\n\t var parentSameAsMeLevel;\n\t if(nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"].indexOf(currentLMAtLevel) > -1){\n\t \t//so one of my parentspecialid is the same as me\n\t \tvar otherParentLevel = [];\n\t \t\n\t \tvar parentsList = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"];\n\t \tparentsList.forEach(function(parSpcID){\n\t\t \tfor(var tIndex = parseInt(currentTreeLev) - 1; tIndex >= 0; tIndex--){\n\t\t \t\tvar spcIDAtThisLevel = Object.keys(newNodeArray[tIndex]);\n\t\t \t\tif(currentLMAtLevel == \"CLM3\"){\n\t\t \t\t\t// console.log(spcIDAtThisLevel, tIndex);\n\t\t \t\t}\n\t\t \t\tif(spcIDAtThisLevel.indexOf(parSpcID) > -1){\n\t\t \t\t\tif(parSpcID == currentLMAtLevel){\n\t\t \t\t\t\tparentSameAsMeLevel = tIndex;\n\t\t \t\t\t}\n\t\t \t\t\telse{\n\t\t \t\t\t\tif(otherParentLevel.indexOf(parSpcID) == -1){\n\t\t \t\t\t\t\totherParentLevel.push(tIndex);\n\t\t \t\t\t\t}\n\t\t \t\t\t}\n\t\t \t\t\tbreak;\n\t\t \t\t}\n\t\t \t}\n\t \t}); // end of parentsList\n\n\t \tif(otherParentLevel.indexOf(parentSameAsMeLevel) == -1 && typeof(parentSameAsMeLevel) != 'undefined'){\n\t \t\tvar largestBool = true;\n\t \t\totherParentLevel.forEach(function(lev){\n\t \t\t\tif(lev >= parentSameAsMeLevel){\n\t \t\t\t\tlargestBool = false;\n\t \t\t\t}\n\t \t\t})\n\t \t\tcanMergeBool = largestBool;\n\t \t}\n\t \telse{\n\t \t\tcanMergeBool = false;\n\t \t}\n\n\t }\n\n\t if(canMergeBool){\n\t \tvar currentConnectionInfo = connectionInfo[currentTreeLev][currentLMAtLevel];\n currentConnectionInfo.forEach(function(connInfo){\n \tif(connInfo[\"specialID\"] != connInfo[\"parentSpecialID\"]){\n\t newConnectionInfo[parentSameAsMeLevel][currentLMAtLevel].push(connInfo);\n \t}\n\t });\n\n var currentNode = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel];\n currentNode[\"uniqueID\"].forEach(function(nodeID){\n \tnewNodeArray[parentSameAsMeLevel][currentLMAtLevel]['uniqueID'].push(nodeID);\n })\n\n\t }\n\t else{\n\t \tnewNodeArray[currentTreeLev][currentLMAtLevel] = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel];\n\t \tnewConnectionInfo[currentTreeLev][currentLMAtLevel] = connectionInfo[currentTreeLev][currentLMAtLevel];\n\t }\n\n\t }\n\n\t //if only have one parent, but parent lmid is not the same as current node lmid\n\t else if( nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"].length == 1 &&\n\t \t\t nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"][0] != currentLMAtLevel){\n\t \tnewNodeArray[currentTreeLev][currentLMAtLevel] = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel];\n\t newConnectionInfo[currentTreeLev][currentLMAtLevel] = connectionInfo[currentTreeLev][currentLMAtLevel];\n\t }\n\n\t //if only have one parent and parent lmid is same as current node lmid\n\t else if(nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"].length == 1 &&\n\t \t\t nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel][\"parentSpecialID\"][0] == currentLMAtLevel){\n\t \t//look for the node with same lm from previous level\n\t \tfor(var i = currentTreeLev -1; i >= 0; i--){\n\t \t\tvar previousLevel = i;\n\n\t var prevLevelLM = Object.keys(newNodeArray[previousLevel]);\n\n\t //check if this prev level has the LM we want\n\t if(prevLevelLM.indexOf(currentLMAtLevel) > -1){\n\n\t var currentNode = nodesKeepAfterFilter[currentTreeLev][currentLMAtLevel];\n\t currentNode[\"uniqueID\"].forEach(function(nodeID){\n\t \tnewNodeArray[previousLevel][currentLMAtLevel]['uniqueID'].push(nodeID);\n\t })\n\n\t //found the node we want, break out of the loop\n\t return;\n\t }\n\t else{\n\t //continue with the for loop\n\t }\n\t \t} //end of for loop\n\t }\n\n\t\t\t\t}); //end of lmAtLevelList\n \t\t\t}\n\n\t\t}); //end of treeLevels\n\t\t// console.log(\"finish groupNodeToParent\");\n\t\t// console.log(newNodeArray);\n\t\treturn {\"newNodeArray\" : newNodeArray, \"newConnectionInfo\" : newConnectionInfo};\n\t}", "get Clustering() {}", "function packageHierarchy_lp(classes,initial)\n{\n\tvar map = {};\t\t//Create blank object\n \n\tfunction find(name, data) \n\t{\n\t\tvar lp_id = name.replace( /^\\D+/g, ''); // replace all leading non-digits with nothing\n\t\tvar pe_id = Math.floor(lp_id/Math.ceil(num_lp/num_pe));\n\t\tif(selected_pes_array[pe_id] != -1)\n {\n\t\t\tvar node = map[name];\t//Check if name is in our map and assign it to variable \"node\"\n\t\t\tvar i;\n\t\t\tif (!node) //IF node for given name currently does not exist in our map then create it\n\t\t\t{\n\t\t\t\tnode = map[name] = data || {name: name, children: []};\n\t\t\t\tif (name.length) \n\t\t\t\t{\n\t\t\t\t\tif(!initial)\n\t\t\t\t\t{\n\t\t\t\t\t\tdelete map[name].connections;\n\t\t\t\t\t\tdelete node.connections;\n\t\t\t\t\t\tmap[name].connections = [];\n\t\t\t\t\t\tnode.connections = [];\n \n\t\t\t\t\t\tfor (var ii = 0; ii < selected_pes.length; ii++){\n\t\t\t\t\t\t\tif(data.connections[0])\n\t\t\t\t\t\t\t{\n var tempnum = data.connections[0].replace( /^\\D+/g, ''); // replace all leading non-digits with nothing\n var tempnum1 = Math.floor(tempnum/Math.ceil(num_lp/num_pe)); //convert to PE ID\n\t\t\t\t\t\t\t\tvar tempnum2 = selected_pes[ii].key.replace( /^\\D+/g, ''); // replace all leading non-digits with nothing\n\t\t\t\t\t\t\t\tif(tempnum1 == tempnum2)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t \t\tnode.connections.push.apply(node.connections,data.connections);\n\t\t\t\t\t\t \t\tnode.messages.push(data.num_messages);\n\t\t\t\t\t\t \t\tnode.num_messages += data.num_messages;\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\n\n\t\t\t\t\tnode.parent = find(name.substring(0, i = name.lastIndexOf(\".\")));\n\t\t\t\t\tnode.parent.children.push(node);\n\t\t\t\t\tnode.key = name.substring(i + 1);\n\t\t node.messages = [];\n\t\t node.messages[0] = data.num_messages;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse //If a node for given name currently exists in our map\n\t\t\t{\n\t\t\t\tif(name.length)\n {\n if(initial)\n {\n node.connections.push.apply(node.connections,data.connections);\n node.messages.push(data.num_messages);\n node.num_messages += data.num_messages;\n }\n else\n {\n for (var ii = 0; ii < selected_pes.length; ii++){\n if(data.connections[0])\n {\n var tempnum = data.connections[0].replace( /^\\D+/g, ''); // replace all leading non-digits with nothing\n var tempnum1 = Math.floor(tempnum/Math.ceil(num_lp/num_pe)); //convert to PE ID\n var tempnum2 = selected_pes[ii].key.replace( /^\\D+/g, ''); // replace all leading non-digits with nothing\n if(tempnum1 == tempnum2)\n {\n node.connections.push.apply(node.connections,data.connections);\n node.messages.push(data.num_messages);\n node.num_messages += data.num_messages;\n }\n }\n }\n }\n\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node;\n\t\t}\n\t}\n\n\tclasses.forEach(\n\t\tfunction(d) \n\t\t{\n\t\t\tfind(d.name, d);\n\t\t}\n\t);\n\n\treturn map[\"\"];\n}", "function parseDynamicData(data) {\n if (!requireJSONElements(\n data, ['hosts'],\n 'data', 'data.json')) {\n return false;\n }\n \n for (var i in data.hosts) {\n var host = data.hosts[i];\n \n // validate object\n if (!requireJSONElements(\n host, ['name','state'],\n 'data.hosts['+i+']','data.json')) {\n return false;\n }\n \n // create host.sessions from hosts.users\n if ('users' in host) {\n host.sessions = [];\n var sess = '';\n var lastSess = null;\n host.users.sort(function(a,b) {\n return a.netid.localeCompare(b.netid);\n }).map(function(user) {\n var currSess = {\n name: user.netid,\n sessions: [],\n header: \n (user.folderExists ? '<a style=\"font-weight:bold\" href=\"/u/' +\n user.netid + '/\">' + dutf8(user.name) + '</a>' :\n b(dutf8(user.name)) + ' (no user directory)')\n };\n if (lastSess != null) {\n if (lastSess.name == user.netid) {\n currSess = lastSess;\n } else {\n host.sessions.push(lastSess);\n }\n }\n currSess.sessions.push(\n parseSession(user.tty, user.host) +\n ' since ' + dt(new Date(user.loginTime*1000)));\n\n lastSess = currSess;\n });\n if (lastSess != null) {\n host.sessions.push(lastSess);\n }\n if (host.sessions.length > 0) {\n sess = '<ul>' + host.sessions.map(function (sessObj) {\n return '<li>' + sessObj.header + '<ul>' + sessObj.sessions.map(function (userObj) {\n return '<li>' + userObj + '</li>';\n }).join('') + '</ul></li>';\n }).join('') + '</ul>';\n }\n host.sessStr = sess;\n lastSess = null;\n }\n\n // set host.color\n host.color = (host.state == 'Up' ? 'green' :\n (host.state == 'Down' ? 'red' : '#aa0'));\n\n // copy to global object here\n var hostsObj = getHostByName(host.name);\n if (hostsObj == null) {\n hosts.push(host);\n } else {\n copyJSONElements(host, hostsObj,\n ['state','color','icon','lastChange','lastCheck','os','cpu','mem','swap_mem','main_mem',\n 'users','sessions','sessStr','disks','prText','prModel','inks','trays']);\n hostsObj.ready = true;\n }\n\n // set state on layout\n var state = host.state;\n if ('icon' in host) {\n state = img('netsp/img/' + host.icon + '.png', host.icon, 12, 12) + ' ' + state;\n }\n if ('lastChange' in host) {\n state += ' ' + dtSince(new Date(host.lastChange*1000), false, true);\n }\n if ('sessions' in host && host.sessions.length) {\n state += '<br/>' + host.sessions.length + ' user' +\n (host.sessions.length == 1 ? '' : 's');\n }\n if ('trays' in host && host.trays.length) {\n if (host.trays.map(function(tray) {\n return (tray.state == 'OK');\n }).indexOf(true) < 0) {\n state += '<br/>no paper';\n }\n }\n if ('inks' in host && host.inks.length) {\n host.inks.map(function(ink) {\n if (ink.amount < 10) {\n state += '<br/>low ' + ink.color.toLowerCase();\n }\n });\n }\n\n $('#status_'+host.name).html(state);\n var ctx = $('#host_'+host.name+' p');\n if ('icon' in host) {\n //.html(img(host.icon + '.png', host.icon, 12, 12) + ' ' + host.name);\n } else {\n //.text(host.name);\n }\n var colorChanged = (ctx.attr('data-color') != host.color);\n ctx.attr('data-color',host.color);\n if (colorChanged) {\n ctx.animate({'opacity':.5},500,'swing', function () {\n $(this).css({'color':$(this).attr('data-color')});\n $(this).animate({'opacity':1},500,'swing');\n });\n }\n }\n\n return true;\n }", "function get_prototypes(t2_clusters, connection, callback) {\n mk_hash_dict(t2_clusters, connection, (err, hash_dict) => {\n if (err) {\n callback(err)\n } else {\n const select_query = 'SELECT * FROM ' + userid_table;\n connection.query(select_query, (err, result, fields) => {\n if (err) {\n callback(err)\n } else {\n const cluster_data = {}\n for (let i = 0; i < t2_clusters.length; i ++) {\n let base = []\n let cluster_userids = new Set()\n base.push(cluster_userids)\n base.push(0)\n cluster_data[i] = base\n }\n\n for (r of result) {\n let r_hash = r['hash']\n if (r_hash in hash_dict) {\n let r_cluster = hash_dict[r_hash]\n let curr_data = cluster_data[r_cluster]\n curr_data[0].add(r['userid'])\n curr_data[1] += r['num_messages']\n cluster_data[r_cluster] = curr_data\n }\n }\n const prototypes = []\n for (let i = 0; i < t2_clusters.length; i ++) {\n let prototype = clone(t2_clusters[i][0])\n delete prototype['essence']\n delete prototype['hash']\n let data = cluster_data[i]\n prototype['userids'] = data[0].size\n prototype['num_messages'] = data[1]\n prototypes.push(prototype)\n }\n callback(null, prototypes)\n }\n })\n }\n })\n}", "setAncestors() {\n\t\t \tvar thisDataSource = this;\n\t\t \tvar addedClient = false;\n\t\t \t_.forEach(thisDataSource.nodes, function(node) {\n\t\t \t\tnode.ancestors = thisDataSource.ancestors_struct[node.id] || [];\n\t\t \t\tif (_.isEmpty(node.ancestors) === false) {\n\t\t \t\t\tnode.parent = node.ancestors[0];\n\t\t \t\t} else {\n\t\t \t\t\tif (_.includes(thisDataSource.children_struct.topLevel, node.id) == false) {\n\t\t \t\t\t\t//container has no parent\n\t\t \t\t\t\t//adding to client\n\t\t \t\t\t\tnode.ancestors.push(\"client\");\n\t\t \t\t\t\tthisDataSource.ancestors_struct[node.id] = [\"client\"];\n\t\t \t\t\t\tif (addedClient === false) {\n\t\t \t\t\t\t\taddedClient = true;\n\t\t\t \t\t\t\tthisDataSource.children_struct.topLevel.push(\"client\");\n\t\t \t\t\t\t\tthisDataSource.children_struct['client'] = [];\n\t\t \t\t\t\t}\n\t\t \t\t\t\tthisDataSource.children_struct['client'].push(node.id);\n\t\t\t \t\t}\n\t\t \t\t}\n\t\t \t})\n\t\t }", "function computeItemNode() {\n items.forEach(function (item) {\n item.node.forEach(function (node) {\n var node_id = node;\n node = {};\n node.cluster = nodes[node];\n })\n item.start.node_id = item.start.node;\n item.start.node = nodes[item.start.node_id];\n })\n\n }", "async function patchACluster() {\n const subscriptionId = \"00000000-0000-0000-0000-000000000000\";\n const resourceGroupName = \"resRg\";\n const clusterName = \"myCluster\";\n const parameters = {\n eventStoreServiceEnabled: true,\n nodeTypes: [\n {\n name: \"nt1vm\",\n applicationPorts: { endPort: 30000, startPort: 20000 },\n clientConnectionEndpointPort: 19000,\n durabilityLevel: \"Bronze\",\n ephemeralPorts: { endPort: 64000, startPort: 49000 },\n httpGatewayEndpointPort: 19007,\n isPrimary: true,\n vmInstanceCount: 5,\n },\n {\n name: \"testnt1\",\n applicationPorts: { endPort: 2000, startPort: 1000 },\n clientConnectionEndpointPort: 0,\n durabilityLevel: \"Bronze\",\n ephemeralPorts: { endPort: 4000, startPort: 3000 },\n httpGatewayEndpointPort: 0,\n isPrimary: false,\n vmInstanceCount: 3,\n },\n ],\n reliabilityLevel: \"Bronze\",\n tags: { a: \"b\" },\n upgradeMode: \"Automatic\",\n upgradePauseEndTimestampUtc: new Date(\"2021-06-25T22:00:00Z\"),\n upgradePauseStartTimestampUtc: new Date(\"2021-06-21T22:00:00Z\"),\n upgradeWave: \"Wave\",\n };\n const credential = new DefaultAzureCredential();\n const client = new ServiceFabricManagementClient(credential, subscriptionId);\n const result = await client.clusters.beginUpdateAndWait(\n resourceGroupName,\n clusterName,\n parameters\n );\n console.log(result);\n}", "async function createClusterWithAvailabilityZones() {\n const subscriptionId = process.env[\"HDINSIGHT_SUBSCRIPTION_ID\"] || \"subId\";\n const resourceGroupName = process.env[\"HDINSIGHT_RESOURCE_GROUP\"] || \"rg1\";\n const clusterName = \"cluster1\";\n const parameters = {\n properties: {\n clusterDefinition: {\n configurations: {\n \"ambari-conf\": {\n \"database-name\": \"{ambari database name}\",\n \"database-server\": \"{sql server name}.database.windows.net\",\n \"database-user-name\": \"**********\",\n \"database-user-password\": \"**********\",\n },\n gateway: {\n \"restAuthCredential.isEnabled\": true,\n \"restAuthCredential.password\": \"**********\",\n \"restAuthCredential.username\": \"admin\",\n },\n \"hive-env\": {\n hive_database: \"Existing MSSQL Server database with SQL authentication\",\n hive_database_name: \"{hive metastore name}\",\n hive_database_type: \"mssql\",\n hive_existing_mssql_server_database: \"{hive metastore name}\",\n hive_existing_mssql_server_host: \"{sql server name}.database.windows.net\",\n hive_hostname: \"{sql server name}.database.windows.net\",\n },\n \"hive-site\": {\n \"javax.jdo.option.ConnectionDriverName\": \"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\n \"javax.jdo.option.ConnectionPassword\": \"**********!\",\n \"javax.jdo.option.ConnectionURL\":\n \"jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0\",\n \"javax.jdo.option.ConnectionUserName\": \"**********\",\n },\n \"oozie-env\": {\n oozie_database: \"Existing MSSQL Server database with SQL authentication\",\n oozie_database_name: \"{oozie metastore name}\",\n oozie_database_type: \"mssql\",\n oozie_existing_mssql_server_database: \"{oozie metastore name}\",\n oozie_existing_mssql_server_host: \"{sql server name}.database.windows.net\",\n oozie_hostname: \"{sql server name}.database.windows.net\",\n },\n \"oozie-site\": {\n \"oozie.db.schema.name\": \"oozie\",\n \"oozie.service.JPAService.jdbc.driver\": \"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\n \"oozie.service.JPAService.jdbc.password\": \"**********\",\n \"oozie.service.JPAService.jdbc.url\":\n \"jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0\",\n \"oozie.service.JPAService.jdbc.username\": \"**********\",\n },\n },\n kind: \"hadoop\",\n },\n clusterVersion: \"3.6\",\n computeProfile: {\n roles: [\n {\n name: \"headnode\",\n hardwareProfile: { vmSize: \"standard_d3\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 2,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n {\n name: \"workernode\",\n hardwareProfile: { vmSize: \"standard_d3\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 2,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n ],\n },\n osType: \"Linux\",\n storageProfile: {\n storageaccounts: [\n {\n name: \"mystorage\",\n container: \"containername\",\n enableSecureChannel: true,\n isDefault: true,\n key: \"storage account key\",\n },\n ],\n },\n },\n zones: [\"1\"],\n };\n const credential = new DefaultAzureCredential();\n const client = new HDInsightManagementClient(credential, subscriptionId);\n const result = await client.clusters.beginCreateAndWait(\n resourceGroupName,\n clusterName,\n parameters\n );\n console.log(result);\n}", "function test_crosshair_op_cluster_vsphere65() {}", "applyClustering () {\n\t\tswitch ( this.params.type ) {\n\t\t\tcase \"distancebased\":\n\t\t\t\tthis.distanceBasedClustering2();\n\t\t\t\tbreak;\n\t\t\tcase \"gridbased\":\n\t\t\t\tthis.gridBasedClustering();\n\t\t\t\tbreak;\n\t\t\tcase \"pnn\":\n\t\t\t\tthis.pnnClustering();\n\t\t\t\tbreak;\n\t\t\tcase \"gridbasedClientServer\":\n\t\t\t\tthis.gridbasedClientServer(); // for both: serverClient and Server side clustering\n\t\t\t\tbreak;\n\t\t\tcase \"clutter_noClustering\":\n\t\t\t\tthis.clutterNoClustering();\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn this.dataOut;\n\t}", "function getLowestCommonAncestor(instA, instB) {\n\t !('_hostNode' in instA) ? ({\"AUTH0_CLIENT_ID\":\"vFL9QUjpiy8LmqgykJVXRhk7dYVvdEip\",\"AUTH0_DOMAIN\":\"edcheung.auth0.com\"}).NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;\n\t !('_hostNode' in instB) ? ({\"AUTH0_CLIENT_ID\":\"vFL9QUjpiy8LmqgykJVXRhk7dYVvdEip\",\"AUTH0_DOMAIN\":\"edcheung.auth0.com\"}).NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;\n\t\n\t var depthA = 0;\n\t for (var tempA = instA; tempA; tempA = tempA._hostParent) {\n\t depthA++;\n\t }\n\t var depthB = 0;\n\t for (var tempB = instB; tempB; tempB = tempB._hostParent) {\n\t depthB++;\n\t }\n\t\n\t // If A is deeper, crawl up.\n\t while (depthA - depthB > 0) {\n\t instA = instA._hostParent;\n\t depthA--;\n\t }\n\t\n\t // If B is deeper, crawl up.\n\t while (depthB - depthA > 0) {\n\t instB = instB._hostParent;\n\t depthB--;\n\t }\n\t\n\t // Walk in lockstep until we find a match.\n\t var depth = depthA;\n\t while (depth--) {\n\t if (instA === instB) {\n\t return instA;\n\t }\n\t instA = instA._hostParent;\n\t instB = instB._hostParent;\n\t }\n\t return null;\n\t}", "async function createSecureHadoopCluster() {\n const subscriptionId = process.env[\"HDINSIGHT_SUBSCRIPTION_ID\"] || \"subid\";\n const resourceGroupName = process.env[\"HDINSIGHT_RESOURCE_GROUP\"] || \"rg1\";\n const clusterName = \"cluster1\";\n const parameters = {\n properties: {\n clusterDefinition: {\n configurations: {\n gateway: {\n \"restAuthCredential.isEnabled\": true,\n \"restAuthCredential.password\": \"**********\",\n \"restAuthCredential.username\": \"admin\",\n },\n },\n kind: \"Hadoop\",\n },\n clusterVersion: \"3.5\",\n computeProfile: {\n roles: [\n {\n name: \"headnode\",\n hardwareProfile: { vmSize: \"Standard_D3_V2\" },\n minInstanceCount: 1,\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n scriptActions: [],\n targetInstanceCount: 2,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n {\n name: \"workernode\",\n hardwareProfile: { vmSize: \"Standard_D3_V2\" },\n minInstanceCount: 1,\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n scriptActions: [],\n targetInstanceCount: 4,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n {\n name: \"zookeepernode\",\n hardwareProfile: { vmSize: \"Small\" },\n minInstanceCount: 1,\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n scriptActions: [],\n targetInstanceCount: 3,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n ],\n },\n osType: \"Linux\",\n securityProfile: {\n clusterUsersGroupDNs: [\"hdiusers\"],\n directoryType: \"ActiveDirectory\",\n domain: \"DomainName\",\n domainUserPassword: \"**********\",\n domainUsername: \"DomainUsername\",\n ldapsUrls: [\"ldaps://10.10.0.4:636\"],\n organizationalUnitDN: \"OU=Hadoop,DC=hdinsight,DC=test\",\n },\n storageProfile: {\n storageaccounts: [\n {\n name: \"mystorage.blob.core.windows.net\",\n container: \"containername\",\n enableSecureChannel: true,\n isDefault: true,\n key: \"storage account key\",\n },\n ],\n },\n tier: \"Premium\",\n },\n tags: { key1: \"val1\" },\n };\n const credential = new DefaultAzureCredential();\n const client = new HDInsightManagementClient(credential, subscriptionId);\n const result = await client.clusters.beginCreateAndWait(\n resourceGroupName,\n clusterName,\n parameters\n );\n console.log(result);\n}", "constructOutputClusters ( clusters ) {\n\t\tlet dataOut = {\n\t\t\tclusters: [],\n\t\t\tdataLabel: [],\n\t\t};\n\n\t\tlet k = 0;\n\t\tfor ( let i = 0; i < clusters.clusters.length; i++ ) {\n\t\t\tif ( this.params.type != \"gridbasedClientServer\" ) {\n\t\t\t\tif ( clusters.clusters[i].valid == true ) {\n\t\t\t\t\tdataOut.clusters.push( clusters.clusters[i] );\n\t\t\t\t\t// we don't know what objects are in clusters in server-side clustering\n\t\t\t\t\tfor ( let j = 0; j < clusters.clusters[i].clusterSize; j++ ) {\n\t\t\t\t\t\tdataOut.dataLabel[clusters.clusters[i].group[j]] = k;\n\t\t\t\t\t}\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// server-side clustering\n\t\t\telse {\n\t\t\t\t// we need invalid clusters as well to access the objects\n\t\t\t\t// in a cluster using bounding box and child sibling\n\t\t\t\tdataOut.clusters.push( clusters.clusters[i] );\n\t\t\t}\n\t\t}\n\n\t\tdataOut.numClusters = dataOut.clusters.length;\n\t\tdataOut.dataSize = clusters.dataSize;\n\n\t\treturn dataOut;\n\t}", "function insertNodes(data) {\n for (var i = 0, n = data.length; i < n; i++) {\n\n var originalId = (vertical && data[i]['idOrigem'] != null) ? data[i]['idOrigem'] : null;\n var modeloAplicacao = getModeloAplicacao(data[i]['idModeloAplicacao']);\n var tipoComponente = getTipoComponente(modeloAplicacao['idTipoComponente']);\n var tipoAplicacao = getTipoAplicacao(modeloAplicacao['idTipoAplicacao']);\n var component = (data[i]['component']) ? getComponent(data[i]['component']) : null;\n var subcomponents = [];\n if (data[i].hasOwnProperty('subcomponents'))\n for (var j = 0, m = data[i]['subcomponents'].length; j < m; j++)\n subcomponents.push(getComponent(data[i]['subcomponents'][j]))\n\n // build node\n var node = {\n application: tipoAplicacao,\n component: component,\n componentType: tipoComponente,\n dbId: data[i]['id'],\n entries: 0,\n exits: 0,\n fixed: true,\n fixedEntries: data[i]['entries'] || 0,\n fixedExits: data[i]['exits'] || 0,\n height: data[i]['altura'],\n id: ++lastNodeId,\n label: data[i]['label'],\n originalId: originalId,\n properties: {},\n subcomponents: subcomponents,\n x: data[i]['x'],\n y: data[i]['y']\n };\n\n // add dynamic properties\n switch (tipoComponente['name'].toLowerCase()) {\n case 'amp':\n node.properties['atenuador'] = data[i]['atenuador'] || 0;\n node.properties['atenuador1'] = data[i]['atenuador1'] || 0;\n node.properties['atenuador2'] = data[i]['atenuador2'] || 0;\n node.properties['equalizador'] = data[i]['equalizador'] || 0;\n node.properties['ganho'] = data[i]['ganho'] || 0;\n node.properties['ganho1'] = data[i]['ganho1'] || 0;\n node.properties['ganho2'] = data[i]['ganho2'] || 0;\n node.properties['nivelSaida'] = data[i]['nivelSaida'] || 0;\n node.properties['nivelSaidaRetorno'] = data[i]['nivelSaidaRetorno'] || 0;\n node.properties['preAcentuador'] = data[i]['preAcentuador'] || 0;\n break;\n case 'ati':\n case 'cc':\n node.properties['amplificacao'] = data[i]['amplificacao'] || 0;\n node.properties['nivelSinal'] = data[i]['nivelSinal'] || 0;\n break;\n case 'derivador':\n node.properties['atenuacaoInsercao'] = data[i]['atenuacaoInsercao'] || 0;\n node.properties['atenuacaoDerivacao'] = data[i]['atenuacaoDerivacao'] || 0;\n break;\n }\n\n // add node\n nodes.push(node);\n }\n\n updateMatrix();\n}", "function renderCluster(top, cluster) {\n let {key, id, text, tests, spans, owner} = cluster;\n\n function plural(count, word, suffix) {\n return count + ' ' + word + (count == 1 ? '' : suffix);\n }\n\n function swapArrow(el) {\n el.textContent = el.textContent.replace(downArrow, rightArrow);\n }\n\n var counts = clustered.makeCounts(id);\n\n var clusterSum = clustersSum(tests);\n var todayCount = clustered.getHitsInLastDayById(id);\n var ownerTag = createElement('span', {className: 'owner sig-' + (owner || ''), dataset: {tooltip: 'inferred owner'}});\n var fileBug = createElement('a', {href: '#', target: '_blank', rel: 'noopener'}, 'file bug');\n var failureNode = addElement(top, 'div', {id: id, className: 'failure'}, [\n createElement('h2', null, [\n `${plural(clusterSum, 'test failure', 's')} (${todayCount} today) look like `,\n createElement('a', {href: '#' + id}, 'link'),\n createElement('a', {href: 'https://github.com/search?type=Issues&q=org:kubernetes%20' + id, target: '_blank', rel: 'noopener'}, 'search github'),\n fileBug,\n ownerTag,\n ]),\n createElement('pre', null, options.showNormalize ? key : renderSpans(text, spans)),\n createElement('div', {className: 'graph', dataset: {cluster: id}}),\n ]);\n\n if (owner) {\n ownerTag.innerText = owner;\n } else {\n ownerTag.remove();\n }\n\n var latest = createElement('table');\n var list = addElement(failureNode, 'ul', null, [\n createElement('span', null, [`Latest Failures`, latest]),\n ]);\n\n var latestBuilds = renderLatest(latest, id);\n\n fileBug.addEventListener('click', () => {\n let [title, body] = makeGitHubIssue(id, text, owner, latestBuilds);\n title = encodeURIComponent(title);\n body = encodeURIComponent(body);\n fileBug.href = `https://github.com/kubernetes/kubernetes/issues/new?body=${body}&title=${title}`;\n })\n\n var clusterJobs = addElement(list, 'li');\n\n var jobSet = new Set();\n\n var testList = createElement('ul');\n\n var expander = addElement(list, 'li', null, [`Failed in ${plural(tests.length, 'Test', 's')} ${downArrow}`, testList]);\n\n // If we expanded all the tests and jobs, how many rows would it take?\n var jobCount = sum(tests, t => t.jobs.length);\n\n // Sort tests by descending [last day hits, total hits]\n var testsSorted = sortByKey(tests, t => [-dayCounts(counts[t.name]), -sum(t.jobs, j => j.builds.length)]);\n\n var allTestsDayCount = dayCounts(counts['']);\n var testsDayCountSum = 0;\n\n var allSection = false;\n var testsShown = 0;\n var i = 0;\n\n for (var test of testsSorted) {\n i++;\n var testCount = sum(test.jobs, j => j.builds.length);\n\n var testDayCount = dayCounts(counts[test.name]);\n\n if (tests.length > kCollapseThreshold) {\n if (!allSection && testsDayCountSum > 0.8 * allTestsDayCount) {\n testsShown = i;\n addElement(testList, 'button', {className: 'rest', title: 'Show Daily Bottom 20% Tests'}, 'More');\n addElement(testList, 'hr');\n allSection = true;\n }\n }\n\n var testDayCountSum = 0;\n testsDayCountSum += testDayCount;\n\n var el = addElement(testList, 'li', null, [\n sparkLineSVG(counts[test.name]),\n ` ${testCount} ${test.name} ${rightArrow}`,\n ]);\n\n var jobList = addElement(el, 'ul', {style: {display: 'none'}});\n\n var jobs = sortByKey(test.jobs, j => [-dayCounts(counts[j.name + ' ' + test.name]), -j.builds.length]);\n\n var jobAllSection = false;\n\n var j = 0;\n for (var job of jobs) {\n var jobCount = counts[job.name + ' ' + test.name];\n if (jobs.length > kCollapseThreshold && !jobAllSection && testDayCountSum > 0.8 * testDayCount) {\n addElement(jobList, 'button', {className: 'rest', title: 'Show Daily Bottom 20% Jobs'}, 'More');\n addElement(jobList, 'hr');\n jobAllSection = true;\n }\n jobSet.add(job.name);\n addBuildListItem(jobList, job.name, job.builds, jobCount, test.name);\n testDayCountSum += dayCounts(jobCount);\n }\n }\n\n if ((testsShown === 0 && tests.length > kCollapseThreshold) || testsShown > kCollapseThreshold) {\n testList.style.display = 'none';\n swapArrow(expander.firstChild);\n }\n\n clusterJobs.innerHTML = `Failed in ${plural(jobSet.size, 'Job', 's')} ${rightArrow}<div style=\"display:none\" class=\"jobs\" data-cluster=\"${id}\">`;\n if (jobSet.size <= 10) { // automatically expand small job lists to save clicking\n expand(clusterJobs.children[0]);\n }\n\n return 1;\n}", "function module2(userid_data, connection, callback) {\n async.waterfall([\n // Select from userid table (returns result)\n function select_userid(wcb) {\n if (userid_data) {\n console.log('Passed userid table data')\n wcb(null, userid_data)\n } else {\n const cols = comma(relevant_fields)\n const select_query = 'SELECT ' + cols + ', hash FROM ' + userid_table + ' GROUP BY ' + cols + ', hash'\n \n connection.query(select_query, (err, result, fields) => {\n if (err) {\n console.log('Error at select_uuid().')\n wcb(err)\n } else {\n console.log('Finished select userid: found ' + result.length + ' unique errors.') \n wcb(null, result)\n }\n })\n }\n },\n // Sort into seen and new using preclusters rows (returns _new)\n function sort_precluster(precluster_data, wcb) {\n const hash_select = 'SELECT hash FROM ' + master_precluster_table\n\n async.map(precluster_data, \n (datum, map_callback) => {\n let hash_query = hash_select + ' WHERE hash=\\'' + datum['hash'] + '\\''\n connection.query(hash_query, (err, result) => {\n if (err) {\n map_callback(err)\n } else {\n if (Array.isArray(result) && result.length) \n map_callback(null)\n else\n map_callback(null, datum)\n }\n })\n },\n (err, result) => {\n if (err) {\n console.log('Error at sort_precluster().')\n wcb(err)\n } else {\n const _new = result.filter((value, index, arr) => {\n return value !== undefined\n })\n console.log('Finished sorting precluster errors: found ' + _new.length + ' new errors.')\n wcb(null, _new)\n }\n })\n },\n // Submodule 2: insert precluster, flask convert, write flask (result = [null, flasked], returns flasked)\n function submodule2(_new, wcb) {\n async.parallel([\n // Insert _new into master_precluster (returns null)\n function insert_precluster(sm2_pcb) {\n if (_new && _new.length) {\n const error_keys = ['message', 'hash']\n const to_insert = []\n for (error of _new) {\n const error_values = {}\n for (key of error_keys) {\n error_values[key] = error[key]\n }\n to_insert.push(error_values)\n }\n\n insert_table(to_insert, master_precluster_table, connection, undefined, undefined, (err) => {\n if (err) {\n console.log('Error at insert precluster.')\n sm2_pcb(err)\n } else {\n console.log('Finished inserting new errors into ' + master_precluster_table + '.')\n sm2_pcb(null)\n }\n })\n } else {\n console.log('Finished inserting new errors into ' + master_precluster_table + ' (none found)')\n sm2_pcb(null)\n }\n },\n // Submodule 2a: flask convert, write flask (returns flasked)\n function submodule2a(sm2_pcb) {\n async.waterfall([\n // Send data to Flask server (returns flasked)\n function flask(sm2a_wcb) {\n const startFlask = new Date()\n const messages = []\n for (datum of _new) {\n let temp = {}\n temp['message'] = datum['message']\n messages.push(temp)\n }\n\n console.log('Converted data for flask: Collected ' + messages.length + ' messages.')\n\n flask_convert(messages, (err, body) => {\n if (err) {\n console.log('Error at flask service.')\n sm2a_wcb(err)\n } else {\n const endFlask = new Date()\n const execFlask = time_string(endFlask - startFlask)\n console.log('FLASK EXECUTION TIME: ' + execFlask)\n \n const flasked = []\n let length = body.length\n console.log('Received ' + body.length + ' essences.')\n for (let i = 0; i < length; i ++) {\n if (body[i]['essence'] !== 'TRUNCATED' && body[i]['essence'] !== '') {\n _new[i]['essence'] = body[i]['essence']\n flasked.push(_new[i])\n }\n }\n console.log('Found ' + flasked.length + ' untruncated errors.')\n sm2a_wcb(null, flasked)\n }\n })\n },\n // Write results to postflask.csv (returns flasked)\n function write_flask(flasked, sm2a_wcb) {\n const csvWriter = csv_writer({\n path: __dirname + '/postflask.csv',\n header: [\n {id: 'application', title: 'application'},\n {id: 'code', title: 'code'},\n {id: 'message', title: 'message'},\n {id: 'essence', title: 'essence'},\n {id: 'hash', title: 'hash'}\n ]\n })\n \n csvWriter.writeRecords(flasked)\n .catch((err) => {\n console.log('Error writing: postflask.csv')\n sm2a_wcb(err)\n })\n .then(() => {\n console.log('Finished writing: postflask.csv')\n sm2a_wcb(null, flasked)\n })\n }\n ], \n function (err, flasked) {\n if (err) {\n sm2_pcb(err)\n } else {\n sm2_pcb(null, flasked)\n }\n })\n }\n ], \n function (err, result) {\n if (err) {\n wcb(err)\n } else {\n wcb(null, result[1])\n }\n })\n }\n ],\n function (err, result) {\n if (err) {\n callback(err)\n } else {\n module3(result, connection, callback)\n } \n })\n\n}", "function createClusterer(raw) {\n var internalClusterer = new InternalClusterer($this, map, raw),\n td = {},\n styles = {},\n thresholds = [],\n isInt = /^[0-9]+$/,\n calculator,\n k;\n\n for (k in raw) {\n if (isInt.test(k)) {\n thresholds.push(1 * k); // cast to int\n styles[k] = raw[k];\n styles[k].width = styles[k].width || 0;\n styles[k].height = styles[k].height || 0;\n } else {\n td[k] = raw[k];\n }\n }\n thresholds.sort(function (a, b) { return a > b; });\n\n // external calculator\n if (td.calculator) {\n calculator = function (indexes) {\n var data = [];\n $.each(indexes, function (i, index) {\n data.push(internalClusterer.value(index));\n });\n return td.calculator.apply($this, [data]);\n };\n } else {\n calculator = function (indexes) {\n return indexes.length;\n };\n }\n\n // set error function\n internalClusterer.error(function () {\n error.apply(self, arguments);\n });\n\n // set display function\n internalClusterer.display(function (cluster) {\n var i, style, atd, obj, offset, shadow,\n cnt = calculator(cluster.indexes);\n\n // look for the style to use\n if (raw.force || cnt > 1) {\n for (i = 0; i < thresholds.length; i++) {\n if (thresholds[i] <= cnt) {\n style = styles[thresholds[i]];\n }\n }\n }\n\n if (style) {\n offset = style.offset || [-style.width/2, -style.height/2];\n // create a custom overlay command\n // nb: 2 extends are faster self a deeper extend\n atd = $.extend({}, td);\n atd.options = $.extend({\n pane: \"overlayLayer\",\n content: style.content ? style.content.replace(\"CLUSTER_COUNT\", cnt) : \"\",\n offset: {\n x: (\"x\" in offset ? offset.x : offset[0]) || 0,\n y: (\"y\" in offset ? offset.y : offset[1]) || 0\n }\n },\n td.options || {});\n\n obj = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n atd.options.pane = \"floatShadow\";\n atd.options.content = $(document.createElement(\"div\")).width(style.width + \"px\").height(style.height + \"px\").css({cursor: \"pointer\"});\n shadow = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n // store data to the clusterer\n td.data = {\n latLng: toLatLng(cluster),\n markers:[]\n };\n $.each(cluster.indexes, function(i, index){\n td.data.markers.push(internalClusterer.value(index));\n if (internalClusterer.markerIsSet(index)){\n internalClusterer.marker(index).setMap(null);\n }\n });\n attachEvents($this, {td: td}, shadow, undef, {main: obj, shadow: shadow});\n internalClusterer.store(cluster, obj, shadow);\n } else {\n $.each(cluster.indexes, function (i, index) {\n internalClusterer.marker(index).setMap(map);\n });\n }\n });\n\n return internalClusterer;\n }", "function createClusterer(raw) {\n var internalClusterer = new InternalClusterer($this, map, raw),\n td = {},\n styles = {},\n thresholds = [],\n isInt = /^[0-9]+$/,\n calculator,\n k;\n\n for (k in raw) {\n if (isInt.test(k)) {\n thresholds.push(1 * k); // cast to int\n styles[k] = raw[k];\n styles[k].width = styles[k].width || 0;\n styles[k].height = styles[k].height || 0;\n } else {\n td[k] = raw[k];\n }\n }\n thresholds.sort(function (a, b) { return a > b; });\n\n // external calculator\n if (td.calculator) {\n calculator = function (indexes) {\n var data = [];\n $.each(indexes, function (i, index) {\n data.push(internalClusterer.value(index));\n });\n return td.calculator.apply($this, [data]);\n };\n } else {\n calculator = function (indexes) {\n return indexes.length;\n };\n }\n\n // set error function\n internalClusterer.error(function () {\n error.apply(self, arguments);\n });\n\n // set display function\n internalClusterer.display(function (cluster) {\n var i, style, atd, obj, offset, shadow,\n cnt = calculator(cluster.indexes);\n\n // look for the style to use\n if (raw.force || cnt > 1) {\n for (i = 0; i < thresholds.length; i++) {\n if (thresholds[i] <= cnt) {\n style = styles[thresholds[i]];\n }\n }\n }\n\n if (style) {\n offset = style.offset || [-style.width/2, -style.height/2];\n // create a custom overlay command\n // nb: 2 extends are faster self a deeper extend\n atd = $.extend({}, td);\n atd.options = $.extend({\n pane: \"overlayLayer\",\n content: style.content ? style.content.replace(\"CLUSTER_COUNT\", cnt) : \"\",\n offset: {\n x: (\"x\" in offset ? offset.x : offset[0]) || 0,\n y: (\"y\" in offset ? offset.y : offset[1]) || 0\n }\n },\n td.options || {});\n\n obj = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n atd.options.pane = \"floatShadow\";\n atd.options.content = $(document.createElement(\"div\")).width(style.width + \"px\").height(style.height + \"px\").css({cursor: \"pointer\"});\n shadow = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n // store data to the clusterer\n td.data = {\n latLng: toLatLng(cluster),\n markers:[]\n };\n $.each(cluster.indexes, function(i, index){\n td.data.markers.push(internalClusterer.value(index));\n if (internalClusterer.markerIsSet(index)){\n internalClusterer.marker(index).setMap(null);\n }\n });\n attachEvents($this, {td: td}, shadow, undef, {main: obj, shadow: shadow});\n internalClusterer.store(cluster, obj, shadow);\n } else {\n $.each(cluster.indexes, function (i, index) {\n internalClusterer.marker(index).setMap(map);\n });\n }\n });\n\n return internalClusterer;\n }", "function createClusterer(raw) {\n var internalClusterer = new InternalClusterer($this, map, raw),\n td = {},\n styles = {},\n thresholds = [],\n isInt = /^[0-9]+$/,\n calculator,\n k;\n\n for (k in raw) {\n if (isInt.test(k)) {\n thresholds.push(1 * k); // cast to int\n styles[k] = raw[k];\n styles[k].width = styles[k].width || 0;\n styles[k].height = styles[k].height || 0;\n } else {\n td[k] = raw[k];\n }\n }\n thresholds.sort(function (a, b) { return a > b; });\n\n // external calculator\n if (td.calculator) {\n calculator = function (indexes) {\n var data = [];\n $.each(indexes, function (i, index) {\n data.push(internalClusterer.value(index));\n });\n return td.calculator.apply($this, [data]);\n };\n } else {\n calculator = function (indexes) {\n return indexes.length;\n };\n }\n\n // set error function\n internalClusterer.error(function () {\n error.apply(self, arguments);\n });\n\n // set display function\n internalClusterer.display(function (cluster) {\n var i, style, atd, obj, offset, shadow,\n cnt = calculator(cluster.indexes);\n\n // look for the style to use\n if (raw.force || cnt > 1) {\n for (i = 0; i < thresholds.length; i++) {\n if (thresholds[i] <= cnt) {\n style = styles[thresholds[i]];\n }\n }\n }\n\n if (style) {\n offset = style.offset || [-style.width/2, -style.height/2];\n // create a custom overlay command\n // nb: 2 extends are faster self a deeper extend\n atd = $.extend({}, td);\n atd.options = $.extend({\n pane: \"overlayLayer\",\n content: style.content ? style.content.replace(\"CLUSTER_COUNT\", cnt) : \"\",\n offset: {\n x: (\"x\" in offset ? offset.x : offset[0]) || 0,\n y: (\"y\" in offset ? offset.y : offset[1]) || 0\n }\n },\n td.options || {});\n\n obj = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n atd.options.pane = \"floatShadow\";\n atd.options.content = $(document.createElement(\"div\")).width(style.width + \"px\").height(style.height + \"px\").css({cursor: \"pointer\"});\n shadow = self.overlay({td: atd, opts: atd.options, latLng: toLatLng(cluster)}, true);\n\n // store data to the clusterer\n td.data = {\n latLng: toLatLng(cluster),\n markers:[]\n };\n $.each(cluster.indexes, function(i, index){\n td.data.markers.push(internalClusterer.value(index));\n if (internalClusterer.markerIsSet(index)){\n internalClusterer.marker(index).setMap(null);\n }\n });\n attachEvents($this, {td: td}, shadow, undef, {main: obj, shadow: shadow});\n internalClusterer.store(cluster, obj, shadow);\n } else {\n $.each(cluster.indexes, function (i, index) {\n internalClusterer.marker(index).setMap(map);\n });\n }\n });\n\n return internalClusterer;\n }", "async function monitorDHTtable(ipfs,db,my_cid){\n \n const cid = new CID(my_cid)\n //var hash = sha256.create();\n //var multiH = multihash.decode(cid.multihash,'hex')\n //var cid_sha = hash.update(multiH.digest.toString('hex')).hex()\n var cid_bin = hexToBinary(cid.multihash.toString('hex')) //calculate the binary of the cid \n //use hexToBinary(peer_sha) if you want to try the sha256(id) XOR method\n var peers_list = []; //list of distinct peer retreived\n var peers_found = {} //dictionary of peer retreived, used to avoid duplicates\n var count = 0;\n var queried_peer = 0\n var notEmpty_peer = 0\n try{\n for await (const info of ipfs.dht.query(my_cid)) { //call the \"IPFS DHT QUERY my_cid\" command\n queried_peer++;\n if(info.responses.length > 0)\n notEmpty_peer++;\n for(var k=0; k<info.responses.length; k++){\n var peer_cid = new CID(info.responses[k].id);\n //var hash2 = sha256.create();\n //var multiH2 = multihash.decode(peer_cid.multihash, 'hex')\n //var peer_sha = hash2.update(multiH2.digest.toString('hex')).hex()\n var peer_bin = hexToBinary(peer_cid.multihash.toString('hex')) //calculate the binary of the returned peer's cid \n //use hexToBinary(peer_sha) if you want to try the sha256(id) XOR method\n \n if(!peers_found.hasOwnProperty(peer_cid.toString())){ //since the command return many duplicates, we keep only distinct peer \n peers_found[peer_cid.toString()] = \"true\";\n peers_list.push([peer_bin,peer_cid.toString()])\n }\n count++;\n }\n }\n \n \n console.log(`QUERY DHT PEERS -> ${count} (DISTINCT ${peers_list.length})`)\n var buckets = commonPrefixLength(cid_bin,peers_list)\n\n }catch(error){console.log(\"Monitor dht error\")}\n\n DB.saveDHTcheck(db,buckets,count,peers_list.length,queried_peer,notEmpty_peer)// save the result on the DB\n}", "function network(data, prev, index, expand) {\n expand = expand || {};\n var gm = {}, // group map\n nm = {}, // node map\n lm = {}, // link map\n gn = {}, // previous group nodes\n gc = {}, // previous group centroids\n nodes = [], // output nodes\n links = []; // output links\n\n // process previous nodes for reuse or centroid calculation\n if (prev) {\n prev.nodes.forEach(function(n) {\n var i = index(n), o;\n if (n.size > 0) {\n gn[i] = n;\n n.size = 0;\n } else {\n o = gc[i] || (gc[i] = {x:0,y:0,count:0});\n o.x += n.x;\n o.y += n.y;\n o.count += 1;\n }\n });\n }\n\n // determine nodes\n for (var k=0; k<data.nodes.length; ++k) {\n var n = data.nodes[k],\n i = index(n),\n l = gm[i] || (gm[i]=gn[i]) || (gm[i]={group:i, size:0, nodes:[]});\n\n if (expand[i]) {\n // the node should be directly visible\n nm[n.name] = nodes.length;\n nodes.push(n);\n if (gn[i]) {\n // place new nodes at cluster location (plus jitter)\n n.x = gn[i].x + Math.random();\n n.y = gn[i].y + Math.random();\n }\n } else {\n // the node is part of a collapsed cluster\n if (l.size == 0) {\n // if new cluster, add to set and position at centroid of leaf nodes\n nm[i] = nodes.length;\n nodes.push(l);\n if (gc[i]) {\n l.x = gc[i].x / gc[i].count;\n l.y = gc[i].y / gc[i].count;\n }\n }\n l.nodes.push(n);\n }\n // always count group size as we also use it to tweak the force graph strengths/distances\n l.size += 1;\n n.group_data = l;\n }\n\n for (i in gm) { gm[i].link_count = 0; }\n\n // determine links\n for (k=0; k<data.links.length; ++k) {\n var e = data.links[k],\n u = index(e.source),\n v = index(e.target);\n if (u != v) {\n gm[u].link_count++;\n gm[v].link_count++;\n }\n u = expand[u] ? nm[e.source.name] : nm[u];\n v = expand[v] ? nm[e.target.name] : nm[v];\n var i = (u<v ? u+\"|\"+v : v+\"|\"+u),\n l = lm[i] || (lm[i] = {source:u, target:v, size:0});\n l.size += 1;\n }\n for (i in lm) { links.push(lm[i]); }\n return {nodes: nodes, links: links};\n}", "function shouldSearchParent(flags,isFirstHostTNode){return!(flags&InjectFlags.Self)&&!(flags&InjectFlags.Host&&isFirstHostTNode);}", "async sync() {\n const startTime = Date.now(); \n const timer = this.createRequestTimer(this.options.network.syncInterval);\n await this.db.normalizeBanlist();\n await this.db.normalizeApproval();\n await this.db.normalizeBehaviorFails();\n await this.db.normalizeBehaviorCandidates();\n await this.db.normalizeServers();\n await this.cleanUpServers();\n await this.normalizeRoot({ timeout: timer() });\n const slaves = await this.db.getSlaves();\n const size = slaves.length;\n size? await this.db.addMaster(this.address, size): await this.db.removeMaster(this.address); \n const mastersUp = await this.syncUp({ timeout: timer() });\n const mastersDown = await this.syncDown({ timeout: timer() });\n const actualMasters = mastersUp.concat(mastersDown);\n\n if(size) {\n const masters = await this.db.getMasters();\n await this.updateMastersInfo(masters.concat(actualMasters), { timeout: timer() });\n }\n else {\n await this.db.removeMasters();\n\n for(let i = 0; i < actualMasters.length; i++) {\n const master = actualMasters[i]; \n \n if(!await this.isAddressAllowed(master.address)) {\n continue;\n }\n\n await this.db.addMaster(master.address, master.size);\n }\n }\n \n await this.normalizeBacklink();\n await this.normalizeMastersCount();\n await this.normalizeSlavesCount();\n \n try {\n await this.register({ timeout: timer() });\n }\n catch(err) {\n await this.db.removeBacklink();\n this.logger.warn(err.stack);\n }\n \n const time = Date.now() - startTime;\n this.__syncList.push({ time });\n this.__syncList.length > this.getSyncListSize() && this.__syncList.shift();\n this.logger.info(`Sync takes ${ms(time)}`);\n }", "function combineNodes(){\n\t\t// console.log(\"begin combineNodes\");\n\t\tvar groupNodeToParentReturn = groupNodeToParent();\n\t\tvar newNodeArrayFromGroup = groupNodeToParentReturn[\"newNodeArray\"];\n\t\tvar newConnectionInfoFromGroup = groupNodeToParentReturn[\"newConnectionInfo\"];\n\n\t\ttreeLevels = Object.keys(newNodeArrayFromGroup);\n\t\tvar newNodeArray = {};//the final node array\n\t\tvar newConnectionInfo = {};//the final connection info\n\n\t\t// access uing the specialid of the current node\n\t\t// each contain an array of specialid of the parent\n\t\t// also contain the array of specialid of the children\n\t\t// when access, if the children filed is null, that mean we haven't seen this id yet\n\n\t\t\n\t\t// var needToChangeSpecialID = [];\n\n\t\tvar seenBefore = []; //this keep track of all special id that we have seen before\n\t\tvar connectTo = {}; //for each lmid, create an array to indicate which lmid it is connect to\n\n\t\t// newConnectionMap[parentLMID] = [\n\t\t// \t {childOldSpecID: oldpscid, childNewSpcID: newspcid}\n\t\t// ]\n\t\tvar newConnectionMap = {};\n\n\t\ttreeLevels.forEach(function(treeLev, idx){\n\t\t\tif(idx > 0){\n\t\t\t\tnewNodeArray[treeLev] = {};\n\t\t\t\tnewConnectionInfo[treeLev] = {};\n\t\t\t\tvar currentTreeLevel = treeLev;\n\t\t\t\tvar lmAtLevelList = Object.keys(newNodeArrayFromGroup[treeLev]);\n\t\t\t\tlmAtLevelList.forEach(function(currentLM){\n\n\t\t\t\t\t//first, is there any specialid that we need to change\n\t\t\t\t\tvar needToChangeSpecialID = Object.keys(newLMIDMapping);\n\t\t\t\t\t//grap the connection list for this specialID\n\t\t\t\t\tvar currentConnList = newConnectionInfoFromGroup[treeLev][currentLM];\n\n\t\t\t\t\t//first determine if this node need to change its lable, need to combine, or keep it as is\n\t\t\t\t\tif(seenBefore.indexOf(currentLM) > -1){ //ok, so we seen this lm id before\n\t\t\t\t\t\t//now we need to determine if we need to change its label or need to combine\n\n\t\t\t\t\t\tif(newLMIDMapping[currentLM] == null){ //this is a node that we haven't determine to change its label yet, so we just combine it to the previous node\n\t\t\t\t\t\t\tcalculateEdge(currentLM , currentConnList, false, \"\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\n\t\t\t\t\t\t\t//this might be wrong, but assume that if we have a new mapping, we only have one name\n\t\t\t\t\t\t\tvar newLabel = newLMIDMapping[currentLM][ newLMIDMapping[currentLM].length ];\n\n\t\t\t\t\t\t\tvar newSankeyNode = newNodeArrayFromGroup[treeLev][currentLM];\n\t\t\t\t\t\t\tnewSankeyNode[\"specialID\"] = newLabel;\n\t\t\t\t\t\t\tif(parentChildrenList[newLabel] == null){\n\t\t\t\t\t\t\t\tparentChildrenList[newLabel] = {};\n\t\t\t\t\t\t\t\tparentChildrenList[newLabel][\"parent\"] = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcalculateEdge(currentLM , currentConnList, true, newLabel)\n\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\telse{ //havent seen this lm id before\n\t\t\t\t\t\t//so we need to create a new sankey node\n\t\t\t\t\t\tvar newSankeyNode = newNodeArrayFromGroup[treeLev][currentLM];\n\t\t\t\t\t\tseenBefore.push(currentLM);\n\t\t\t\t\t\tparentChildrenList[currentLM] = {};\n\t\t\t\t\t\tparentChildrenList[currentLM][\"parent\"] = [];\n\t\t\t\t\t\tcalculateEdge(currentLM , currentConnList, false, \"\")\n\t\t\t\t\t}\n\t\t\t\t}); //end of lmAtLevelList\n\t\t\t}\n\t\t\telse{\n\t\t\t\tnewNodeArray[0] = newNodeArrayFromGroup[0];\n\t\t\t\tnewConnectionInfo[0] = newConnectionInfoFromGroup[0];\n\t\t\t\tvar connInfoList = [];\n\t\t\t\tparentChildrenList[\"LM0\"] = {};\n\t\t\t\tvar childrenSpecID = [];\n\t\t\t\tnewConnectionInfo[0][\"LM0\"].forEach(function(connInfo){\n\t\t\t\t\t// note that we only want the connInfo where the chldspcid is different from the current node\n\t\t\t\t\tif(connInfo[\"childSpecialID\"] != \"LM0\"){\n\t\t\t\t\t\tconnInfoList.push(connInfo);\n\t\t\t\t\t\tif(childrenSpecID.indexOf(connInfo[\"childSpecialID\"]) == -1){\n\t\t\t\t\t\t\tchildrenSpecID.push(connInfo[\"childSpecialID\"]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tparentChildrenList[\"LM0\"][\"children\"] = childrenSpecID;\n\t\t\t\tparentChildrenList[\"LM0\"][\"parent\"] = [];\n\t\t\t\t// calculateEdge(\"LM0\", connInfoList);\n\t\t\t}\n\t\t}); //end of treeLevels\n\n\t\t// console.log(\"finish combineNodes\");\n\t}", "function updateClusterAndNodeNames ( stats, state ){\n if (stats) {\n // get master node id if available\n var masterNodeId = undefined;\n if (state) {\n masterNodeId = state.master_node;\n }\n if(stats.cluster_name && clusterName != stats.cluster_name) {\n clusterName = stats.cluster_name;\n clusterNameSpan.text(clusterName);\n }\n if (stats.nodes) {\n var nodesChanged = false;\n for (var node in nodes) {\n // node removed?\n if (!stats.nodes[node]) {\n if (selectedNodeName && nodes[node] == selectedNodeName) {\n selectedNodeName = undefined;\n cleanCharts(charts);\n // TODO stop timer ?\n }\n delete nodes[node];\n nodesChanged = true;\n }\n }\n for (var node in stats.nodes) {\n // new node?\n if (!nodes[node]) {\n nodes[node] = stats.nodes[node].name;\n nodesChanged = true;\n }\n }\n if (nodesChanged) {\n //redraw nodes\n var _nodes = [];\n for (var n in nodes) _nodes.push(nodes[n]);\n _nodes.sort(); // sort node names alphabetically\n nodesSpan.empty();\n if (selectedNodeName == undefined && _nodes.length > 0) {\n // make first available node selected\n selectedNodeName = _nodes[0];\n refreshNodeInfo(selectedNodeName);\n }\n $.each(_nodes, function(index, value) {\n var node = $(document.createElement(\"span\")).attr(\"class\",\"node\").append(value);\n if (value == selectedNodeName) { $(node).addClass(\"selectedNode\"); }\n if ( masterNodeId == getSelectedNodeId(value)) { $(node).addClass( \"masterNode\" ); }\n $(node).click(\n function(){\n // new node selected by user\n if (selectedNodeName != $(this).text()) {\n selectedNodeName = $(this).text();\n refreshNodeInfo(selectedNodeName);\n $.each(nodesSpan.children(),\n function(id, s){\n if (selectedNodeName == $(s).text()) $(s).addClass(\"selectedNode\")\n else $(s).removeClass(\"selectedNode\");\n }\n );\n cleanCharts(charts);\n setupInterval($(\"#interval option:selected\").val());\n }\n }\n );\n $(nodesSpan).append(node);\n });\n }\n }\n }\n }", "function test_candu_graphs_vm_compare_cluster_vsphere65() {}", "function get_cluster_configs() {\n let clusters = [];\n for_each_element(key => is_cluster_key(key), (key, cluster) => {\n clusters.push(decode(cluster));\n });\n return clusters;\n}", "function module3(flasked, connection, callback) {\n async.waterfall([\n // Gets postflask.csv data if not passed along.\n function setup(cb) {\n if (flasked) {\n cb(null, flasked)\n } else {\n read_csvfile(__dirname + '/postflask.csv', (err, flasked_data) => {\n if (err) {\n cb(err)\n } else {\n const flasked_data_objs = make_obj(flasked_data[0], flasked_data.slice(1))\n cb(null, flasked_data_objs)\n }\n })\n }\n },\n // Clusters by essence equality\n function t1_cluster(flasked, cb) {\n const clusters = t1_clustering(flasked)\n const master_data = []\n const cluster_mappings = []\n\n for (cluster of clusters) {\n master_data.push(cluster[0])\n let key = cluster[0]['essence']\n for (e of cluster) {\n let map = {}\n map['essence'] = key\n map['hash'] = e['hash']\n cluster_mappings.push(map)\n }\n }\n console.log('Finished Tier 1 clustering')\n cb(null, master_data, cluster_mappings)\n },\n // Submodule 3: sort master, insert master, t2 cluster, write t2, update cluster (result = [t2_clusters, null], return t2_clusters)\n function submodule3(master_insert, cluster_mappings, cb) {\n async.parallel([\n // Submodule 3a: sort master, insert master, t2 cluster, write t2 (returns t2_clusters)\n function submodule3a(sm3_pcb) {\n async.waterfall([\n // Sorts clusters by essence from master table\n function sort_master(sm3a_wcb) {\n const essence_select = 'SELECT essence FROM ' + master_table\n \n connection.query(essence_select, (err, result, fields) => {\n if (err) {\n console.log('Error at sort_master().')\n sm3a_wcb(err)\n } else {\n const essences = []\n for (essence_obj of result) {\n essences.push(essence_obj['essence'])\n }\n\n const new_master = []\n\n for (md of master_insert) {\n let curr_ess = md['essence']\n if (!essences.includes(curr_ess)) {\n new_master.push(md)\n }\n }\n\n console.log('Finished sorting master errors: found ' + new_master.length + ' new errors.')\n sm3a_wcb(null, new_master)\n }\n })\n },\n // Submodule 3b: insert master, t2 cluster, write t2, create run, insert run (result = [null, t2_clusters, null], returns t2_clusters)\n function submodule3b(new_master, sm3a_wcb) {\n async.parallel([\n // Insert new errors into master (returns null)\n function insert_master(sm3b_pcb) {\n if (new_master && new_master.length) {\n const to_insert = []\n for (error of new_master) {\n let error_values = {}\n for (c of master_cols) {\n error_values[c] = error[c]\n }\n to_insert.push(error_values)\n }\n\n insert_table(to_insert, master_table, connection, undefined, undefined, (err) => {\n if (err) {\n console.log('Error at insert master.')\n sm3b_pcb(err)\n } else {\n console.log('Finished inserting new errors into: ' + master_table + '.')\n sm3b_pcb(null)\n }\n })\n } else {\n console.log('Finished inserting new errors into: ' + master_table + ' (none found)')\n sm3b_pcb(null)\n }\n },\n // Submodule 3c: t2 cluster, write t2 (returns t2_clusters)\n function submodule3c(sm3b_pcb) {\n async.waterfall([\n // Implements tier 2 clustering by essence\n function t2_cluster(sm3c_wcb) {\n t2_convert(new_master, (err, t2_clusters) => {\n if (err) {\n console.log('Error at Tier 2 clustering.')\n sm3c_wcb(err)\n } else {\n console.log('Finished Tier 2 clustering.')\n sm3c_wcb(null, t2_clusters)\n }\n })\n },\n // Write t2 clusters\n function write_t2(t2_clusters, sm3c_wcb) {\n fs.writeFile(__dirname + '/t2_clusters.json', JSON.stringify(t2_clusters), (err) => {\n if (err) {\n sm3c_wcb(err)\n } else {\n sm3c_wcb(null, t2_clusters)\n }\n })\n }\n ], \n function (err, result) {\n if (err) {\n sm3b_pcb(err)\n } else {\n sm3b_pcb(null, result)\n }\n })\n },\n // Submodule 3d: create run, insert run (returns null)\n function submodule3d(sm3b_pcb) {\n async.waterfall([\n // Create run map\n function create_run(sm3d_wcb) {\n create_table(run_map, run_example, undefined, connection, (err) => {\n if (err) {\n console.log('Error creating: ' + run_map)\n sm3d_wcb(err)\n } else {\n console.log('Created table: ' + run_map)\n sm3d_wcb(null)\n }\n })\n },\n // Insert into run map\n function insert_run(sm3d_wcb) {\n const to_insert = []\n for (error of new_master) {\n let error_to_insert = {}\n error_to_insert['essence'] = error['essence']\n error_to_insert['hash'] = error['hash']\n to_insert.push(error_to_insert)\n }\n insert_table(to_insert, run_map, connection, undefined, undefined, (err) => {\n if (err) {\n console.log('Error inserting into: ' + run_map)\n sm3d_wcb(err)\n } else {\n console.log('Finished insert into ' + run_map)\n sm3d_wcb(null)\n }\n })\n }\n ], \n function (err) {\n if (err) {\n sm3b_pcb(err)\n } else {\n sm3b_pcb(null)\n }\n })\n }\n ], \n function (err, result) {\n if (err) {\n sm3a_wcb(err)\n } else {\n sm3a_wcb(null, result[1])\n }\n })\n }\n ], \n function (err, result) {\n if (err) {\n sm3_pcb(err)\n } else {\n sm3_pcb(null, result)\n }\n })\n },\n // Insert values into cluster_map (returns null)\n function insert_cluster(sm3_pcb) {\n if (cluster_mappings && (cluster_mappings.length)) {\n insert_table(cluster_mappings, cluster_map, connection, true, undefined, (err) => {\n if (err) {\n console.log('Error inserting into: ' + cluster_map)\n sm3_pcb(err)\n } else {\n console.log('Finished inserting into: ' + cluster_map)\n sm3_pcb(null)\n }\n })\n } else {\n console.log('Finished inserting into: ' + cluster_map + ' (none found)')\n sm3_pcb(null)\n }\n }\n ], \n function(err, result) {\n if (err) {\n cb(err)\n } else { \n cb(null, result[0])\n }\n })\n }\n ],\n function (err, result) {\n if (err) {\n callback(err)\n } else {\n module4(result, connection, callback)\n }\n })\n}", "function main(hostAndPort) {\n\n if (hostAndPort == #N/A)\n hostAndPort = \"*\";\n\n var result={};\n result[\"status\"] = {};\n result[\"status\"][\"global\"]={};\n\n var hosts = cluster::mySqlNodes();\n for (idx = 0; idx < hosts.size(); ++idx) {\n host = hosts[idx];\n if(hostAndPort != \"*\" && !hostMatchesFilter(host,hostAndPort))\n continue;\n\n map = host.toMap();\n connected = map[\"connected\"];\n if (connected) {\n ret = getValueMap(host, \"SHOW GLOBAL STATUS\");\n \n if (ret != false && ret.size() > 0)\n {\n result[\"status\"][\"global\"][idx]={};\n result[\"status\"][\"global\"][idx][\"reported_by\"]=host.toString();\n for (i=0; i<ret.size(); ++i)\n {\n result[\"status\"][\"global\"][idx][i]={};\n result[\"status\"][\"global\"][idx][i][\"variable_name\"]=linkify(ret[i][0]);\n result[\"status\"][\"global\"][idx][i][\"value\"]=ret[i][1];\n\n }\n }\n }\n }\n exit(result);\n}", "async processStateMachineOperation () {\n // Record all stages of this function along with associated information for use in logging\n let decisionTree = [{\n stage: 'BEGIN processStateMachineOperation()',\n vals: {\n currentModuloSlice: this.currentModuloSlice,\n moduloBase: this.moduloBase\n },\n time: Date.now()\n }]\n\n try {\n let nodeUsers\n try {\n nodeUsers = await this.peerSetManager.getNodeUsers()\n nodeUsers = this.sliceUsers(nodeUsers)\n\n decisionTree.push({ stage: 'getNodeUsers() and sliceUsers() Success', vals: { nodeUsersLength: nodeUsers.length }, time: Date.now() })\n } catch (e) {\n decisionTree.push({ stage: 'getNodeUsers() or sliceUsers() Error', vals: e.message, time: Date.now() })\n throw new Error(`processStateMachineOperation():getNodeUsers()/sliceUsers() Error: ${e.toString()}`)\n }\n\n let unhealthyPeers\n try {\n unhealthyPeers = await this.peerSetManager.getUnhealthyPeers(nodeUsers)\n decisionTree.push({\n stage: 'getUnhealthyPeers() Success',\n vals: {\n unhealthyPeerSetLength: unhealthyPeers.size,\n unhealthyPeers: Array.from(unhealthyPeers)\n },\n time: Date.now()\n })\n } catch (e) {\n decisionTree.push({ stage: 'processStateMachineOperation():getUnhealthyPeers() Error', vals: e.message, time: Date.now() })\n throw new Error(`processStateMachineOperation():getUnhealthyPeers() Error: ${e.toString()}`)\n }\n\n // Lists to aggregate all required ReplicaSetUpdate ops and potential SyncRequest ops\n const requiredUpdateReplicaSetOps = []\n const potentialSyncRequests = []\n\n /**\n * For every node user, record sync requests to issue to secondaries if this node is primary\n * and record replica set updates to issue for any unhealthy replicas\n *\n * Purpose for the if/else case is that if the current node is a primary, issue reconfig or sync requests.\n * Else, if the current node is a secondary, only issue reconfig requests.\n *\n * @notice this will issue sync to healthy secondary and update replica set away from unhealthy secondary\n */\n for (const nodeUser of nodeUsers) {\n const { primary, secondary1, secondary2 } = nodeUser\n let unhealthyReplicas = []\n\n /**\n * If this node is primary for user, check both secondaries for health\n * Enqueue SyncRequests against healthy secondaries, and enqueue UpdateReplicaSetOps against unhealthy secondaries\n */\n if (primary === this.endpoint) {\n // filter out false-y values to account for incomplete replica sets\n const secondaries = ([secondary1, secondary2]).filter(Boolean)\n\n /**\n * If either secondary is in `unhealthyPeers` list, add it to `unhealthyReplicas` list\n */\n for (const secondary of secondaries) {\n if (unhealthyPeers.has(secondary)) {\n unhealthyReplicas.push(secondary)\n } else {\n potentialSyncRequests.push({ ...nodeUser, endpoint: secondary })\n }\n }\n\n /**\n * If either secondary has a Sync success rate for user below threshold, add it to `unhealthyReplicas` list\n */\n const userSecondarySyncMetrics = await SecondarySyncHealthTracker.computeUserSecondarySyncSuccessRates(\n nodeUser.wallet, [secondary1, secondary2]\n )\n const sec1UserSyncSuccessRate = userSecondarySyncMetrics[secondary1]['SuccessRate']\n const sec2UserSyncSuccessRate = userSecondarySyncMetrics[secondary2]['SuccessRate']\n\n // If SyncRequest success rate for user to either secondary falls under threshold -> mark as unhealthy\n if (sec1UserSyncSuccessRate < this.MinimumSecondaryUserSyncSuccessPercent && !unhealthyReplicas.includes(secondary1)) {\n unhealthyReplicas.push(secondary1)\n }\n if (sec2UserSyncSuccessRate < this.MinimumSecondaryUserSyncSuccessPercent && !unhealthyReplicas.includes(secondary2)) {\n unhealthyReplicas.push(secondary2)\n }\n\n /**\n * If any unhealthy replicas found for user, enqueue an updateReplicaSetOp for later processing\n */\n if (unhealthyReplicas.length > 0) {\n requiredUpdateReplicaSetOps.push({ ...nodeUser, unhealthyReplicas })\n }\n\n /**\n * If this node is secondary for user, check both secondaries for health and enqueue SyncRequests against healthy secondaries\n * Ignore unhealthy secondaries for now\n */\n } else {\n // filter out false-y values to account for incomplete replica sets\n let replicas = ([primary, secondary1, secondary2]).filter(Boolean)\n // filter out this endpoint\n replicas = replicas.filter(replica => replica !== this.endpoint)\n\n for (const replica of replicas) {\n if (unhealthyPeers.has(replica)) {\n unhealthyReplicas.push(replica)\n }\n }\n\n if (unhealthyReplicas.length > 0) {\n requiredUpdateReplicaSetOps.push({ ...nodeUser, unhealthyReplicas })\n }\n }\n }\n decisionTree.push({\n stage: 'Build requiredUpdateReplicaSetOps and potentialSyncRequests arrays',\n vals: {\n requiredUpdateReplicaSetOpsLength: requiredUpdateReplicaSetOps.length,\n potentialSyncRequestsLength: potentialSyncRequests.length\n },\n time: Date.now()\n })\n\n // Build map of secondary node to secondary user wallets array\n const secondaryNodesToUserWalletsMap = this.buildSecondaryNodesToUserWalletsMap(potentialSyncRequests)\n decisionTree.push({\n stage: 'buildSecondaryNodesToUserWalletsMap() Success',\n vals: { numSecondaryNodes: Object.keys(secondaryNodesToUserWalletsMap).length },\n time: Date.now()\n })\n\n // Retrieve clock statuses for all secondary users from secondary nodes\n let secondaryNodesToUserClockStatusesMap\n try {\n secondaryNodesToUserClockStatusesMap = await this.retrieveClockStatusesForSecondaryUsersFromNodes(\n secondaryNodesToUserWalletsMap\n )\n decisionTree.push({\n stage: 'retrieveClockStatusesForSecondaryUsersFromNodes() Success',\n vals: { },\n time: Date.now()\n })\n } catch (e) {\n decisionTree.push({\n stage: 'retrieveClockStatusesForSecondaryUsersFromNodes() Error',\n vals: e.message,\n time: Date.now()\n })\n throw new Error('processStateMachineOperation():retrieveClockStatusesForSecondaryUsersFromNodes() Error')\n }\n\n // Setup the mapping of Content Node endpoint to service provider id. Used in reconfig\n const previousSnapbackReconfigEnabledValue = this.snapbackReconfigEnabled\n await this.updateEndpointToSpIdMap()\n decisionTree.push({\n stage: `updateEndpointToSpIdMap()`,\n vals: {\n previousSnapbackReconfigEnabledValue,\n currentSnapbackReconfigEnabledValue: this.snapbackReconfigEnabled,\n endpointToSPIdMapSize: Object.keys(this.endpointToSPIdMap).length\n },\n time: Date.now()\n })\n\n // Issue all required sync requests\n let numSyncRequestsRequired, numSyncRequestsEnqueued, enqueueSyncRequestErrors\n try {\n const resp = await this.issueSyncRequests(potentialSyncRequests, secondaryNodesToUserClockStatusesMap)\n numSyncRequestsRequired = resp.numSyncRequestsRequired\n numSyncRequestsEnqueued = resp.numSyncRequestsEnqueued\n enqueueSyncRequestErrors = resp.enqueueSyncRequestErrors\n\n // Error if > 50% syncRequests fail\n if (enqueueSyncRequestErrors.length > numSyncRequestsEnqueued) {\n throw new Error('More than 50% of SyncRequests failed to be enqueued')\n }\n\n decisionTree.push({\n stage: 'issueSyncRequests() Success',\n vals: {\n numSyncRequestsRequired,\n numSyncRequestsEnqueued,\n numIssueSyncRequestErrors: enqueueSyncRequestErrors.length,\n enqueueSyncRequestErrors\n },\n time: Date.now()\n })\n } catch (e) {\n decisionTree.push({\n stage: 'issueSyncRequests() Error',\n vals: {\n error: e.message,\n numSyncRequestsRequired,\n numSyncRequestsEnqueued,\n numIssueSyncRequestErrors: (enqueueSyncRequestErrors ? enqueueSyncRequestErrors.length : null),\n enqueueSyncRequestErrors\n },\n time: Date.now()\n })\n }\n\n /**\n * Issue all required replica set updates\n * TODO move to chunked parallel (maybe?) + wrap each in try-catch to not halt on single error\n */\n let numUpdateReplicaOpsIssued = 0\n try {\n // Fetch all the healthy nodes while disabling sync checks to select nodes for new replica set\n // Note: sync checks are disabled because there should not be any syncs occurring for a particular user\n // on a new replica set. Also, the sync check logic is coupled with a user state on the userStateManager.\n // There will be an explicit clock value check on the newly selected replica set nodes instead.\n const { services: healthyServicesMap } = await this.audiusLibs.ServiceProvider.autoSelectCreatorNodes({\n performSyncCheck: false,\n log: false\n })\n\n const healthyNodes = Object.keys(healthyServicesMap)\n if (healthyNodes.length === 0) throw new Error('Auto-selecting Content Nodes returned an empty list of healthy nodes.')\n\n const errors = []\n for await (const userInfo of requiredUpdateReplicaSetOps) {\n const errorMsg = await this.issueUpdateReplicaSetOp(\n userInfo.user_id,\n userInfo.wallet,\n userInfo.primary,\n userInfo.secondary1,\n userInfo.secondary2,\n userInfo.unhealthyReplicas,\n healthyNodes\n )\n\n errorMsg ? errors.push(errorMsg) : numUpdateReplicaOpsIssued++\n }\n if (errors.length > 0) throw new Error(`issueUpdateReplicaSetOp() failed for subset of users: [${errors.toString()}]`)\n\n decisionTree.push({\n stage: 'issueUpdateReplicaSetOp() Success',\n vals: { numUpdateReplicaOpsIssued },\n time: Date.now()\n })\n } catch (e) {\n decisionTree.push({\n stage: 'issueUpdateReplicaSetOp() Error',\n vals: e.message,\n time: Date.now()\n })\n throw new Error('processStateMachineOperation():issueUpdateReplicaSetOp() Error')\n }\n\n decisionTree.push({\n stage: 'END processStateMachineOperation()',\n vals: {\n currentModuloSlice: this.currentModuloSlice,\n moduloBase: this.moduloBase,\n numSyncRequestsEnqueued,\n numUpdateReplicaOpsIssued\n },\n time: Date.now()\n })\n\n // Log error without throwing - next run will attempt to rectify\n } catch (e) {\n decisionTree.push({ stage: 'processStateMachineOperation Error', vals: e.message, time: Date.now() })\n } finally {\n // Increment and adjust current slice by this.moduloBase\n this.currentModuloSlice += 1\n this.currentModuloSlice = this.currentModuloSlice % this.moduloBase\n\n // Log decision tree\n try {\n this.log(`processStateMachineOperation Decision Tree ${JSON.stringify(decisionTree)}`)\n } catch (e) {\n this.logError(`Error printing processStateMachineOperation Decision Tree ${decisionTree}`)\n }\n }\n }", "function getLowestCommonAncestor(instA, instB) {\n\t !('_hostNode' in instA) ? ({\"TERM_PROGRAM\":\"Apple_Terminal\",\"SHELL\":\"/bin/bash\",\"TERM\":\"xterm-256color\",\"TMPDIR\":\"/var/folders/0j/sct_mds14ljd8k18mkdpqznh0000gn/T/\",\"Apple_PubSub_Socket_Render\":\"/private/tmp/com.apple.launchd.wV6as6027H/Render\",\"TERM_PROGRAM_VERSION\":\"388\",\"OLDPWD\":\"/Users/maxwelldemers/documents/repos\",\"TERM_SESSION_ID\":\"F26783D2-1813-4F7E-84C9-0293EA6BE539\",\"USER\":\"maxwelldemers\",\"SSH_AUTH_SOCK\":\"/private/tmp/com.apple.launchd.xHoP6guWcs/Listeners\",\"__CF_USER_TEXT_ENCODING\":\"0x1F5:0x0:0x0\",\"PATH\":\"/Users/maxwelldemers/Documents/google/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin\",\"PWD\":\"/Users/maxwelldemers/documents/repos/MasterMind\",\"LANG\":\"en_US.UTF-8\",\"XPC_FLAGS\":\"0x0\",\"XPC_SERVICE_NAME\":\"0\",\"SHLVL\":\"1\",\"HOME\":\"/Users/maxwelldemers\",\"LOGNAME\":\"maxwelldemers\",\"_\":\"/usr/local/bin/webpack\"}).NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;\n\t !('_hostNode' in instB) ? ({\"TERM_PROGRAM\":\"Apple_Terminal\",\"SHELL\":\"/bin/bash\",\"TERM\":\"xterm-256color\",\"TMPDIR\":\"/var/folders/0j/sct_mds14ljd8k18mkdpqznh0000gn/T/\",\"Apple_PubSub_Socket_Render\":\"/private/tmp/com.apple.launchd.wV6as6027H/Render\",\"TERM_PROGRAM_VERSION\":\"388\",\"OLDPWD\":\"/Users/maxwelldemers/documents/repos\",\"TERM_SESSION_ID\":\"F26783D2-1813-4F7E-84C9-0293EA6BE539\",\"USER\":\"maxwelldemers\",\"SSH_AUTH_SOCK\":\"/private/tmp/com.apple.launchd.xHoP6guWcs/Listeners\",\"__CF_USER_TEXT_ENCODING\":\"0x1F5:0x0:0x0\",\"PATH\":\"/Users/maxwelldemers/Documents/google/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin\",\"PWD\":\"/Users/maxwelldemers/documents/repos/MasterMind\",\"LANG\":\"en_US.UTF-8\",\"XPC_FLAGS\":\"0x0\",\"XPC_SERVICE_NAME\":\"0\",\"SHLVL\":\"1\",\"HOME\":\"/Users/maxwelldemers\",\"LOGNAME\":\"maxwelldemers\",\"_\":\"/usr/local/bin/webpack\"}).NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;\n\n\t var depthA = 0;\n\t for (var tempA = instA; tempA; tempA = tempA._hostParent) {\n\t depthA++;\n\t }\n\t var depthB = 0;\n\t for (var tempB = instB; tempB; tempB = tempB._hostParent) {\n\t depthB++;\n\t }\n\n\t // If A is deeper, crawl up.\n\t while (depthA - depthB > 0) {\n\t instA = instA._hostParent;\n\t depthA--;\n\t }\n\n\t // If B is deeper, crawl up.\n\t while (depthB - depthA > 0) {\n\t instB = instB._hostParent;\n\t depthB--;\n\t }\n\n\t // Walk in lockstep until we find a match.\n\t var depth = depthA;\n\t while (depth--) {\n\t if (instA === instB) {\n\t return instA;\n\t }\n\t instA = instA._hostParent;\n\t instB = instB._hostParent;\n\t }\n\t return null;\n\t}", "function t1_clustering(errors) {\n const clusters = []\n for (error of errors) {\n if (clusters.length == 0) {\n const first = []\n first.push(error)\n clusters.push(first)\n } else {\n let in_cluster = false\n for (cluster of clusters) {\n const prototype = cluster[0]\n if (prototype['essence'] === error['essence']) {\n cluster.push(error)\n in_cluster = true\n break\n }\n }\n if (!in_cluster) {\n const new_cluster = []\n new_cluster.push(error)\n clusters.push(new_cluster)\n }\n }\n }\n return clusters\n}", "function appendCluster() {\n if (!$(\".dd-empty\").length) {\n let cluster = $(\"#cluster\");\n clusterNumber++;\n cluster.append(\n '<div class=\"dd py-3\" id=cluster_' +\n clusterNumber.toString() +\n \">\" +\n \"</div>\"\n );\n\n //activate nestable2 function\n drop_zone(clusterNumber);\n $(\".dd\").nestable({\n onDragStart: function (l, e) {\n // get type of dragged element\n // let type = $(e).children(\".dd-handle\").attr(\"class\").split(\" \")[0];\n // console.log(type);\n //when start dragging, trigger addNoChildrenClass method\n addNoChildrenClass();\n },\n callback: function (l, e) {\n // l is the main container\n // e is the element that was moved\n //when finish dropping, trigger these methods to make \"dd-empty\" is always one\n appendCluster();\n removeCluster();\n },\n //enable auto scrolling method while dragging\n scroll: true\n });\n }\n}", "function PoolCluster(args) {\n const opts = new PoolClusterOptions(args);\n const nodes = {};\n let cachedPatterns = {};\n let nodeCounter = 0;\n EventEmitter.call(this);\n\n /**\n * Add a new pool node to cluster.\n *\n * @param id identifier\n * @param config pool configuration\n */\n this.add = (id, config) => {\n let identifier;\n if (typeof id === 'string' || id instanceof String) {\n identifier = id;\n if (nodes[identifier])\n throw new Error(\"Node identifier '\" + identifier + \"' already exist !\");\n } else {\n identifier = 'PoolNode-' + nodeCounter++;\n config = id;\n }\n const options = new PoolOptions(config);\n const pool = _createPool(options);\n pool.initialize();\n nodes[identifier] = pool;\n };\n\n /**\n * End cluster (and underlying pools).\n *\n * @return {Promise<any[]>}\n */\n this.end = () => {\n cachedPatterns = {};\n const poolEndPromise = [];\n Object.keys(nodes).forEach(pool => {\n poolEndPromise.push(nodes[pool].end());\n delete nodes[pool];\n });\n\n return Promise.all(poolEndPromise);\n };\n\n this.of = (pattern, selector) => {\n return new FilteredPoolCluster(this, pattern, selector);\n };\n\n /**\n * Remove nodes according to pattern.\n *\n * @param pattern pattern\n */\n this.remove = pattern => {\n if (!pattern) throw new Error('pattern parameter in Cluster.remove(pattern) is mandatory');\n\n const regex = RegExp(pattern);\n Object.keys(nodes).forEach(key => {\n if (regex.test(key)) {\n nodes[key].end();\n delete nodes[key];\n cachedPatterns = {};\n }\n });\n };\n\n /**\n * Get connection from available pools matching pattern, according to selector\n *\n * @param pattern pattern filter (not mandatory)\n * @param selector node selector ('RR','RANDOM' or 'ORDER')\n * @return {Promise}\n */\n this.getConnection = (pattern, selector) => {\n return _getConnection(this, pattern, selector);\n };\n\n /**\n * Force using callback methods.\n */\n this.setCallback = () => {\n this.getConnection = _getConnectionCallback.bind(this, this);\n _createPool = _createPoolCallback;\n };\n\n /**\n * Get connection from available pools matching pattern, according to selector\n * with additional parameter to avoid reusing failing node\n *\n * @param pattern pattern filter (not mandatory)\n * @param selector node selector ('RR','RANDOM' or 'ORDER')\n * @param avoidNodeKey failing node\n * @param lastError last error\n * @return {Promise}\n * @private\n */\n const _getConnection = (cluster, pattern, selector, avoidNodeKey, lastError) => {\n const matchingNodeList = _matchingNodes(pattern || /^/);\n\n if (matchingNodeList.length === 0) {\n if (Object.keys(nodes).length === 0 && !lastError) {\n return Promise.reject(\n new Error(\n 'No node have been added to cluster ' +\n 'or nodes have been removed due to too much connection error'\n )\n );\n }\n if (avoidNodeKey === undefined)\n return Promise.reject(new Error(\"No node found for pattern '\" + pattern + \"'\"));\n const errMsg =\n \"No Connection available for '\" +\n pattern +\n \"'\" +\n (lastError ? '. Last connection error was: ' + lastError.message : '');\n return Promise.reject(new Error(errMsg));\n }\n\n const retry = _getConnection.bind(this, this, pattern, selector);\n try {\n const nodeKey = _selectPool(matchingNodeList, selector, avoidNodeKey);\n return _handleConnectionError(cluster, matchingNodeList, nodeKey, retry);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n let _createPool = options => {\n return new Pool(options, false);\n };\n\n const _createPoolCallback = options => {\n return new PoolCallback(options, false);\n };\n\n /**\n * Get connection from available pools matching pattern, according to selector\n * with additional parameter to avoid reusing failing node\n *\n * @param pattern pattern filter (not mandatory)\n * @param selector node selector ('RR','RANDOM' or 'ORDER')\n * @param callback callback function\n * @param avoidNodeKey failing node\n * @param lastError last error\n * @private\n */\n const _getConnectionCallback = (\n cluster,\n pattern,\n selector,\n callback,\n avoidNodeKey,\n lastError\n ) => {\n const matchingNodeList = _matchingNodes(pattern || /^/);\n\n if (matchingNodeList.length === 0) {\n if (Object.keys(nodes).length === 0 && !lastError) {\n callback(\n new Error(\n 'No node have been added to cluster ' +\n 'or nodes have been removed due to too much connection error'\n )\n );\n return;\n }\n\n if (avoidNodeKey === undefined)\n callback(new Error(\"No node found for pattern '\" + pattern + \"'\"));\n const errMsg =\n \"No Connection available for '\" +\n pattern +\n \"'\" +\n (lastError ? '. Last connection error was: ' + lastError.message : '');\n callback(new Error(errMsg));\n return;\n }\n\n const retry = _getConnectionCallback.bind(this, this, pattern, selector, callback);\n try {\n const nodeKey = _selectPool(matchingNodeList, selector, avoidNodeKey);\n _handleConnectionCallbackError(this, matchingNodeList, nodeKey, retry, callback);\n } catch (e) {\n callback(e);\n }\n };\n\n /**\n * Selecting nodes according to pattern.\n *\n * @param pattern pattern\n * @return {*}\n * @private\n */\n const _matchingNodes = pattern => {\n if (cachedPatterns[pattern]) return cachedPatterns[pattern];\n\n const regex = RegExp(pattern);\n const matchingNodeList = [];\n Object.keys(nodes).forEach(key => {\n if (regex.test(key)) {\n matchingNodeList.push(key);\n }\n });\n\n cachedPatterns[pattern] = matchingNodeList;\n return matchingNodeList;\n };\n\n /**\n * Select next node to be chosen in nodeList according to selector and failed nodes.\n *\n * @param nodeList current node list\n * @param selectorParam selector\n * @param avoidNodeKey last failing node to avoid selecting this one.\n * @return {Promise}\n * @private\n */\n const _selectPool = (nodeList, selectorParam, avoidNodeKey) => {\n const selector = selectorParam || opts.defaultSelector;\n let retry = 0;\n let selectorFct;\n let nodeKey;\n switch (selector) {\n case 'RR':\n selectorFct = roundRobinSelector;\n break;\n\n case 'RANDOM':\n selectorFct = randomSelector;\n break;\n\n case 'ORDER':\n selectorFct = orderedSelector;\n break;\n\n default:\n throw new Error(\n \"Wrong selector value '\" + selector + \"'. Possible values are 'RR','RANDOM' or 'ORDER'\"\n );\n }\n\n nodeKey = selectorFct(nodeList, retry);\n while (\n (avoidNodeKey === nodeKey || nodes[nodeKey].blacklistedUntil > Date.now()) &&\n retry < nodeList.length - 1\n ) {\n retry++;\n nodeKey = selectorFct(nodeList, retry);\n }\n return nodeKey;\n };\n\n /**\n * Round robin selector: using nodes one after the other.\n *\n * @param nodeList node list\n * @return {String}\n */\n const roundRobinSelector = nodeList => {\n let lastRoundRobin = nodeList.lastRrIdx;\n if (lastRoundRobin === undefined) lastRoundRobin = -1;\n if (++lastRoundRobin >= nodeList.length) lastRoundRobin = 0;\n nodeList.lastRrIdx = lastRoundRobin;\n return nodeList[lastRoundRobin];\n };\n\n /**\n * Random selector: use a random node.\n *\n * @param nodeList node list\n * @return {String}\n */\n const randomSelector = nodeList => {\n let randomIdx = Math.floor(Math.random() * nodeList.length);\n return nodeList[randomIdx];\n };\n\n /**\n * Ordered selector: always use the nodes in sequence, unless failing.\n *\n * @param nodeList node list\n * @param retry sequence number if last node is tagged has failing\n * @return {String}\n */\n const orderedSelector = (nodeList, retry) => {\n return nodeList[retry];\n };\n\n /**\n * Connect, or if fail handle retry / set timeout error\n *\n * @param cluster current cluster\n * @param nodeList current node list\n * @param nodeKey node name to connect\n * @param retryFct retry function\n * @return {Promise}\n * @private\n */\n const _handleConnectionError = (cluster, nodeList, nodeKey, retryFct) => {\n const node = nodes[nodeKey];\n return node\n .getConnection()\n .then(conn => {\n node.errorCount = 0;\n return Promise.resolve(conn);\n })\n .catch(err => {\n node.errorCount = node.errorCount ? node.errorCount + 1 : 1;\n node.blacklistedUntil = Date.now() + opts.restoreNodeTimeout;\n if (\n opts.removeNodeErrorCount &&\n node.errorCount >= opts.removeNodeErrorCount &&\n nodes[nodeKey]\n ) {\n delete nodes[nodeKey];\n cachedPatterns = {};\n delete nodeList.lastRrIdx;\n process.nextTick(() => cluster.emit('remove', nodeKey));\n //remove node from configuration if not already removed\n node.end().catch(err => {\n // dismiss error\n });\n }\n\n if (nodeList.length !== 0 && opts.canRetry) {\n return retryFct(nodeKey, err);\n }\n return Promise.reject(err);\n });\n };\n\n /**\n * Connect, or if fail handle retry / set timeout error\n *\n * @param cluster current cluster\n * @param nodeList current node list\n * @param nodeKey node name to connect\n * @param retryFct retry function\n * @param callback callback function\n * @private\n */\n const _handleConnectionCallbackError = (cluster, nodeList, nodeKey, retryFct, callback) => {\n const node = nodes[nodeKey];\n node.getConnection((err, conn) => {\n if (err) {\n node.errorCount = node.errorCount ? node.errorCount + 1 : 1;\n node.blacklistedUntil = Date.now() + opts.restoreNodeTimeout;\n if (\n opts.removeNodeErrorCount &&\n node.errorCount >= opts.removeNodeErrorCount &&\n nodes[nodeKey]\n ) {\n delete nodes[nodeKey];\n cachedPatterns = {};\n delete nodeList.lastRrIdx;\n process.nextTick(() => cluster.emit('remove', nodeKey));\n //remove node from configuration if not already removed\n node.end(() => {\n //dismiss error\n });\n if (nodeList.length === 0) return Promise.reject(err);\n }\n\n if (opts.canRetry) return retryFct(nodeKey, err);\n callback(err);\n } else {\n node.errorCount = 0;\n callback(null, conn);\n }\n });\n };\n\n //*****************************************************************\n // internal public testing methods\n //*****************************************************************\n\n function TestMethods() {}\n TestMethods.prototype.getNodes = () => {\n return nodes;\n };\n\n this.__tests = new TestMethods();\n}", "function parseHost(host) {\n if (!requireJSONElements(\n host, ['name', 'category', 'type', 'ip', 'position', 'state'],\n 'host', 'data.json')) {\n return null;\n }\n\n host.color = (host.state == 'Up' ? 'green' :\n (host.state == 'Down' ? 'red' : '#aa0'));\n\n var lines = [];\n //console.log(host);\n lines.push('Host: ' + ('webServer' in host && host.webServer ?\n '<a href=\"http://' + host.fullName + '/\">' +\n b(host.fullName, /^([^.]+)/) + '</a>' :\n b(host.fullName, /^([^.]+)/)) + ' (' + b(host.fullIP, /([\\d]+)$/) +\n ')' + ('externalAccess' in host && host.externalAccess ?\n ' (accessible outside the network)' : ''));\n if ('alias' in host && host.alias.length) {\n var es = host.alias.length == 1 ? '' : 'es';\n var aliases = '';\n host.alias.map(function(a){\n if (aliases.length > 0) {\n aliases += ', ';\n }\n aliases += b(host.fullName.replace(host.name, a).replace('..', ''), /^([^.]+)/)\n });\n lines.push('Alias'+es+': ' + aliases);\n }\n\n var since = '';\n if ('lastChange' in host) {\n since = ' since ' + dt(new Date(host.lastChange*1000), false);\n }\n\n lines.push('State: <b style=\"color:' + host.color + '\">This '+\n host.type.displayName.toLowerCase() + ' is ' +\n host.state.toLowerCase() + '</b>' + since);\n\n if ('lastCheck' in host) {\n lines.push('Last checked: ' + dt(new Date(host.lastCheck*1000), true));\n }\n\n if ('os' in host) {\n lines.push('Operating system: ' +\n img('netsp/img/' + host.os.class + '.png', host.os.class, 12, 12) + ' ' +\n b(dutf8(host.os.release)));\n }\n\n if ('cpu' in host && host.cpu.modelClean && host.cpu.speed && host.cpu.threads) {\n lines.push('CPU: ' +\n b(dutf8(host.cpu.modelClean\n .replace(/\\(R\\)/g, '&reg;')\n .replace(/\\(TM\\)/g, '&trade;'))) +\n ' (' + hertz(host.cpu.speed, 'M') +\n ' on ' + b(host.cpu.threads) + ' logical core' +\n (host.cpu.threads == 1 ? '' : 's') + ')');\n }\n\n if ('cpu' in host && host.cpu.length) {\n var cpu_parse = function (obj) {\n if (obj.model_clean && obj.speed && obj.threads) {\n return b(dutf8(obj.model_clean\n .replace(/\\(R\\)/g, '&reg;')\n .replace(/\\(TM\\)/g, '&trade;'))) +\n ' (' + hertz(obj.speed, 'M') +\n ' on ' + b(obj.threads) + ' thread' +\n (obj.threads == 1 ? '' : 's') + ')';\n } else {\n return '';\n }\n };\n if (host.cpu.length == 1) {\n lines.push('CPU: ' + cpu_parse(host.cpu[0]));\n } else {\n lines.push('CPU: ' + host.cpu.length + ' CPUs connected<ul>' + host.cpu.map(function (obj) {\n return '<li>' + cpu_parse(obj) + '</li>';\n }).join('') + '</ul>');\n }\n }\n\n if ('mem' in host && !('main_mem' in host) && host.mem && host.mem.total) {\n lines.push('Memory: ' + bytes(host.mem.total, 'k'));\n } else if ('main_mem' in host && host.main_mem) {\n var mem_data = 'Memory: <ul><li>' +\n (host.main_mem.used >= 0 ? bytes(host.main_mem.used, 'k') + ' in use of ' : '') +\n bytes(host.main_mem.total, 'k') + ' (' + b('main') + ')' +\n (host.main_mem.used >= 0 ? '<br/>' + progressBar('green',\n host.main_mem.used / host.main_mem.total, 2, 'red', .9) : '') + '</li>';\n if ('swap_mem' in host && host.swap_mem) {\n mem_data += '<li>' +\n (host.swap_mem.used >= 0 ? bytes(host.swap_mem.used, 'k') + ' in use of ' : '') +\n bytes(host.swap_mem.total, 'k') + ' (' + b('swap') + ')' +\n (host.swap_mem.used >= 0 ? '<br/>' + progressBar('green',\n host.swap_mem.used / host.swap_mem.total, 2, 'red', .9) : '') + '</li>';\n }\n mem_data += '</ul>';\n lines.push(mem_data);\n }\n\n if ('disks' in host && host.disks && host.disks.length > 0) {\n lines.push('Disks: ' + host.disks.length + ' mounted<ul>' +\n host.disks.map(function(disk) {\n return '<li>' + b(disk.path) + ' is mounted with ' +\n bytes(disk.used, 'k') + ' in use of ' + bytes(disk.total, 'k') +\n '<br/>' + progressBar('blue', disk.used / disk.total, 2, 'red', .9) + '</li>';\n }).join('') + '</ul>');\n }\n\n if ('prModel' in host) {\n lines.push('Printer Model: ' + \n img('netsp/img/hp.png', 'hp', 12, 12) + ' ' +\n b(dutf8(host.prModel)));\n }\n\n if ('prText' in host) {\n lines.push('Status: <pre>' + b(dutf8(host.prText.split('\\n').join('<br/>'))) + '</pre>');\n }\n\n if ('inks' in host) {\n lines.push('Ink cartridges: ' + host.inks.length + ' installed<ul>' +\n host.inks.map(function(ink) {\n return '<li>' + b(ink.color) + ' cartridge<br/>' +\n progressBar(ink.color.toLowerCase(), ink.amount / 100, 0, 'red', -.1) + '</li>';\n }).join('') + '</ul>');\n }\n\n if ('trays' in host) {\n lines.push('Paper trays: ' + host.trays.length + ' installed<ul>' +\n host.trays.map(function(tray) {\n return '<li>Tray ' + b(tray.index) + ' is ' + b(tray.state) + '</li>';\n }).join('') + '</ul>');\n }\n\n if ('sessions' in host && 'sessStr' in host) {\n lines.push('Users: ' +\n host.sessions.length + ' online ' +\n '(' + host.users.length + ' session' +\n (host.users.length == 1 ? '' : 's') + ')' +\n host.sessStr);\n }\n\n if ('webLocation' in host) {\n lines.push('Most recent snapshot:<br/>' +\n img(host.webLocation, host.fullName + ' snapshot', 352, 240));\n }\n\n var iconStr = '';\n if ('icon' in host) {\n iconStr = img('netsp/img/' + host.icon + '.png', host.icon, 16, 16) + ' ';\n }\n var html = '<h2>Info for ' + iconStr + host.type.displayName + ' ' + host.name + '</h2><ul>';\n for (var i in lines) {\n html += '<li>' + lines[i] + '</li>';\n }\n html += '</ul>';\n return html;\n }", "function network(data, prev, index, expand) {\n expand = expand || {};\n var gm = {}, // group map\n nm = {}, // node map\n lm = {}, // link map\n gn = {}, // previous group nodes\n gc = {}, // previous group centroids\n nodes = [], // output nodes\n links = []; // output links\n\n // process previous nodes for reuse or centroid calculation\n if (prev) {\n prev.nodes.forEach(function(n) {\n var i = index(n), o;\n if (n.size > 0) {\n gn[i] = n;\n n.size = 0;\n } else {\n o = gc[i] || (gc[i] = {x:0,y:0,count:0});\n o.x += n.x;\n o.y += n.y;\n o.count += 1;\n }\n });\n }\n\n // determine nodes\n for (var k=0; k<data.nodes.length; ++k) {\n var n = data.nodes[k],\n i = index(n), //group id\n l = gm[i] || (gm[i]=gn[i]) || (gm[i]={group:i, size:0, exec_t:n.exec_t, nodes:[]});\n\n if (expand[i]) {\n // the node should be directly visible\n nm[n.name] = nodes.length;\n nodes.push(n);\n if (gn[i]) {\n // place new nodes at cluster location (plus jitter)\n n.x = gn[i].x + Math.random();\n n.y = gn[i].y + Math.random();\n }\n } else {\n // the node is part of a collapsed cluster\n if (l.size == 0) {\n // if new cluster, add to set and position at centroid of leaf nodes\n nm[i] = nodes.length;\n nodes.push(l);\n if (gc[i]) {\n l.x = gc[i].x / gc[i].count;\n l.y = gc[i].y / gc[i].count;\n }\n }\n l.nodes.push(n);\n }\n // always count group size as we also use it to tweak the force graph strengths/distances\n l.size += 1;\n //l.exec_t += n.exec_t;\n n.group_data = l;\n }\n\n for (i in gm) { gm[i].link_count = 0; }\n\n //scale the weight range [1,10] domain[min.max]\n var weigh_arr = [];\n for( i in nodes ){ weigh_arr.push(nodes[i].exec_t); }\n\n //console.log(weigh_arr);\n var max = d3.max(weigh_arr);\n var min = d3.min(weigh_arr);\n var scale = d3.scale.linear().domain([min, max]).range([6, 15]);\n for ( i in nodes )\n nodes[i].exec_t = scale(weigh_arr[i]);\n\n // determine links\n for (k=0; k<data.links.length; ++k) {\n var e = data.links[k],\n u = index(e.source),\n v = index(e.target)\n d = e.dist\n s = e.strength;\n if (u != v) {\n gm[u].link_count++;\n gm[v].link_count++;\n }\n u = expand[u] ? nm[e.source.name] : nm[u];\n v = expand[v] ? nm[e.target.name] : nm[v];\n\n var i = (u<v ? u+\"|\"+v : v+\"|\"+u),\n l = lm[i] || (lm[i] = {source:u, target:v, size:0, dist:d, strength:s});\n l.size += 1;\n }\n for (i in lm) { links.push(lm[i]); }\n\n //scale the strength/stroke-width range [0.1,1] domain[min.max]\n var strength_arr = [];\n for (i in links) { strength_arr.push(links[i].strength); }\n\n //console.log(weigh_arr);\n var max_s = d3.max(strength_arr);\n var min_s = d3.min(strength_arr);\n var scale_s = d3.scale.linear().domain([min_s, max_s]).range([0.1, 1]);\n\n for ( i in links )\n links[i].strength = scale_s(strength_arr[i]);\n\n return {nodes: nodes, links: links};\n }", "function addCluster() {\n let cluster = $(\"#cluster\");\n // count cluster number\n clusterNumber++;\n\n // add cluster html\n cluster.append(\n '<div class=\"dd py-3\" id=cluster_' +\n clusterNumber.toString() +\n \">\" +\n \"</div>\"\n );\n\n //activate drag and drop function\n drop_zone(clusterNumber);\n $(\".dd\").nestable({\n onDragStart: function (l, e) {\n // get type of dragged element\n // let type = $(e).children(\".dd-handle\").attr(\"class\").split(\" \")[0];\n // console.log(type);\n //when start dragging, trigger addNoChildrenClass method\n addNoChildrenClass();\n },\n callback: function (l, e) {\n // l is the main container\n // e is the element that was moved\n //when finish dropping, trigger these methods to make \"dd-empty\" is always one\n appendCluster();\n removeCluster();\n },\n //enable auto scrolling method while dragging\n scroll: true\n });\n}", "async function patchBareMetalMachineKeySetOfCluster() {\n const subscriptionId =\n process.env[\"NETWORKCLOUD_SUBSCRIPTION_ID\"] || \"123e4567-e89b-12d3-a456-426655440000\";\n const resourceGroupName = process.env[\"NETWORKCLOUD_RESOURCE_GROUP\"] || \"resourceGroupName\";\n const clusterName = \"clusterName\";\n const bareMetalMachineKeySetName = \"bareMetalMachineKeySetName\";\n const bareMetalMachineKeySetUpdateParameters = {\n expiration: new Date(\"2022-12-31T23:59:59.008Z\"),\n jumpHostsAllowed: [\"192.0.2.1\", \"192.0.2.5\"],\n tags: { key1: \"myvalue1\", key2: \"myvalue2\" },\n userList: [\n {\n description: \"Needs access for troubleshooting as a part of the support team\",\n azureUserName: \"userABC\",\n sshPublicKey: {\n keyData:\n \"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm\",\n },\n },\n {\n description: \"Needs access for troubleshooting as a part of the support team\",\n azureUserName: \"userXYZ\",\n sshPublicKey: {\n keyData:\n \"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm\",\n },\n },\n ],\n };\n const options = {\n bareMetalMachineKeySetUpdateParameters,\n };\n const credential = new DefaultAzureCredential();\n const client = new NetworkCloud(credential, subscriptionId);\n const result = await client.bareMetalMachineKeySets.beginUpdateAndWait(\n resourceGroupName,\n clusterName,\n bareMetalMachineKeySetName,\n options\n );\n console.log(result);\n}", "gridBasedClustering () {\n\t\tlet clusters = this.initializeGridBasedClusters();\n\t\tlet clustersOrder = this.assignPointsToCells( clusters );\n\n\t\tthis.setRepresentatives(\n\t\t\tclusters, clustersOrder, this.params.representativeType );\n\n\t\tthis.handleOverlappedClusters(\n\t\t\tclusters, clustersOrder, this.params.representativeType );\n\n\t\tthis.dataOut = this.constructOutputClusters( clusters );\n\t}", "for (let i = 0; i<clusters.length; i++) {\n let cluster = clusters[i];\n cluster.level = 1;\n }", "function init() {\n\tif (verbose) { \n\t\tconsole.log('Root directory set to ' + directory);\n\t\tconsole.log('Child processes set to ' + child_processes);\n\t}\n\tconsole.log('Spawning ' + child_processes +' workers...');\n\n\tfor (var i = 0; i < child_processes; i++) {\n\t\tvar worker = cluster.fork();\n\t\tif (verbose) console.log('Worker ' + worker.pid + ' online!');\n\n\t\tworker.on('message', function(msg) {\n\t\t\t// Master receieved message from a worker, examine message contents.\n\t\t\tif (msg.ready) {\n\t\t\t\tif (++readyCount === workers.length) {\n\t\t\t\t\tif (verbose) console.log(\"All workers indicated they're ready, sending start signal...\");\n\t\t\t\t\tworkers.forEach(function(worker) {\n\t\t\t\t\t\tworker.send( { start: true, fullMode: fullMode, verbose: verbose } );\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t} else if (msg.data) {\n\t\t\t\t//console.log(msg.data.ticker || msg.data, msg.data.date || '');\n\t\t\t\tcount++;\n\t\t\t\t// TODO: write back to DB\n\n\t\t\t} else if (msg.done) {\n\t\t\t\tconsole.log('Worker ' + msg.done + ' signaled that it is finished.');\n\t\t\t\tif (--readyCount === 0) {\n\t\t\t\t\tconsole.log('All workers finished!');\n\t\t\t\t\t// Sometimes we have to wait briefly for the master process to catch up.\n\t\t\t\t\tsetInterval(function() {\n\t\t\t\t\t\tif (count === filePaths.length) { \n\t\t\t\t\t\t\tconsole.log('Finished successfully!');\n\t\t\t\t\t\t\tworkers.forEach(function(worker) {\n\t\t\t\t\t\t\t\tif (verbose) console.log('Killing worker ' + worker.pid);\n\t\t\t\t\t\t\t\tworker.kill();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tprocess.exit(0); \n\t\t\t\t\t\t} else { console.log('Waiting for async calls to finish... ('+count+')'); }\n\t\t\t\t\t}, 1000);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tworkers.push(worker);\n\t}\n}", "onChangeCluster (clusterId) {\n this.setState({\n clusterId,\n })\n\n const template = this.getTemplate(this.state.templateId)\n if (template && template.get('clusterId') && template.get('clusterId') !== clusterId) {\n this.doChangeTemplateIdTo(zeroUID) // Careful: this.state.clusterId still contains previous clusterId, call setTimeout(function, 0) if needed otherwise\n }\n\n // fire external data retrieval here if needed after Cluster change\n }", "getInitialDateClusterMaps() {\n return {\n run: new Map(),\n failure: new Map(),\n error: new Map(),\n test: new Map(),\n rest: new Map()\n };\n }", "function InternalClusterer($container, map, raw) {\n var timer, projection,\n ffilter, fdisplay, ferror, // callback function\n updating = false,\n updated = false,\n redrawing = false,\n ready = false,\n enabled = true,\n self = this,\n events = [],\n store = {}, // combin of index (id1-id2-...) => object\n ids = {}, // unique id => index\n idxs = {}, // index => unique id\n markers = [], // index => marker\n tds = [], // index => td or null if removed\n values = [], // index => value\n overlay = newEmptyOverlay(map, raw.radius);\n\n main();\n\n function prepareMarker(index) {\n if (!markers[index]) {\n delete tds[index].options.map;\n markers[index] = new defaults.classes.Marker(tds[index].options);\n attachEvents($container, {td: tds[index]}, markers[index], tds[index].id);\n }\n }\n\n /**\n * return a marker by its id, null if not yet displayed and false if no exist or removed\n **/\n self.getById = function (id) {\n if (id in ids) {\n prepareMarker(ids[id]);\n return markers[ids[id]];\n }\n return false;\n };\n\n /**\n * remove one object from the store\n **/\n self.rm = function (id) {\n var index = ids[id];\n if (markers[index]) { // can be null\n markers[index].setMap(null);\n }\n delete markers[index];\n markers[index] = false;\n\n delete tds[index];\n tds[index] = false;\n\n delete values[index];\n values[index] = false;\n\n delete ids[id];\n delete idxs[index];\n updated = true;\n };\n\n /**\n * remove a marker by its id\n **/\n self.clearById = function (id) {\n if (id in ids){\n self.rm(id);\n return true;\n }\n };\n\n /**\n * remove objects from the store\n **/\n self.clear = function (last, first, tag) {\n var start, stop, step, index, i,\n list = [],\n check = ftag(tag);\n if (last) {\n start = tds.length - 1;\n stop = -1;\n step = -1;\n } else {\n start = 0;\n stop = tds.length;\n step = 1;\n }\n for (index = start; index !== stop; index += step) {\n if (tds[index]) {\n if (!check || check(tds[index].tag)) {\n list.push(idxs[index]);\n if (first || last) {\n break;\n }\n }\n }\n }\n for (i = 0; i < list.length; i++) {\n self.rm(list[i]);\n }\n };\n\n // add a \"marker td\" to the cluster\n self.add = function (td, value) {\n td.id = globalId(td.id);\n self.clearById(td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(null); // null = marker not yet created / displayed\n tds.push(td);\n values.push(value);\n updated = true;\n };\n\n // add a real marker to the cluster\n self.addMarker = function (marker, td) {\n td = td || {};\n td.id = globalId(td.id);\n self.clearById(td.id);\n if (!td.options) {\n td.options = {};\n }\n td.options.position = marker.getPosition();\n attachEvents($container, {td: td}, marker, td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(marker);\n tds.push(td);\n values.push(td.data || {});\n updated = true;\n };\n\n // return a \"marker td\" by its index\n self.td = function (index) {\n return tds[index];\n };\n\n // return a \"marker value\" by its index\n self.value = function (index) {\n return values[index];\n };\n\n // return a marker by its index\n self.marker = function (index) {\n if (index in markers) {\n prepareMarker(index);\n return markers[index];\n }\n return false;\n };\n\n // return a marker by its index\n self.markerIsSet = function (index) {\n return Boolean(markers[index]);\n };\n\n // store a new marker instead if the default \"false\"\n self.setMarker = function (index, marker) {\n markers[index] = marker;\n };\n\n // link the visible overlay to the logical data (to hide overlays later)\n self.store = function (cluster, obj, shadow) {\n store[cluster.ref] = {obj: obj, shadow: shadow};\n };\n\n // free all objects\n self.free = function () {\n var i;\n for(i = 0; i < events.length; i++) {\n gm.event.removeListener(events[i]);\n }\n events = [];\n\n $.each(store, function (key) {\n flush(key);\n });\n store = {};\n\n $.each(tds, function (i) {\n tds[i] = null;\n });\n tds = [];\n\n $.each(markers, function (i) {\n if (markers[i]) { // false = removed\n markers[i].setMap(null);\n delete markers[i];\n }\n });\n markers = [];\n\n $.each(values, function (i) {\n delete values[i];\n });\n values = [];\n\n ids = {};\n idxs = {};\n };\n\n // link the display function\n self.filter = function (f) {\n ffilter = f;\n redraw();\n };\n\n // enable/disable the clustering feature\n self.enable = function (value) {\n if (enabled !== value) {\n enabled = value;\n redraw();\n }\n };\n\n // link the display function\n self.display = function (f) {\n fdisplay = f;\n };\n\n // link the errorfunction\n self.error = function (f) {\n ferror = f;\n };\n\n // lock the redraw\n self.beginUpdate = function () {\n updating = true;\n };\n\n // unlock the redraw\n self.endUpdate = function () {\n updating = false;\n if (updated) {\n redraw();\n }\n };\n\n // extends current bounds with internal markers\n self.autofit = function (bounds) {\n var i;\n for (i = 0; i < tds.length; i++) {\n if (tds[i]) {\n bounds.extend(tds[i].options.position);\n }\n }\n };\n\n // bind events\n function main() {\n projection = overlay.getProjection();\n if (!projection) {\n setTimeout(function () { main.apply(self, []); }, 25);\n return;\n }\n ready = true;\n events.push(gm.event.addListener(map, \"zoom_changed\", delayRedraw));\n events.push(gm.event.addListener(map, \"bounds_changed\", delayRedraw));\n redraw();\n }\n\n // flush overlays\n function flush(key) {\n if (isObject(store[key])) { // is overlay\n if (isFunction(store[key].obj.setMap)) {\n store[key].obj.setMap(null);\n }\n if (isFunction(store[key].obj.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.setMap)) {\n store[key].shadow.setMap(null);\n }\n delete store[key].obj;\n delete store[key].shadow;\n } else if (markers[key]) { // marker not removed\n markers[key].setMap(null);\n // don't remove the marker object, it may be displayed later\n }\n delete store[key];\n }\n\n /**\n * return the distance between 2 latLng couple into meters\n * Params :\n * Lat1, Lng1, Lat2, Lng2\n * LatLng1, Lat2, Lng2\n * Lat1, Lng1, LatLng2\n * LatLng1, LatLng2\n **/\n function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }\n\n // extend the visible bounds\n function extendsMapBounds() {\n var radius = distanceInMeter(map.getCenter(), map.getBounds().getNorthEast()),\n circle = new gm.Circle({\n center: map.getCenter(),\n radius: 1.25 * radius // + 25%\n });\n return circle.getBounds();\n }\n\n // return an object where keys are store keys\n function getStoreKeys() {\n var k,\n keys = {};\n for (k in store) {\n keys[k] = true;\n }\n return keys;\n }\n\n // async the delay function\n function delayRedraw() {\n clearTimeout(timer);\n timer = setTimeout(redraw, 25);\n }\n\n // generate bounds extended by radius\n function extendsBounds(latLng) {\n var p = projection.fromLatLngToDivPixel(latLng),\n ne = projection.fromDivPixelToLatLng(new gm.Point(p.x + raw.radius, p.y - raw.radius)),\n sw = projection.fromDivPixelToLatLng(new gm.Point(p.x - raw.radius, p.y + raw.radius));\n return new gm.LatLngBounds(sw, ne);\n }\n\n // run the clustering process and call the display function\n function redraw() {\n if (updating || redrawing || !ready) {\n return;\n }\n\n var i, j, k, indexes, check = false, bounds, cluster, position, previous, lat, lng, loop,\n keys = [],\n used = {},\n zoom = map.getZoom(),\n forceDisabled = (\"maxZoom\" in raw) && (zoom > raw.maxZoom),\n previousKeys = getStoreKeys();\n\n // reset flag\n updated = false;\n\n if (zoom > 3) {\n // extend the bounds of the visible map to manage clusters near the boundaries\n bounds = extendsMapBounds();\n\n // check contain only if boundaries are valid\n check = bounds.getSouthWest().lng() < bounds.getNorthEast().lng();\n }\n\n // calculate positions of \"visibles\" markers (in extended bounds)\n for (i = 0; i < tds.length; i++) {\n if (tds[i] && (!check || bounds.contains(tds[i].options.position)) && (!ffilter || ffilter(values[i]))) {\n keys.push(i);\n }\n }\n\n // for each \"visible\" marker, search its neighbors to create a cluster\n // we can't do a classical \"for\" loop, because, analysis can bypass a marker while focusing on cluster\n while (1) {\n i = 0;\n while (used[i] && (i < keys.length)) { // look for the next marker not used\n i++;\n }\n if (i === keys.length) {\n break;\n }\n\n indexes = [];\n\n if (enabled && !forceDisabled) {\n loop = 10;\n do {\n previous = indexes;\n indexes = [];\n loop--;\n\n if (previous.length) {\n position = bounds.getCenter();\n } else {\n position = tds[keys[i]].options.position;\n }\n bounds = extendsBounds(position);\n\n for (j = i; j < keys.length; j++) {\n if (used[j]) {\n continue;\n }\n if (bounds.contains(tds[keys[j]].options.position)) {\n indexes.push(j);\n }\n }\n } while ((previous.length < indexes.length) && (indexes.length > 1) && loop);\n } else {\n for (j = i; j < keys.length; j++) {\n if (!used[j]) {\n indexes.push(j);\n break;\n }\n }\n }\n\n cluster = {indexes: [], ref: []};\n lat = lng = 0;\n for (k = 0; k < indexes.length; k++) {\n used[indexes[k]] = true;\n cluster.indexes.push(keys[indexes[k]]);\n cluster.ref.push(keys[indexes[k]]);\n lat += tds[keys[indexes[k]]].options.position.lat();\n lng += tds[keys[indexes[k]]].options.position.lng();\n }\n lat /= indexes.length;\n lng /= indexes.length;\n cluster.latLng = new gm.LatLng(lat, lng);\n\n cluster.ref = cluster.ref.join(\"-\");\n\n if (cluster.ref in previousKeys) { // cluster doesn't change\n delete previousKeys[cluster.ref]; // remove this entry, these still in this array will be removed\n } else { // cluster is new\n if (indexes.length === 1) { // alone markers are not stored, so need to keep the key (else, will be displayed every time and marker will blink)\n store[cluster.ref] = true;\n }\n fdisplay(cluster);\n }\n }\n\n // flush the previous overlays which are not still used\n $.each(previousKeys, function (key) {\n flush(key);\n });\n redrawing = false;\n }\n}", "function InternalClusterer($container, map, raw) {\n var timer, projection,\n ffilter, fdisplay, ferror, // callback function\n updating = false,\n updated = false,\n redrawing = false,\n ready = false,\n enabled = true,\n self = this,\n events = [],\n store = {}, // combin of index (id1-id2-...) => object\n ids = {}, // unique id => index\n idxs = {}, // index => unique id\n markers = [], // index => marker\n tds = [], // index => td or null if removed\n values = [], // index => value\n overlay = newEmptyOverlay(map, raw.radius);\n\n main();\n\n function prepareMarker(index) {\n if (!markers[index]) {\n delete tds[index].options.map;\n markers[index] = new defaults.classes.Marker(tds[index].options);\n attachEvents($container, {td: tds[index]}, markers[index], tds[index].id);\n }\n }\n\n /**\n * return a marker by its id, null if not yet displayed and false if no exist or removed\n **/\n self.getById = function (id) {\n if (id in ids) {\n prepareMarker(ids[id]);\n return markers[ids[id]];\n }\n return false;\n };\n\n /**\n * remove one object from the store\n **/\n self.rm = function (id) {\n var index = ids[id];\n if (markers[index]) { // can be null\n markers[index].setMap(null);\n }\n delete markers[index];\n markers[index] = false;\n\n delete tds[index];\n tds[index] = false;\n\n delete values[index];\n values[index] = false;\n\n delete ids[id];\n delete idxs[index];\n updated = true;\n };\n\n /**\n * remove a marker by its id\n **/\n self.clearById = function (id) {\n if (id in ids){\n self.rm(id);\n return true;\n }\n };\n\n /**\n * remove objects from the store\n **/\n self.clear = function (last, first, tag) {\n var start, stop, step, index, i,\n list = [],\n check = ftag(tag);\n if (last) {\n start = tds.length - 1;\n stop = -1;\n step = -1;\n } else {\n start = 0;\n stop = tds.length;\n step = 1;\n }\n for (index = start; index !== stop; index += step) {\n if (tds[index]) {\n if (!check || check(tds[index].tag)) {\n list.push(idxs[index]);\n if (first || last) {\n break;\n }\n }\n }\n }\n for (i = 0; i < list.length; i++) {\n self.rm(list[i]);\n }\n };\n\n // add a \"marker td\" to the cluster\n self.add = function (td, value) {\n td.id = globalId(td.id);\n self.clearById(td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(null); // null = marker not yet created / displayed\n tds.push(td);\n values.push(value);\n updated = true;\n };\n\n // add a real marker to the cluster\n self.addMarker = function (marker, td) {\n td = td || {};\n td.id = globalId(td.id);\n self.clearById(td.id);\n if (!td.options) {\n td.options = {};\n }\n td.options.position = marker.getPosition();\n attachEvents($container, {td: td}, marker, td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(marker);\n tds.push(td);\n values.push(td.data || {});\n updated = true;\n };\n\n // return a \"marker td\" by its index\n self.td = function (index) {\n return tds[index];\n };\n\n // return a \"marker value\" by its index\n self.value = function (index) {\n return values[index];\n };\n\n // return a marker by its index\n self.marker = function (index) {\n if (index in markers) {\n prepareMarker(index);\n return markers[index];\n }\n return false;\n };\n\n // return a marker by its index\n self.markerIsSet = function (index) {\n return Boolean(markers[index]);\n };\n\n // store a new marker instead if the default \"false\"\n self.setMarker = function (index, marker) {\n markers[index] = marker;\n };\n\n // link the visible overlay to the logical data (to hide overlays later)\n self.store = function (cluster, obj, shadow) {\n store[cluster.ref] = {obj: obj, shadow: shadow};\n };\n\n // free all objects\n self.free = function () {\n var i;\n for(i = 0; i < events.length; i++) {\n gm.event.removeListener(events[i]);\n }\n events = [];\n\n $.each(store, function (key) {\n flush(key);\n });\n store = {};\n\n $.each(tds, function (i) {\n tds[i] = null;\n });\n tds = [];\n\n $.each(markers, function (i) {\n if (markers[i]) { // false = removed\n markers[i].setMap(null);\n delete markers[i];\n }\n });\n markers = [];\n\n $.each(values, function (i) {\n delete values[i];\n });\n values = [];\n\n ids = {};\n idxs = {};\n };\n\n // link the display function\n self.filter = function (f) {\n ffilter = f;\n redraw();\n };\n\n // enable/disable the clustering feature\n self.enable = function (value) {\n if (enabled !== value) {\n enabled = value;\n redraw();\n }\n };\n\n // link the display function\n self.display = function (f) {\n fdisplay = f;\n };\n\n // link the errorfunction\n self.error = function (f) {\n ferror = f;\n };\n\n // lock the redraw\n self.beginUpdate = function () {\n updating = true;\n };\n\n // unlock the redraw\n self.endUpdate = function () {\n updating = false;\n if (updated) {\n redraw();\n }\n };\n\n // extends current bounds with internal markers\n self.autofit = function (bounds) {\n var i;\n for (i = 0; i < tds.length; i++) {\n if (tds[i]) {\n bounds.extend(tds[i].options.position);\n }\n }\n };\n\n // bind events\n function main() {\n projection = overlay.getProjection();\n if (!projection) {\n setTimeout(function () { main.apply(self, []); }, 25);\n return;\n }\n ready = true;\n events.push(gm.event.addListener(map, \"zoom_changed\", delayRedraw));\n events.push(gm.event.addListener(map, \"bounds_changed\", delayRedraw));\n redraw();\n }\n\n // flush overlays\n function flush(key) {\n if (isObject(store[key])) { // is overlay\n if (isFunction(store[key].obj.setMap)) {\n store[key].obj.setMap(null);\n }\n if (isFunction(store[key].obj.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.setMap)) {\n store[key].shadow.setMap(null);\n }\n delete store[key].obj;\n delete store[key].shadow;\n } else if (markers[key]) { // marker not removed\n markers[key].setMap(null);\n // don't remove the marker object, it may be displayed later\n }\n delete store[key];\n }\n\n /**\n * return the distance between 2 latLng couple into meters\n * Params :\n * Lat1, Lng1, Lat2, Lng2\n * LatLng1, Lat2, Lng2\n * Lat1, Lng1, LatLng2\n * LatLng1, LatLng2\n **/\n function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }\n\n // extend the visible bounds\n function extendsMapBounds() {\n var radius = distanceInMeter(map.getCenter(), map.getBounds().getNorthEast()),\n circle = new gm.Circle({\n center: map.getCenter(),\n radius: 1.25 * radius // + 25%\n });\n return circle.getBounds();\n }\n\n // return an object where keys are store keys\n function getStoreKeys() {\n var k,\n keys = {};\n for (k in store) {\n keys[k] = true;\n }\n return keys;\n }\n\n // async the delay function\n function delayRedraw() {\n clearTimeout(timer);\n timer = setTimeout(redraw, 25);\n }\n\n // generate bounds extended by radius\n function extendsBounds(latLng) {\n var p = projection.fromLatLngToDivPixel(latLng),\n ne = projection.fromDivPixelToLatLng(new gm.Point(p.x + raw.radius, p.y - raw.radius)),\n sw = projection.fromDivPixelToLatLng(new gm.Point(p.x - raw.radius, p.y + raw.radius));\n return new gm.LatLngBounds(sw, ne);\n }\n\n // run the clustering process and call the display function\n function redraw() {\n if (updating || redrawing || !ready) {\n return;\n }\n\n var i, j, k, indexes, check = false, bounds, cluster, position, previous, lat, lng, loop,\n keys = [],\n used = {},\n zoom = map.getZoom(),\n forceDisabled = (\"maxZoom\" in raw) && (zoom > raw.maxZoom),\n previousKeys = getStoreKeys();\n\n // reset flag\n updated = false;\n\n if (zoom > 3) {\n // extend the bounds of the visible map to manage clusters near the boundaries\n bounds = extendsMapBounds();\n\n // check contain only if boundaries are valid\n check = bounds.getSouthWest().lng() < bounds.getNorthEast().lng();\n }\n\n // calculate positions of \"visibles\" markers (in extended bounds)\n for (i = 0; i < tds.length; i++) {\n if (tds[i] && (!check || bounds.contains(tds[i].options.position)) && (!ffilter || ffilter(values[i]))) {\n keys.push(i);\n }\n }\n\n // for each \"visible\" marker, search its neighbors to create a cluster\n // we can't do a classical \"for\" loop, because, analysis can bypass a marker while focusing on cluster\n while (1) {\n i = 0;\n while (used[i] && (i < keys.length)) { // look for the next marker not used\n i++;\n }\n if (i === keys.length) {\n break;\n }\n\n indexes = [];\n\n if (enabled && !forceDisabled) {\n loop = 10;\n do {\n previous = indexes;\n indexes = [];\n loop--;\n\n if (previous.length) {\n position = bounds.getCenter();\n } else {\n position = tds[keys[i]].options.position;\n }\n bounds = extendsBounds(position);\n\n for (j = i; j < keys.length; j++) {\n if (used[j]) {\n continue;\n }\n if (bounds.contains(tds[keys[j]].options.position)) {\n indexes.push(j);\n }\n }\n } while ((previous.length < indexes.length) && (indexes.length > 1) && loop);\n } else {\n for (j = i; j < keys.length; j++) {\n if (!used[j]) {\n indexes.push(j);\n break;\n }\n }\n }\n\n cluster = {indexes: [], ref: []};\n lat = lng = 0;\n for (k = 0; k < indexes.length; k++) {\n used[indexes[k]] = true;\n cluster.indexes.push(keys[indexes[k]]);\n cluster.ref.push(keys[indexes[k]]);\n lat += tds[keys[indexes[k]]].options.position.lat();\n lng += tds[keys[indexes[k]]].options.position.lng();\n }\n lat /= indexes.length;\n lng /= indexes.length;\n cluster.latLng = new gm.LatLng(lat, lng);\n\n cluster.ref = cluster.ref.join(\"-\");\n\n if (cluster.ref in previousKeys) { // cluster doesn't change\n delete previousKeys[cluster.ref]; // remove this entry, these still in this array will be removed\n } else { // cluster is new\n if (indexes.length === 1) { // alone markers are not stored, so need to keep the key (else, will be displayed every time and marker will blink)\n store[cluster.ref] = true;\n }\n fdisplay(cluster);\n }\n }\n\n // flush the previous overlays which are not still used\n $.each(previousKeys, function (key) {\n flush(key);\n });\n redrawing = false;\n }\n}", "function InternalClusterer($container, map, raw) {\n var timer, projection,\n ffilter, fdisplay, ferror, // callback function\n updating = false,\n updated = false,\n redrawing = false,\n ready = false,\n enabled = true,\n self = this,\n events = [],\n store = {}, // combin of index (id1-id2-...) => object\n ids = {}, // unique id => index\n idxs = {}, // index => unique id\n markers = [], // index => marker\n tds = [], // index => td or null if removed\n values = [], // index => value\n overlay = newEmptyOverlay(map, raw.radius);\n\n main();\n\n function prepareMarker(index) {\n if (!markers[index]) {\n delete tds[index].options.map;\n markers[index] = new defaults.classes.Marker(tds[index].options);\n attachEvents($container, {td: tds[index]}, markers[index], tds[index].id);\n }\n }\n\n /**\n * return a marker by its id, null if not yet displayed and false if no exist or removed\n **/\n self.getById = function (id) {\n if (id in ids) {\n prepareMarker(ids[id]);\n return markers[ids[id]];\n }\n return false;\n };\n\n /**\n * remove one object from the store\n **/\n self.rm = function (id) {\n var index = ids[id];\n if (markers[index]) { // can be null\n markers[index].setMap(null);\n }\n delete markers[index];\n markers[index] = false;\n\n delete tds[index];\n tds[index] = false;\n\n delete values[index];\n values[index] = false;\n\n delete ids[id];\n delete idxs[index];\n updated = true;\n };\n\n /**\n * remove a marker by its id\n **/\n self.clearById = function (id) {\n if (id in ids){\n self.rm(id);\n return true;\n }\n };\n\n /**\n * remove objects from the store\n **/\n self.clear = function (last, first, tag) {\n var start, stop, step, index, i,\n list = [],\n check = ftag(tag);\n if (last) {\n start = tds.length - 1;\n stop = -1;\n step = -1;\n } else {\n start = 0;\n stop = tds.length;\n step = 1;\n }\n for (index = start; index !== stop; index += step) {\n if (tds[index]) {\n if (!check || check(tds[index].tag)) {\n list.push(idxs[index]);\n if (first || last) {\n break;\n }\n }\n }\n }\n for (i = 0; i < list.length; i++) {\n self.rm(list[i]);\n }\n };\n\n // add a \"marker td\" to the cluster\n self.add = function (td, value) {\n td.id = globalId(td.id);\n self.clearById(td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(null); // null = marker not yet created / displayed\n tds.push(td);\n values.push(value);\n updated = true;\n };\n\n // add a real marker to the cluster\n self.addMarker = function (marker, td) {\n td = td || {};\n td.id = globalId(td.id);\n self.clearById(td.id);\n if (!td.options) {\n td.options = {};\n }\n td.options.position = marker.getPosition();\n attachEvents($container, {td: td}, marker, td.id);\n ids[td.id] = markers.length;\n idxs[markers.length] = td.id;\n markers.push(marker);\n tds.push(td);\n values.push(td.data || {});\n updated = true;\n };\n\n // return a \"marker td\" by its index\n self.td = function (index) {\n return tds[index];\n };\n\n // return a \"marker value\" by its index\n self.value = function (index) {\n return values[index];\n };\n\n // return a marker by its index\n self.marker = function (index) {\n if (index in markers) {\n prepareMarker(index);\n return markers[index];\n }\n return false;\n };\n\n // return a marker by its index\n self.markerIsSet = function (index) {\n return Boolean(markers[index]);\n };\n\n // store a new marker instead if the default \"false\"\n self.setMarker = function (index, marker) {\n markers[index] = marker;\n };\n\n // link the visible overlay to the logical data (to hide overlays later)\n self.store = function (cluster, obj, shadow) {\n store[cluster.ref] = {obj: obj, shadow: shadow};\n };\n\n // free all objects\n self.free = function () {\n var i;\n for(i = 0; i < events.length; i++) {\n gm.event.removeListener(events[i]);\n }\n events = [];\n\n $.each(store, function (key) {\n flush(key);\n });\n store = {};\n\n $.each(tds, function (i) {\n tds[i] = null;\n });\n tds = [];\n\n $.each(markers, function (i) {\n if (markers[i]) { // false = removed\n markers[i].setMap(null);\n delete markers[i];\n }\n });\n markers = [];\n\n $.each(values, function (i) {\n delete values[i];\n });\n values = [];\n\n ids = {};\n idxs = {};\n };\n\n // link the display function\n self.filter = function (f) {\n ffilter = f;\n redraw();\n };\n\n // enable/disable the clustering feature\n self.enable = function (value) {\n if (enabled !== value) {\n enabled = value;\n redraw();\n }\n };\n\n // link the display function\n self.display = function (f) {\n fdisplay = f;\n };\n\n // link the errorfunction\n self.error = function (f) {\n ferror = f;\n };\n\n // lock the redraw\n self.beginUpdate = function () {\n updating = true;\n };\n\n // unlock the redraw\n self.endUpdate = function () {\n updating = false;\n if (updated) {\n redraw();\n }\n };\n\n // extends current bounds with internal markers\n self.autofit = function (bounds) {\n var i;\n for (i = 0; i < tds.length; i++) {\n if (tds[i]) {\n bounds.extend(tds[i].options.position);\n }\n }\n };\n\n // bind events\n function main() {\n projection = overlay.getProjection();\n if (!projection) {\n setTimeout(function () { main.apply(self, []); }, 25);\n return;\n }\n ready = true;\n events.push(gm.event.addListener(map, \"zoom_changed\", delayRedraw));\n events.push(gm.event.addListener(map, \"bounds_changed\", delayRedraw));\n redraw();\n }\n\n // flush overlays\n function flush(key) {\n if (isObject(store[key])) { // is overlay\n if (isFunction(store[key].obj.setMap)) {\n store[key].obj.setMap(null);\n }\n if (isFunction(store[key].obj.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.remove)) {\n store[key].obj.remove();\n }\n if (isFunction(store[key].shadow.setMap)) {\n store[key].shadow.setMap(null);\n }\n delete store[key].obj;\n delete store[key].shadow;\n } else if (markers[key]) { // marker not removed\n markers[key].setMap(null);\n // don't remove the marker object, it may be displayed later\n }\n delete store[key];\n }\n\n /**\n * return the distance between 2 latLng couple into meters\n * Params :\n * Lat1, Lng1, Lat2, Lng2\n * LatLng1, Lat2, Lng2\n * Lat1, Lng1, LatLng2\n * LatLng1, LatLng2\n **/\n function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }\n\n // extend the visible bounds\n function extendsMapBounds() {\n var radius = distanceInMeter(map.getCenter(), map.getBounds().getNorthEast()),\n circle = new gm.Circle({\n center: map.getCenter(),\n radius: 1.25 * radius // + 25%\n });\n return circle.getBounds();\n }\n\n // return an object where keys are store keys\n function getStoreKeys() {\n var k,\n keys = {};\n for (k in store) {\n keys[k] = true;\n }\n return keys;\n }\n\n // async the delay function\n function delayRedraw() {\n clearTimeout(timer);\n timer = setTimeout(redraw, 25);\n }\n\n // generate bounds extended by radius\n function extendsBounds(latLng) {\n var p = projection.fromLatLngToDivPixel(latLng),\n ne = projection.fromDivPixelToLatLng(new gm.Point(p.x + raw.radius, p.y - raw.radius)),\n sw = projection.fromDivPixelToLatLng(new gm.Point(p.x - raw.radius, p.y + raw.radius));\n return new gm.LatLngBounds(sw, ne);\n }\n\n // run the clustering process and call the display function\n function redraw() {\n if (updating || redrawing || !ready) {\n return;\n }\n\n var i, j, k, indexes, check = false, bounds, cluster, position, previous, lat, lng, loop,\n keys = [],\n used = {},\n zoom = map.getZoom(),\n forceDisabled = (\"maxZoom\" in raw) && (zoom > raw.maxZoom),\n previousKeys = getStoreKeys();\n\n // reset flag\n updated = false;\n\n if (zoom > 3) {\n // extend the bounds of the visible map to manage clusters near the boundaries\n bounds = extendsMapBounds();\n\n // check contain only if boundaries are valid\n check = bounds.getSouthWest().lng() < bounds.getNorthEast().lng();\n }\n\n // calculate positions of \"visibles\" markers (in extended bounds)\n for (i = 0; i < tds.length; i++) {\n if (tds[i] && (!check || bounds.contains(tds[i].options.position)) && (!ffilter || ffilter(values[i]))) {\n keys.push(i);\n }\n }\n\n // for each \"visible\" marker, search its neighbors to create a cluster\n // we can't do a classical \"for\" loop, because, analysis can bypass a marker while focusing on cluster\n while (1) {\n i = 0;\n while (used[i] && (i < keys.length)) { // look for the next marker not used\n i++;\n }\n if (i === keys.length) {\n break;\n }\n\n indexes = [];\n\n if (enabled && !forceDisabled) {\n loop = 10;\n do {\n previous = indexes;\n indexes = [];\n loop--;\n\n if (previous.length) {\n position = bounds.getCenter();\n } else {\n position = tds[keys[i]].options.position;\n }\n bounds = extendsBounds(position);\n\n for (j = i; j < keys.length; j++) {\n if (used[j]) {\n continue;\n }\n if (bounds.contains(tds[keys[j]].options.position)) {\n indexes.push(j);\n }\n }\n } while ((previous.length < indexes.length) && (indexes.length > 1) && loop);\n } else {\n for (j = i; j < keys.length; j++) {\n if (!used[j]) {\n indexes.push(j);\n break;\n }\n }\n }\n\n cluster = {indexes: [], ref: []};\n lat = lng = 0;\n for (k = 0; k < indexes.length; k++) {\n used[indexes[k]] = true;\n cluster.indexes.push(keys[indexes[k]]);\n cluster.ref.push(keys[indexes[k]]);\n lat += tds[keys[indexes[k]]].options.position.lat();\n lng += tds[keys[indexes[k]]].options.position.lng();\n }\n lat /= indexes.length;\n lng /= indexes.length;\n cluster.latLng = new gm.LatLng(lat, lng);\n\n cluster.ref = cluster.ref.join(\"-\");\n\n if (cluster.ref in previousKeys) { // cluster doesn't change\n delete previousKeys[cluster.ref]; // remove this entry, these still in this array will be removed\n } else { // cluster is new\n if (indexes.length === 1) { // alone markers are not stored, so need to keep the key (else, will be displayed every time and marker will blink)\n store[cluster.ref] = true;\n }\n fdisplay(cluster);\n }\n }\n\n // flush the previous overlays which are not still used\n $.each(previousKeys, function (key) {\n flush(key);\n });\n redrawing = false;\n }\n}", "_addToSwarm(peer) {\n if(!(peer.connectionString in this.swarm)) {\n this.swarm[peer.connectionString] = peer;\n return true;\n } else {\n if(this.swarm[peer.connectionString].socket !== peer.socket) {\n this.swarm[peer.connectionString].socket = peer.socket;\n return true;\n } else {\n return false;\n }\n // console.log(\"peer is already in swarm\");\n }\n }", "function getDBClustersSummary(conf, cb) {\n var aws = getAWS({accessKeyId: conf.rdsaccess, secretAccessKey: conf.rdssecret, region: conf.rdsregion}),\n rds = new aws.RDS(),\n rdsInstances = {read: [], write: [], instances: []};\n\n rds.describeDBClusters({}, function(err, data) {\n if (err) {\n console.log(err, err.stack); // an error occurred\n } else {\n if (data.hasOwnProperty('DBClusters')) {\n for (var i = 0; i < data.DBClusters.length; i++) {\n if (data.DBClusters[i].hasOwnProperty('DBClusterMembers') && data.DBClusters[i].hasOwnProperty('Endpoint') && data.DBClusters[i].Endpoint == conf.rdscluster) {\n for (var j = 0; j < data.DBClusters[i].DBClusterMembers.length; j++) {\n var kind = data.DBClusters[i].DBClusterMembers[j].IsClusterWriter ? 'write' : 'read';\n\n var info = {\n name: data.DBClusters[i].DBClusterMembers[j].DBInstanceIdentifier,\n kind: kind\n };\n\n console.log('Cluster ' + kind + ' instance : ' + info.name);\n\n rdsInstances.instances[data.DBClusters[i].DBClusterMembers[j].DBInstanceIdentifier] = info;\n\n rdsInstances[kind].push(info);\n }\n }\n }\n\n getDBInstancesSummary(conf, rds, rdsInstances, cb);\n } else {\n console.log('Count not reference data.DBClusters[i].DBClusterMembers');\n }\n }\n });\n}", "getClusters(region, deployment) {\n console.log('[DataProvider][getClusters] for region: %s deployment: %s begin', region, deployment);\n\n return Promise.timeout(1)\n .then(() => {\n console.log('[DataProvider][getClusters] for region: %s deployment: %s inside begin', region, deployment);\n\n return [\n {\n name: \"hello\",\n state: \"deploy\",\n status: \"inprogres\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'undeploy',\n confirm: true\n }]\n },\n {\n name: \"addr\",\n state: \"deploy\",\n status: \"completed\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'undeploy',\n confirm: true\n }]\n },\n {\n name: \"img\",\n state: \"undeploy\",\n status: \"error\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'deploy'\n }]\n },\n {\n name: \"addrf\",\n state: \"undeploy\",\n status: \"completed\",\n actions: [{\n name: 'build'\n }, {\n name: 'push'\n }, {\n name: 'deploy'\n }]\n }\n ];\n });\n }", "function creaMappaNodoParassitaLivelloHost(data){\n\tvar parassitaLivelloHost=d3.map();\n\t// funzione per assegnare i valori\n\tfunction recursive(nodo,data,numero){\n\t\tvar childId = findChildrenIdsOfHostOrParasiteNode(nodo[\"id\"],\"P\",data);\n\t\tif(childId.length>0){\n\t\t\tnumero=numero+1;\n\t\t\tchildId\n\t\t\t.forEach(function(d){\n\t\t\t\tvar nodoChild = findNodeById(d,data);\n\t\t\t\tif (nodoChild[\"belongs_to\"]==nodo[\"belongs_to\"]){\n\t\t\t\t\tparassitaLivelloHost.set(nodoChild[\"id\"],numero);\n\t\t\t\t\trecursive(nodoChild,data,numero);\n\t\t\t\t} else {\n\t\t\t\t\tparassitaLivelloHost.set(nodoChild[\"id\"],0);\n\t\t\t\t\trecursive(nodoChild,data,0);\n\t\t\t\t}\n\n\t\t\t});\n\t\t}\n\t}\n\t//prendo la root e lancio la funzione\n var rootId = findRoot(data,\"P\");\n var rootNode = findNodeById(rootId, data);\n parassitaLivelloHost.set(rootId,0);\n\trecursive(rootNode,data,0);\n\n return parassitaLivelloHost;\n}", "insert()\n {\n let result = this._api.chain('get', null, false);\n\n if(result['error']) {\n Nodes.errorsNodes(`Failed to LOAD data. ${result['message']}`, this);\n return;\n }\n\n this._api.chain('get', null, false).forEach(index => {\n if(index['delete_status'] === '1') {\n this.createNodes(index['message'], index['id'], 'archive');\n } else if(index['done_status'] === '1'){\n this.createNodes(index['message'], index['id'], 'todo');\n } else if (index['done_status'] === '0') {\n this.createNodes(index['message'], index['id'], 'completed');\n }\n });\n }", "function masterProcess() {\n console.log('Master %s is running', process.pid);\n\n /**\n * Creating workers in same number as number of cores the running machine is.\n */\n for (let i = 0; i < numCPUs; i++) {\n console.log('Forking process number ... %s.....%s', i, process.pid);\n /**\n * cluster.fork() to create worker, which is a based on child process fork() functionality \n */\n cluster.fork();\n }\n\n /**\n * Event Handler which fires everytime a new worker created. \n */\n cluster.on('online', (worker) => {\n console.log('Worker ' + worker.process.pid + ' is online');\n });\n\n /**\n * Event Handler which fires everytime a worker/process is exit or disconnected.\n */\n cluster.on('exit', (worker) => {\n console.log('The worker has exit..%s', worker.id);\n /**\n * Creating a new worker \n */\n cluster.fork();\n });\n}", "function provisionNode(newMint, geo, port, incomingIP, publickey, version, wallet, incomingTimestamp, callback) {\n //console.log(ts()+\"provisionNode(): newMint=\"+newMint+\" geo=\"+geo);\n expressRedisClient.hgetall(\"mint:1\", function (err, mint1) {\n //create mint and entry as if this was the genesis node\n var mint0 = makeMintEntry(newMint, geo, geo + \".1\", port, incomingIP, publickey, version, wallet, incomingTimestamp);\n if (newMint == 1) {\n expressRedisClient.hmset(\"mint:0\", mint0, function (err, reply) {\n expressRedisClient.hmset(\"mint:1\", mint0, function (err, reply) {\n var mint1 = mint0; //make a copy for readaibility\n var genesisPulseGroupEntry = makePulseEntry(newMint, geo, geo + \".1\");\n expressRedisClient.hmset(mint1.geo + \":\" + mint1.group, genesisPulseGroupEntry, function (err, reply) {\n expressRedisClient.hmset(\"gSRlist\", mint1.geo + \":\" + mint1.group, \"1\", function (err, reply) {\n makeConfig(function (config) {\n //console.log(ts()+\"makeConfig\");\n config.mintTable[\"mint:0\"] = mint0; // Install this new guy's mint0 into config\n config.rc = \"0\";\n config.isGenesisNode = \"1\";\n config.ts = lib_1.now(); //give other side a notion of my clock when I sent this\n //config.isGenesisNode=(config.mintTable[\"mint:0\"].mint==1)\n //console.log(ts()+\"EXPRESS: Sending config:\"+dump(config));\n callback(config); //parent routine's callback\n });\n });\n }); //Create GENESIS GroupEntry:DEVOPS:DEVOPS.1\n }); //mint:1 is always the GENESIS NODE\n }); //mint:0 always is \"me\" we are GENESIS NODE\n }\n else {\n expressRedisClient.hgetall(\"mint:0\", function (err, mint0) {\n expressRedisClient.hgetall(\"mint:1\", function (err, mint1) {\n var mint1 = mint0; //make a copy for readaibility\n expressRedisClient.hgetall(mint1.geo + \":\" + mint1.group, function (err, genesisGroupEntry) {\n expressRedisClient.hgetall(\"gSRlist\", function (err, gSRlist) {\n var mintN = makeMintEntry(newMint, geo, mint1.group, port, incomingIP, publickey, version, wallet, incomingTimestamp);\n expressRedisClient.hmset(\"mint:\" + newMint, mintN, function (err, reply) {\n var newNodePulseEntry = makePulseEntry(newMint, geo, mint1.group);\n expressRedisClient.hmset(geo + \":\" + mint1.group, newNodePulseEntry, function (err, reply) {\n expressRedisClient.hmset(\"gSRlist\", geo + \":\" + mint1.group, \"\" + newMint, function (err, reply) {\n var _a, _b, _c;\n genesisGroupEntry.owls = genesisGroupEntry.owls + \",\" + newMint;\n var config = {\n gSRlist: (_a = {},\n _a[mint1.geo + \":\" + mint1.group] = \"1\",\n _a[geo + \":\" + mint1.group] = \"\" + newMint,\n _a),\n mintTable: (_b = {\n \"mint:0\": mintN,\n \"mint:1\": mint1\n },\n _b[\"mint:\" + newMint] = mintN //and the actual pulse\n ,\n _b),\n pulses: (_c = {},\n _c[mint1.geo + \":\" + mint1.group] = genesisGroupEntry,\n _c[geo + \":\" + mint1.group] = newNodePulseEntry,\n _c),\n rc: \"0\",\n isGenesisNode: \"0\",\n ts: \"\" + lib_1.now()\n };\n //console.log(ts()+\"newMint=\"+newMint+\" \"+dump(config));\n expressRedisClient.hmset(mint1.geo + \":\" + mint1.group, \"owls\", genesisGroupEntry.owls);\n //expressRedisClient.hmset(geo+\":\"+mint1.group, \"owls\",genesisGroupEntry.owls);\n callback(config);\n /*\n makeConfig(function (config) {\n \n console.log(ts()+\"makeConfig\");\n config.mintTable[\"mint:0\"]=mint0; // Install this new guy's mint0 into config\n config.rc=\"0\";\n config.ts=now(); //give other side a notion of my clock when I sent this\n //config.isGenesisNode=(config.mintTable[\"mint:0\"].mint==1)\n console.log(ts()+\"EXPRESS: Sending config:\"+dump(config));\n callback(config); //parent routine's callback\n })\n */\n });\n });\n });\n });\n }); //Create GENESIS GroupEntry:DEVOPS:DEVOPS.1\n }); //mint:1 is always the GENESIS NODE\n }); //mint:0 always is \"me\" we are GENESIS NODE\n }\n //if (newMint==1) expressRedisClient.hmset(\"mint:1\",mint0); //mint:1 is always the GENESIS NODE\n //if (newMint==1) expressRedisClient.hmset(mint1.geo+\":\"+mint1.group,mint1); //Create GENESIS GroupEntry:DEVOPS:DEVOPS.1\n //if (newMint==1) expressRedisClient.hmset(\"gSRlist\",mint1.geo+\":\"+mint1.group,\"1\"); //Add our Genesis Group Entry to the gSRlist\n /**\n // \"isGenesisNode\" : \"1\",\n var mintN=makeMintEntry( newMint,geo,geo+\".1\",port,incomingIP,publickey,version,wallet, incomingTimestamp )\n \n if (mint1==null) { // GENESIS NODE BEING FORMED -\n console.log(ts()+\"SETTING OURSELVES UP AS GENESIS NODE\");\n \n mint1=mint0; //Genesis mint:1 is mint:0 (me)\n expressRedisClient.hmset(\"mint:1\",mint1); //create mint:1 as clone of mint:0\n \n //create the group entry while we are at it\n \n expressRedisClient.hmset([geo+\":\"+geo+\".1\"], genesisPulseGroupEntry);\n expressRedisClient.hmset(\"gSRlist\", geo+\":\"+geo+\".1\", \"1\");\n console.log(ts()+\"At this point we should have mint:0 mint:1 and group Entry defined... newMint=\"+newMint);\n expressRedisClient.hgetall(\"mint:0\", function(err,mint0) { console.log(\"mint0=\"+dump(mint0));});\n expressRedisClient.hgetall(\"mint:1\", function(err,mint1) { console.log(\"mint1=\"+dump(mint1));});\n expressRedisClient.hgetall(\"DEVOPS:DEVOPS.1\", function(err,mint1) { console.log(\"DEVOPS:DEVOPS.1=\"+dump(mint1));});\n } //At this point we have mint:0 mint:1 and group Entry defined <-- this is enough for genesi node\n \n // Non-Genesis Node - create the newGeo:genesisGroup entry and add to gSRlist\n //// mint:0 mint:1 *mint:N genesisGeo:genesisGroup *geoN:genesisGroup and update gSRlist and genesis OWLs\n \n if (newMint!=1) {\n console.log(ts()+\"SETTING UP NON-GENESIS NODE to connect with Genesis Node: \"+mint1.group);\n console.log(ts()+\"At this point we should have mint:0 mint:1 and group Entry defined... newMint=\"+newMint);\n expressRedisClient.hgetall(\"mint:0\", function(err,mint0) { console.log(\"mint0=\"+dump(mint0));});\n expressRedisClient.hgetall(\"mint:1\", function(err,mint1) { console.log(\"mint1=\"+dump(mint1));});\n expressRedisClient.hgetall(\"DEVOPS:DEVOPS.1\", function(err,mint1) { console.log(\"DEVOPS:DEVOPS.1=\"+dump(mint1));});\n mint0.group=mint1.group; //adjust this node mint:0 to be part of genesis group\n mintN=makeMintEntry( newMint,geo,mint1.group,port,incomingIP,publickey,version,wallet, incomingTimestamp )\n expressRedisClient.hmset(\"mint:\"+newMint,mintN);\n expressRedisClient.hmset(\"gSRlist\", mint1.group, \"\"+newMint);\n \n var newMintPulseGroupEntry=makePulseEntry( newMint, geo, mint1.group );\n expressRedisClient.hmset([geo+\":\"+mint1.group], newMintPulseGroupEntry);\n }\n expressRedisClient.hgetall(\"DEVOPS:DEVOPS.1\", function(err,genesisGroupEntry) {\n console.log(\"DEVOPS:DEVOPS.1=\"+dump(mint1));});\n \n console.log(ts()+\"genesis newOWLs=\"+newOWLs);\n var newOWLs=\"1\";\n if (newMint!=1) newOWLs=genesisGroup.owls+\",\"+newMint\n \n makeConfig(function (config) {\n console.log(ts()+\"makeConfig\");\n config.mintTable[\"mint:0\"]=mint0; //nstall this new guy's mint0\n config.rc=\"0\";\n config.ts=now();\n //config.isGenesisNode=(config.mintTable[\"mint:0\"].mint==1)\n console.log(ts()+\"EXPRESS: Sending config:\"+dump(config));\n callback(config); //parent routine's callback\n })\n //console.log(ts()+\"EXPRESS: after makeConfig\");\n **/\n });\n}", "onChangeCluster (clusterId) {\n this.setState({\n clusterId,\n })\n\n const template = this.getTemplate(this.state.templateId)\n if (template && template.get('clusterId') && template.get('clusterId') !== clusterId) {\n this.doChangeTemplateIdTo(zeroUID) // Careful: this.state.clusterId still contains previous clusterId, call setTimeout(fnc, 0) if needed otherwise\n }\n\n // fire external data retrieval here if needed after Cluster change\n }", "async function forNode (config, layerParents, subLayerBasePath) {\n\n const subLayerPaths = [];\n\n TRAVERSE(config).map(function (node) {\n if (/^@/.test(this.key)) {\n subLayerPaths.push(this.path);\n this.update(node, true);\n }\n });\n \n if (!subLayerPaths.length) {\n return;\n }\n \n//console.log(\"subLayerPaths\", subLayerPaths);\n \n return Promise.all(subLayerPaths.map(function (subLayerPath) {\n \n //async function forLayer (DECLARATIONS, type, path, parent)\n return forLayer(\n LODASH.get(config, subLayerPath),\n subLayerPath[subLayerPath.length - 1],\n [].concat(subLayerBasePath).concat(subLayerPath),\n layerParents\n );\n })); \n }", "async function monitorSwarm(ipfs,db){\n\n var SQLtime = DB.sqlDate();\n try{\n const peersInfos = await ipfs.swarm.peers({verbose:true,latency:true,direction:true}) //call the IPFS SWARM PEERS command\n peersInfos.forEach(peer => {\n\n var peer_id = peer.peer\n var multiadd, peer_ip, peer_ip_fam, peer_ip_port,direction = \"\"\n try{\n //get the IP informations from the multiaddress\n multiadd = multiaddr(peer.addr)\n peer_ip = multiadd.nodeAddress().address\n peer_ip_fam = multiadd.nodeAddress().family\n peer_ip_port = multiadd.nodeAddress().port\n direction = peer.direction\n }catch(error){console.log(`Multiaddress error -> ${peer.addr}`)}\n \n var peer_loc = \"\"\n try{peer_loc = geoip.lookup(peer_ip).country}catch(error){} //locate the ip location with the geoip-lite library\n \n\n DB.saveSWARMcheck(db,peer_id,peer.addr,peer_ip_fam,peer_ip,peer_ip_port,peer_loc,peer.latency,direction,SQLtime,lastCheck); //save the result on the DB\n\n })\n lastCheck = SQLtime\n console.log(`SWARM SIZE -> ${peersInfos.length}`)\n }catch(error){Console.log(\"Monitor swarm error\")}\n\n}", "function cluster_svinfo(input, config) {\n var self = this;\n\n\n // var RF_FASTA = config.RF_FASTA;\n // var RF_JSON = (config.RF_JSON) ? require(config.RF_JSON) : null;\n // self.freader = new FASTAReader(RF_FASTA, RF_JSON);\n\n var SV_MAX_DIFF = config.SV_MAX_DIFF || 3;\n var MIN_CLUSTER_SIZE = config.MIN_CLUSTER_SIZE || 10;\n var SAVE_DIR = config.SAVE_DIR || (__dirname + '../');\n\n\n var svcStream = new SVClassifyStream(SAVE_DIR, {prefix: ''});\n\n svcStream.on('sv', function(svinfo, line) {\n console.log(line.trim());\n });\n\n //var lines = new LineStream(input, {\n // fieldNum: 2,\n // fieldSep: \"\\t\",\n // comment: \"#\"\n //});\n var lines = new LineStream(input); //no format filter\n\n var clusters = {};\n\n /**\n * set current svinfo to clusters\n **/\n function setCurrent(current, key) {\n if (!clusters[key]) {\n clusters[key] = new Cluster();\n }\n\n clusters[key].push(current);\n }\n\n lines.on(\"data\", function(line) {\n /**\n * sv info\n **/\n var current = JSON.parse(line.split('\\t')[1]);\n\n /**\n * get the key of the cluster from current sv info\n **/\n var keys = [current.type, current.rname, current.rname2];\n\n if (current.subtype) {\n keys.push(current.subtype);\n }\n\n var key = keys.join('_');\n\n\n\n /**\n * get value\n **/\n var cluster = clusters[key];\n\n /**\n * if there's no adequate cluster, set current value and return\n **/\n if (!cluster) {\n setCurrent(current, key);\n return;\n }\n\n\n /**\n * checking if cluster and current are in different clusters\n **/\n if( ( Math.abs(cluster.get('start') - current.start) > SV_MAX_DIFF)\n ||\n ( current.type != 'INS' && current.type != 'CTX' && Math.abs(cluster.get('end') - current.end) > SV_MAX_DIFF)\n ||\n ( current.type == 'CTX' && Math.abs(cluster.get('start2') - current.start2) > SV_MAX_DIFF)\n ) {\n\n printSVInfo.call(self, svcStream, clusters[key],\n MIN_CLUSTER_SIZE // allowable minimum cluster size\n );\n clusters[key] = new Cluster(); // reset\n }\n\n setCurrent(current, key);\n });\n\n lines.on(\"end\", function() {\n svcStream.end();\n });\n\n svcStream.on(\"close\", function() {\n // finished!\n });\n}", "async function createClusterWithNetworkProperties() {\n const subscriptionId = process.env[\"HDINSIGHT_SUBSCRIPTION_ID\"] || \"subId\";\n const resourceGroupName = process.env[\"HDINSIGHT_RESOURCE_GROUP\"] || \"rg1\";\n const clusterName = \"cluster1\";\n const parameters = {\n properties: {\n clusterDefinition: {\n configurations: {\n gateway: {\n \"restAuthCredential.isEnabled\": true,\n \"restAuthCredential.password\": \"**********\",\n \"restAuthCredential.username\": \"admin\",\n },\n },\n kind: \"hadoop\",\n },\n clusterVersion: \"3.6\",\n computeProfile: {\n roles: [\n {\n name: \"headnode\",\n hardwareProfile: { vmSize: \"standard_d3\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 2,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n {\n name: \"workernode\",\n hardwareProfile: { vmSize: \"standard_d3\" },\n osProfile: {\n linuxOperatingSystemProfile: {\n password: \"**********\",\n sshProfile: { publicKeys: [{ certificateData: \"**********\" }] },\n username: \"sshuser\",\n },\n },\n targetInstanceCount: 2,\n virtualNetworkProfile: {\n id: \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname\",\n subnet:\n \"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet\",\n },\n },\n ],\n },\n networkProperties: {\n privateLink: \"Enabled\",\n resourceProviderConnection: \"Outbound\",\n },\n osType: \"Linux\",\n storageProfile: {\n storageaccounts: [\n {\n name: \"mystorage\",\n container: \"containername\",\n enableSecureChannel: true,\n isDefault: true,\n key: \"storage account key\",\n },\n ],\n },\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new HDInsightManagementClient(credential, subscriptionId);\n const result = await client.clusters.beginCreateAndWait(\n resourceGroupName,\n clusterName,\n parameters\n );\n console.log(result);\n}", "function findClusters() {\n // Reset clusters\n clusters = []\n \n // Find horizontal clusters\n for (var j=0; j<level.rows; j++) {\n // Start with a single tile, cluster of 1\n var matchlength = 1;\n for (var i=0; i<level.columns; i++) {\n var checkcluster = false;\n \n if (i == level.columns-1) {\n // Last tile\n checkcluster = true;\n } else {\n // Check the type of the next tile\n if (level.tiles[i][j].type == level.tiles[i+1][j].type &&\n level.tiles[i][j].type != -1) {\n // Same type as the previous tile, increase matchlength\n matchlength += 1;\n } else {\n // Different type\n checkcluster = true;\n }\n }\n \n // Check if there was a cluster\n if (checkcluster) {\n if (matchlength >= 3) {\n // Found a horizontal cluster\n clusters.push({ column: i+1-matchlength, row:j,\n length: matchlength, horizontal: true });\n }\n \n matchlength = 1;\n }\n }\n }\n\n // Find vertical clusters\n for (var i=0; i<level.columns; i++) {\n // Start with a single tile, cluster of 1\n var matchlength = 1;\n for (var j=0; j<level.rows; j++) {\n var checkcluster = false;\n \n if (j == level.rows-1) {\n // Last tile\n checkcluster = true;\n } else {\n // Check the type of the next tile\n if (level.tiles[i][j].type == level.tiles[i][j+1].type &&\n level.tiles[i][j].type != -1) {\n // Same type as the previous tile, increase matchlength\n matchlength += 1;\n } else {\n // Different type\n checkcluster = true;\n }\n }\n \n // Check if there was a cluster\n if (checkcluster) {\n if (matchlength >= 3) {\n // Found a vertical cluster\n clusters.push({ column: i, row:j+1-matchlength,\n length: matchlength, horizontal: false });\n }\n \n matchlength = 1;\n }\n }\n }\n }", "function findClusters() {\n // Reset clusters\n clusters = []\n \n // Find horizontal clusters\n for (var j=0; j<level.rows; j++) {\n // Start with a single tile, cluster of 1\n var matchlength = 1;\n for (var i=0; i<level.columns; i++) {\n var checkcluster = false;\n \n if (i == level.columns-1) {\n // Last tile\n checkcluster = true;\n } else {\n // Check the type of the next tile\n if (level.tiles[i][j].type == level.tiles[i+1][j].type &&\n level.tiles[i][j].type != -1) {\n // Same type as the previous tile, increase matchlength\n matchlength += 1;\n } else {\n // Different type\n checkcluster = true;\n }\n }\n \n // Check if there was a cluster\n if (checkcluster) {\n if (matchlength >= 3) {\n // Found a horizontal cluster\n clusters.push({ column: i+1-matchlength, row:j,\n length: matchlength, horizontal: true });\n }\n \n matchlength = 1;\n }\n }\n }\n\n // Find vertical clusters\n for (var i=0; i<level.columns; i++) {\n // Start with a single tile, cluster of 1\n var matchlength = 1;\n for (var j=0; j<level.rows; j++) {\n var checkcluster = false;\n \n if (j == level.rows-1) {\n // Last tile\n checkcluster = true;\n } else {\n // Check the type of the next tile\n if (level.tiles[i][j].type == level.tiles[i][j+1].type &&\n level.tiles[i][j].type != -1) {\n // Same type as the previous tile, increase matchlength\n matchlength += 1;\n } else {\n // Different type\n checkcluster = true;\n }\n }\n \n // Check if there was a cluster\n if (checkcluster) {\n if (matchlength >= 3) {\n // Found a vertical cluster\n clusters.push({ column: i, row:j+1-matchlength,\n length: matchlength, horizontal: false });\n }\n \n matchlength = 1;\n }\n }\n }\n }", "function test_cluster_graph_by_vm_tag_vsphere65() {}", "static replicateBorderNodes(parentGroup, modelClasses){\n let borderNodesByID = {};\n (parentGroup.lyphs||[]).forEach(lyph => {\n if (lyph.border && lyph.border.borders) {\n lyph.border.borders.forEach(b =>\n this.addLyphToHostMap(lyph, b.hostedNodes, borderNodesByID, parentGroup.namespace))\n }\n });\n\n const nodeOnBorder = (node, lyphID) => (borderNodesByID[getID(node)]||[]).find(e => e.id === lyphID);\n\n borderNodesByID::keys().forEach(nodeFullID => {\n let hostLyphs = borderNodesByID[nodeFullID];\n if (hostLyphs.length > 1){\n const nodeID = getRefID(nodeFullID);\n let node = refToResource(nodeFullID, parentGroup, $Field.nodes, true);\n let prev = node;\n hostLyphs.forEach((hostLyph, i) => {\n if (i < 1) { return; }\n let nodeClone = genResource({\n [$Field.id]: getGenID(nodeID, $Prefix.clone, i),\n [$Field.skipLabel]: true,\n [$Field.hidden]: node.hidden\n }, \"verticeModel.replicateBorderNodes (Node)\");\n modelClasses.Node.clone(node, nodeClone);\n mergeGenResource(undefined, parentGroup, nodeClone, $Field.nodes);\n\n let targetOfLinks = (parentGroup.links||[]).filter(e => getRefID(e.target) === nodeID && nodeOnBorder(e.source, hostLyph.id));\n let sourceOfLinks = (parentGroup.links||[]).filter(e => getRefID(e.source) === nodeID && nodeOnBorder(e.target, hostLyph.id));\n //These arrays may miss links from other namespaces, try to discover them in another way\n (hostLyph.bundles||[]).forEach(lnkRef => {\n let lnk = refToResource(lnkRef, parentGroup, $Field.links);\n if (lnk){\n if (lnk.source === nodeID && !findResourceByID(sourceOfLinks, lnk.id)){\n sourceOfLinks.push(lnk);\n }\n if (lnk.target === nodeID && !findResourceByID(targetOfLinks, lnk.id)){\n targetOfLinks.push(lnk);\n }\n }\n });\n\n targetOfLinks.forEach(lnk => lnk.target = nodeClone.fullID);\n sourceOfLinks.forEach(lnk => lnk.source = nodeClone.fullID);\n\n hostLyphs[i].border.borders.forEach(b => {\n let k = findIndex(b.hostedNodes, nodeFullID, parentGroup.namespace);\n if (k > -1){\n b.hostedNodes[k] = nodeClone.fullID;\n }\n });\n let lnk = modelClasses.Link.createCollapsibleLink(prev, nodeClone);\n mergeGenResource(undefined, parentGroup, lnk, $Field.links);\n prev = nodeClone;\n })\n }\n });\n }", "function mk_hash_dict(t2_clusters, connection, callback) {\n const essence_dict = {}\n let count = 0\n for (cluster of t2_clusters) {\n for (error of cluster) {\n essence_dict[error['essence']] = count\n }\n count ++\n }\n\n const select_map = 'SELECT * FROM ' + run_map\n connection.query(select_map, (err, result, field) => {\n if (err) {\n callback(err)\n } else {\n const hash_dict = {}\n for (r of result) {\n hash_dict[r['hash']] = essence_dict[r['essence']]\n }\n callback(null, hash_dict)\n }\n })\n }", "function cluster(_centers) {\n\n var nodes = void 0,\n centerpoints = [],\n strength = 0.1,\n centerInertia = 0.0;\n\n // coerce centers accessor into a function\n if (typeof _centers !== 'function') _centers = function centers() {\n return _centers;\n };\n\n function force(alpha) {\n // scale + curve alpha value\n alpha *= strength * alpha;\n\n var c = void 0,\n x = void 0,\n y = void 0,\n l = void 0,\n r = void 0;\n nodes.forEach(function (d, i) {\n c = centerpoints[i];\n if (!c || c === d) return;\n\n x = d.x - c.x, y = d.y - c.y, l = Math.sqrt(x * x + y * y), r = d.radius + (c.radius || 0);\n\n if (l && l != r) {\n l = (l - r) / l * alpha;\n d.x -= x *= l;\n d.y -= y *= l;\n c.x += (1 - centerInertia) * x;\n c.y += (1 - centerInertia) * y;\n }\n });\n }\n\n function initialize() {\n if (!nodes) return;\n\n // populate local `centerpoints` using `centers` accessor\n var i = void 0,\n n = nodes.length;\n centerpoints = new Array(n);\n for (i = 0; i < n; i++) {\n centerpoints[i] = _centers(nodes[i], i, nodes);\n }\n }\n\n /**\n * Reinitialize the force with the specified nodes.\n */\n force.initialize = function (_) {\n nodes = _;\n initialize();\n };\n\n /**\n * An array of objects representing the centerpoint of each cluster,\n * or a function that returns such an array.\n * Each object must have `x` and `y` values, and optionally `radius`.\n */\n force.centers = function (_) {\n // return existing value if no value passed\n if (_ == null) return _centers;\n\n // coerce centers accessor into a function\n _centers = typeof _ === 'function' ? _ : function (n, i) {\n return _[i];\n };\n\n // reinitialize\n initialize();\n\n // allow chaining\n return force;\n };\n\n /**\n * Strength of attraction to the cluster center node/position.\n */\n force.strength = function (_) {\n return _ == null ? strength : (strength = +_, force);\n };\n\n /**\n * Inertia of cluster center nodes/positions.\n * Higher values mean the cluster center moves less;\n * lower values mean the cluster center is more easily\n * pulled around by other nodes in the cluster.\n * Typical values range from 0.0 (cluster centers move as much as all other nodes)\n * to 1.0 (cluster centers are not moved at all by the clustering force).\n */\n force.centerInertia = function (_) {\n return _ == null ? centerInertia : (centerInertia = +_, force);\n };\n\n return force;\n}", "function createallhoststable()\n{\n var aii_actions = ['boot', 'install', 'reinstall', 'configure'];\n /**\n * Icon mapping\n * @type {{install: string, boot: string, reinstall: string, configure: string}}\n */\n var icon = {\n 'install': 'glyphicon-save',\n 'boot': 'glyphicon-hdd',\n 'reinstall': 'glyphicon-refresh',\n 'configure': 'glyphicon-cog'\n };\n\n /**\n * Icon color mapping\n * @type {{install: string, boot: string, reinstall: string, configure: string}}\n */\n var color = {\n 'install': 'btn-success',\n 'boot': 'btn-info',\n 'reinstall': 'btn-warning',\n 'configure': 'btn-unbind'\n };\n\n // Query Hosts information\n $.get(AII_URL + '/cgi-bin/dashboard-aii.cgi',\n {\n 'action': 'getHosts'\n },\n function (data)\n {\n $(data['hosts']).each(function (k, host)\n {\n var hostname = host['hostname'];\n var toDisable = '';\n\n if (host['bootcfg'] == 'localboot.cfg') toDisable = 'boot';\n else if (host['bootcfg'] != '') toDisable = 'install';\n\n var aii_actions_html = '';\n\n $.each(aii_actions, function (k, action)\n {\n var disabled = action == toDisable ? 'disabled' : '';\n\n aii_actions_html += '<button title=\"' + action + '\" class=\"btn btn-xs ' + color[action] + '\" onclick=\"configure(\\'' + action + '\\',\\'' + hostname + '\\')\" ' + disabled + '>' +\n '<span class=\"glyphicon ' + icon[action] + '\" />' +\n '</button>&nbsp;';\n });\n\n var bootcfg = host['bootcfg'] != '' ? host['bootcfg'] : 'NOT CONFIGURED';\n\n var row = '<tr id=\"' + hostname + '\">' +\n '<td>' + hostname + '</td>' +\n '<td>' + host['dotaddr'] + ' (' + host['hexaddr'] + ')' + '</td>' +\n '<td>' + bootcfg + '</td>' +\n '<td>' + aii_actions_html + '</td>' +\n '<td style=\"text-align:center\">' +\n '<button class=\"btn btn-xs btn-primary\" onclick=\"showdialog(\\'' + hostname + '\\')\" >' +\n '<span class=\"glyphicon glyphicon-share-alt\" /> Profile' +\n '</td>' +\n '</tr>';\n\n $('#hostlist').find('tbody').append(row);\n });\n $('#hostlist').dataTable({\n \"iDisplayLength\": 25,\n \"lengthMenu\": [[10, 25, 50, 100, -1], [10, 25, 50, 100, \"All\"]],\n \"aoColumnDefs\": [{\n 'bSortable': false,\n 'aTargets': [3, 4]\n }]\n });\n\n }).fail(function ()\n {\n alert('Error retrieving hosts informations');\n });\n\n}", "function network(data, prev, index, expand) {\n expand = expand || {};\n var gm = {}, // group map\n nm = {}, // node map\n lm = {}, // link map\n gn = {}, // previous group nodes\n gc = {}, // previous group centroids\n nodes = [], // output nodes\n links = []; // output links\n\n // process previous nodes for reuse or centroid calculation\n if (prev) {\n prev.nodes.forEach(function (n) {\n var i = index(n), o;\n if (n.size > 0) {\n gn[i] = n;\n n.size = 0;\n } else {\n o = gc[i] || (gc[i] = { x: 0, y: 0, count: 0 });\n o.x += n.x;\n o.y += n.y;\n o.count += 1;\n }\n });\n }\n\n // determine nodes\n for (var k = 0; k < data.nodes.length; ++k) {\n var n = data.nodes[k],\n i = index(n),\n l = gm[i] || (gm[i] = gn[i]) || (gm[i] = { group: i, size: 0, nodes: [] });\n\n if (expand[i]) {\n // the node should be directly visible\n nm[n.name] = nodes.length;\n nodes.push(n);\n if (gn[i]) {\n // place new nodes at cluster location (plus jitter)\n n.x = gn[i].x + Math.random();\n n.y = gn[i].y + Math.random();\n }\n } else {\n // the node is part of a collapsed cluster\n if (l.size == 0) {\n // if new cluster, add to set and position at centroid of leaf nodes\n nm[i] = nodes.length;\n nodes.push(l);\n if (gc[i]) {\n l.x = gc[i].x / gc[i].count;\n l.y = gc[i].y / gc[i].count;\n }\n }\n l.nodes.push(n);\n }\n // always count group size as we also use it to tweak the force graph strengths/distances\n l.size += 1;\n n.group_data = l;\n }\n\n for (i in gm) { gm[i].link_count = 0; }\n\n // determine links\n for (k = 0; k < data.links.length; ++k) {\n var e = data.links[k],\n u = index(e.source),\n v = index(e.target);\n if (u != v) {\n gm[u].link_count++;\n gm[v].link_count++;\n }\n u = expand[u] ? nm[e.source.name] : nm[u];\n v = expand[v] ? nm[e.target.name] : nm[v];\n var i = (u < v ? u + \"|\" + v : v + \"|\" + u),\n l = lm[i] || (lm[i] = { source: u, target: v, size: 0 });\n l.size += 1;\n }\n for (i in lm) { links.push(lm[i]); }\n\n // circle packing\n for (i in nodes) {\n var inner = nodes[i].nodes;\n for (j in inner) {\n var root = d3.hierarchy(inner[j], function (d) { return d.children; })\n .sum(function (d) { return d.size })\n .sort(function (a, b) { return b.value - a.value; });\n var packed = pack(root);\n if (packed.r) {\n inner[j] = packed;\n }\n }\n }\n \n return { nodes: nodes, links: links };\n }", "mergeTwoClusters ( clusters, index1, index2, representType, variableSizeIcon ) {\n\t\tlet cluster1 = clusters.clusters[index1];\n\t\tlet cluster2 = clusters.clusters[index2];\n\n\t\tlet point1 = {\n\t\t\tx: cluster1.represent[0],\n\t\t\ty: cluster1.represent[1],\n\t\t};\n\t\tlet point2 = {\n\t\t\tx: cluster2.represent[0],\n\t\t\ty: cluster2.represent[1],\n\t\t};\n\n\t\tlet n1 = cluster1.clusterSize;\n\t\tlet n2 = cluster2.clusterSize;\n\n\t\tif ( this.params.type !== \"gridbasedClientServer\" )\n\t\t\tfor ( let k = 0; k < n2; k++ ) {\n\t\t\t\tcluster1.group.push( cluster2.group[k] );\n\t\t\t\tclusters.dataLabel[cluster2.group[k]] = index1;\n\t\t\t}\n\t\tcluster1.clusterSize += cluster2.clusterSize;\n\t\tif ( variableSizeIcon ) {\n\t\t\tthis.setIconSize( clusters, index1 );\n\t\t}\n\t\t// not valid after merged into cluster1\n\t\tcluster2.valid = false;\n\n\t\t// update the representative\n\t\tif ( representType == \"mean\" ) {\n\t\t\tcluster1.represent[0] = (point1.x * n1 + point2.x * n2) / (n1 + n2);\n\t\t\tcluster1.represent[1] = (point1.y * n1 + point2.y * n2) / (n1 + n2);\n\n\t\t\tcluster2.parent = index1;\n\t\t\tif ( this.params.type == \"gridbasedClientServer\" ) {\n\t\t\t\t// update bounding box\n\t\t\t\tif ( cluster2.latMin < cluster1.latMin )\n\t\t\t\t\tcluster1.latMin = cluster2.latMin;\n\t\t\t\tif ( cluster2.latMax > cluster1.latMax )\n\t\t\t\t\tcluster1.latMax = cluster2.latMax;\n\t\t\t\tif ( cluster2.lonMin < cluster1.lonMin )\n\t\t\t\t\tcluster1.lonMin = cluster2.lonMin;\n\t\t\t\tif ( cluster2.lonMax > cluster1.lonMax )\n\t\t\t\t\tcluster1.lonMax = cluster2.lonMax;\n\n\t\t\t\tthis.setChildSibling( clusters, index1, index2 );\n\t\t\t}\n\t\t}\n\t\tif ( representType == \"first\" ) {\n\t\t\tcluster1.represent[0] = point1.x;\n\t\t\tcluster1.represent[1] = point1.y;\n\t\t}\n\t}", "pnnClustering () {\n\t\tlet th = this.params.distMerge * this.params.distMerge;\n\n\t\tlet dataSize = this.dataIn.length;\n\t\tlet dataOut = {\n\t\t\tclusters: [],\n\t\t\tdataLabel: new Array( dataSize ).fill( -1 ),\n\t\t};\n\n\t\tlet maxX = this.params.maxX;\n\t\tlet maxY = this.params.maxY;\n\t\tlet minX = this.params.minX;\n\t\tlet minY = this.params.minY;\n\n\t\tlet data = [];\n\t\tfor ( let i = 0; i < dataSize; i++ ) {\n\t\t\tdata[i] = {\n\t\t\t\tx: this.dataIn[i].x,\n\t\t\t\ty: this.dataIn[i].y,\n\t\t\t};\n\t\t}\n\n\t\tlet N = dataSize; // number of data objects in map view\n\n\t\t// initialize clusters\n\t\tlet clusters = [];\n\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\tclusters[i] = {\n\t\t\t\trepresent: [ this.dataIn[i].x, this.dataIn[i].y ],\n\t\t\t\tclusterSize: 1,\n\t\t\t\tgroup: [ i ],\n\t\t\t};\n\t\t}\n\n\t\t// find all paiwise distances\n\t\tlet distanceMatrix = [];\n\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\tdistanceMatrix[i] = new Array( N );\n\t\t}\n\n\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\tfor ( let j = i + 1; j < N; j++ ) {\n\t\t\t\tlet tx = data[i].x - data[j].x;\n\t\t\t\tlet ty = data[i].y - data[j].y;\n\t\t\t\tdistanceMatrix[i][j] = (tx * tx) + (ty * ty);\n\t\t\t\tdistanceMatrix[j][i] = distanceMatrix[i][j];\n\t\t\t}\n\t\t}\n\n\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\tdistanceMatrix[i][i] = Number.MAX_VALUE;\n\t\t}\n\n\t\tlet iMin = Array.from( Array( N ).keys() );\n\n\t\tfor ( let i = 0; i < N; i++ )\n\t\t\tfor ( let j = 0; j < N; j++ )\n\t\t\t\tif ( distanceMatrix[i][j] < distanceMatrix[i][iMin[i]] )\n\t\t\t\t\tiMin[i] = j;\n\n\t\tlet nClusters = N;\n\n\t\t// find two most similar clusters\n\t\tlet i1 = 0;\n\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\tif ( distanceMatrix[i][iMin[i]] < distanceMatrix[i1][iMin[i1]] ) {\n\t\t\t\ti1 = i;\n\t\t\t}\n\t\t}\n\t\tlet i2 = iMin[i1]; // we know that i1 is always less than i2\n\n\t\twhile ( distanceMatrix[i1][i2] < th ) {\n\t\t\t// merge clusters i1 and i2 and update centroid\n\t\t\tfor ( let i = 0; i < clusters[i2].group.length; i++ ) {\n\t\t\t\tclusters[i1].group.push( clusters[i2].group[i] );\n\t\t\t}\n\n\t\t\tlet n1 = clusters[i1].clusterSize;\n\t\t\tlet x1 = clusters[i1].represent[0];\n\t\t\tlet y1 = clusters[i1].represent[1];\n\n\t\t\tlet n2 = clusters[i2].clusterSize;\n\t\t\tlet x2 = clusters[i2].represent[0];\n\t\t\tlet y2 = clusters[i2].represent[1];\n\n\t\t\tclusters[i1].represent = [\n\t\t\t\t(x1 * n1 + x2 * n2) / (n1 + n2),\n\t\t\t\t(y1 * n1 + y2 * n2) / (n1 + n2),\n\t\t\t];\n\n\t\t\tclusters[i1].clusterSize += n2;\n\n\t\t\t// Max_VALUE to row i2 and column i2\n\t\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\t\tdistanceMatrix[i2][i] = distanceMatrix[i][i2] = Number.MAX_VALUE;\n\t\t\t}\n\n\t\t\t// update iMin and replace ones that previous pointed to i2 to point to i1\n\t\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\t\tswitch ( true ) {\n\t\t\t\t\tcase (iMin[i] == i2):\n\t\t\t\t\t\tiMin[i] = i1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (distanceMatrix[i1][i] < distanceMatrix[i1][iMin[i1]]):\n\t\t\t\t\t\tiMin[i1] = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tclusters[i2].group = []; // no object in cluster i2\n\n\t\t\t--nClusters;\n\n\t\t\t// find next most similar clusters\n\t\t\ti1 = 0;\n\t\t\tfor ( let i = 0; i < N; i++ ) {\n\t\t\t\tif ( distanceMatrix[i][iMin[i]] < distanceMatrix[i1][iMin[i1]] ) {\n\t\t\t\t\ti1 = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti2 = iMin[i1]; // we know that i1 is always less than i2\n\t\t}\n\n\t\t// write clusters to output variable\n\n\t\tlet c = 0;\n\t\tfor ( let k = 0; k < N; k++ ) {\n\t\t\tif ( clusters[k].group.length > 0 ) {\n\t\t\t\tdataOut.clusters[c] = {\n\t\t\t\t\tclusterSize: clusters[k].clusterSize,\n\t\t\t\t\trepresent: [ clusters[k].represent[0], clusters[k].represent[1] ],\n\t\t\t\t\tvalid: true,\n\t\t\t\t\tgroup: [],\n\t\t\t\t};\n\n\t\t\t\tfor ( let i = 0; i < clusters[k].group.length; i++ ) {\n\t\t\t\t\tlet j = clusters[k].group[i];\n\t\t\t\t\tdataOut.dataLabel[j] = c;\n\t\t\t\t\tdataOut.clusters[c].group[i] = j;\n\t\t\t\t}\n\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\n\t\tdataOut.numClusters = c;\n\t\tdataOut.dataSize = dataSize;\n\n\t\tthis.dataOut = dataOut;\n\t}", "function create_newly_discovered_node(bl, node_addr, cluster, callback) {\n //console.log(\"create_newly_discovered_node\", node_addr, cluster);\n var req = {\n action: 'add_node',\n data: {\n name: 'Node ' + node_addr,\n status: 'unknown',\n cluster: cluster,\n loc_lon: 0,\n loc_lat: 0,\n sn: '',\n mac: 0,\n network_addr: node_addr,\n network_addr2: node_addr,\n firmware: '',\n bootloader: '',\n setup: '',\n role: 'device',\n scope: '',\n project: '',\n location: '',\n user_comment: 'Node created with autodiscovery',\n box_label: '',\n components: [],\n sensors: []\n },\n session: { user: \"system\", ip: \"localhost\" }\n };\n bl.add_node(req, function (err, data) {\n if (err) return callback(err);\n //console.log(\"create_newly_discovered_node1\", data);\n var req2 = {\n action: 'get_node',\n data: { id: data.id },\n session: { user: \"system\", ip: \"localhost\" }\n };\n bl.get_node(req2, function (err2, data2) {\n if (err2) return callback(err2);\n //console.log(\"create_newly_discovered_node2\", data2);\n callback(null, data2);\n });\n });\n}", "async function containerHostMappingsGetContainerHostMapping() {\n const subscriptionId = \"00000000-0000-0000-0000-000000000000\";\n const resourceGroupName = \"myResourceGroup\";\n const location = \"eastus\";\n const containerHostMapping = {\n containerHostResourceId:\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myCluster\",\n };\n const credential = new DefaultAzureCredential();\n const client = new DevSpacesManagementClient(credential, subscriptionId);\n const result = await client.containerHostMappings.getContainerHostMapping(\n resourceGroupName,\n location,\n containerHostMapping\n );\n console.log(result);\n}", "function Cluster(addrs){\n if (!this instanceof Cluster) return new Cluster(addrs);\n if (typeof addrs === 'number') addrs = addresses(addrs);\n this.nodes = addrs.map(function(addr){\n var cruise = new Cruise(addr);\n addrs.forEach(cruise.peer.bind(cruise));\n cruise.connect();\n return cruise;\n });\n }", "function getObjects(callback) {\r\n socket.emit('getObjects', function (err, res) {\r\n var obj;\r\n objects = res;\r\n for (var id in objects) {\r\n if (id.slice(0, 7) === '_design') continue;\r\n\r\n obj = objects[id];\r\n\r\n if (obj.type === 'instance') instances.push(id);\r\n if (obj.type === 'enum') enums.push(id);\r\n if (obj.type === 'script') scripts.push(id);\r\n if (obj.type === 'user') users.push(id);\r\n if (obj.type === 'group') groups.push(id);\r\n if (obj.type === 'adapter') adapters.push(id);\r\n if (obj.type === 'enum') enums.push(id);\r\n if (obj.type === 'host') {\r\n var addr = null;\r\n // Find first non internal IP and use it as identifier\r\n if (obj.native.hardware && obj.native.hardware.networkInterfaces) {\r\n for (var eth in obj.native.hardware.networkInterfaces) {\r\n for (var num = 0; num < obj.native.hardware.networkInterfaces[eth].length; num++) {\r\n if (!obj.native.hardware.networkInterfaces[eth][num].internal) {\r\n addr = obj.native.hardware.networkInterfaces[eth][num].address;\r\n break;\r\n }\r\n }\r\n if (addr) break;\r\n }\r\n }\r\n if (addr) hosts.push({name: obj.common.hostname, address: addr, id: obj._id});\r\n }\r\n\r\n if (id.match(/^system\\.adapter\\.node-red\\.[0-9]+$/) && obj && obj.common && obj.common.enabled) {\r\n $(\"#a-tab-node-red\").show();\r\n if ($('#tabs').tabs(\"option\", \"active\") == 8) $(\"#tab-node-red\").show();\r\n $('#iframe-node-red').height($(window).height() - 55);\r\n $('#iframe-node-red').attr('src', 'http://' + location.hostname + ':' + obj.native.port);\r\n }\r\n //treeInsert(id);\r\n }\r\n //benchmark('finished getObjects loop');\r\n objectsLoaded = true;\r\n\r\n // Remove empty leafs and sub-leafs\r\n //treeOptimize();\r\n\r\n // Detect if some script engine instance installed\r\n var engines = fillEngines();\r\n\r\n // Disable scripts tab if no one script engine instance found\r\n if (!engines || !engines.length) $('#tabs').tabs('option', 'disabled', [7]);\r\n\r\n // Show if update available\r\n initHostsList();\r\n\r\n if (typeof callback === 'function') callback();\r\n });\r\n }", "cluster(points) {\n this.initializeCache(points);\n // console.log(this.distanceCache);\n let dendrogram = (new AgglomerativeHierarchy(\n (x, y) => this.distance(x, y)))\n .dendrogram(points);\n\n return dendrogram.levelSetMaximizing(levelSet =>\n this.silhouetteScore.averageSilhouetteScore(levelSet));\n }", "createWorkers(){\n\n //Guardo la estructura de procesos en una matriz [workerId][gidRequest].\n for (let i = 0; i <= config.workers-1; i++)\n cluster.fork();\n \n for (const id in cluster.workers){\n\n //Agrego handler.\n cluster.workers[id].on('message',this.onChildMsg);\n \n //Armo el id del proceso.\n const workerId = this.getWorkerId(id,cluster.workers[id].process.pid);\n\n //Guardo el worker.\n db.saveProcess(workerId);\n \n //Agrego property.\n cluster.workers[id].idWorker = workerId;\n\n }\n\n }" ]
[ "0.59436774", "0.57877105", "0.5773753", "0.57273227", "0.57084966", "0.57065123", "0.56778544", "0.56060505", "0.55737275", "0.55737275", "0.55671185", "0.55547965", "0.55064", "0.54834527", "0.5422067", "0.541295", "0.5358403", "0.53452945", "0.5304326", "0.5261183", "0.52135855", "0.51562417", "0.51386714", "0.51020193", "0.5097264", "0.5085298", "0.50371575", "0.5025297", "0.50198257", "0.50082165", "0.49826792", "0.49773058", "0.49733216", "0.49655196", "0.49620435", "0.49541956", "0.49537486", "0.49497306", "0.49384263", "0.4931876", "0.4921517", "0.49137083", "0.49019632", "0.49019632", "0.49019632", "0.4896755", "0.48943058", "0.48926723", "0.48849872", "0.48848647", "0.4874455", "0.4873593", "0.4872474", "0.48585373", "0.48537758", "0.48489422", "0.48438933", "0.48426732", "0.48414892", "0.48371622", "0.48359352", "0.48303005", "0.48291534", "0.48271495", "0.48194328", "0.48170573", "0.48151097", "0.48032406", "0.48011616", "0.47785875", "0.47785875", "0.47785875", "0.477438", "0.47644016", "0.47626984", "0.47573128", "0.4749161", "0.4743374", "0.4738808", "0.47352633", "0.47331852", "0.47305262", "0.4720329", "0.4715883", "0.47102726", "0.47102726", "0.4709575", "0.47028875", "0.4702311", "0.47020605", "0.47005367", "0.4691047", "0.46909168", "0.46890298", "0.46838483", "0.46828908", "0.46828136", "0.46825457", "0.46809658", "0.46679178" ]
0.6155328
0
In some versions of JavaScript subnet calculators they use bitwise operations to shift the values left. Unfortunately JavaScript converts to a 32bit signed integer when you mess with bits, which leaves you with the sign + 31 bits. For the first byte this means converting back to an integer results in a negative value for values 128 and higher since the leftmost bit, the sign, becomes 1. Using the 64bit float allows us to display the integer value to the user. / dottedquad IP to integer
function IPv4_dotquadA_to_intA( strbits ) { var split = strbits.split( '.', 4 ); var myInt = ( parseFloat( split[0] * 16777216 ) /* 2^24 */ + parseFloat( split[1] * 65536 ) /* 2^16 */ + parseFloat( split[2] * 256 ) /* 2^8 */ + parseFloat( split[3] ) ); return myInt; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "function int_to_ip(ip) {\n\treturn(format(\"%u.%u.%u.%u\"\n\t\t,(ip>>24)&0xff\n\t\t,(ip>>16)&0xff\n\t\t,(ip>>8)&0xff\n\t\t,ip&0xff\n\t\t));\n}", "function ip2long(IP) {\n // discuss at: http://phpjs.org/functions/ip2long/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // improved by: Victor\n // revised by: fearphage (http://http/my.opera.com/fearphage/)\n // revised by: Theriault\n // example 1: ip2long('192.0.34.166');\n // returns 1: 3221234342\n // example 2: ip2long('0.0xABCDEF');\n // returns 2: 11259375\n // example 3: ip2long('255.255.255.256');\n // returns 3: false\n\n var i = 0;\n // PHP allows decimal, octal, and hexadecimal IP components.\n // PHP allows between 1 (e.g. 127) to 4 (e.g 127.0.0.1) components.\n IP = IP.match(\n /^([1-9]\\d*|0[0-7]*|0x[\\da-f]+)(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?$/i\n ); // Verify IP format.\n if (!IP) {\n // Invalid format.\n return false;\n }\n // Reuse IP variable for component counter.\n IP[0] = 0;\n for (i = 1; i < 5; i += 1) {\n IP[0] += !! ((IP[i] || '')\n .length);\n IP[i] = parseInt(IP[i]) || 0;\n }\n // Continue to use IP for overflow values.\n // PHP does not allow any component to overflow.\n IP.push(256, 256, 256, 256);\n // Recalculate overflow of last component supplied to make up for missing components.\n IP[4 + IP[0]] *= Math.pow(256, 4 - IP[0]);\n if (IP[1] >= IP[5] || IP[2] >= IP[6] || IP[3] >= IP[7] || IP[4] >= IP[8]) {\n return false;\n }\n return IP[1] * (IP[0] === 1 || 16777216) + IP[2] * (IP[0] <= 2 || 65536) + IP[3] * (IP[0] <= 3 || 256) + IP[4] * 1;\n}", "function ipv4ToInt(stringIP) {\n\tvar ipParte = stringIP.split('.');\n\treturn ((((((+ipParte[0]) * 256) + (+ipParte[1])) * 256) + (+ipParte[2])) * 256)\n\t\t\t+ (+ipParte[3]);\n}", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function int2ip(ipInt) {\n return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));\n }", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "function long2ip(ip) {\n // discuss at: http://phpjs.org/functions/long2ip/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: long2ip( 3221234342 );\n // returns 1: '192.0.34.166'\n if (!isFinite(ip))\n return false;\n return [ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF].join('.');\n}", "function convertIpToDecimal(ip) {\n // a not-perfect regex for checking a valid ip address\n\t// It checks for (1) 4 numbers between 0 and 3 digits each separated by dots (IPv4)\n\t// or (2) 6 numbers between 0 and 3 digits each separated by dots (IPv6)\n\tvar ipAddressRegEx = /^(\\d{0,3}\\.){3}.(\\d{0,3})$|^(\\d{0,3}\\.){5}.(\\d{0,3})$/;\n\tvar valid = ipAddressRegEx.test(ip);\n\tif (!valid) {\n\t\treturn false;\n\t}\n\tvar dots = ip.split('.');\n\t// make sure each value is between 0 and 255\n\tfor (var i = 0; i < dots.length; i++) {\n\t\tvar dot = dots[i];\n\t\tif (dot > 255 || dot < 0) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (dots.length == 4) {\n\t\t// IPv4\n\t\treturn ((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3]);\n\t} else if \n (dots.length == 6) {\n\t\t// IPv6\n\t\treturn ((((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3])*256)+(+dots[4])*256)+(+dots[5]);\n\t}\n\treturn false;\n}", "function calNetworkAddress(en1,en2,en3,en4,ss1,ss2,ss3,ss4 ){\r\n\r\n//-----------Network Address Output --------------------------------------\r\n\r\n var netOut = [] ;\r\n\r\n//--------Convert all input Value to Binary-------------------------------\r\n\r\n //-----Enter IP Portion ------\r\n // cen1 = en1.toString(2);\r\n\t\t\t\t // cen2 = en2.toString(2);\r\n\t\t\t\t\t// cen3 = en3.toString(2);\r\n\t\t\t\t\t //cen4 = en4.toString(2);\r\n\t\t\t\t\t//----Subnet IP Portion\r\n\t\t\t\t\t// css1 = ss1.toString(2);\r\n\t\t\t\t\t// css2 = ss2.toString(2);\r\n\t\t\t\t\t// css3 = ss3.toString(2);\r\n\t\t\t\t\t //css4 = ss4.toString(2);\r\n\t\t\t\t\t \r\n\t\t\t\t\t \r\n//--------------'And 'the User Input Value with the Subnet Value Selected to get the Network Address ------------------------------------------------\r\n\t\t\t\t\t \r\n netOut[1] = en1 & ss1 ;\r\n\t\t\t\t netOut[2] = en2 & ss2 ;\r\n\t\t\t\t netOut[3] = en3 & ss3 ;\r\n\t\t\t\t netOut[4] = en4 & ss4 ;\r\n\t\t\t\t \r\n\t\t\t\t \r\n//-----------Convert Binary Value Back to Decimal-----------------------------------------------------------------------------------------------------------\r\n\t\t\t\t \r\n return [netOut[1],netOut[2],netOut[3],netOut[4] ];\t\t\t\t \r\n\r\n}", "function startingIP(aNet,aMask){\n var a = subnetID(aNet,aMask);\n var d = octet2dec(a);\n d = d+1;\n return dec2octet(d);\n}", "function octet2dec(a){\n //alert(\"octet2dec1 \"+a[0]+\"\\n\"+dec2bin(a[0])+\"\\n\"+dec2bin(a[0] * 16777216));\n // poor mans bit shifting (Int32 issue)\n var d = 0;\n d = d + parseInt(a[0]) * 16777216 ; //Math.pow(2,24);\n d = d + a[1] * 65536;\t //Math.pow(2,16);\n d = d + a[2] * 256;\t //Math.pow(2,8);\n d = d + a[3];\n return d;\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "static calculateNetmask(mask) {\n return NetworkUtils.numToIp(2 ** 32 - 2 ** (32 - mask));\n }", "function IPAddress$IPv4ToInt(address) {\n var res = 0;\n // check that the input is a valid IPv4 address\n if (IPAddress$getValidIPv4(address) === address) {\n var parts = address.split('.');\n res += parseInt10(parts[0]) << 24;\n res += parseInt10(parts[1]) << 16;\n res += parseInt10(parts[2]) << 8;\n res += parseInt10(parts[3]);\n return res;\n }\n}", "function toNumber(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n b = match.reverse().join('');\r\n }\r\n }\r\n var result = parseInt(b, 16);\r\n if (result >= Number.MAX_SAFE_INTEGER) {\r\n throw new Error(\"Overflowed when converting to number: \" + bytes);\r\n }\r\n return result;\r\n}", "function toNumber$1(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex$1(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n b = match.reverse().join('');\r\n }\r\n }\r\n var result = parseInt(b, 16);\r\n if (result >= Number.MAX_SAFE_INTEGER) {\r\n throw new Error(\"Overflowed when converting to number: \" + bytes);\r\n }\r\n return result;\r\n}", "function maskAnd(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) & parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) & parseInt(mask.toBin().substr(16,16), 2)));\n}", "function convert64to32(id) {\n return new BigNumber(id).minus('76561197960265728');\n}", "function maskOr(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) | parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) | parseInt(mask.toBin().substr(16,16), 2)));\n}", "function f2i(val)\n{ \n f64[0] = val;\n let tmp = Array.from(u32);\n return tmp[1] * 0x100000000 + tmp[0];\n}", "function convert32to64(id) {\n return new BigNumber('76561197960265728').plus(id);\n}", "function convertIPv4StrToInt2(ipv4Str) {\n if (typeof ipv4Str !== \"string\") {\n throw TypeError(\"Illegal arguments, ipv4Str should be a string\");\n }\n\n let ipv4Int = 0,\n base = 1,\n digit,\n digitBase = 1,\n dotsCnt = 0,\n isSpaceAppearBeforeDigit = false,\n char;\n\n for (let i = ipv4Str.length - 1; i >= -1; i--) {\n char = ipv4Str[i];\n\n if (char === '.' || i === -1) { // dot or end\n dotsCnt = i !== -1 ? dotsCnt + 1 : dotsCnt;\n if (dotsCnt > 3 || (i === -1 && dotsCnt !== 3)) {\n throw Error(\"Invalid IPv4 address, it should be formated in A.B.C.D\");\n }\n if (digit === undefined) { // nothing between two dots, such as: 172.1..\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n if (digit >= 256) {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be less than 256\");\n }\n ipv4Int += digit * base;\n base *= 256;\n\n digit = undefined;\n digitBase = 1;\n isSpaceAppearBeforeDigit = false;\n } else if (/\\d/.test(char)) { // digit\n if (isSpaceAppearBeforeDigit) { // spaces between two digits, such as: 172.1.1 2\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n\n digit = parseInt(char) * digitBase + (digit === undefined ? 0 : digit);\n digitBase *= 10;\n } else if (char === ' ') { // space\n if (digit !== undefined) {\n isSpaceAppearBeforeDigit = true;\n }\n\n isSpaceAppear = true;\n } else {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n }\n\n return ipv4Int;\n}", "getInt64() {\n var low, high;\n if (this.littleEndian) {\n low = this.getUint32();\n high = this.getUint32();\n }\n else {\n high = this.getUint32();\n low = this.getUint32();\n }\n // calculate negative value\n if (high & 0x80000000) {\n high = ~high & 0xFFFFFFFF;\n low = ~low & 0xFFFFFFFF;\n if (low === 0xFFFFFFFF)\n high = (high + 1) & 0xFFFFFFFF;\n low = (low + 1) & 0xFFFFFFFF;\n return -(high * 0x100000000 + low);\n }\n return high * 0x100000000 + low;\n }", "function cidr2octet(bits) {\n var bits = parseInt(bits);\n if( bits < 0 | bits > 32 ) {\n alert(\"Invalid 32 bit DIDR mask. You entered \"+bits);\n return false;\n }\n // make up our mask\n var ones = \"11111111111111111111111111111111\";\n var mask = parseInt(ones.substring(0,bits),2);\n var shift = 32-bits;\n // poor mans bit shift because javascript uses 32 bit integers\n mask = mask * Math.pow(2,shift);\n\n return dec2octet(mask);\n}", "function maskInvert(mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return (((~parseInt(mask.toBin().substr(0,16), 2)) & 0xffff) * factor16 + (~parseInt(mask.toBin().substr(16,16), 2) & 0xffff));\n}", "function ipMask(s2){\r\n\t \r\n \r\n var s2 = document.getElementById(s2);\r\n \r\n\t \r\n\t if(s2.value == \"1\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 255; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =32;\r\n\t\t\t\r\n\t\t\t hostBits =0 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 1 ;\r\n\t\t\t\t\t\t\t\t \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"2\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 254; \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =31;\r\n\t\t\t\r\n\t\t\t hostBits =1 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 2 ;\r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"3\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 252; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =30;\r\n\t\t\t\r\n\t\t\t hostBits =2 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 3 ;\r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"4\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 248; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =29;\r\n\t\t\t\r\n\t\t\t hostBits =3 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 4 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"5\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 240; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =28;\r\n\t\t\t\r\n\t\t\t hostBits =4 ;\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 5 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"6\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 224; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =27;\r\n\t\t\t\r\n\t\t\t hostBits =5 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 6 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"7\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 192; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =26;\r\n\t\t\t\r\n\t\t\t hostBits =6 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 7 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"8\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 128; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =25;\r\n\t\t\t\r\n\t\t\t hostBits =7 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 8 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//-------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"9\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =24;\r\n\t\t\t\r\n\t\t\t hostBits =8 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 9 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"10\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 254;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =23;\r\n\t\t\t\r\n\t\t\t hostBits =9 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 10 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"11\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 252;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =22;\r\n\t\t\t\r\n\t\t\t hostBits =10 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 11 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"12\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 248;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =21;\r\n\t\t\t\r\n\t\t\t hostBits =11 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 12 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"13\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 240;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =20;\r\n\t\t\t\r\n\t\t\t hostBits =12 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 13 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"14\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 224;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =19;\r\n\t\t\t\r\n\t\t\t hostBits =13 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 14 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"15\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 192;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =18;\r\n\t\t\t\r\n\t\t\t hostBits =14 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 15 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"16\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 128;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =17;\r\n\t\t\t\r\n\t\t\t hostBits =15 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 16 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//----------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"17\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\r\n //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =16;\r\n\t\t\t\r\n\t\t\t hostBits =16 ;\r\n\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 17 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"18\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 254;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =15;\r\n\t\t\t\r\n\t\t\t hostBits =17 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 18 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"19\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 252;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =14;\r\n\t\t\t\r\n\t\t\t hostBits =18 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 19 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"20\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 248;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 20 ; \r\n dropSelect =1;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =13;\r\n\t\t\t\r\n\t\t\t hostBits =19 ;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"21\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 240;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =12;\r\n\t\t\t\r\n\t\t\t hostBits =20 ;\r\n \r\n\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 21 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"22\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 224;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =11;\r\n\t\t\t\r\n\t\t\t hostBits =21 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 22 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"23\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 192;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =10;\r\n\t\t\t\r\n\t\t\t hostBits =22;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 23 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"24\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 128;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =9;\r\n\t\t\t\r\n\t\t\t hostBits =23;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 24 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"25\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\r\n //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =8;\r\n\t\t\t\r\n\t\t\t hostBits =24;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\r\n\t\t\t\t\t\t\t kase = 25 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"26\"){\r\n \r\n \r\n ipA = 254;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 1;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =7;\r\n\t\t\t\r\n\t\t\t hostBits =25;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 26 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"27\"){\r\n \r\n \r\n ipA = 252;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 3;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =6;\r\n\t\t\t\r\n\t\t\t hostBits =26;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 27 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"28\"){\r\n \r\n \r\n ipA = 248;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 7;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =5;\r\n\t\t\t\r\n\t\t\t hostBits =27;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 28 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"29\"){\r\n \r\n \r\n ipA = 240;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 15;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =4;\r\n\t\t\t\r\n\t\t\t hostBits =28;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 29 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"30\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 224;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 31;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =3;\r\n\t\t\t\r\n\t\t\t hostBits =29;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 30 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"31\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 192;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 63;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =2;\r\n\t\t\t\r\n\t\t\t hostBits =30;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 31 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"32\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 128;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 127;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =1;\r\n\t\t\t\r\n\t\t\t hostBits =31;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 32 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n}", "function i2f(val)\n{\n let tmp = [];\n tmp[0] = parseInt(val % 0x100000000);\n tmp[1] = parseInt((val - tmp[0]) / 0x100000000);\n u32.set(tmp);\n return f64[0];\n}", "function bytesToFloat(bytes) {\n // JavaScript bitwise operators yield a 32 bits integer, not a float.\n // Assume LSB (least significant byte first).\n var bits = bytes[3]<<24 | bytes[2]<<16 | bytes[1]<<8 | bytes[0];\n var sign = (bits>>>31 === 0) ? 1.0 : -1.0;\n var e = bits>>>23 & 0xff;\n var m = (e === 0) ? (bits & 0x7fffff)<<1 : (bits & 0x7fffff) | 0x800000;\n var f = sign * m * Math.pow(2, e - 150);\n return f;\n }", "function subnetID(aNet,aMask){\n var a = new Array(0,0,0,0);\n for(var i=0;i<4;i++){\n a[i] = aNet[i] & aMask[i];\n }\n return a;\n}", "maxIp() {\n // min + (2^(32-mask)) - 1 [zero needs to count]\n return NetworkUtils.numToIp(this.maxAddress());\n }", "function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netaddressBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = addressBinStr.substr( pos, 1 );\r\n\t\tnmBit = netmaskBinStr.substr( pos, 1 );\r\n\t\tif( aBit == nmBit ) {\tnetaddressBinStr += aBit.toString();\t}\r\n\t\telse{\tnetaddressBinStr += '0';\t}\r\n\t}\r\n\treturn netaddressBinStr;\r\n}", "function dec2octet(d){\n //alert(\"d=\"+d+\" \"+d.toString(2)+\"=\"+d.toString(2).substring(0,8)+\"=\"+parseInt(d.toString(2).substring(0,8),2));\n var zeros = \"00000000000000000000000000000000\";\n var b = d.toString(2);\n var b = zeros.substring(0,32-b.length) + b;\n var a = new Array(\n parseInt(b.substring(0,8),2)\t// 32 bit integer issue (d & 4278190080)/16777216 //Math.pow(2,32) - Math.pow(2,24);\n , (d & 16711680)/65536\t //Math.pow(2,24) - Math.pow(2,16);\n , (d & 65280)/256\t\t //Math.pow(2,16) - Math.pow(2,8);\n , (d & 255)\n );\t\t //Math.pow(2,8);\n return a;\n}", "function convert32_to_8bit(){\n\n}", "function bytes2Float32(bytes) {\n var sign = bytes & 0x80000000 ? -1 : 1,\n exponent = ((bytes >> 23) & 0xff) - 127,\n significand = bytes & ~(-1 << 23)\n\n if (exponent == 128) {\n return sign * (significand ? Number.NaN : Number.POSITIVE_INFINITY)\n }\n\n if (exponent == -127) {\n if (significand == 0) {\n return sign * 0.0\n }\n exponent = -126\n significand /= 1 << 22\n } else {\n significand = (significand | (1 << 23)) / (1 << 23)\n }\n\n return sign * significand * Math.pow(2, exponent)\n}", "function _IsLegalSubnet(subnet, bits) {\r\n\tvar binary_subnet = \"\";\r\n\tvar i, arr;\r\n\tvar subnet_hostID_bits = 0;\r\n\tvar networkID_bits = 32 - bits;\r\n\r\n\r\n\t//alert(\"Bit : \" + bits);\r\n\tfor(i = 0, arr = subnet.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_subnet += ToBinary(arr[i]);\r\n\t}\r\n\t//alert(binary_subnet);\r\n\tfor(i = 0; i < binary_subnet.length; i ++) {\r\n\t\tif(binary_subnet.charAt(i) != '1') break;\r\n\t}\r\n\tsubnet_hostID_bits = i;\r\n\t//alert(\"netmask length : \" + subnet_hostID_bits);\r\n\tfor(i ++; i < binary_subnet.length; i ++) {\r\n\t\tif(binary_subnet.charAt(i) == '1') {\r\n\t\t\tsubnet_hostID_bits = -1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(subnet_hostID_bits != -1) {\r\n\t\tif(networkID_bits > subnet_hostID_bits) {\r\n\t\t\tsubnet_hostID_bits = -1;\r\n\t\t} else {\r\n\t\t\tsubnet_hostID_bits -= networkID_bits;\r\n\t\t\tsubnet_hostID_bits = bits - subnet_hostID_bits;\r\n\t\t}\r\n\t}\r\n\r\n\treturn subnet_hostID_bits;\r\n}", "getUint64() {\n var low, high;\n if (this.littleEndian) {\n low = this.getUint32();\n high = this.getUint32();\n }\n else {\n high = this.getUint32();\n low = this.getUint32();\n }\n return high * 0x100000000 + low;\n }", "function HostIDBits(ip) {\r\n\tvar IPSegment;\r\n\tvar bits = 0;\r\n\r\n\tIPSegment = ip.split(\".\");\r\n\t\r\n\tif(IPSegment[0] == 127) {\r\n\t\treturn -1; // for loopback address\r\n\t} else if(IPSegment[0] >= 224 && IPSegment[0] < 240) {\r\n\t\treturn -2; // for multicast address\r\n\t} else if(IPSegment[0] >= 240) {\r\n\t\treturn -3; // for future use\r\n\t}\r\n\r\n\tif(IPSegment[0] < 127) { // Class A, by the way, 127 is for loopback address\r\n\t\tbits = 24;\r\n\t} else if(IPSegment[0] < 192) { // Class B\r\n\t\tbits = 16;\r\n\t} else if(IPSegment[0] < 224) { // Class C\r\n\t\tbits = 8;\r\n\t} \r\n\r\n\treturn bits;\r\n}", "static calculateNetsize(mask) {\n return 2 ** (32 - mask);\n }", "function float2int (value) {\n\treturn value | 0;\n}", "function parseIPv4(addr) {\n if (typeof(addr) !== 'string')\n throw new TypeError('addr (string) is required');\n\n var octets = addr.split(/\\./).map(function (octet) {\n return (parseInt(octet, 10));\n });\n if (octets.length !== 4)\n throw new TypeError('valid IP address required');\n\n var uint32 = ((octets[0] * Math.pow(256, 3)) +\n (octets[1] * Math.pow(256, 2)) +\n (octets[2] * 256) + octets[3]);\n return (uint32);\n}", "full_u64() {\n this.throw_if_less_than(8);\n\n let val = 0;\n for (let i = 0; i < 8; i++) {\n val = (val * 256) + this.buffer[this.pos];\n this.pos += 1;\n }\n return val;\n }", "maxAddress() {\n // min + (2^(32-mask)) - 1 [zero needs to count]\n return this.minAddress() + this.networkSize - 1;\n }", "function encodeFloat(number) {\n var n = +number,\n status = (n !== n) || n == -Infinity || n == +Infinity ? n : 0,\n exp = 0,\n len = 281, // 2 * 127 + 1 + 23 + 3,\n bin = new Array(len),\n signal = (n = status !== 0 ? 0 : n) < 0,\n n = Math.abs(n),\n intPart = Math.floor(n),\n floatPart = n - intPart,\n i, lastBit, rounded, j, exponent;\n\n if (status !== 0) {\n if (n !== n) {\n return 0x7fc00000;\n }\n if (n === Infinity) {\n return 0x7f800000;\n }\n if (n === -Infinity) {\n return 0xff800000\n }\n }\n\n i = len;\n while (i) {\n bin[--i] = 0;\n }\n\n i = 129;\n while (intPart && i) {\n bin[--i] = intPart % 2;\n intPart = Math.floor(intPart / 2);\n }\n\n i = 128;\n while (floatPart > 0 && i) {\n (bin[++i] = ((floatPart *= 2) >= 1) - 0) && --floatPart;\n }\n\n i = -1;\n while (++i < len && !bin[i]);\n\n if (bin[(lastBit = 22 + (i = (exp = 128 - i) >= -126 && exp <= 127 ? i + 1 : 128 - (exp = -127))) + 1]) {\n if (!(rounded = bin[lastBit])) {\n j = lastBit + 2;\n while (!rounded && j < len) {\n rounded = bin[j++];\n }\n }\n\n j = lastBit + 1;\n while (rounded && --j >= 0) {\n (bin[j] = !bin[j] - 0) && (rounded = 0);\n }\n }\n i = i - 2 < 0 ? -1 : i - 3;\n while(++i < len && !bin[i]);\n (exp = 128 - i) >= -126 && exp <= 127 ? ++i : exp < -126 && (i = 255, exp = -127);\n (intPart || status !== 0) && (exp = 128, i = 129, status == -Infinity ? signal = 1 : (status !== status) && (bin[i] = 1));\n\n n = Math.abs(exp + 127);\n exponent = 0;\n j = 0;\n while (j < 8) {\n exponent += (n % 2) << j;\n n >>= 1;\n j++;\n }\n\n var mantissa = 0;\n n = i + 23;\n for (; i < n; i++) {\n mantissa = (mantissa << 1) + bin[i];\n }\n return ((signal ? 0x80000000 : 0) + (exponent << 23) + mantissa) | 0;\n}", "function f(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}", "function extractInt(nobbles,start,nBits,signed=false) {\n var result = 0;\n var offset, theBit, bitOffset, i, nobble;\n // Proceed bit by bit\n for (i=0;i<nBits;i++) {\n // Compute offset into nobbles; retrieve nobble\n offset = Math.floor((start+i)/6);\n nobble = nobbles[offset];\n // Extract the bit we want\n bitOffset = 5 - ((start+i)%6);\n theBit = (nobble >> bitOffset) & 1;\n // To deal correctly with negative numbers, propogate the first bit up the result\n if (signed && theBit && i==0) {\n result = -1;\n }\n // Push theBit onto the least-significant end of the result\n result = result << 1;\n result |= theBit;\n }\n return result;\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function bnIntValue() {\nif(this.s < 0) {\n if(this.t == 1) return this.data[0]-this.DV;\n else if(this.t == 0) return -1;\n} else if(this.t == 1) return this.data[0];\nelse if(this.t == 0) return 0;\n// assumes 16 < DB < 32\nreturn ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];\n}", "function caml_int64_of_float (x) {\n if (x < 0) x = Math.ceil(x);\n return [255,\n x & 0xffffff,\n Math.floor(x * caml_int64_offset) & 0xffffff,\n Math.floor(x * caml_int64_offset * caml_int64_offset) & 0xffff];\n}", "function Je(e){var n=parseInt(e,16);return[n>>16,n>>8&255,255&n]}", "function normalizeCIDR(s) {\n var parts = s.split(\"/\");\n if (parts.length != 2) {\n return s;\n }\n\n if (parts[1] == \"32\") {\n /* Most of the time (JavaScript spec and hardware lshift instruction)\n * only 5 bits are used in right operand.\n */\n return s;\n }\n\n var mask = parseInt(parts[1]);\n var ip_int = $.su.func.ipToInt(parts[0]);\n var mask_int = ((1 << mask) - 1) << (32 - mask);\n var norm_ip_int = ip_int & mask_int;\n return $.su.func.intToIp(norm_ip_int) + \"/\" + mask;\n}", "function d2b(integer){\n\t\tif (typeof integer !== \"string\" && integer.toString().length > 15){throw \"integer should be entered as a string for precision\";}\n\t\tvar padding = \"\";\n\t\tfor (i = 0; i < 63; i++){\n\t\t\tpadding += \"0\";\n\t\t}\n\t\tvar a = new JSBigInt(integer);\n\t\tif (a.toString(2).length > 64){throw \"amount overflows uint64!\";}\n\t\treturn swapEndianC((padding + a.toString(2)).slice(-64));\n\t}", "function extractIPformat(val,tpart,tpartip4) {\r\n var tpartip4txt = new Array(4); \r\n var tparttxt = new Array(8);\r\n var tparttxt2 = new Array(2);\r\n var typeIP;\r\n\r\n tparttxt[0]=tparttxt[1]=tparttxt[2]=tparttxt[3]=tparttxt[4]=tparttxt[5]=tparttxt[6]=tparttxt[7]='0';\r\n tpart[0]=tpart[1]=tpart[2]=tpart[3]=tpart[4]=tpart[5]=tpart[6]=tpart[7]=0;\r\n //IPv4 or IPv6 alternative \r\n tpartip4txt[0]=tpartip4txt[1]=tpartip4txt[2]=tpartip4txt[3]='0';\r\n tpartip4[0]=tpartip4[1]=tpartip4[2]=tpartip4[3]=0;\r\n typeIP=checkIPformat(val);\r\n if (typeIP>=0) {\r\n\t switch (typeIP) {\r\n\t\t case 1: {\r\n\t\t\t tpartip4 = val.split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 2: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 3: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t tpartip4 = tparttxt[6].split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t }\r\n\t for (var i=0;i<8;i++) { tpart[i]=parseInt(tparttxt[i],16); }\r\n }\r\n return typeIP;\r\n}", "function wgint64(value, endian, buffer, offset)\n{\n\tif (endian == 'big') {\n\t\twgint32(value[0], endian, buffer, offset);\n\t\twgint32(value[1], endian, buffer, offset+4);\n\t} else {\n\t\twgint32(value[0], endian, buffer, offset+4);\n\t\twgint32(value[1], endian, buffer, offset);\n\t}\n}", "function ToInt8(v) { return (v << 24) >> 24; }", "function u(e){var t=\"string\"==typeof e?parseInt(e,16):e;return t<65536?x(t):(t-=65536,x(55296+(t>>10),56320+(1023&t)))}", "toNumber() {\n\t\tlet total = 0;\n\n\t\tthis.bits.forEach((bit, i) => {\n\t\t\tconst powerOfTwo = this.bits.length - i - 1;\n\t\t\tif (bit === 1) {\n\t\t\t\ttotal += 2**powerOfTwo;\n\t\t\t}\n\t\t});\n\n\t\treturn total;\n }", "function getWorkerIdByIP(bits) {\n var shift = 64 - bits;\n var address = '192.168.0.1';\n if (c_ip) {\n console.info(\"using config ip:\" + c_ip);\n address = c_ip;\n } else {\n var networkInterfaces = os.networkInterfaces();\n if (networkInterfaces['eth0'] && networkInterfaces['eth0'][0]) {\n address = networkInterfaces['eth0'][0].address;\n } else {\n console.warn(\"can not find IP address of 'eth0', using default IP \" + address + \"!\");\n }\n }\n var ip = ipV4ToLong(address);\n ip = Number(ip.toString());\n var workerId = (ip << shift) >>> shift;\n return workerId;\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV\n else if (this.t == 0) return -1\n } else if (this.t == 1) return this[0]\n else if (this.t == 0) return 0\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;else if (this.t == 0) return -1;\n } else if (this.t == 1) return this[0];else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];\n}", "function IPv4_Calc_netbcastBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netbcastBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = parseInt( addressBinStr.substr( pos, 1 ));\r\n\t\tnmBit = parseInt( netmaskBinStr.substr( pos, 1 ));\r\n\t\t\r\n\t\tif( nmBit ) {\tnmBit = 0;\t}\t/* flip netmask bits */\r\n\t\telse{\tnmBit = 1;\t}\r\n\t\t\r\n\t\tif( aBit || nmBit ) {\tnetbcastBinStr += '1'\t}\r\n\t\telse{\tnetbcastBinStr += '0';\t}\r\n\t}\r\n\treturn netbcastBinStr;\r\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;\n else if (this.t === 0) return -1;\n }\n else if (this.t == 1) return this[0];\n else if (this.t === 0) return 0;\n// assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;else if (this.t == 0) return -1;\n } else if (this.t == 1) return this[0];else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];\n }", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;else if (this.t == 0) return -1;\n } else if (this.t == 1) return this[0];else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];\n }", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;else if (this.t == 0) return -1;\n } else if (this.t == 1) return this[0];else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];\n }", "function bitsToNum(ba)\n{\n return ba.reduce(function(s, n) {\n return s * 2 + n;\n }, 0);\n}", "function binaryToFloat(str){\n return parseFloat(parseInt(str, 2));\n}", "function arrayToInt(arrIP, theThingToThrow) {\n let octets = arrIP.map((octet) => {\n if(typeof octet === 'string') {\n octet = octet.trim();\n if(!onlyDigits(octet))\n throw new theThingToThrow();\n octet = parseInt(octet);\n }\n else if(typeof octet === 'number')\n octet = parseInt(octet, 10);\n else\n throw new theThingToThrow();\n if(octet > 255)\n throw new theThingToThrow();\n return octet; \n });\n return octets[0] * factor24 + octets[1] * factor16 + octets[2] * factor8 + octets[3];\n}", "function trigger(){\r\n\t_in = document.getElementById(\"subnet\");\r\n\t_ip = document.getElementById(\"ip_addr\")\r\n\t_dbg(\"\");\r\n\t\r\n\tvar subn = new IPv4SubnetUtils();\r\n\tsubn.initialize(_in.value);\r\n\t\t\r\n\tif (subn.is_valid_format() && IPv4SubnetUtils.is_valid_address(_ip.value)){\r\n\t\t\r\n\t\t/*\r\n\t\tvar bin_str = subn.get_binary_addr(false);\r\n\t\tconsole.log(\"Binary address: \"+bin_str);\r\n\t\t\r\n\t\tvar bin_nm = subn.get_binary_netm();\t\t\r\n\t\tconsole.log(\"Binary netmask: \"+bin_nm+\", \"+IPv4Subnet.bin2dot_decimal(bin_nm));\r\n\t\t\r\n\t\tvar bin_broadcast = subn.get_binary_broadcast();\r\n\t\tvar broadcast = subn.get_broadcast();\t\t\r\n\t\tconsole.log(\"Binary broadcast: \"+bin_broadcast+\", Broadcast IP: \" + broadcast );\r\n\t\t\r\n\t\tvar minhost = subn.get_binary_minhost();\r\n\t\tvar maxhost = subn.get_binary_maxhost();\r\n\t\tconsole.log(\"maxhost: \" + maxhost + \", IP: \" + subn.get_maxhost());\r\n\t\tconsole.log(\"minhost: \" + minhost + \", IP: \" + subn.get_minhost());\r\n\t\t*/\r\n\t\tvar isIn = subn.within(_ip.value);\r\n\t\tconsole.log(\"IP in given subnet: \" + isIn.toString());\r\n\t\t\r\n\t}\r\n\t\r\n}", "function int24(raw, start) {\n return (raw[start] << 8*2) + (raw[start+1] << 8) + raw[start+2];\n}", "function genIP(currentIP, value){\n\tvar zeroBitsCount = countZeros(currentIP);\n\n\tvar maxValue = Math.pow(2, zeroBitsCount);\n\n\tif (value < maxValue) {\n\n\t\tvar neededBits = Math.floor(Math.log2(value));\n\t\tvar maxCIDR_IPValue = Math.pow(2, neededBits);\n\n\t\tconsole.log(currentIP[0] + '.' + currentIP[1] + '.' + currentIP[2] + '.' + currentIP[3] + '/' + (32 - maxCIDR_IPValue));\n\t\t\n\t\twhile (maxCIDR_IPValue > 0) {\n\t\t\tvalue--;\n\t\t\tmaxCIDR_IPValue--;\n\t\t\tcurrentIP = incrementIP(currentIP);\n\t\t}\n\n\t\tgenIP(currentIP, value);\n\t}\n\telse{\n\t\tconsole.log(currentIP[0] + '.' + currentIP[1] + '.' + currentIP[2] + '.' + currentIP[3] + '/' + (32 - Math.log2(maxValue)));\n\t\t\n\t\twhile (maxValue > 0) {\n\t\t\tmaxValue--;\n\t\t\tvalue--;\n\t\t\tcurrentIP = incrementIP(currentIP);\n\t\t}\n\n\t\tgenIP(currentIP, value);\n\t}\n\treturn;\n}", "function endingIP(aNet,aWild){\n // work around int32\n var a = new broadcast(aNet,aWild);\n var d = octet2dec(a);\n d = d-1;\n return dec2octet(d);\n}", "function bnIntValue() {\n if (this.s < 0) {\n if (this.t == 1) return this[0] - this.DV;\n else if (this.t == 0) return -1;\n } else if (this.t == 1) return this[0];\n else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n}", "toSignedNumber() {\n if (this.bits[0] === 0) {\n return this.toNumber();\n }\n\n const minusOneBits = Array.from({length: this.bits.length}, () => 1);\n const minusOne = new Binary(minusOneBits);\n\n const positiveWithCarry = this.add(minusOne).not();\n const positiveNumber = new Binary(positiveWithCarry.bits.slice(1));\n return -positiveNumber.toNumber();\n }", "function bnIntValue() {\n\t if (this.s < 0) {\n\t if (this.t == 1) return this[0] - this.DV\n\t else if (this.t == 0) return -1\n\t } else if (this.t == 1) return this[0]\n\t else if (this.t == 0) return 0\n\t // assumes 16 < DB < 32\n\t return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n\t}", "function bnIntValue() {\n\t if (this.s < 0) {\n\t if (this.t == 1) return this[0] - this.DV\n\t else if (this.t == 0) return -1\n\t } else if (this.t == 1) return this[0]\n\t else if (this.t == 0) return 0\n\t // assumes 16 < DB < 32\n\t return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]\n\t}", "function AllZeroesOrOnes(binary, subnet_hostID_bits) { \r\n\tvar i;\r\n\tvar result = 2;\r\n\r\n\t//alert(\"subnet_hostID_bits : \" + subnet_hostID_bits);\r\n\r\n\tfor(i = 0; i < subnet_hostID_bits && binary.charAt(i) == '0'; i ++);\r\n\tif(i == subnet_hostID_bits) {\r\n\t\tresult = 0;\r\n\t}\r\n\r\n\t//alert(\"After reversing, binary : \" + binary);\r\n\r\n\tfor(i = 0; i < subnet_hostID_bits && binary.charAt(i) == '1'; i ++);\r\n\tif(i == subnet_hostID_bits) {\r\n\t\tresult = 1;\r\n\t}\r\n\treturn result;\r\n}", "function isValidIP(objIP) \r\n\t{\r\n\t\tvar strIPtext = objIP.value; \r\n\t\tif ((strIPtext.length == 0) || IsAllSpaces(strIPtext)) \r\n\t\t{ \r\n\t\t\t// IP Empty\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\t\r\n\t\tif ( countChars(strIPtext,\".\") != 3) \r\n\t\t{ \r\n\t\t\t// Invalid Format, number of dots is not 3\r\n\t\t\treturn 2;\r\n\t\t}\r\n\t\tvar arrIP = strIPtext.split(\".\");\r\n\t\t\t\r\n\t\tfor(var i = 0; i < 4; i++)\r\n\t\t{\r\n\t\t\tif ( (arrIP[i].length < 1 ) || (arrIP[i].length > 3 ) )\r\n\t\t\t{\r\n\t\t\t\t// Invalid Format, continuous dots or more than 3 digits given between dots\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tif ( !isInteger(arrIP[i]) )\r\n\t\t\t{\r\n\t\t\t\t// non-integers present in the value\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tarrIP[i] = parseInt(arrIP[i]);\r\n\t\t\t\t\r\n\t\t\tif(i == 0)\r\n\t\t\t{\r\n\t\t\t\t// start IP value\r\n\t\t\t\tif(arrIP[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP value must not be 0\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(arrIP[i] > 223)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be > 223\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\t}\r\n\t\t\t\tif(arrIP[i] == 127)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be 127 - Loopback ip\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// the 2nd, 3rd and 4th IP values between the dots\r\n\t\t\t\t// these must not be more than 255\r\n\t\t\t\tif (arrIP[i] > 255)\r\n\t\t\t\t{\r\n\t\t\t\t\t// IP out of bound\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\tobjIP.value = arrIP.join(\".\");\r\n\t\t\t\r\n\t\tif(objIP.value == \"0.0.0.0\")\r\n\t\t{\r\n\t\t\t// IP all zeros\r\n\t\t\treturn 7;\r\n\t\t}\t\r\n\t\t\t\r\n\t\treturn 0;\r\n\t\t\t\r\n\t}\t// end of isValidIP", "function convertValue(bytes, base, unit, floor) {\n var result = bytes / Math.pow(base, unit);\n if (floor) {\n return Math.floor(result);\n }\n return parseFloat(result.toFixed(fixedDecimalPlaces));\n }", "function fixIP(ip) {\r\n\tlet a = ip.split('/');\r\n\tlet parts = a[0].split('.');\r\n\twhile (parts.length < 4) parts.push('0');\r\n\treturn parts.join('.') + (a[1] ? '/' + a[1] : '');\r\n}", "function bnIntValue()\n{\n if (this.s < 0)\n {\n if (this.t == 1) return this[0] - this.DV;\n else if (this.t == 0) return -1;\n }\n else if (this.t == 1) return this[0];\n else if (this.t == 0) return 0;\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n}", "function convToUInt32(value) {\n\tvalue = value % MAX_INTEGER;\n\tif (value < 0) {\n\t\tvalue += MAX_INTEGER;\n\t}\n\treturn value;\n}", "function bin2dec(bin) { return parseInt(bin, 2); }", "function fromBinary(input){\n // We assume input is 8 digits long\n var result = 0;\n for ( i = 0 ; i < 8 ; i += 1 ){\n if ((input[i]) !== \"0\") result = result + Math.pow(2, 7 - i);\n }\n console.log(result);\n return result;\n }" ]
[ "0.7144108", "0.6971148", "0.67631763", "0.6753766", "0.66046524", "0.6519572", "0.6381058", "0.63735265", "0.62802345", "0.62318075", "0.62083477", "0.6166805", "0.607505", "0.59041", "0.5902165", "0.588857", "0.5886315", "0.5871601", "0.5856926", "0.5831653", "0.5779503", "0.5758926", "0.5751915", "0.5743477", "0.569324", "0.56846064", "0.56725305", "0.56543857", "0.5614791", "0.56145173", "0.55979437", "0.5574641", "0.5567005", "0.5524205", "0.55129904", "0.5482551", "0.5480226", "0.5477775", "0.5472643", "0.5447836", "0.54439443", "0.5437575", "0.54329526", "0.54203516", "0.54054105", "0.5394443", "0.5394182", "0.5385213", "0.5370857", "0.5363295", "0.5349352", "0.5344676", "0.5344676", "0.5344676", "0.5344676", "0.5344676", "0.5344676", "0.5344676", "0.53402424", "0.53317785", "0.5330076", "0.53223026", "0.5307072", "0.53011924", "0.52931815", "0.529032", "0.5276758", "0.5276042", "0.52560055", "0.52560055", "0.52560055", "0.52560055", "0.52560055", "0.52560055", "0.52560055", "0.5249838", "0.5236732", "0.5233023", "0.5232446", "0.5232446", "0.5232446", "0.5225911", "0.5221519", "0.5211395", "0.52112746", "0.52101904", "0.52092713", "0.52030504", "0.52020895", "0.5201394", "0.51953954", "0.51953954", "0.51910454", "0.5186103", "0.51845574", "0.5183687", "0.5173769", "0.51735747", "0.51686597", "0.5164824" ]
0.588534
17
integer IP to dottedquad
function IPv4_intA_to_dotquadA( strnum ) { var byte1 = ( strnum >>> 24 ); var byte2 = ( strnum >>> 16 ) & 255; var byte3 = ( strnum >>> 8 ) & 255; var byte4 = strnum & 255; return ( byte1 + '.' + byte2 + '.' + byte3 + '.' + byte4 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function IPAddress$dottedQuadNotation(ipv4part) {\n var ipv4 = IPAddress$IPv4ToInt(ipv4part);\n\n // convert to unsigned int\n var bits = ipv4 >>> 0;\n\n // take IPv4 bits and stuff them in two hextets\n var hextets = [];\n hextets.push(((bits >>> 16) & 0xffff).toString(16));\n hextets.push((bits & 0xffff).toString(16));\n\n return hextets;\n}", "function int2ip(ipInt) {\n return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));\n }", "function int_to_ip(ip) {\n\treturn(format(\"%u.%u.%u.%u\"\n\t\t,(ip>>24)&0xff\n\t\t,(ip>>16)&0xff\n\t\t,(ip>>8)&0xff\n\t\t,ip&0xff\n\t\t));\n}", "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "function long2ip(ip) {\n // discuss at: http://phpjs.org/functions/long2ip/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: long2ip( 3221234342 );\n // returns 1: '192.0.34.166'\n if (!isFinite(ip))\n return false;\n return [ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF].join('.');\n}", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function IPv4_BinaryDotQuad( binaryString ) {\r\n\treturn ( binaryString.substr( 0, 8 ) +'.'+ binaryString.substr( 8, 8 ) +'.'+ binaryString.substr( 16, 8 ) +'.'+ binaryString.substr( 24, 8 ) );\r\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function fixIP(ip) {\r\n\tlet a = ip.split('/');\r\n\tlet parts = a[0].split('.');\r\n\twhile (parts.length < 4) parts.push('0');\r\n\treturn parts.join('.') + (a[1] ? '/' + a[1] : '');\r\n}", "function IPv4_dotquadA_to_intA( strbits ) {\r\n\tvar split = strbits.split( '.', 4 );\r\n\tvar myInt = (\r\n\t\tparseFloat( split[0] * 16777216 )\t/* 2^24 */\r\n\t + parseFloat( split[1] * 65536 )\t\t/* 2^16 */\r\n\t + parseFloat( split[2] * 256 )\t\t/* 2^8 */\r\n\t + parseFloat( split[3] )\r\n\t);\r\n\treturn myInt;\r\n}", "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "function convertIpToDecimal(ip) {\n // a not-perfect regex for checking a valid ip address\n\t// It checks for (1) 4 numbers between 0 and 3 digits each separated by dots (IPv4)\n\t// or (2) 6 numbers between 0 and 3 digits each separated by dots (IPv6)\n\tvar ipAddressRegEx = /^(\\d{0,3}\\.){3}.(\\d{0,3})$|^(\\d{0,3}\\.){5}.(\\d{0,3})$/;\n\tvar valid = ipAddressRegEx.test(ip);\n\tif (!valid) {\n\t\treturn false;\n\t}\n\tvar dots = ip.split('.');\n\t// make sure each value is between 0 and 255\n\tfor (var i = 0; i < dots.length; i++) {\n\t\tvar dot = dots[i];\n\t\tif (dot > 255 || dot < 0) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (dots.length == 4) {\n\t\t// IPv4\n\t\treturn ((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3]);\n\t} else if \n (dots.length == 6) {\n\t\t// IPv6\n\t\treturn ((((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3])*256)+(+dots[4])*256)+(+dots[5]);\n\t}\n\treturn false;\n}", "function decimals(n) {\n\treturn web3.utils.toWei(n,'ether')\n}", "function getipaddress(theip){\n theip = theip.split(\":\");\n return theip[3];\n}", "function extractIPformat(val,tpart,tpartip4) {\r\n var tpartip4txt = new Array(4); \r\n var tparttxt = new Array(8);\r\n var tparttxt2 = new Array(2);\r\n var typeIP;\r\n\r\n tparttxt[0]=tparttxt[1]=tparttxt[2]=tparttxt[3]=tparttxt[4]=tparttxt[5]=tparttxt[6]=tparttxt[7]='0';\r\n tpart[0]=tpart[1]=tpart[2]=tpart[3]=tpart[4]=tpart[5]=tpart[6]=tpart[7]=0;\r\n //IPv4 or IPv6 alternative \r\n tpartip4txt[0]=tpartip4txt[1]=tpartip4txt[2]=tpartip4txt[3]='0';\r\n tpartip4[0]=tpartip4[1]=tpartip4[2]=tpartip4[3]=0;\r\n typeIP=checkIPformat(val);\r\n if (typeIP>=0) {\r\n\t switch (typeIP) {\r\n\t\t case 1: {\r\n\t\t\t tpartip4 = val.split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 2: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 3: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t tpartip4 = tparttxt[6].split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t }\r\n\t for (var i=0;i<8;i++) { tpart[i]=parseInt(tparttxt[i],16); }\r\n }\r\n return typeIP;\r\n}", "function ip(address) {\n var finalAnswer = \"\";\n for(var char of address){\n if (char === \".\"){\n finalAnswer+= \"[.]\";\n } else{\n finalAnswer+= char;\n }\n }\n return finalAnswer;\n \n \n}", "function nwp(v, p) {\n\tvar parts = v.toFixed(p).split('.');\n\tparts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n\treturn parts.join('.');\n}", "function defangIPaddr(address) {\n return address.replace(new RegExp(\"\\\\.\", \"g\"), \"[.]\");\n}", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "function defangIPaddr(address) {\n return address.split(\".\").join(\"[.]\");\n}", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "function formatType(addrStr)\n{\n var pos = addrStr.indexOf(\"..\");\n if(pos != -1)\n\treturn -1; \n var a = addrStr.split(\".\");\n if(a.length < 2)\n\t\treturn false;\n var allInt = true;\n for(var i=0; i < a.length; i++)\n {\n if(!isIntStr(a[i]))\n\t\tallInt = false;\n }\n if(allInt)\n {\n\tif(a.length == 4)\n\t\treturn 0; //ip\n\treturn -1;//incorrect ip\n }\n return 1; // domain\n}", "function ipv4ToInt(stringIP) {\n\tvar ipParte = stringIP.split('.');\n\treturn ((((((+ipParte[0]) * 256) + (+ipParte[1])) * 256) + (+ipParte[2])) * 256)\n\t\t\t+ (+ipParte[3]);\n}", "function mask_num(v){\n var prefix='';\n var decimal_pos=v.lastIndexOf('.');\n var sa=v.split('.');\n var s=sa[0].replace(/,/g,'');\n var s1='';\n if(s.charAt(0)=='-') {\n prefix='-';\n s=s.slice(1);\n } \n \n var l=s.length-1;\n for(var j=0;j<=l;j++){\n s1=s.charAt(l-j)+s1;\n if(j<l && j%3==2) s1=','+s1;\n }\n //if(sa[1]) s1+='.'+sa[1];\n if(sa[1] || decimal_pos>0 ) s1+='.'+sa[1];\n if(prefix!='') s1=prefix+s1;\n \n return s1;\n}", "function IPAddress$IPv4ToInt(address) {\n var res = 0;\n // check that the input is a valid IPv4 address\n if (IPAddress$getValidIPv4(address) === address) {\n var parts = address.split('.');\n res += parseInt10(parts[0]) << 24;\n res += parseInt10(parts[1]) << 16;\n res += parseInt10(parts[2]) << 8;\n res += parseInt10(parts[3]);\n return res;\n }\n}", "function convertIPv4StrToInt2(ipv4Str) {\n if (typeof ipv4Str !== \"string\") {\n throw TypeError(\"Illegal arguments, ipv4Str should be a string\");\n }\n\n let ipv4Int = 0,\n base = 1,\n digit,\n digitBase = 1,\n dotsCnt = 0,\n isSpaceAppearBeforeDigit = false,\n char;\n\n for (let i = ipv4Str.length - 1; i >= -1; i--) {\n char = ipv4Str[i];\n\n if (char === '.' || i === -1) { // dot or end\n dotsCnt = i !== -1 ? dotsCnt + 1 : dotsCnt;\n if (dotsCnt > 3 || (i === -1 && dotsCnt !== 3)) {\n throw Error(\"Invalid IPv4 address, it should be formated in A.B.C.D\");\n }\n if (digit === undefined) { // nothing between two dots, such as: 172.1..\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n if (digit >= 256) {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be less than 256\");\n }\n ipv4Int += digit * base;\n base *= 256;\n\n digit = undefined;\n digitBase = 1;\n isSpaceAppearBeforeDigit = false;\n } else if (/\\d/.test(char)) { // digit\n if (isSpaceAppearBeforeDigit) { // spaces between two digits, such as: 172.1.1 2\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n\n digit = parseInt(char) * digitBase + (digit === undefined ? 0 : digit);\n digitBase *= 10;\n } else if (char === ' ') { // space\n if (digit !== undefined) {\n isSpaceAppearBeforeDigit = true;\n }\n\n isSpaceAppear = true;\n } else {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n }\n\n return ipv4Int;\n}", "ipv4() {\n // coercing to int forces validation here\n const ipv4Int = this.toInt();\n if (ipv4Int && ipv4Int !== 0) {\n return this.addr;\n }\n return undefined;\n }", "function getIP(json) {\n var dIP = json.ip;\n IP = dIP.split('.').join('dot');\n}", "function combine_ipaddr(ipaddr_name) {\n\tvar obj;\n\tvar ip = \"\";\n\tfor (i=0;i<4;i++) {\n\t\tobj = get_by_name(ipaddr_name)[i];\n\t\tip += obj.value;\n\t\tif (i<3)\n\t\t\tip += \".\";\n\t}\n\tif (ip == \"...\") \n\t\tip = \"\";\n\treturn ip;\n}", "function isValidIP(objIP) \r\n\t{\r\n\t\tvar strIPtext = objIP.value; \r\n\t\tif ((strIPtext.length == 0) || IsAllSpaces(strIPtext)) \r\n\t\t{ \r\n\t\t\t// IP Empty\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\t\r\n\t\tif ( countChars(strIPtext,\".\") != 3) \r\n\t\t{ \r\n\t\t\t// Invalid Format, number of dots is not 3\r\n\t\t\treturn 2;\r\n\t\t}\r\n\t\tvar arrIP = strIPtext.split(\".\");\r\n\t\t\t\r\n\t\tfor(var i = 0; i < 4; i++)\r\n\t\t{\r\n\t\t\tif ( (arrIP[i].length < 1 ) || (arrIP[i].length > 3 ) )\r\n\t\t\t{\r\n\t\t\t\t// Invalid Format, continuous dots or more than 3 digits given between dots\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tif ( !isInteger(arrIP[i]) )\r\n\t\t\t{\r\n\t\t\t\t// non-integers present in the value\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tarrIP[i] = parseInt(arrIP[i]);\r\n\t\t\t\t\r\n\t\t\tif(i == 0)\r\n\t\t\t{\r\n\t\t\t\t// start IP value\r\n\t\t\t\tif(arrIP[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP value must not be 0\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(arrIP[i] > 223)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be > 223\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\t}\r\n\t\t\t\tif(arrIP[i] == 127)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be 127 - Loopback ip\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// the 2nd, 3rd and 4th IP values between the dots\r\n\t\t\t\t// these must not be more than 255\r\n\t\t\t\tif (arrIP[i] > 255)\r\n\t\t\t\t{\r\n\t\t\t\t\t// IP out of bound\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\tobjIP.value = arrIP.join(\".\");\r\n\t\t\t\r\n\t\tif(objIP.value == \"0.0.0.0\")\r\n\t\t{\r\n\t\t\t// IP all zeros\r\n\t\t\treturn 7;\r\n\t\t}\t\r\n\t\t\t\r\n\t\treturn 0;\r\n\t\t\t\r\n\t}\t// end of isValidIP", "function parseIPv4(addr) {\n if (typeof(addr) !== 'string')\n throw new TypeError('addr (string) is required');\n\n var octets = addr.split(/\\./).map(function (octet) {\n return (parseInt(octet, 10));\n });\n if (octets.length !== 4)\n throw new TypeError('valid IP address required');\n\n var uint32 = ((octets[0] * Math.pow(256, 3)) +\n (octets[1] * Math.pow(256, 2)) +\n (octets[2] * 256) + octets[3]);\n return (uint32);\n}", "function get_ip(ip_port_string) {\n\treturn ip_port_string.split(\":\")[0];\n}", "function argToPortNum(arg)\r\n{\r\n return Number(arg);\r\n}", "function defangIPaddr(address) {\n let result = \"\";\n\n for (let i = 0; i < address.length; i++) {\n if (address[i] === \".\") {\n result += \"[.]\";\n } else {\n result += address[i];\n }\n }\n\n return result;\n}", "function threeDecimalPoints(number){\n var s = number.toString();\n var i;\n for(i = 0;i<s.length;i++){\n if(s[i]=='.'){\n break;\n }\n }\n if(i>=s.length-3){\n for(var j=0;j<i-s.length+3;j++){\n s.concat('0');\n }\n return s;\n }else{\n return s.substring(0,i+4);\n }\n }", "function IPv4_intA_to_binstrA( strnum ) {\r\n\tvar numStr = strnum.toString( 2 ); /* Initialize return value as string */\r\n\tvar numZeros = 32 - numStr.length; /* Calculate no. of zeros */\r\n\tif (numZeros > 0) {\tfor (var i = 1; i <= numZeros; i++) { numStr = \"0\" + numStr }\t} \r\n\treturn numStr;\r\n}", "function normalizeCIDR(s) {\n var parts = s.split(\"/\");\n if (parts.length != 2) {\n return s;\n }\n\n if (parts[1] == \"32\") {\n /* Most of the time (JavaScript spec and hardware lshift instruction)\n * only 5 bits are used in right operand.\n */\n return s;\n }\n\n var mask = parseInt(parts[1]);\n var ip_int = $.su.func.ipToInt(parts[0]);\n var mask_int = ((1 << mask) - 1) << (32 - mask);\n var norm_ip_int = ip_int & mask_int;\n return $.su.func.intToIp(norm_ip_int) + \"/\" + mask;\n}", "function getIntIP (num) {\n //library get ip address from ubuntu\n return require('child_process').execSync(\"ifconfig | grep 'inet' | grep -v inet6 | grep -v 127.0.0.1 | awk '{print $2}'\").toString().trim();\n //other way : install packet NPM IP first\n //let ip = require(\"ip\");\n // eturn ip.address()\n\n}", "function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netaddressBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = addressBinStr.substr( pos, 1 );\r\n\t\tnmBit = netmaskBinStr.substr( pos, 1 );\r\n\t\tif( aBit == nmBit ) {\tnetaddressBinStr += aBit.toString();\t}\r\n\t\telse{\tnetaddressBinStr += '0';\t}\r\n\t}\r\n\treturn netaddressBinStr;\r\n}", "function calculateIPCIDR(ip) {\n /*\n var x = mask.value;\n var re = new RegExp(\"^([0-9]{1,3}\\.){3}[0-9]{1,3}(( ([0-9]{1,3}\\.){3}[0-9]{1,3})|(/[0-9]{1,2}))$\");\n if( !re.test(mask.value) ) {\n var s = \"Use IP & CIDR Netmask: 10.0.0.1/22\";\n s += \"\\nOr IP & Netmask: 10.0.0.1 255.255.252.0\";\n //s += \"\\nOr IP & Wildcard Mask: 10.0.0.1 0.0.3.255\";\n mask.focus();\n mask.select();\n return false;\n }\n */\n\n var ipa = ip.split('/');\n if( ipa.length = 2 ) {\n var a = ipa[0].split('.');\n nAddr[0] = parseInt(a[0]);\n nAddr[1] = parseInt(a[1]);\n nAddr[2] = parseInt(a[2]);\n nAddr[3] = parseInt(a[3]);\n nMask = cidr2octet(ipa[1]);\n } else {\n nAddr = ip.split('.');\n }\n displayInfo();\n}", "function dig(n, d){\n var res = n.toString();\n while(res.length < d)\n res = \"0\" + res;\n return res;\n}", "function format(n) {\n // padStart requires node 8+ or 7.5+ with harmony flag.\n return Number('0.' + String(n).padStart(9, '0'));\n }", "function calNetworkAddress(en1,en2,en3,en4,ss1,ss2,ss3,ss4 ){\r\n\r\n//-----------Network Address Output --------------------------------------\r\n\r\n var netOut = [] ;\r\n\r\n//--------Convert all input Value to Binary-------------------------------\r\n\r\n //-----Enter IP Portion ------\r\n // cen1 = en1.toString(2);\r\n\t\t\t\t // cen2 = en2.toString(2);\r\n\t\t\t\t\t// cen3 = en3.toString(2);\r\n\t\t\t\t\t //cen4 = en4.toString(2);\r\n\t\t\t\t\t//----Subnet IP Portion\r\n\t\t\t\t\t// css1 = ss1.toString(2);\r\n\t\t\t\t\t// css2 = ss2.toString(2);\r\n\t\t\t\t\t// css3 = ss3.toString(2);\r\n\t\t\t\t\t //css4 = ss4.toString(2);\r\n\t\t\t\t\t \r\n\t\t\t\t\t \r\n//--------------'And 'the User Input Value with the Subnet Value Selected to get the Network Address ------------------------------------------------\r\n\t\t\t\t\t \r\n netOut[1] = en1 & ss1 ;\r\n\t\t\t\t netOut[2] = en2 & ss2 ;\r\n\t\t\t\t netOut[3] = en3 & ss3 ;\r\n\t\t\t\t netOut[4] = en4 & ss4 ;\r\n\t\t\t\t \r\n\t\t\t\t \r\n//-----------Convert Binary Value Back to Decimal-----------------------------------------------------------------------------------------------------------\r\n\t\t\t\t \r\n return [netOut[1],netOut[2],netOut[3],netOut[4] ];\t\t\t\t \r\n\r\n}", "function IsLegalIPAddress(ip) { \r\n\tvar re = new RegExp(/^\\d{1,3}(\\.\\d{1,3}){3}$/);\r\n\tvar legal = re.test(ip);\r\n\tvar IPSegment, i;\r\n\r\n\tif(legal) {\r\n\t\tIPSegment = ip.split(\".\");\r\n\t\tfor(i = 0; i < IPSegment.length; i ++) {\r\n\t\t\tif(String(Number(IPSegment[i])) != IPSegment[i] || Number(IPSegment[i]) > 255) {\r\n\t\t\t\tlegal = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn legal;\r\n}", "function subnetAddress(ip, mask) {\n var result = [];\n\n for (i = 0; i < ip.length; i++) {\n var ip_sub_array = [];\n var mask_sub_array = [];\n var pre_result = [];\n\n // Les deux strings deviennent des arrays\n ip_sub_array = ip[i].split(\"\");\n mask_sub_array = mask[i].split(\"\");\n\n for (x = 0; x < ip_sub_array.length; x++) {\n if (ip_sub_array[x] == 1 && mask_sub_array[x] == 1) {\n pre_result.push(1);\n }\n else {\n pre_result.push(0);\n }\n }\n result.push(pre_result.join(\"\"));\n }\n\n return result;\n }", "function _explodeShorthandIPstring(ipStr) {\n\t if (!_isShortHand(ipStr)) {\n\t // We've already got a longhand ipStr\n\t return ipStr\n\t }\n\t\n\t var newIp = []\n\t var hextets = ipStr.split('::')\n\t\n\t // If there is a ::, we need to expand it with zeroes to get to 8 hextets -\n\t // unless there is a dot in the last hextet, meaning we're doing v4-mapping\n\t var fillTo = (ipStr.split(':').pop().indexOf('.') != -1) ? 7 : 8\n\t\n\t if (hextets.length > 1) {\n\t var sep = hextets[0].split(':').length + hextets[1].split(':').length\n\t newIp = hextets[0].split(':')\n\t for (var i = 0, l = fillTo - sep; i < l; i++) {\n\t newIp.push('0000')\n\t }\n\t newIp = newIp.concat(hextets[1].split(':'))\n\t }\n\t else {\n\t newIp = ipStr.split(':')\n\t }\n\t\n\t // Now need to make sure every hextet is 4 lower case characters.\n\t // If a hextet is < 4 characters, we've got missing leading 0's.\n\t var retIp = []\n\t for (i = 0, l = newIp.length; i < l; i++) {\n\t retIp.push(zeroPadding(newIp[i], 4) + newIp[i].toLowerCase())\n\t }\n\t return retIp.join(':')\n\t}", "static calculateNetmask(mask) {\n return NetworkUtils.numToIp(2 ** 32 - 2 ** (32 - mask));\n }", "function ipRangeToString(ipRange) {\n return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start;\n}", "function ipRangeToString(ipRange) {\n return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start;\n}", "function validIP(str) {\n numbers = str.split(\".\");\n if (numbers.length !== 4) return false;\n\n for (let i = 0; i < numbers.length; i++) {\n let number = parseInt(numbers[i]);\n if (number < 0 || number > 255) {\n return false;\n }\n }\n\n return true\n}", "getBroadcastAddress () {\n\t\tlet num, inverse;\n\n\t\tif ((! this.isValid) || (this.netmaskOctets.length != 4)) {\n\t\t\treturn (\"\");\n\t\t}\n\t\tconst addr = [ ];\n\t\tfor (let i = 0; i < 4; ++i) {\n\t\t\tnum = this.octets[i];\n\t\t\tnum &= this.netmaskOctets[i];\n\t\t\tinverse = ~(this.netmaskOctets[i]);\n\t\t\tinverse &= 0xFF;\n\t\t\tinverse >>>= 0;\n\t\t\tnum |= inverse;\n\t\t\tnum >>>= 0;\n\t\t\taddr.push (num);\n\t\t}\n\t\treturn (addr.join (\".\"));\n\t}", "function glslifyNumber (n) {\n return n === (n | 0) ? n + '.0' : n + '';\n }", "function trigger(){\r\n\t_in = document.getElementById(\"subnet\");\r\n\t_ip = document.getElementById(\"ip_addr\")\r\n\t_dbg(\"\");\r\n\t\r\n\tvar subn = new IPv4SubnetUtils();\r\n\tsubn.initialize(_in.value);\r\n\t\t\r\n\tif (subn.is_valid_format() && IPv4SubnetUtils.is_valid_address(_ip.value)){\r\n\t\t\r\n\t\t/*\r\n\t\tvar bin_str = subn.get_binary_addr(false);\r\n\t\tconsole.log(\"Binary address: \"+bin_str);\r\n\t\t\r\n\t\tvar bin_nm = subn.get_binary_netm();\t\t\r\n\t\tconsole.log(\"Binary netmask: \"+bin_nm+\", \"+IPv4Subnet.bin2dot_decimal(bin_nm));\r\n\t\t\r\n\t\tvar bin_broadcast = subn.get_binary_broadcast();\r\n\t\tvar broadcast = subn.get_broadcast();\t\t\r\n\t\tconsole.log(\"Binary broadcast: \"+bin_broadcast+\", Broadcast IP: \" + broadcast );\r\n\t\t\r\n\t\tvar minhost = subn.get_binary_minhost();\r\n\t\tvar maxhost = subn.get_binary_maxhost();\r\n\t\tconsole.log(\"maxhost: \" + maxhost + \", IP: \" + subn.get_maxhost());\r\n\t\tconsole.log(\"minhost: \" + minhost + \", IP: \" + subn.get_minhost());\r\n\t\t*/\r\n\t\tvar isIn = subn.within(_ip.value);\r\n\t\tconsole.log(\"IP in given subnet: \" + isIn.toString());\r\n\t\t\r\n\t}\r\n\t\r\n}", "function ip2long(IP) {\n // discuss at: http://phpjs.org/functions/ip2long/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // improved by: Victor\n // revised by: fearphage (http://http/my.opera.com/fearphage/)\n // revised by: Theriault\n // example 1: ip2long('192.0.34.166');\n // returns 1: 3221234342\n // example 2: ip2long('0.0xABCDEF');\n // returns 2: 11259375\n // example 3: ip2long('255.255.255.256');\n // returns 3: false\n\n var i = 0;\n // PHP allows decimal, octal, and hexadecimal IP components.\n // PHP allows between 1 (e.g. 127) to 4 (e.g 127.0.0.1) components.\n IP = IP.match(\n /^([1-9]\\d*|0[0-7]*|0x[\\da-f]+)(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?$/i\n ); // Verify IP format.\n if (!IP) {\n // Invalid format.\n return false;\n }\n // Reuse IP variable for component counter.\n IP[0] = 0;\n for (i = 1; i < 5; i += 1) {\n IP[0] += !! ((IP[i] || '')\n .length);\n IP[i] = parseInt(IP[i]) || 0;\n }\n // Continue to use IP for overflow values.\n // PHP does not allow any component to overflow.\n IP.push(256, 256, 256, 256);\n // Recalculate overflow of last component supplied to make up for missing components.\n IP[4 + IP[0]] *= Math.pow(256, 4 - IP[0]);\n if (IP[1] >= IP[5] || IP[2] >= IP[6] || IP[3] >= IP[7] || IP[4] >= IP[8]) {\n return false;\n }\n return IP[1] * (IP[0] === 1 || 16777216) + IP[2] * (IP[0] <= 2 || 65536) + IP[3] * (IP[0] <= 3 || 256) + IP[4] * 1;\n}", "function isIPv4Address(inputString) {\n let regex = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\n if (regex.test(inputString)) {\n inputString = inputString.split(\".\");\n for (let i = 0; i < inputString.length; i++) {\n if ((inputString[i] < 0 || inputString[i] > 255)) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n}", "function validIp(str) {\n let terms = str.split(\".\");\n for (let i = 0; i < terms.length; i++) {\n let term = parseInt(terms[i]);\n if (term > 255 || term < 0) {\n return false;\n }\n }\n return true;\n}", "function numSan(num) {\n\t\tnum = parseFloat(num);\n\t\tvar strnum = ''+num;\n\n\t\tif(strnum.indexOf('0000') > -1 || strnum.indexOf('9999') > -1){\n\t\t\tnum = round(num, 6);\n\t\t}\n\n\t\tif(num < 0.0000 && num > 0) num = 0;\n\n\t\treturn num;\n\t}", "function d2b4(integer){\n\t\tif (typeof integer !== \"string\" && integer.toString().length > 15){throw \"integer should be entered as a string for precision\";}\n\t\tvar padding = \"\";\n\t\tfor (i = 0; i < 31; i++){\n\t\t\tpadding += \"0\";\n\t\t}\n\t\tvar a = new JSBigInt(integer);\n\t\tif (a.toString(2).length > 64){throw \"amount overflows uint64!\";}\n\t\treturn swapEndianC((padding + a.toString(4)).slice(-32));\n\t}", "function toFixedPoint(v, d) {\r\n var mask = (1 << d) - 1;\r\n return (v >> d).toString(10) + '.' + (v & mask).toString(10);\r\n}", "function getIPAdress(){ \n var interfaces = require('os').networkInterfaces(); \n for(var devName in interfaces){ \n var iface = interfaces[devName]; \n for(var i=0;i<iface.length;i++){ \n var alias = iface[i]; \n if(alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal){ \n return alias.address; \n } \n } \n } \n}", "function quadruple(n) {\n return n * 4;\n }", "function cutDecimal4(num) {\n num = String(num);\n if (num.indexOf(\".\") !== -1) {\n let numArr = num.split(\".\");\n if (numArr.length == 1) {\n return Number(num);\n } else {\n return Number(\n numArr[0] +\n \".\" +\n numArr[1].charAt(0) +\n numArr[1].charAt(1) +\n numArr[1].charAt(2) +\n numArr[1].charAt(3)\n );\n }\n } else {\n return Number(num);\n }\n}", "static get ipAddress() {}", "function HostIDBits(ip) {\r\n\tvar IPSegment;\r\n\tvar bits = 0;\r\n\r\n\tIPSegment = ip.split(\".\");\r\n\t\r\n\tif(IPSegment[0] == 127) {\r\n\t\treturn -1; // for loopback address\r\n\t} else if(IPSegment[0] >= 224 && IPSegment[0] < 240) {\r\n\t\treturn -2; // for multicast address\r\n\t} else if(IPSegment[0] >= 240) {\r\n\t\treturn -3; // for future use\r\n\t}\r\n\r\n\tif(IPSegment[0] < 127) { // Class A, by the way, 127 is for loopback address\r\n\t\tbits = 24;\r\n\t} else if(IPSegment[0] < 192) { // Class B\r\n\t\tbits = 16;\r\n\t} else if(IPSegment[0] < 224) { // Class C\r\n\t\tbits = 8;\r\n\t} \r\n\r\n\treturn bits;\r\n}", "function ipsBetween(start, end) {\n const arrStart = start.split('.')\n const arrEnd = end.split('.')\n let res = {\n \"0\": 0,\n \"1\": 0,\n \"2\": 0,\n \"3\": 0,\n };\n\n arrStart.forEach((value, i) => {\n if (value !== arrEnd[i]) {\n if (value < arrEnd[i]) {\n for (let j = +value; j < +arrEnd[i]; j++) {\n res[i] += 1\n }\n } else {\n res[i] = \"m \" + value\n }\n }\n })\n\n return Object.entries(res).reduce((acc, curr) => {\n switch (true) {\n case curr[0] === \"0\" && curr[1] !== 0:\n acc += (65536 * 256) * curr[1]\n return acc\n case curr[0] === \"1\" && curr[1] !== 0:\n acc += (256 ** 2) * curr[1]\n return acc\n case curr[0] === \"2\" && curr[1] !== 0:\n acc += (curr[1] * 256)\n return acc\n case curr[0] === \"3\" && curr[1] !== 0:\n if (curr[1][0] === 'm') {\n acc -= +curr[1].split(' ')[1]\n } else {\n acc += curr[1]\n }\n return acc\n }\n return acc;\n }, 0)\n}", "function ipAddressInNanoAccount(account) {\n\n const byteArrayToLong = function (byteArray) {\n let value = 0;\n for (let i = byteArray.length - 1; i >= 0; i--) {\n value = (value * 256) + byteArray[i];\n }\n return value;\n };\n\n const intToIPv4 = function (int) {\n const part1 = int & 255;\n const part2 = ((int >> 8) & 255);\n const part3 = ((int >> 16) & 255);\n const part4 = ((int >> 24) & 255);\n\n return part1 + \".\" + part2 + \".\" + part3 + \".\" + part4;\n }\n\n const byteArrayToIPv6 = function (byteArray) {\n let ipv6 = \"\"\n let i = 0;\n while (byteArray.length > i) {\n ipv6 += ('0' + (byteArray[i] & 0xFF).toString(16)).slice(-2)\n ipv6 += ('0' + (byteArray[i + 1] & 0xFF).toString(16)).slice(-2)\n i += 2\n if (byteArray.length > i) ipv6 += ':'\n }\n const ipv6_compressed = ipv6.replace(/\\b:?(?:0+:?){2,}/g, '::') //compress ipv6\n return ipv6_compressed.toUpperCase()\n }\n\n const publicKeyBytes = parseNanoAddress(account).publicKeyBytes\n const utf8 = new TextDecoder(\"utf-8\").decode(publicKeyBytes)\n if (utf8.substr(-28) == '\\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') {\n const int_ipv4 = byteArrayToLong(publicKeyBytes.slice(0, 4))\n return intToIPv4(int_ipv4)\n } else {\n if (utf8.substr(-16) == '\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0') {\n return byteArrayToIPv6(publicKeyBytes.slice(0, 16))\n } else {\n return \"Invalid IP Address\"\n }\n }\n }", "static isIP(ip){ return F.isIP(ip) }", "static set ipAddress(value) {}", "function _sanitiseIPv4Mapping(ipStr) {\n\t if (ipStr.toLowerCase().indexOf('0000:0000:0000:0000:0000:ffff:') !== 0) {\n\t // Not an ipv4 mapping\n\t return ipStr\n\t }\n\t\n\t var hextets = ipStr.split(':')\n\t\n\t if (hextets[hextets.length - 1].indexOf('.') != -1) {\n\t // Already sanitized\n\t return ipStr\n\t }\n\t\n\t var ipv4Address = [\n\t parseInt(hextets[6].substring(0, 2), 16)\n\t , parseInt(hextets[6].substring(2, 4), 16)\n\t , parseInt(hextets[7].substring(0, 2), 16)\n\t , parseInt(hextets[7].substring(2, 4), 16)\n\t ].join('.')\n\t\n\t return hextets.slice(0, 6).join(':') + ':' + ipv4Address\n\t}", "function isIPv4Address(inputString) {\n const octets = inputString.split('.'); // octets = ['172', '1', '254', '1']\n\n if (octets.length !== 4) return false; // .length = 4\n\n for (let i = 0; i < octets.length; i++) { // i = 0; length = 4\n const octet = octets[i]; // octets[0] = '172'\n if (isNaN(+octet)) return false; // isNaN(172) = false;\n if (+octet < 0 || +octet > 255) return false;\n if (octet.length > 1 && octet[0] === '0') return false;\n if (octet === '') return false;\n }\n\n return true;\n}", "function isIPV4(url)\r\n{\r\n var reg = new RegExp(\"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$\");\r\n return reg.test(url);\r\n}", "function numberWithDots(x) {\n var parts = x.toString().split(\".\");\n // console.log(parts)\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n return parts.join(\".\");\n }", "function getIPAddress() \n{\n var interfaces = require('os').networkInterfaces();\n for (var devName in interfaces) \n {\n var iface = interfaces[devName];\n\n for (var i = 0; i < iface.length; i++) \n {\n var alias = iface[i];\n if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal)\n return alias.address;\n }\n }\n return '0.0.0.0';\n}", "function formDecimalString(scale, sign, hi32, lo64high, lo64low){\n var dec = bn.dec(bn.add(bn.add(bn.shl(bn.n2a(hi32), 8), bn.shl(bn.n2a(lo64high), 4)), bn.n2a(lo64low)));\n if(scale > 0) {\n if (scale < dec.length) {\n dec = dec.slice(0, dec.length - scale) + '.' + dec.slice(-scale);\n } else if (scale > dec.length) {\n dec = \"0.\" + new Array(scale - dec.length + 1).join(\"0\") + dec;\n } else /* scale == dec.length */\n dec = \"0.\" + dec;\n }\n if(sign == 0x80)\n dec = '-' + dec;\n return dec;\n}", "IP() {\n // return \"47.106.171.247\";\n return \"tcjump.anyh5.com\";\n // return \"tcrhythm.anyh5.com\";\n }", "function toHex(n){return (n<16?\"0\":\"\")+n.toString(16);}", "function stringToInt(strIP, theThingToThrow) {\n let octets = strIP.split('.');\n if(octets.length != 4)\n throw new theThingToThrow();\n return arrayToInt(octets, theThingToThrow);\n}", "function bnpFromInt(x) {\n\t this.t = 1\n\t this.s = (x < 0) ? -1 : 0\n\t if (x > 0) this[0] = x\n\t else if (x < -1) this[0] = x + DV\n\t else this.t = 0\n\t}", "function bnpFromInt(x) {\n\t this.t = 1\n\t this.s = (x < 0) ? -1 : 0\n\t if (x > 0) this[0] = x\n\t else if (x < -1) this[0] = x + DV\n\t else this.t = 0\n\t}", "function maskOr(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) | parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) | parseInt(mask.toBin().substr(16,16), 2)));\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function bnpFromInt(x) {\n this.t = 1\n this.s = (x < 0) ? -1 : 0\n if (x > 0) this[0] = x\n else if (x < -1) this[0] = x + DV\n else this.t = 0\n}", "function subnetID(aNet,aMask){\n var a = new Array(0,0,0,0);\n for(var i=0;i<4;i++){\n a[i] = aNet[i] & aMask[i];\n }\n return a;\n}", "function ipIsPrivateV4Address(ip = \"\") {\n // Handle IPv4-mapped IPv6 addresses like ::ffff:192.168.0.1\n if (ip.startsWith(\"::ffff:\")) {\n ip = ip.substr(7); // Strip ::ffff: prefix\n }\n const octets = ip.split(\".\").map(o => parseInt(o, 10));\n return octets[0] === 10 // 10.0.0.0 - 10.255.255.255\n || (octets[0] === 172 && octets[1] >= 16 && octets[1] <= 31) // 172.16.0.0 - 172.31.255.255\n || (octets[0] === 192 && octets[1] === 168) // 192.168.0.0 - 192.168.255.255\n || ip === \"127.0.0.1\";\n}", "function getIPv4(timer) {\n return getIPTypes(timer).then(ips => {\n // Filters the IP by IPv4.\n const ip = ips.filter(ip => ip.IPv4);\n // Loops over each object and extracts the IP.\n for(let i = 0; i < ip.length; i++){\n ip[i] = ip[i].ip\n }\n // Returns undefined if the array is empty.\n return ip ? ip : '';\n });\n}", "function ipCheck(input)\r\n {\r\n\tif (!check(input,\"0123456789.\"))\r\n\t\treturn false;\r\n\t\r\n\tvar temp=0;\r\n\tvar npos=0;\r\n\tfor (var i=0;i<input.length;i++)\r\n\t{\r\n\t\tvar chr = input.charAt(i);\r\n\t\tif ((i==0)&&(chr==\".\"))\r\n\t\t return false;\r\n\t\tif (chr==\".\"){\r\n\t\t if ((npos==0)&&(temp==0)) return false;\r\n\t\t npos++;\r\n temp=0;\r\n if ((i==input.length-1)&&(npos!=3)) return false;\r\n if (i==input.length-1) return false;\r\n\t\t continue;\r\n\t\t}\r\n\t\ttemp +=chr;\r\n\t\tif ((i==input.length-1)&&(temp==0)) return false;\r\n if ((i==input.length-1)&&(npos!=3)) return false;\r\n\t\tif (temp>255)\r\n\t\t return false;\r\n\t}\r\n\treturn true;\r\n }", "function formatNumber(iNum, iDn)\r\n{\r\n\tvar iTmp=\"\";\r\n\tif ( iDn == null )\r\n\t\tiDn = 2;\r\n\tvar strNum =iNum + \"\";\r\n\tstrNum = trim(strNum);\r\n\tif (isNaN(strNum) || strNum.length == 0)\r\n\t{\r\n\t\tfor (i = 0; i < iDn; i++)\r\n\t\t\tiTmp += \"0\"\r\n\t\treturn \"0.\"+iTmp;\r\n\t}\r\n\r\n \tvar ifirst=0;\r\n\tfor(var iN=0;iN<strNum.length-1;iN++)\r\n\t{\r\n\t\tif(strNum.indexOf(\".\")==1)\r\n\t\t\tbreak;\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(strNum.charAt(iN)==\"0\") ifirst+=1;\r\n\t\t\telse break;\r\n\t\t}\r\n\t}\r\n\tstrNum=strNum.substring(ifirst);\r\n\tif(strNum.indexOf(\".\")==0) strNum=\"0\"+strNum;\r\n\tif(strNum.indexOf(\"-.\")==0) strNum=\"-0.\"+strNum.substring(2);\r\n\tvar iDi = strNum.indexOf(\".\",0);\r\n\tif(iDi < 0)\r\n\t{\r\n\t\tif (iDn==0) return strNum; // iDn==0 不保留小数位\r\n\t\tfor (i = 0; i < iDn; i++)\r\n\t\t\tiTmp += \"0\"\r\n\t\tstrNum += \".\"+iTmp;\r\n\t\treturn strNum;\r\n\t}\r\n\tvar iDiLength = strNum.length - (iDi+1);\r\n\tif (iDiLength == iDn)\r\n\t\treturn strNum;\r\n\tif (iDiLength < iDn)\r\n\t{\r\n\t\tfor (var iLoop=iDn; iLoop>iDiLength; iLoop--)\r\n\t\t{\r\n\t\t\tstrNum += '0';\r\n\t\t}\r\n\t\treturn strNum;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tvar iNum1 = parseFloat(strNum);\r\n\t\tiNum1 = (iNum1+(5/Math.pow(10,(iDn+1))))*(Math.pow (10,iDn));\r\n\t\tiNum1 = Math.floor(iNum1);\r\n\t\tiNum1 = iNum1/Math.pow (10,iDn);\r\n\t\tstrNum = new String(iNum1);\r\n\t\tif (iDn==0) return strNum; // iDn==0 不保留小数位\r\n\t\tvar iDi = strNum.indexOf(\".\",0);\r\n\t\tif(iDi < 0)\r\n\t\t{\r\n\t\t\tfor (i = 0; i < iDn; i++)\r\n\t\t\t\tiTmp += \"0\"\r\n\t\t\tstrNum += \".\"+iTmp;\r\n\t\t\treturn strNum;\r\n\t\t}\r\n\t\tvar iDiLength = strNum.length - (iDi+1);\r\n\t\tif (iDiLength == iDn){\r\n\t\t\treturn strNum;}\r\n\t\tif (iDiLength < iDn)\r\n\t\t{\r\n\t\t\tfor (var iLoop=iDn; iLoop>iDiLength; iLoop--)\r\n\t\t\t{\r\n\t\t\t\tstrNum += '0';\r\n\t\t\t}\r\n\t\t\treturn strNum;\r\n\t\t}\r\n\t}\r\n}", "function num(n) {\r\n n = n.toString();\r\n var i = n.indexOf('.');\r\n if (i == -1) {\r\n return n + '.00';\r\n }\r\n i = n.length - i;\r\n if (i == 3)\r\n return n;\r\n \r\n return n + '0';\r\n }", "toString (p = 4) {\n\t\t\treturn this.x.toPrecision (p) + \" \" + ((this.y > 0) ? \"+\" : \"\") + this.y.toPrecision (p) + \"i\";\n\t\t}", "function IPAddress$expandZeros(toExpand) {\n var left = toExpand[0].split(':');\n var right = toExpand[1].split(':');\n\n if (left.length === 1 && left[0] === '') {\n left = [];\n }\n if (right.length === 1 && right[0] === '') {\n right = [];\n }\n\n var gap = 8 - (left.length + right.length);\n\n if (gap < 1) {\n return [];\n }\n\n var i;\n for (i=0; i<gap; i++) {\n left.push('0');\n }\n\n for (i=0; i<right.length; i++) {\n left.push(right[i]);\n }\n\n return left;\n}", "function bitFloor(n){var i=n|0;return n>0||n===i?i:i-1}// Return a coefficient array as a string of base 10 digits.", "function i(n){var t=parseInt(n,16);return[t>>16,t>>8&255,255&t]}" ]
[ "0.66691685", "0.6656301", "0.65467286", "0.6528585", "0.6415432", "0.64053726", "0.63745654", "0.6355883", "0.6326696", "0.62906796", "0.62012213", "0.6025194", "0.60071456", "0.59007293", "0.5771361", "0.56877965", "0.5649471", "0.56186336", "0.55782306", "0.55221874", "0.5517678", "0.5513968", "0.5455765", "0.54408413", "0.5421602", "0.54135484", "0.54115534", "0.53439826", "0.5342063", "0.53295237", "0.53016436", "0.5294824", "0.5264991", "0.52614975", "0.52427435", "0.5181702", "0.5177125", "0.51584256", "0.50917125", "0.50814307", "0.5069397", "0.5048787", "0.502554", "0.5004974", "0.49962303", "0.49848437", "0.4937891", "0.4936366", "0.4924581", "0.4919281", "0.48879918", "0.48879918", "0.48866653", "0.48573604", "0.4855022", "0.4853598", "0.4847836", "0.4829886", "0.4810158", "0.4799285", "0.4796778", "0.478834", "0.47842166", "0.47744122", "0.4772793", "0.47626364", "0.47615403", "0.47582966", "0.47518975", "0.4750777", "0.47332388", "0.47203523", "0.4702195", "0.46929756", "0.46907428", "0.46904013", "0.4685786", "0.46806714", "0.4676978", "0.46749333", "0.4673767", "0.4673767", "0.46695504", "0.46675715", "0.46675715", "0.46675715", "0.46675715", "0.46675715", "0.46675715", "0.46675715", "0.46598387", "0.46378967", "0.46322116", "0.46319407", "0.46283975", "0.4627027", "0.46267763", "0.46229213", "0.46211973", "0.46144053" ]
0.71540564
0
integer IP to binary string representation
function IPv4_intA_to_binstrA( strnum ) { var numStr = strnum.toString( 2 ); /* Initialize return value as string */ var numZeros = 32 - numStr.length; /* Calculate no. of zeros */ if (numZeros > 0) { for (var i = 1; i <= numZeros; i++) { numStr = "0" + numStr } } return numStr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function int2ip(ipInt) {\n return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));\n }", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function int_to_ip(ip) {\n\treturn(format(\"%u.%u.%u.%u\"\n\t\t,(ip>>24)&0xff\n\t\t,(ip>>16)&0xff\n\t\t,(ip>>8)&0xff\n\t\t,ip&0xff\n\t\t));\n}", "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "function long2ip(ip) {\n // discuss at: http://phpjs.org/functions/long2ip/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: long2ip( 3221234342 );\n // returns 1: '192.0.34.166'\n if (!isFinite(ip))\n return false;\n return [ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF].join('.');\n}", "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function intToString(int) {\n var bytes = [\n (int & 0xff),\n ((int >>> 8) & 0xff),\n ((int >>> 16) & 0xff),\n ((int >>> 24) & 0xff)\n ];\n return bytes.map(function (byte) {\n return String.fromCharCode(byte);\n }).join('');\n}", "function intToString(int) {\n var bytes = [\n (int & 0xff),\n ((int >>> 8) & 0xff),\n ((int >>> 16) & 0xff),\n ((int >>> 24) & 0xff)\n ];\n return bytes.map(function (byte) {\n return String.fromCharCode(byte);\n }).join('');\n}", "function intToString(int) {\n return String.fromCharCode(int & 0xff) +\n String.fromCharCode((int >>> 8) & 0xff) +\n String.fromCharCode((int >>> 16) & 0xff) +\n String.fromCharCode((int >>> 24) & 0xff);\n}", "function intToString(val) {\n return (\n String.fromCharCode(val & 0xff) +\n String.fromCharCode((val >> 8) & 0xff) +\n String.fromCharCode((val >> 16) & 0xff) +\n String.fromCharCode((val >> 24) & 0xff)\n )\n}", "function byteString(num) {\nlet s = num.toString(16).toUpperCase();\nreturn (s.length === 1) ? '0' + s : s;\n}", "function toBinStr_old(bits){\n\t\tvar data = '';\n\t\tvar pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\n\t\tbits = pad + bits;\n\t\tfor(var i = 0; i < bits.length; i+= 8){\n\t\t\tdata += String.fromCharCode(parseInt(bits.substr(i,8),2))\n\t\t}\n\t\treturn data;\n\t}", "function toBinary(n) {\r\n return Number(n.toString(2));\r\n}", "function intToBinary(num, length) {\n\tvar ret = num.toString(2);\n\twhile (ret.length < length) {\n\t\tret = '0' + ret;\n\t}\n\treturn ret;\n}", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "function binaryFromString(stringToBinary){\n var binary = \"\";\n for(var i = 0; i < stringToBinary.length; i++){\n binary += binaryFixedSize(stringToBinary.charCodeAt(i), 8);\n }\n return binary;\n}", "function toBinaryStr(val, size) {\n const pad = \"0000000000000000\"; // this will work up to size 16\n let num = val.toString(2);\n return pad.substring(0, size - num.length) + num;\n}", "function byteToCan(v){\n\tvar res = '' + v.toString(16);\n\twhile (res.length < 2) res = '0' + res;\n\treturn res;\n}", "function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netaddressBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = addressBinStr.substr( pos, 1 );\r\n\t\tnmBit = netmaskBinStr.substr( pos, 1 );\r\n\t\tif( aBit == nmBit ) {\tnetaddressBinStr += aBit.toString();\t}\r\n\t\telse{\tnetaddressBinStr += '0';\t}\r\n\t}\r\n\treturn netaddressBinStr;\r\n}", "function bytesToBinary(bytes) {\n\t return bytes.map(function(x) {\n\t return lpad(x.toString(2), '0', 8)\n\t }).join('');\n\t}", "function convertToBinary(n) {\n return Number(n).toString(2);\n}", "function toBinStr_old(bits) {\n var data = '';\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\n bits = pad + bits;\n for (var i = 0; i < bits.length; i += 8) {\n data += String.fromCharCode(parseInt(bits.substr(i, 8), 2))\n }\n return data;\n }", "function h$jsstringHexIPadded8(n) {\n ;\n if(n === 0) return '00000000';\n var pad = (n>=0x10000000)?'':\n (n>=0x1000000)?'0':\n (n>=0x100000)?'00':\n (n>=0x10000)?'000':\n (n>=0x1000)?'0000':\n (n>=0x100)?'00000':\n (n>=0x10)?'000000':\n '0000000';\n return pad+n.toString(16);\n}", "function h$jsstringHexIPadded8(n) {\n ;\n if(n === 0) return '00000000';\n var pad = (n>=0x10000000)?'':\n (n>=0x1000000)?'0':\n (n>=0x100000)?'00':\n (n>=0x10000)?'000':\n (n>=0x1000)?'0000':\n (n>=0x100)?'00000':\n (n>=0x10)?'000000':\n '0000000';\n return pad+n.toString(16);\n}", "function h$jsstringHexIPadded8(n) {\n ;\n if(n === 0) return '00000000';\n var pad = (n>=0x10000000)?'':\n (n>=0x1000000)?'0':\n (n>=0x100000)?'00':\n (n>=0x10000)?'000':\n (n>=0x1000)?'0000':\n (n>=0x100)?'00000':\n (n>=0x10)?'000000':\n '0000000';\n return pad+n.toString(16);\n}", "function h$jsstringHexIPadded8(n) {\n ;\n if(n === 0) return '00000000';\n var pad = (n>=0x10000000)?'':\n (n>=0x1000000)?'0':\n (n>=0x100000)?'00':\n (n>=0x10000)?'000':\n (n>=0x1000)?'0000':\n (n>=0x100)?'00000':\n (n>=0x10)?'000000':\n '0000000';\n return pad+n.toString(16);\n}", "function h$jsstringHexIPadded8(n) {\n ;\n if(n === 0) return '00000000';\n var pad = (n>=0x10000000)?'':\n (n>=0x1000000)?'0':\n (n>=0x100000)?'00':\n (n>=0x10000)?'000':\n (n>=0x1000)?'0000':\n (n>=0x100)?'00000':\n (n>=0x10)?'000000':\n '0000000';\n return pad+n.toString(16);\n}", "function bytesToBinary(bytes) {\r\n return bytes.map(function(x) {\r\n return lpad(x.toString(2), '0', 8)\r\n }).join('');\r\n}", "function toBinaryString(num, length){\n let str = num.toString(2);\n while(str.length < length) str = '0' + str;\n return str;\n}", "function toBinaryString(number) {\n let binary = [];\n\n if (!number) return '0';\n\n for (let i = number; i > 0; i = Math.floor(i / 2)) {\n binary.unshift(i % 2);\n }\n\n return binary.join('');\n}", "function bytesToBinary(bytes) {\n return bytes.map(function(x) {\n return lpad(x.toString(2), '0', 8)\n }).join('');\n}", "function toBinaryString(number) {\n if (number === 0) {\n return \"0\";\n }\n let result = [];\n while (number > 0) {\n result.unshift(number % 2);\n number = Math.floor(number / 2);\n }\n return result.join(\"\");\n}", "function get64binary(int) {\n if (int>=0)\n return int\n .toString(2)\n .padStart(36, \"0\");\n // else\n return (-int-1)\n .toString(2)\n .replace(/[01]/g, function(d){return +!+d;}) // hehe: inverts each char\n .padStart(36, \"1\");\n}", "function writeInt(number) {\n do {\n encoded += URL64Code[(number & 0x1f) | (number > 0x1f ? 0x20 : 0)];\n number >>= 5;\n } while (number > 0);\n }", "function HostIDBits(ip) {\r\n\tvar IPSegment;\r\n\tvar bits = 0;\r\n\r\n\tIPSegment = ip.split(\".\");\r\n\t\r\n\tif(IPSegment[0] == 127) {\r\n\t\treturn -1; // for loopback address\r\n\t} else if(IPSegment[0] >= 224 && IPSegment[0] < 240) {\r\n\t\treturn -2; // for multicast address\r\n\t} else if(IPSegment[0] >= 240) {\r\n\t\treturn -3; // for future use\r\n\t}\r\n\r\n\tif(IPSegment[0] < 127) { // Class A, by the way, 127 is for loopback address\r\n\t\tbits = 24;\r\n\t} else if(IPSegment[0] < 192) { // Class B\r\n\t\tbits = 16;\r\n\t} else if(IPSegment[0] < 224) { // Class C\r\n\t\tbits = 8;\r\n\t} \r\n\r\n\treturn bits;\r\n}", "function toBinary(msg) {\n let binaryMsg = \"\";\n for (let i = 0; i < msg.length; ++i) {\n let asciiBin = msg[i].charCodeAt(0).toString(2)\n while (asciiBin.length < 7) {\n asciiBin = `0${asciiBin}`;\n }\n binaryMsg += asciiBin;\n }\n return binaryMsg;\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function binaryAgent(str) {\n var newBin = str.split(\" \");\n var binCode = [];\n\n for (var i = 0; i < newBin.length; i++) {\n binCode.push(String.fromCharCode(parseInt(newBin[i], 2)));\n }\n return binCode.join(\"\");\n}", "function _bnToBytes(b) {\n\t // prepend 0x00 if first byte >= 0x80\n\t var hex = b.toString(16);\n\t if(hex[0] >= '8') {\n\t hex = '00' + hex;\n\t }\n\t var bytes = forge.util.hexToBytes(hex);\n\n\t // ensure integer is minimally-encoded\n\t if(bytes.length > 1 &&\n\t // leading 0x00 for positive integer\n\t ((bytes.charCodeAt(0) === 0 &&\n\t (bytes.charCodeAt(1) & 0x80) === 0) ||\n\t // leading 0xFF for negative integer\n\t (bytes.charCodeAt(0) === 0xFF &&\n\t (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n\t return bytes.substr(1);\n\t }\n\t return bytes;\n\t}", "function bnToString(b) {\n var self = this;\n if (self.s < 0) return \"-\" + self.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return self.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = self.t;\n var p = self.DB - i * self.DB % k;\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & (1 << p) - 1) << k - p;\n d |= self[--i] >> (p += self.DB - k);\n } else {\n d = self[i] >> (p -= k) & km;\n if (p <= 0) {\n p += self.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function bnToString(b)\n{\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0)\n {\n if (p < this.DB && (d = this[i] >> p) > 0)\n {\n m = true;\n r = int2char(d);\n }\n while (i >= 0)\n {\n if (p < k)\n {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else\n {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0)\n {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function binaryAgent(str) {\n //seperate binary code for conversion\n biString = str.split(\" \");\n //empty array to push converted binary\n uniString = [];\n //loop through our split binary code\n for(i = 0; i < biString.length; i++) {\n //convert to decimal with parseInt\n uniString.push(String.fromCharCode(parseInt(biString[i],2)));\n }\n //rejoin and return our converted binary\n return uniString.join('');\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function writeToBinaryString (number, strLength) {\n\tvar binary = number.toString(2),\n\t\tstrLeftOvers = new Array(Math.max(strLength, binary.length) - binary.length).join('0');\n\t\treturn strLeftOvers + binary;\n}", "function IPv4_bitsNM_to_binstrNM( bitsNM ) {\r\n\tvar bitString = '';\r\n\tvar numberOfOnes = bitsNM;\r\n\twhile( numberOfOnes-- ) bitString += '1'; /* fill in ones */\r\n\tnumberOfZeros = 32 - bitsNM;\r\n\twhile( numberOfZeros-- ) bitString += '0'; /* pad remaining with zeros */\r\n\treturn bitString;\r\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function binaryRepresentation(num) {\n // if (num === 0) { // if num is === 0\n // return '';\n // }\n\n // if (isNaN(num / num)) {\n // return 0; // if the number is zero \n // }\n\n if (num > 0) {\n let binary = Math.floor(num % 2); // binary string\n\n return binaryRepresentation(Math.floor(num / 2)) + binary;// return binary\n }\n\n return '';\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function encodeMBI(number) {\n var output = new Array(1);\n var numBytes = 0;\n\n do {\n var digit = number % 128;\n number = number >> 7;\n if (number > 0) {\n digit |= 0x80;\n }\n output[numBytes++] = digit;\n } while ( (number > 0) && (numBytes<4) );\n\n return output;\n}", "function bnToString(b) {\n\tif(this.s < 0) return \"-\"+this.negate().toString(b);\n\tvar k;\n\tif(b == 16) k = 4;\n\telse if(b == 8) k = 3;\n\telse if(b == 2) k = 1;\n\telse if(b == 32) k = 5;\n\telse if(b == 4) k = 2;\n\telse return this.toRadix(b);\n\tvar km = (1<<k)-1, d, m = false, r = [], i = this.t;\n\tvar p = this.DB-(i*this.DB)%k;\n\tif(i-- > 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r.push(int2char(d)); }\n\t while(i >= 0) {\n\t\tif(p < k) {\n\t\t d = (this[i]&((1<<p)-1))<<(k-p);\n\t\t d |= this[--i]>>(p+=this.DB-k);\n\t\t}\n\t\telse {\n\t\t d = (this[i]>>(p-=k))&km;\n\t\t if(p <= 0) { p += this.DB; --i; }\n\t\t}\n\t\tif(d > 0) m = true;\n\t\tif(m) r.push(int2char(d));\n\t }\n\t}\n\treturn m?r.join(\"\"):\"0\";\n }", "function binary(array, idx) {\n var value = array[idx]; // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n\n if (typeof value !== 'number') return '????????'; // We prefix 0s so that we have constant length number\n\n var text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n }", "function encodeMBI(number) {\n var output = new Array(1);\n var numBytes = 0;\n\n do {\n var digit = number % 128;\n number = number >> 7;\n if (number > 0) {\n digit |= 0x80;\n }\n output[numBytes++] = digit;\n } while ( (number > 0) && (numBytes<4) );\n\n return output;\n }", "function encodeMBI(number) {\n var output = new Array(1);\n var numBytes = 0;\n\n do {\n var digit = number % 128;\n number = number >> 7;\n if (number > 0) {\n digit |= 0x80;\n }\n output[numBytes++] = digit;\n } while ((number > 0) && (numBytes < 4));\n\n return output;\n }", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function _bnToBytes(b) {\n // prepend 0x00 if first byte >= 0x80\n var hex = b.toString(16);\n if(hex[0] >= '8') {\n hex = '00' + hex;\n }\n var bytes = forge.util.hexToBytes(hex);\n\n // ensure integer is minimally-encoded\n if(bytes.length > 1 &&\n // leading 0x00 for positive integer\n ((bytes.charCodeAt(0) === 0 &&\n (bytes.charCodeAt(1) & 0x80) === 0) ||\n // leading 0xFF for negative integer\n (bytes.charCodeAt(0) === 0xFF &&\n (bytes.charCodeAt(1) & 0x80) === 0x80))) {\n return bytes.substr(1);\n }\n return bytes;\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) { m = true;\n r = int2char(d); }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) { p += this.DB;--i; }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function fixIP(ip) {\r\n\tlet a = ip.split('/');\r\n\tlet parts = a[0].split('.');\r\n\twhile (parts.length < 4) parts.push('0');\r\n\treturn parts.join('.') + (a[1] ? '/' + a[1] : '');\r\n}", "function toBinaryString(number) {\n var res = \"\";\n\n do {\n var remainder = number % 2;\n res += remainder;\n number = Math.floor(number / 2);\n } while (number !== 0)\n \n return reverseStr(res);\n}", "ipToId(ip){\n return bdPlayer.checkIp(ip);\n }", "function binb2rstr(input){\r\n var output='';\r\n for(var i=0;i<input.length*32;i +=8) output +=String.fromCharCode((input[i>>5] >>> (24-i%32)) & 0xFF);\r\n return output;\r\n}", "function IPv4_Calc_netbcastBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netbcastBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = parseInt( addressBinStr.substr( pos, 1 ));\r\n\t\tnmBit = parseInt( netmaskBinStr.substr( pos, 1 ));\r\n\t\t\r\n\t\tif( nmBit ) {\tnmBit = 0;\t}\t/* flip netmask bits */\r\n\t\telse{\tnmBit = 1;\t}\r\n\t\t\r\n\t\tif( aBit || nmBit ) {\tnetbcastBinStr += '1'\t}\r\n\t\telse{\tnetbcastBinStr += '0';\t}\r\n\t}\r\n\treturn netbcastBinStr;\r\n}", "function binb2rstr(input)\n{\n var output = \"\";\n for(var i = 0; i < input.length * 32; i += 8)\n output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);\n return output;\n}", "function bnToString(b) {\n if (this.s < 0) return '-' + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = '',\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : '0';\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function encodeMBI(number) {\r\n\t\tvar output = new Array(1);\r\n\t\tvar numBytes = 0;\r\n\r\n\t\tdo {\r\n\t\t\tvar digit = number % 128;\r\n\t\t\tnumber = number >> 7;\r\n\t\t\tif (number > 0) {\r\n\t\t\t\tdigit |= 0x80;\r\n\t\t\t}\r\n\t\t\toutput[numBytes++] = digit;\r\n\t\t} while ( (number > 0) && (numBytes<4) );\r\n\r\n\t\treturn output;\r\n\t}", "function convertToBinary(addressArr){\n //console.log(\"here\");\n addressArr.forEach(function(element){\n temp = parseInt(element, 10);\n //console.log(\"temp is \" + temp);\n if(temp == 0){\n bin = \"00000000\";\n }else{\n while(temp > 0){\n if(temp >= binaryCheck[idx]){\n temp = temp - binaryCheck[idx];\n bin += \"1\";\n }else{\n bin += \"0\";\n }\n idx++;\n }\n for(var i = idx;i < 8;i++){\n bin += \"0\";\n }\n idx = 0;\n }\n //console.log(bin);\n binAddress += bin + \".\";\n bin = \"\";\n temp = 0;\n });\n\n return binAddress.substring(0, binAddress.length - 1);\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 256) k = 8; // byte array /** MODIFIED **/\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = (k==8)?String.fromCharCode(d):int2char(d); } /** MODIFIED **/\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += (k==8)?String.fromCharCode(d):int2char(d); /** MODIFIED **/\n }\n }\n return m?r:\"0\";\n}", "function getIntIP (num) {\n //library get ip address from ubuntu\n return require('child_process').execSync(\"ifconfig | grep 'inet' | grep -v inet6 | grep -v 127.0.0.1 | awk '{print $2}'\").toString().trim();\n //other way : install packet NPM IP first\n //let ip = require(\"ip\");\n // eturn ip.address()\n\n}", "function createBinaryString (nMask, size) {\n\n\tsize = typeof size !== 'undefined' ? size : 32;\n\n\tfor (var nFlag = 0, nShifted = nMask, sMask = \"\"; nFlag < 32;\n\t\tnFlag++, sMask += String(nShifted >>> 31), nShifted <<= 1);\n\tconsole.log(sMask);\n\tsMask = sMask.slice(32-size,32);\n\tconsole.log(sMask);\n\treturn sMask;\n}", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this.DB-(i*this.DB)%k;\n\t if(i-- > 0) {\n\t if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this.data[i]&((1<<p)-1))<<(k-p);\n\t d |= this.data[--i]>>(p+=this.DB-k);\n\t } else {\n\t d = (this.data[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t}", "function bnToString(b) {\n\t var self = this\n\t if (self.s < 0) return \"-\" + self.negate()\n\t .toString(b)\n\t var k\n\t if (b == 16) k = 4\n\t else if (b == 8) k = 3\n\t else if (b == 2) k = 1\n\t else if (b == 32) k = 5\n\t else if (b == 4) k = 2\n\t else return self.toRadix(b)\n\t var km = (1 << k) - 1,\n\t d, m = false,\n\t r = \"\",\n\t i = self.t\n\t var p = self.DB - (i * self.DB) % k\n\t if (i-- > 0) {\n\t if (p < self.DB && (d = self[i] >> p) > 0) {\n\t m = true\n\t r = int2char(d)\n\t }\n\t while (i >= 0) {\n\t if (p < k) {\n\t d = (self[i] & ((1 << p) - 1)) << (k - p)\n\t d |= self[--i] >> (p += self.DB - k)\n\t } else {\n\t d = (self[i] >> (p -= k)) & km\n\t if (p <= 0) {\n\t p += self.DB\n\t --i\n\t }\n\t }\n\t if (d > 0) m = true\n\t if (m) r += int2char(d)\n\t }\n\t }\n\t return m ? r : \"0\"\n\t}", "function bnToString(b) {\n\t var self = this\n\t if (self.s < 0) return \"-\" + self.negate()\n\t .toString(b)\n\t var k\n\t if (b == 16) k = 4\n\t else if (b == 8) k = 3\n\t else if (b == 2) k = 1\n\t else if (b == 32) k = 5\n\t else if (b == 4) k = 2\n\t else return self.toRadix(b)\n\t var km = (1 << k) - 1,\n\t d, m = false,\n\t r = \"\",\n\t i = self.t\n\t var p = self.DB - (i * self.DB) % k\n\t if (i-- > 0) {\n\t if (p < self.DB && (d = self[i] >> p) > 0) {\n\t m = true\n\t r = int2char(d)\n\t }\n\t while (i >= 0) {\n\t if (p < k) {\n\t d = (self[i] & ((1 << p) - 1)) << (k - p)\n\t d |= self[--i] >> (p += self.DB - k)\n\t } else {\n\t d = (self[i] >> (p -= k)) & km\n\t if (p <= 0) {\n\t p += self.DB\n\t --i\n\t }\n\t }\n\t if (d > 0) m = true\n\t if (m) r += int2char(d)\n\t }\n\t }\n\t return m ? r : \"0\"\n\t}", "function GetBinary(text)\n\t{\n\t\tvar output = \"\";\n\t\tfor (var i = 0 ; i < text.length; i++)\n\t\t{\n\t\t\tvar charCode = text.charCodeAt(i);\n\t\t\toutput += charCode.toString(2) + \" \";\n\t\t}\n\t\treturn output;\n\t}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }" ]
[ "0.720971", "0.6954008", "0.6925673", "0.6919331", "0.6758537", "0.67022055", "0.6317694", "0.61956024", "0.6191963", "0.61403567", "0.607433", "0.58968896", "0.58968896", "0.58130854", "0.57628435", "0.5753533", "0.5681489", "0.56513435", "0.5624836", "0.560719", "0.558211", "0.55704314", "0.5553814", "0.55525935", "0.5542576", "0.55379885", "0.55324024", "0.55283886", "0.55283886", "0.55283886", "0.5523203", "0.5523203", "0.5521232", "0.55199933", "0.55138105", "0.55048656", "0.54920745", "0.5485077", "0.54704815", "0.5458427", "0.5448697", "0.5430047", "0.5430047", "0.5430047", "0.54287136", "0.54274", "0.54195905", "0.5412105", "0.5411605", "0.5411001", "0.5411001", "0.5411001", "0.5411001", "0.5411001", "0.5411001", "0.5411001", "0.54008573", "0.5398581", "0.5394889", "0.5386271", "0.5386271", "0.5386271", "0.5386271", "0.5386271", "0.5386271", "0.5386271", "0.53819656", "0.5380905", "0.5380905", "0.538023", "0.5372055", "0.53718716", "0.53718704", "0.53664595", "0.53657323", "0.53657323", "0.53657323", "0.53657323", "0.53657323", "0.53657323", "0.535884", "0.5357623", "0.53565365", "0.53554505", "0.53546166", "0.5351837", "0.5350616", "0.5349541", "0.5346824", "0.5346087", "0.5343733", "0.5325532", "0.53248286", "0.5323596", "0.532257", "0.53187186", "0.53187186", "0.5311185", "0.53099203", "0.53099203" ]
0.60560924
11
binary string IP to integer representation
function IPv4_binstrA_to_intA( binstr ) { return parseInt( binstr, 2 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "function ipv4ToInt(stringIP) {\n\tvar ipParte = stringIP.split('.');\n\treturn ((((((+ipParte[0]) * 256) + (+ipParte[1])) * 256) + (+ipParte[2])) * 256)\n\t\t\t+ (+ipParte[3]);\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "function int_to_ip(ip) {\n\treturn(format(\"%u.%u.%u.%u\"\n\t\t,(ip>>24)&0xff\n\t\t,(ip>>16)&0xff\n\t\t,(ip>>8)&0xff\n\t\t,ip&0xff\n\t\t));\n}", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function int2ip(ipInt) {\n return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));\n }", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "function BinaryConverter(str) { \n return parseInt(str, 2);\n}", "function convertToInteger(str) {\n var binaryNum = parseInt(str, 2);\n return binaryNum;\n}", "function IPv4_dotquadA_to_intA( strbits ) {\r\n\tvar split = strbits.split( '.', 4 );\r\n\tvar myInt = (\r\n\t\tparseFloat( split[0] * 16777216 )\t/* 2^24 */\r\n\t + parseFloat( split[1] * 65536 )\t\t/* 2^16 */\r\n\t + parseFloat( split[2] * 256 )\t\t/* 2^8 */\r\n\t + parseFloat( split[3] )\r\n\t);\r\n\treturn myInt;\r\n}", "function stringToInt(strIP, theThingToThrow) {\n let octets = strIP.split('.');\n if(octets.length != 4)\n throw new theThingToThrow();\n return arrayToInt(octets, theThingToThrow);\n}", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "function convertToInteger(str) {\n //pass 2 so the computer knows it is a binary number\n return parseInt(str, 2);\n}", "function convertIPv4StrToInt2(ipv4Str) {\n if (typeof ipv4Str !== \"string\") {\n throw TypeError(\"Illegal arguments, ipv4Str should be a string\");\n }\n\n let ipv4Int = 0,\n base = 1,\n digit,\n digitBase = 1,\n dotsCnt = 0,\n isSpaceAppearBeforeDigit = false,\n char;\n\n for (let i = ipv4Str.length - 1; i >= -1; i--) {\n char = ipv4Str[i];\n\n if (char === '.' || i === -1) { // dot or end\n dotsCnt = i !== -1 ? dotsCnt + 1 : dotsCnt;\n if (dotsCnt > 3 || (i === -1 && dotsCnt !== 3)) {\n throw Error(\"Invalid IPv4 address, it should be formated in A.B.C.D\");\n }\n if (digit === undefined) { // nothing between two dots, such as: 172.1..\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n if (digit >= 256) {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be less than 256\");\n }\n ipv4Int += digit * base;\n base *= 256;\n\n digit = undefined;\n digitBase = 1;\n isSpaceAppearBeforeDigit = false;\n } else if (/\\d/.test(char)) { // digit\n if (isSpaceAppearBeforeDigit) { // spaces between two digits, such as: 172.1.1 2\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n\n digit = parseInt(char) * digitBase + (digit === undefined ? 0 : digit);\n digitBase *= 10;\n } else if (char === ' ') { // space\n if (digit !== undefined) {\n isSpaceAppearBeforeDigit = true;\n }\n\n isSpaceAppear = true;\n } else {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n }\n\n return ipv4Int;\n}", "function IPAddress$IPv4ToInt(address) {\n var res = 0;\n // check that the input is a valid IPv4 address\n if (IPAddress$getValidIPv4(address) === address) {\n var parts = address.split('.');\n res += parseInt10(parts[0]) << 24;\n res += parseInt10(parts[1]) << 16;\n res += parseInt10(parts[2]) << 8;\n res += parseInt10(parts[3]);\n return res;\n }\n}", "function binaryToInteger(binary) {\n var bits = [128,64,32,16,8,4,2,1];\n var result = 0;\n\n binary = binary.split(\"\");\n\n for (x = 0; x < binary.length; x++) {\n if (binary[x] == 1) {\n result += bits[x];\n }\n }\n\n return result.toString();\n }", "function ba2int(x) {\n assert(x.length <= 8, 'Cannot convert bytearray larger than 8 bytes');\n var retval = 0;\n for (var i = 0; i < x.length; i++) {\n retval |= x[x.length - 1 - i] << 8 * i;\n }\n return retval;\n}", "function long2ip(ip) {\n // discuss at: http://phpjs.org/functions/long2ip/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // example 1: long2ip( 3221234342 );\n // returns 1: '192.0.34.166'\n if (!isFinite(ip))\n return false;\n return [ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF].join('.');\n}", "function binaryAgent(str) {\n //seperate binary code for conversion\n biString = str.split(\" \");\n //empty array to push converted binary\n uniString = [];\n //loop through our split binary code\n for(i = 0; i < biString.length; i++) {\n //convert to decimal with parseInt\n uniString.push(String.fromCharCode(parseInt(biString[i],2)));\n }\n //rejoin and return our converted binary\n return uniString.join('');\n}", "function IPv4_intA_to_binstrA( strnum ) {\r\n\tvar numStr = strnum.toString( 2 ); /* Initialize return value as string */\r\n\tvar numZeros = 32 - numStr.length; /* Calculate no. of zeros */\r\n\tif (numZeros > 0) {\tfor (var i = 1; i <= numZeros; i++) { numStr = \"0\" + numStr }\t} \r\n\treturn numStr;\r\n}", "function convertToInteger(str) {\n\n\n return parseInt(str, 2); // radix 2 -> binary base 2\n}", "function binaryAgent(str) {\n return String.fromCharCode(...str.split(\" \").map(x => parseInt(x, 2)));\n}", "ipToId(ip){\n return bdPlayer.checkIp(ip);\n }", "function ip2long(IP) {\n // discuss at: http://phpjs.org/functions/ip2long/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // improved by: Victor\n // revised by: fearphage (http://http/my.opera.com/fearphage/)\n // revised by: Theriault\n // example 1: ip2long('192.0.34.166');\n // returns 1: 3221234342\n // example 2: ip2long('0.0xABCDEF');\n // returns 2: 11259375\n // example 3: ip2long('255.255.255.256');\n // returns 3: false\n\n var i = 0;\n // PHP allows decimal, octal, and hexadecimal IP components.\n // PHP allows between 1 (e.g. 127) to 4 (e.g 127.0.0.1) components.\n IP = IP.match(\n /^([1-9]\\d*|0[0-7]*|0x[\\da-f]+)(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?$/i\n ); // Verify IP format.\n if (!IP) {\n // Invalid format.\n return false;\n }\n // Reuse IP variable for component counter.\n IP[0] = 0;\n for (i = 1; i < 5; i += 1) {\n IP[0] += !! ((IP[i] || '')\n .length);\n IP[i] = parseInt(IP[i]) || 0;\n }\n // Continue to use IP for overflow values.\n // PHP does not allow any component to overflow.\n IP.push(256, 256, 256, 256);\n // Recalculate overflow of last component supplied to make up for missing components.\n IP[4 + IP[0]] *= Math.pow(256, 4 - IP[0]);\n if (IP[1] >= IP[5] || IP[2] >= IP[6] || IP[3] >= IP[7] || IP[4] >= IP[8]) {\n return false;\n }\n return IP[1] * (IP[0] === 1 || 16777216) + IP[2] * (IP[0] <= 2 || 65536) + IP[3] * (IP[0] <= 3 || 256) + IP[4] * 1;\n}", "function parseIPv4(addr) {\n if (typeof(addr) !== 'string')\n throw new TypeError('addr (string) is required');\n\n var octets = addr.split(/\\./).map(function (octet) {\n return (parseInt(octet, 10));\n });\n if (octets.length !== 4)\n throw new TypeError('valid IP address required');\n\n var uint32 = ((octets[0] * Math.pow(256, 3)) +\n (octets[1] * Math.pow(256, 2)) +\n (octets[2] * 256) + octets[3]);\n return (uint32);\n}", "function convertIpToDecimal(ip) {\n // a not-perfect regex for checking a valid ip address\n\t// It checks for (1) 4 numbers between 0 and 3 digits each separated by dots (IPv4)\n\t// or (2) 6 numbers between 0 and 3 digits each separated by dots (IPv6)\n\tvar ipAddressRegEx = /^(\\d{0,3}\\.){3}.(\\d{0,3})$|^(\\d{0,3}\\.){5}.(\\d{0,3})$/;\n\tvar valid = ipAddressRegEx.test(ip);\n\tif (!valid) {\n\t\treturn false;\n\t}\n\tvar dots = ip.split('.');\n\t// make sure each value is between 0 and 255\n\tfor (var i = 0; i < dots.length; i++) {\n\t\tvar dot = dots[i];\n\t\tif (dot > 255 || dot < 0) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (dots.length == 4) {\n\t\t// IPv4\n\t\treturn ((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3]);\n\t} else if \n (dots.length == 6) {\n\t\t// IPv6\n\t\treturn ((((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3])*256)+(+dots[4])*256)+(+dots[5]);\n\t}\n\treturn false;\n}", "function getIntIP (num) {\n //library get ip address from ubuntu\n return require('child_process').execSync(\"ifconfig | grep 'inet' | grep -v inet6 | grep -v 127.0.0.1 | awk '{print $2}'\").toString().trim();\n //other way : install packet NPM IP first\n //let ip = require(\"ip\");\n // eturn ip.address()\n\n}", "function bin_to_dec(bstr) { \n return parseInt(bstr, 2);\n }", "function hexstr2int(str)\n{\n\tvar i = 0;\n\tif (is_hexdigit(str)==true) i = parseInt(str, [16]);\n\treturn i;\n}", "function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netaddressBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = addressBinStr.substr( pos, 1 );\r\n\t\tnmBit = netmaskBinStr.substr( pos, 1 );\r\n\t\tif( aBit == nmBit ) {\tnetaddressBinStr += aBit.toString();\t}\r\n\t\telse{\tnetaddressBinStr += '0';\t}\r\n\t}\r\n\treturn netaddressBinStr;\r\n}", "function binaryAgent(str) {\n var newBin = str.split(\" \");\n var binCode = [];\n\n for (var i = 0; i < newBin.length; i++) {\n binCode.push(String.fromCharCode(parseInt(newBin[i], 2)));\n }\n return binCode.join(\"\");\n}", "function textToNumberBinary(str) {\n const numberText = str.split(' ').map(item => item.toLowerCase());\n const toNumber = numberText\n .filter(num => num === 'one' || num === 'zero')\n .map(num => num === 'one' ? 1 : 0)\n const modulo = toNumber.length % 8\n return modulo < toNumber.length ? toNumber.slice(0, toNumber.length - modulo).join('') : ''\n}", "function arrayToInt(arrIP, theThingToThrow) {\n let octets = arrIP.map((octet) => {\n if(typeof octet === 'string') {\n octet = octet.trim();\n if(!onlyDigits(octet))\n throw new theThingToThrow();\n octet = parseInt(octet);\n }\n else if(typeof octet === 'number')\n octet = parseInt(octet, 10);\n else\n throw new theThingToThrow();\n if(octet > 255)\n throw new theThingToThrow();\n return octet; \n });\n return octets[0] * factor24 + octets[1] * factor16 + octets[2] * factor8 + octets[3];\n}", "function fromBinary(input){\n // We assume input is 8 digits long\n var result = 0;\n for ( i = 0 ; i < 8 ; i += 1 ){\n if ((input[i]) !== \"0\") result = result + Math.pow(2, 7 - i);\n }\n console.log(result);\n return result;\n }", "function getipaddress(theip){\n theip = theip.split(\":\");\n return theip[3];\n}", "function binaryAgent(str) {\n var binaries = str.split(' ');\n\n return binaries.map(function(binary) {\n var decimal = parseInt(binary, 2);\n var char = String.fromCharCode(decimal);\n\n return char;\n }).join('');\n}", "function HostIDBits(ip) {\r\n\tvar IPSegment;\r\n\tvar bits = 0;\r\n\r\n\tIPSegment = ip.split(\".\");\r\n\t\r\n\tif(IPSegment[0] == 127) {\r\n\t\treturn -1; // for loopback address\r\n\t} else if(IPSegment[0] >= 224 && IPSegment[0] < 240) {\r\n\t\treturn -2; // for multicast address\r\n\t} else if(IPSegment[0] >= 240) {\r\n\t\treturn -3; // for future use\r\n\t}\r\n\r\n\tif(IPSegment[0] < 127) { // Class A, by the way, 127 is for loopback address\r\n\t\tbits = 24;\r\n\t} else if(IPSegment[0] < 192) { // Class B\r\n\t\tbits = 16;\r\n\t} else if(IPSegment[0] < 224) { // Class C\r\n\t\tbits = 8;\r\n\t} \r\n\r\n\treturn bits;\r\n}", "function bin2dec(bin) { return parseInt(bin, 2); }", "function binaryAgent(str) {\n const stringArray = str.split(' ');\n const result = stringArray.map(number => String.fromCharCode(parseInt(number, 2))).join('')\n return result\n}", "function extractInteger(buf, bufPos) {\n var x = buf[bufPos + 0] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 1] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 2] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 3] & 0xff;\n return x;\n }", "function extractInteger(buf, bufPos) {\n var x = buf[bufPos + 0] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 1] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 2] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 3] & 0xff;\n return x;\n }", "function hexStringToIntegers(msg, port) {\n\tvar data = msg;\n\tvar hex = msg.match(/.{2}/g);\n\tvar v = [];\n\tfor (var i = 0; i < hex.length-5; i++) {\n\t\tv.push(parseInt('0x' + hex[i]));\n\t}\n\n\tif (msg.length <= 6) {\n\t\treturn shortPayloadDecoder(msg, v);\n\t}\n\telse if (msg.length > 6) {\n\t\treturn longPayloadDecoder(msg, v);\n\t}\n\n\treturn false;\n}", "function binaryAgent(str) {\n let array = str.split(' ');\n array = array.map(item => { return String.fromCharCode(parseInt(item, 2)); });\n return array.join('');\n}", "function sc_string2integer(s, radix) {\n return parseInt(s, radix);\n}", "function convertBinaryToDec(binary){\n return parseInt(binary, 2)\n}", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function bufferToInt(buf) {\n return new bn_js_1.default(toBuffer(buf)).toNumber();\n}", "function octet2dec(a){\n //alert(\"octet2dec1 \"+a[0]+\"\\n\"+dec2bin(a[0])+\"\\n\"+dec2bin(a[0] * 16777216));\n // poor mans bit shifting (Int32 issue)\n var d = 0;\n d = d + parseInt(a[0]) * 16777216 ; //Math.pow(2,24);\n d = d + a[1] * 65536;\t //Math.pow(2,16);\n d = d + a[2] * 256;\t //Math.pow(2,8);\n d = d + a[3];\n return d;\n}", "function binaryAgent(str) {\n let binaryStrings = str.split(' ');\n let characterStrings = binaryStrings.map(binaryStr => String.fromCharCode(parseInt(binaryStr, 2)));\n return characterStrings.join('');\n}", "function binaryAgent (str) {\n return str\n .split(' ')\n .map(e => String.fromCharCode(parseInt(e, 2)))\n .join('');\n}", "function num_from(s, offset)\n{\n\treturn s[offset] << 24 | s[offset + 1] << 16 | s[offset + 2] << 8 | s[offset + 3];\n}", "function num_from(s, offset)\n{\n\treturn s[offset] << 24 | s[offset + 1] << 16 | s[offset + 2] << 8 | s[offset + 3];\n}", "function bufToI32(buf) {\n // let addr = Integer.fromBits(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);\n // return addr;\n\n\n // let bar = new ArrayBuffer(4);\n var conv = new DataView(buf);\n\n conv.setUint8(0, buf[3]);\n conv.setUint8(1, buf[2]);\n conv.setUint8(2, buf[1]);\n conv.setUint8(3, buf[0]);\n\n return conv.getUint32(0);\n}", "function int24(raw, start) {\n return (raw[start] << 8*2) + (raw[start+1] << 8) + raw[start+2];\n}", "function i(n){var t=parseInt(n,16);return[t>>16,t>>8&255,255&t]}", "function parseInt(off) {\n if (a[off] != UTIL_ASN_INT) return null;\n var l = a[off + 1] & 255;\n if (l & 0x80) return null; // INT.size too large\n if (off + 2 + l > a.length) return null; // Out of bounds\n return a.slice(off + 2, off + 2 + l);\n }", "function validIP(str) {\n numbers = str.split(\".\");\n if (numbers.length !== 4) return false;\n\n for (let i = 0; i < numbers.length; i++) {\n let number = parseInt(numbers[i]);\n if (number < 0 || number > 255) {\n return false;\n }\n }\n\n return true\n}", "function isValidIP(objIP) \r\n\t{\r\n\t\tvar strIPtext = objIP.value; \r\n\t\tif ((strIPtext.length == 0) || IsAllSpaces(strIPtext)) \r\n\t\t{ \r\n\t\t\t// IP Empty\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\t\r\n\t\tif ( countChars(strIPtext,\".\") != 3) \r\n\t\t{ \r\n\t\t\t// Invalid Format, number of dots is not 3\r\n\t\t\treturn 2;\r\n\t\t}\r\n\t\tvar arrIP = strIPtext.split(\".\");\r\n\t\t\t\r\n\t\tfor(var i = 0; i < 4; i++)\r\n\t\t{\r\n\t\t\tif ( (arrIP[i].length < 1 ) || (arrIP[i].length > 3 ) )\r\n\t\t\t{\r\n\t\t\t\t// Invalid Format, continuous dots or more than 3 digits given between dots\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tif ( !isInteger(arrIP[i]) )\r\n\t\t\t{\r\n\t\t\t\t// non-integers present in the value\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tarrIP[i] = parseInt(arrIP[i]);\r\n\t\t\t\t\r\n\t\t\tif(i == 0)\r\n\t\t\t{\r\n\t\t\t\t// start IP value\r\n\t\t\t\tif(arrIP[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP value must not be 0\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(arrIP[i] > 223)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be > 223\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\t}\r\n\t\t\t\tif(arrIP[i] == 127)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be 127 - Loopback ip\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// the 2nd, 3rd and 4th IP values between the dots\r\n\t\t\t\t// these must not be more than 255\r\n\t\t\t\tif (arrIP[i] > 255)\r\n\t\t\t\t{\r\n\t\t\t\t\t// IP out of bound\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\tobjIP.value = arrIP.join(\".\");\r\n\t\t\t\r\n\t\tif(objIP.value == \"0.0.0.0\")\r\n\t\t{\r\n\t\t\t// IP all zeros\r\n\t\t\treturn 7;\r\n\t\t}\t\r\n\t\t\t\r\n\t\treturn 0;\r\n\t\t\t\r\n\t}\t// end of isValidIP", "function labelToInt(label) {\n\tvar n = 0;\n\tvar i;\n\tfor(i = 0; i < label.length; ++i) {\n\t\tn *= charset.length;\n\t\tn += charset.indexOf(label[i]);\n\t}\n\treturn n;\n}", "function int32(data, offset) {\n return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;\n }", "function binaryFromString(stringToBinary){\n var binary = \"\";\n for(var i = 0; i < stringToBinary.length; i++){\n binary += binaryFixedSize(stringToBinary.charCodeAt(i), 8);\n }\n return binary;\n}", "function binaryToInt(binaryString) {\n var result = 0;\n\n if (typeof binaryString !== \"string\"\n || !binaryString\n || binaryString.search(/[2-9a-zA-Z]/g) !== -1) {\n return null;\n }\n\n // reverse the string so the for loop can start at 2^0.\n // Since the last characters of the binary digit is the most \n // important and consistent.\n var tempArr = binaryString.split(\"\").reverse();\n\n for (var i = 0; i < tempArr.length; i++) {\n if (tempArr[i] === \"1\") {\n result += Math.pow(2, i);\n }\n }\n\n return result;\n }", "function ba2bigInt(data) {\n var mpi = str2bigInt('0', 10, data.length)\n data.forEach(function (d, i) {\n if (i) leftShift_(mpi, 8)\n mpi[0] |= d\n })\n return mpi\n }", "function s2i(s){\n\n i<-s.tochar();\n i<-i.tointeger();\n\n return i;\n}", "function convertToInteger(str) {\n return parseInt(str, 2)\n }", "function binaryAgent(str) {\r\n var arr = str.split(' ');\r\n\r\n arr = arr.map(function(el) {\r\n if(el) {\r\n return String.fromCharCode(parseInt(el, 2));\r\n }\r\n return el;\r\n });\r\n\r\n str = arr.join('');\r\n\r\n return str;\r\n}", "readInt32() {\n const result = ((this.str.charCodeAt(this.position) << 24)\n + (this.str.charCodeAt(this.position + 1) << 16)\n + (this.str.charCodeAt(this.position + 2) << 8)\n + this.str.charCodeAt(this.position + 3));\n this.position += 4;\n return result;\n }", "function binaryAgent(str) {\n var arr = str.split(\" \");\n \n return arr.map(function(val){\n return String.fromCharCode(parseInt(val,2));\n }).join(\"\");\n \n}", "function ToInt8(v) { return (v << 24) >> 24; }", "function convertToInteger(str) {\n return parseInt(str, 2);\n}", "function binaryAgent(str) {\n return str.split(' ').map(x=>parseInt(x, 2)).map(x=>String.fromCharCode(x)).join('');\n}", "function binaryAgent(str) {\n return str.split(' ').map(e=> String.fromCharCode(parseInt(e,2))).join('')\n}", "function binaryAgent(str) {\n return str.split(' ').map(e=> String.fromCharCode(parseInt(e,2))).join('')\n}", "function toInt(string) {\n\t return parseInt(string, 10);\n\t }", "function toNumber(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n b = match.reverse().join('');\r\n }\r\n }\r\n var result = parseInt(b, 16);\r\n if (result >= Number.MAX_SAFE_INTEGER) {\r\n throw new Error(\"Overflowed when converting to number: \" + bytes);\r\n }\r\n return result;\r\n}", "function convertToInteger(str) {\n\treturn parseInt(str, 2);\n}", "influence () {\n return parseInt(this.I, 16);\n }", "function convertToInteger(str) {\n return parseInt(str, 2);\n }", "function readInt8(signed) {\n var result = str.charCodeAt(position);\n if (signed && result > 127) result -= 256;\n position += 1;\n return result;\n }", "function binaryAgent(str) {\n let myArr = str.split(\" \");\n let decimal = [128,64,32,16,8,4,2,1];\n myArr = myArr.map(elem => {\n let biToDec = 0;\n for(let i = 0; i < elem.length; i++){\n if(elem[i] == 0){\n biToDec = biToDec;\n }else{\n biToDec += decimal[i];\n }\n }\n return biToDec;\n });\n return myArr.map(x => String.fromCharCode(x)).join(\"\");\n\n}", "function bin2dec(b) {\n return parseInt(b,2);\n}", "function parse_PtgInt(blob) {\n blob.l++;\n return blob.read_shift(2);\n }", "function binaryAgent(str) {\n return str.split(' ').map(function(code){\n return String.fromCharCode(parseInt(code, 2));\n }).join('')\n}", "function i(t){var n=parseInt(t,16);return[n>>16,n>>8&255,255&n]}", "function binaryToDecimal(i1, i2, i3, i4)\n{\n return i1 * 8 + i2 * 4 + i3 * 2 + i4;\n}", "function asciiHexToBinary(buf) {\r\n\r\n var upperNibble = charHexToBinary(buf[0]);\r\n var lowerNibble = charHexToBinary(buf[1]);\r\n\r\n var result = 0;\r\n result = (upperNibble << 4) & 0xF0;\r\n result |= lowerNibble & 0x0F;\r\n\r\n return result;\r\n}", "function _intify(str) {\n var ret = '';\n for (var i = 0; i < str.length; i++) {\n var cur = str.charCodeAt(i);\n ret += String.fromCharCode(cur & 0xff);\n }\n\n return ret;\n }", "function rstr2binl(input){var i;var output=[];output[(input.length>>2)-1]=undefined;for(i=0;i<output.length;i+=1){output[i]=0;}var length8=input.length*8;for(i=0;i<length8;i+=8){output[i>>5]|=(input.charCodeAt(i/8)&0xff)<<i%32;}return output;}", "function binaryAgent(str) {\n const newStr = str.split(' ');\n // console.log(newArr)\n const trans = [];\n for (let i = 0; i < newStr.length; i++) {\n trans.push(String.fromCharCode(parseInt(newStr[i], 2)));\n }\n return trans.join('');\n}", "extractBinaryNumber(bitLength){\n return parseInt(this.data.substring(this.index, this.index+=bitLength), 2)\n }", "function convertToInteger(str6) {\n\n return parseInt(str6);\n}", "function bytes_to_int32(arr, off) {\n return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off])\n }", "function get_ip(ip_port_string) {\n\treturn ip_port_string.split(\":\")[0];\n}" ]
[ "0.8008878", "0.7915412", "0.7426816", "0.73700917", "0.7018979", "0.6864039", "0.6843921", "0.68012166", "0.68005884", "0.67612255", "0.6714375", "0.6517607", "0.6449379", "0.63932", "0.6374356", "0.62983423", "0.6271007", "0.62106454", "0.62102085", "0.60810375", "0.6079408", "0.6074414", "0.60731095", "0.6014939", "0.5930716", "0.59055036", "0.58491373", "0.5848361", "0.58367527", "0.580147", "0.5755637", "0.5725346", "0.5696925", "0.56963587", "0.5691262", "0.56740135", "0.56696403", "0.5668212", "0.5659422", "0.56242585", "0.5620398", "0.5593928", "0.55736786", "0.55706483", "0.55706483", "0.55136913", "0.55098593", "0.54996043", "0.54945123", "0.5489943", "0.5489943", "0.5489943", "0.5489943", "0.5487222", "0.54814124", "0.54782975", "0.5474948", "0.5473522", "0.5473522", "0.54719275", "0.5468152", "0.5458885", "0.5445593", "0.5445354", "0.54439545", "0.54405916", "0.5432096", "0.5430532", "0.5418467", "0.5416023", "0.539242", "0.53834635", "0.53794473", "0.53675663", "0.5367209", "0.53656846", "0.53654677", "0.53611547", "0.53570354", "0.53570354", "0.53556365", "0.5351161", "0.53508073", "0.5331439", "0.5324835", "0.53244066", "0.532335", "0.53194624", "0.5318872", "0.5317296", "0.5306573", "0.5296145", "0.52953714", "0.52931815", "0.52909315", "0.528172", "0.5281263", "0.52766985", "0.52764595", "0.5275156" ]
0.6796587
9
convert of bits to a string representation of the binary value
function IPv4_bitsNM_to_binstrNM( bitsNM ) { var bitString = ''; var numberOfOnes = bitsNM; while( numberOfOnes-- ) bitString += '1'; /* fill in ones */ numberOfZeros = 32 - bitsNM; while( numberOfZeros-- ) bitString += '0'; /* pad remaining with zeros */ return bitString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toBinStr_old(bits){\n\t\tvar data = '';\n\t\tvar pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\n\t\tbits = pad + bits;\n\t\tfor(var i = 0; i < bits.length; i+= 8){\n\t\t\tdata += String.fromCharCode(parseInt(bits.substr(i,8),2))\n\t\t}\n\t\treturn data;\n\t}", "function toBinStr_old(bits) {\n var data = '';\n var pad = (bits.length % 8) ? (new Array(1 + 8 - (bits.length % 8))).join('0') : '';\n bits = pad + bits;\n for (var i = 0; i < bits.length; i += 8) {\n data += String.fromCharCode(parseInt(bits.substr(i, 8), 2))\n }\n return data;\n }", "function binb2str(bin)\r\n{\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for(var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\r\n return str;\r\n}", "function toBinaryString(number) {\n if (number === 0) {\n return \"0\";\n }\n let result = [];\n while (number > 0) {\n result.unshift(number % 2);\n number = Math.floor(number / 2);\n }\n return result.join(\"\");\n}", "function binb2str(bin) {\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for (var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i >> 5] >>> (24 - i % 32)) & mask);\n return str;\n}", "function arrayToBitstring(bitArray) {\n var ret = '';\n bitArray.forEach(function (bit) {\n if (ret == '') {\n ret = bit;\n } else {\n ret += ',' + bit;\n }\n });\n return ',' + ret + ',';\n}", "function binb2str(bin) {\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for (var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i >> 5] >>> (24 - i % 32)) & mask);\r\n return str;\r\n}", "function binb2str(bin)\n\t{\n\t\tvar str = \"\";\n\t\tvar mask = (1 << charSize) - 1;\n\t\tvar length = bin.length * 32;\n\n\t\tfor(var i = 0; i < length; i += charSize)\n\t\t\tstr += String.fromCharCode((bin[i>>5] >>> (32 - charSize - i%32)) & mask);\n\n\t\treturn str;\n\t}", "function binb2str(bin) {\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for (var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i >> 5] >>> (32 - chrsz - i % 32)) & mask);\r\n return str;\r\n}", "function binb2str(bin)\n{\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for(var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n return str;\n}", "function binb2str(bin)\n{\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for(var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n return str;\n}", "function binb2str(bin)\n{\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for(var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n return str;\n}", "function binb2str(bin)\n{\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for(var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n return str;\n}", "function binb2str(bin)\n{\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for(var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);\n return str;\n}", "_binb2str(_bin) {\n const _this = this;\n let _str = '';\n const _mask = (1 << _this._chrsz) - 1;\n let i;\n const _binLen32 = _bin.length * 32;\n const _32chrsz = 32 - _this._chrsz;\n for (i = 0; i < _binLen32; i += _this._chrsz) {\n _str += String.fromCharCode((_bin[i>>5] >>> (_32chrsz - i%32)) & _mask);\n }\n return _str;\n }", "function bnToString(b) {\n var self = this;\n if (self.s < 0) return \"-\" + self.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return self.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = self.t;\n var p = self.DB - i * self.DB % k;\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & (1 << p) - 1) << k - p;\n d |= self[--i] >> (p += self.DB - k);\n } else {\n d = self[i] >> (p -= k) & km;\n if (p <= 0) {\n p += self.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function binToString(bin) {\n\t if (isBoolean(bin)) {\n\t bin = normalizeBin(bin, undefined);\n\t }\n\t return ('bin' +\n\t keys(bin)\n\t .map(p => varName(`_${p}_${bin[p]}`))\n\t .join(''));\n\t}", "function binary(array, idx) {\n var value = array[idx]; // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n\n if (typeof value !== 'number') return '????????'; // We prefix 0s so that we have constant length number\n\n var text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n }", "function toBinaryStr(val, size) {\n const pad = \"0000000000000000\"; // this will work up to size 16\n let num = val.toString(2);\n return pad.substring(0, size - num.length) + num;\n}", "function binaryRepresentation(num) {\n // if (num === 0) { // if num is === 0\n // return '';\n // }\n\n // if (isNaN(num / num)) {\n // return 0; // if the number is zero \n // }\n\n if (num > 0) {\n let binary = Math.floor(num % 2); // binary string\n\n return binaryRepresentation(Math.floor(num / 2)) + binary;// return binary\n }\n\n return '';\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = self.t\n var p = self.DB - (i * self.DB) % k\n if (i-- > 0) {\n if (p < self.DB && (d = self[i] >> p) > 0) {\n m = true\n r = int2char(d)\n }\n while (i >= 0) {\n if (p < k) {\n d = (self[i] & ((1 << p) - 1)) << (k - p)\n d |= self[--i] >> (p += self.DB - k)\n } else {\n d = (self[i] >> (p -= k)) & km\n if (p <= 0) {\n p += self.DB\n --i\n }\n }\n if (d > 0) m = true\n if (m) r += int2char(d)\n }\n }\n return m ? r : \"0\"\n}", "function binb2str(bin) {\n var str = \"\";\n var mask = (1 << chrsz) - 1;\n for (var i = 0; i < bin.length * 32; i += chrsz)\n str += String.fromCharCode((bin[i >> 5] >>> (24 - i % 32)) & mask);\n return str;\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - i * this.DB % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n if (p <= 0) {\n p += this.DB;--i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n\t var self = this\n\t if (self.s < 0) return \"-\" + self.negate()\n\t .toString(b)\n\t var k\n\t if (b == 16) k = 4\n\t else if (b == 8) k = 3\n\t else if (b == 2) k = 1\n\t else if (b == 32) k = 5\n\t else if (b == 4) k = 2\n\t else return self.toRadix(b)\n\t var km = (1 << k) - 1,\n\t d, m = false,\n\t r = \"\",\n\t i = self.t\n\t var p = self.DB - (i * self.DB) % k\n\t if (i-- > 0) {\n\t if (p < self.DB && (d = self[i] >> p) > 0) {\n\t m = true\n\t r = int2char(d)\n\t }\n\t while (i >= 0) {\n\t if (p < k) {\n\t d = (self[i] & ((1 << p) - 1)) << (k - p)\n\t d |= self[--i] >> (p += self.DB - k)\n\t } else {\n\t d = (self[i] >> (p -= k)) & km\n\t if (p <= 0) {\n\t p += self.DB\n\t --i\n\t }\n\t }\n\t if (d > 0) m = true\n\t if (m) r += int2char(d)\n\t }\n\t }\n\t return m ? r : \"0\"\n\t}", "function bnToString(b) {\n\t var self = this\n\t if (self.s < 0) return \"-\" + self.negate()\n\t .toString(b)\n\t var k\n\t if (b == 16) k = 4\n\t else if (b == 8) k = 3\n\t else if (b == 2) k = 1\n\t else if (b == 32) k = 5\n\t else if (b == 4) k = 2\n\t else return self.toRadix(b)\n\t var km = (1 << k) - 1,\n\t d, m = false,\n\t r = \"\",\n\t i = self.t\n\t var p = self.DB - (i * self.DB) % k\n\t if (i-- > 0) {\n\t if (p < self.DB && (d = self[i] >> p) > 0) {\n\t m = true\n\t r = int2char(d)\n\t }\n\t while (i >= 0) {\n\t if (p < k) {\n\t d = (self[i] & ((1 << p) - 1)) << (k - p)\n\t d |= self[--i] >> (p += self.DB - k)\n\t } else {\n\t d = (self[i] >> (p -= k)) & km\n\t if (p <= 0) {\n\t p += self.DB\n\t --i\n\t }\n\t }\n\t if (d > 0) m = true\n\t if (m) r += int2char(d)\n\t }\n\t }\n\t return m ? r : \"0\"\n\t}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) { m = true;\n r = int2char(d); }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) { p += this.DB;--i; }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b)\n{\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0)\n {\n if (p < this.DB && (d = this[i] >> p) > 0)\n {\n m = true;\n r = int2char(d);\n }\n while (i >= 0)\n {\n if (p < k)\n {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else\n {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0)\n {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function toBinaryX(number, X, bit){\n let tmp = (number).toString(2);\n let length = X - tmp.length;\n for(let i = 0; i < length; i++)\n {\n tmp = bit + tmp;\n }\n return tmp;\n}", "function convertToBinary(n) {\n return Number(n).toString(2);\n}", "function toBinaryString(number) {\n let binary = [];\n\n if (!number) return '0';\n\n for (let i = number; i > 0; i = Math.floor(i / 2)) {\n binary.unshift(i % 2);\n }\n\n return binary.join('');\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d, m = false,\n r = \"\",\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n }", "function toBinaryString(number) {\n var res = \"\";\n\n do {\n var remainder = number % 2;\n res += remainder;\n number = Math.floor(number / 2);\n } while (number !== 0)\n \n return reverseStr(res);\n}", "function bnToString(b) {\n if (this.s < 0) return \"-\" + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : \"0\";\n}", "function binl2str(bin)\r\n{\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for(var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);\r\n return str;\r\n}", "function binl2str(bin)\r\n{\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for(var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);\r\n return str;\r\n}", "function binl2str(bin)\r\n{\r\n var str = \"\";\r\n var mask = (1 << chrsz) - 1;\r\n for(var i = 0; i < bin.length * 32; i += chrsz)\r\n str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);\r\n return str;\r\n}", "function bnToString(b) {\n if (this.s < 0) return '-' + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;\n else if (b == 8) k = 3;\n else if (b == 2) k = 1;\n else if (b == 32) k = 5;\n else if (b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1 << k) - 1,\n d,\n m = false,\n r = '',\n i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n return m ? r : '0';\n}", "function binary(num){\n if(num===0){\n return '';\n }\n return binary(Math.floor(num/2))+num%2;\n}", "function toBinary(num) {\r\n // Instantiate the string representation as an empty string\r\n var bin = \"\";\r\n // while the number is greater than zero\r\n while (num > 0) {\r\n // take the remainder of the number divided by 2 and prepend it to the binary representation\r\n bin = num%2 + bin;\r\n // take the quotient of the number divided by 2 and store it as the new number since we're moving past the current power of two\r\n num = Math.floor(num/2);\r\n }\r\n // Return the binary representation of the number\r\n // If the representation is falsy, then it's still an empty string because the number was less than 0, so we should return \"0\" instead of an empty string\r\n return bin ? bin : \"0\";\r\n}", "function binb2rstr(input)\n{\n var output = \"\";\n for(var i = 0; i < input.length * 32; i += 8)\n output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);\n return output;\n}", "function bin2string(array){\n var result = \"\";\n for(var i = 0; i < array.length; ++i){\n result += (String.fromCharCode(array[i]));\n }\n return result;\n}", "function bin2String(array) {\n var result = \"\";\n for (var i = 0; i < array.length; i++) {\n result += String.fromCharCode(parseInt(array[i], 10));\n }\n return result;\n}", "function binb2str(bin) {\n var str = \"\";\n var mask = 255;\n\n for (var i = 0; i < bin.length * 32; i += 8) {\n str += String.fromCharCode(bin[i >> 5] >>> 24 - i % 32 & mask);\n }\n\n return str;\n }", "function binb2rstr(input){\r\n var output='';\r\n for(var i=0;i<input.length*32;i +=8) output +=String.fromCharCode((input[i>>5] >>> (24-i%32)) & 0xFF);\r\n return output;\r\n}", "function toBinary(n) {\r\n return Number(n.toString(2));\r\n}", "function bnToString(b) {\n\tif(this.s < 0) return \"-\"+this.negate().toString(b);\n\tvar k;\n\tif(b == 16) k = 4;\n\telse if(b == 8) k = 3;\n\telse if(b == 2) k = 1;\n\telse if(b == 32) k = 5;\n\telse if(b == 4) k = 2;\n\telse return this.toRadix(b);\n\tvar km = (1<<k)-1, d, m = false, r = [], i = this.t;\n\tvar p = this.DB-(i*this.DB)%k;\n\tif(i-- > 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r.push(int2char(d)); }\n\t while(i >= 0) {\n\t\tif(p < k) {\n\t\t d = (this[i]&((1<<p)-1))<<(k-p);\n\t\t d |= this[--i]>>(p+=this.DB-k);\n\t\t}\n\t\telse {\n\t\t d = (this[i]>>(p-=k))&km;\n\t\t if(p <= 0) { p += this.DB; --i; }\n\t\t}\n\t\tif(d > 0) m = true;\n\t\tif(m) r.push(int2char(d));\n\t }\n\t}\n\treturn m?r.join(\"\"):\"0\";\n }", "function toBinaryString(num, length){\n let str = num.toString(2);\n while(str.length < length) str = '0' + str;\n return str;\n}", "function binary(array, idx) {\n var value = array[idx]; // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n\n if (typeof value !== 'number') return '????????'; // We prefix 0s so that we have constant length number\n\n var text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function binary(array, idx) {\n const value = array[idx];\n // If not a number we print 8 `?` to retain alignment but let user know that it was called on\n // wrong type.\n if (typeof value !== 'number')\n return '????????';\n // We prefix 0s so that we have constant length number\n const text = '00000000' + value.toString(2);\n return text.substring(text.length - 8);\n}", "function bnToString(b) {\r\n\t if (this.s < 0) return \"-\" + this.negate().toString(b);\r\n\t var k;\r\n\t if (b == 16) k = 4;\r\n\t else if (b == 8) k = 3;\r\n\t else if (b == 2) k = 1;\r\n\t else if (b == 32) k = 5;\r\n\t else if (b == 4) k = 2;\r\n\t else return this.toRadix(b);\r\n\t var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\r\n\t var p = this.DB - (i * this.DB) % k;\r\n\t if (i-- > 0) {\r\n\t if (p < this.DB && (d = this[i] >> p) > 0) {\r\n\t m = true;\r\n\t r = int2char(d);\r\n\t }\r\n\t while (i >= 0) {\r\n\t if (p < k) {\r\n\t d = (this[i] & ((1 << p) - 1)) << (k - p);\r\n\t d |= this[--i] >> (p += this.DB - k);\r\n\t }\r\n\t else {\r\n\t d = (this[i] >> (p -= k)) & km;\r\n\t if (p <= 0) {\r\n\t p += this.DB;\r\n\t --i;\r\n\t }\r\n\t }\r\n\t if (d > 0) m = true;\r\n\t if (m) r += int2char(d);\r\n\t }\r\n\t }\r\n\t return m ? r : \"0\";\r\n\t}", "function bnToString(b) {\r\n\t if (this.s < 0) return \"-\" + this.negate().toString(b);\r\n\t var k;\r\n\t if (b == 16) k = 4;\r\n\t else if (b == 8) k = 3;\r\n\t else if (b == 2) k = 1;\r\n\t else if (b == 32) k = 5;\r\n\t else if (b == 4) k = 2;\r\n\t else return this.toRadix(b);\r\n\t var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\r\n\t var p = this.DB - (i * this.DB) % k;\r\n\t if (i-- > 0) {\r\n\t if (p < this.DB && (d = this[i] >> p) > 0) {\r\n\t m = true;\r\n\t r = int2char(d);\r\n\t }\r\n\t while (i >= 0) {\r\n\t if (p < k) {\r\n\t d = (this[i] & ((1 << p) - 1)) << (k - p);\r\n\t d |= this[--i] >> (p += this.DB - k);\r\n\t }\r\n\t else {\r\n\t d = (this[i] >> (p -= k)) & km;\r\n\t if (p <= 0) {\r\n\t p += this.DB;\r\n\t --i;\r\n\t }\r\n\t }\r\n\t if (d > 0) m = true;\r\n\t if (m) r += int2char(d);\r\n\t }\r\n\t }\r\n\t return m ? r : \"0\";\r\n\t}", "function converNumberToBinary (num) {\n return Number(num).toString(2)\n}", "function tobits(data) {\n\tlet bits = '';\n\n\tfor (let i = 0; i < data.length; i++) {\n\t\tlet c = data.charCodeAt(i);\n\n\t\tbits += bit1;\n\t\tbits += (c & 128) ? bit1 : bit0;\n\t\tbits += (c & 64) ? bit1 : bit0;\n\t\tbits += (c & 32) ? bit1 : bit0;\n\t\tbits += (c & 16) ? bit1 : bit0;\n\t\tbits += (c & 8) ? bit1 : bit0;\n\t\tbits += (c & 4) ? bit1 : bit0;\n\t\tbits += (c & 2) ? bit1 : bit0;\n\t\tbits += (c & 1) ? bit1 : bit0;\n\t\tbits += bit0;\n\t}\n\treturn bits\n}", "function binaryConverter(value) {\n value = value.toString();\n sum = 0;\n let power = 0;\n for(let index = value.length -1; index >= 0; index--)\n {\n sum += parseInt(value[index])*Math.pow(2, power);\n power++;\n }\n return sum;\n}", "function binb2rstr(input) {\r\n var output = \"\";\r\n for (var i = 0; i < input.length * 32; i += 8)\r\n output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF);\r\n return output;\r\n}", "function binl2str(bin) {\n\t\tvar str = \"\";\n\t\tvar mask = (1 << chrsz) - 1;\n\t\tfor (var i = 0; i < bin.length * 32; i += chrsz) {\n\t\t\tstr += String.fromCharCode(bin[i >> 5] >>> i % 32 & mask);\n\t\t}\n\t\treturn str;\n\t}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n } else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function binl2str(bin) {\n\t\t\tvar str = \"\";\n\t\t\tvar mask = (1 << chrsz) - 1;\n\t\t\tfor(var i = 0; i < bin.length * 32; i += chrsz)\n\t\t\t\tstr += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask);\n\t\t\treturn str;\n\t\t}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this.data[i]&((1<<p)-1))<<(k-p);\n d |= this.data[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this.data[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n}", "function binb2rstr(input) {\n\t var i, l = input.length * 32,\n\t output = '';\n\t for (i = 0; i < l; i += 8) {\n\t output += String.fromCharCode((input[i >> 5] >>> (24 - i % 32)) & 0xFF);\n\t }\n\t return output;\n\t }", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this.DB-(i*this.DB)%k;\n\t if(i-- > 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this[i]&((1<<p)-1))<<(k-p);\n\t d |= this[--i]>>(p+=this.DB-k);\n\t }\n\t else {\n\t d = (this[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t }", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this.DB-(i*this.DB)%k;\n\t if(i-- > 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this[i]&((1<<p)-1))<<(k-p);\n\t d |= this[--i]>>(p+=this.DB-k);\n\t }\n\t else {\n\t d = (this[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t }", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this.DB-(i*this.DB)%k;\n\t if(i-- > 0) {\n\t if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this[i]&((1<<p)-1))<<(k-p);\n\t d |= this[--i]>>(p+=this.DB-k);\n\t }\n\t else {\n\t d = (this[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t }", "function binb2rstr(input) {\n var output = \"\";\n for (var i = 0; i < input.length * 32; i += 8) {\n output += String.fromCharCode(input[i >> 5] >>> 24 - i % 32 & 0xFF);\n }return output;\n}", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this.toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this.DB-(i*this.DB)%k;\n\t if(i-- > 0) {\n\t if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }\n\t while(i >= 0) {\n\t if(p < k) {\n\t d = (this.data[i]&((1<<p)-1))<<(k-p);\n\t d |= this.data[--i]>>(p+=this.DB-k);\n\t } else {\n\t d = (this.data[i]>>(p-=k))&km;\n\t if(p <= 0) { p += this.DB; --i; }\n\t }\n\t if(d > 0) m = true;\n\t if(m) r += int2char(d);\n\t }\n\t }\n\t return m?r:\"0\";\n\t}", "function bnToString(b) {\n\t if(this.s < 0) return \"-\"+this.negate().toString(b);\n\t var k;\n\t if(b == 16) k = 4;\n\t else if(b == 8) k = 3;\n\t else if(b == 2) k = 1;\n\t else if(b == 32) k = 5;\n\t else if(b == 4) k = 2;\n\t else return this._toRadix(b);\n\t var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n\t var p = this._DB-(i*this._DB)%k;\n\t if(i-- > 0) {\n\t\tif(p < this._DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n\t\twhile(i >= 0) {\n\t\t if(p < k) {\n\t\t\td = (this[i]&((1<<p)-1))<<(k-p);\n\t\t\td |= this[--i]>>(p+=this._DB-k);\n\t\t }\n\t\t else {\n\t\t\td = (this[i]>>(p-=k))&km;\n\t\t\tif(p <= 0) { p += this._DB; --i; }\n\t\t }\n\t\t if(d > 0) m = true;\n\t\t if(m) r += int2char(d);\n\t\t}\n\t }\n\t return m?r:\"0\";\n\t}", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }", "function bnToString(b) {\n if(this.s < 0) return \"-\"+this.negate().toString(b);\n var k;\n if(b == 16) k = 4;\n else if(b == 8) k = 3;\n else if(b == 2) k = 1;\n else if(b == 32) k = 5;\n else if(b == 4) k = 2;\n else return this.toRadix(b);\n var km = (1<<k)-1, d, m = false, r = \"\", i = this.t;\n var p = this.DB-(i*this.DB)%k;\n if(i-- > 0) {\n if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); }\n while(i >= 0) {\n if(p < k) {\n d = (this[i]&((1<<p)-1))<<(k-p);\n d |= this[--i]>>(p+=this.DB-k);\n }\n else {\n d = (this[i]>>(p-=k))&km;\n if(p <= 0) { p += this.DB; --i; }\n }\n if(d > 0) m = true;\n if(m) r += int2char(d);\n }\n }\n return m?r:\"0\";\n }" ]
[ "0.77219754", "0.7598411", "0.7060089", "0.7016584", "0.7003877", "0.692534", "0.6918987", "0.6915354", "0.6894471", "0.6865475", "0.6865475", "0.6865475", "0.6865475", "0.6865475", "0.68610656", "0.6859688", "0.6854282", "0.68462634", "0.68333507", "0.6833349", "0.68287325", "0.68287325", "0.68287325", "0.68287325", "0.68287325", "0.68287325", "0.68287325", "0.68285036", "0.6827014", "0.6827014", "0.6827014", "0.67991316", "0.67991316", "0.6790117", "0.6788438", "0.6782239", "0.6781424", "0.67785025", "0.67757285", "0.6763747", "0.6763747", "0.6756877", "0.67563134", "0.67529625", "0.67529625", "0.67529625", "0.67522", "0.6745106", "0.674394", "0.6739623", "0.6737082", "0.6736229", "0.67336905", "0.67314714", "0.6728755", "0.6718788", "0.670749", "0.670244", "0.66957134", "0.66957134", "0.66957134", "0.66957134", "0.66957134", "0.66957134", "0.66775364", "0.66775364", "0.66703784", "0.6665098", "0.66433686", "0.66365093", "0.6635357", "0.6629439", "0.6629439", "0.6629439", "0.6629439", "0.6629439", "0.6629439", "0.6629439", "0.66274804", "0.66257524", "0.66257524", "0.6624341", "0.6617055", "0.6613596", "0.6613596", "0.66070604", "0.6604388", "0.6604001", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973", "0.65986973" ]
0.0
-1
The IPv4_Calc_ functions operate on string representations of the binary value because I don't trust JavaScript's sign + 31bit bitwise functions. / logical AND between address & netmask
function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) { var netaddressBinStr = ''; var aBit = 0; var nmBit = 0; for( pos = 0; pos < 32; pos ++ ) { aBit = addressBinStr.substr( pos, 1 ); nmBit = netmaskBinStr.substr( pos, 1 ); if( aBit == nmBit ) { netaddressBinStr += aBit.toString(); } else{ netaddressBinStr += '0'; } } return netaddressBinStr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maskAnd(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) & parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) & parseInt(mask.toBin().substr(16,16), 2)));\n}", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "ipv4() {\n // coercing to int forces validation here\n const ipv4Int = this.toInt();\n if (ipv4Int && ipv4Int !== 0) {\n return this.addr;\n }\n return undefined;\n }", "function maskOr(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) | parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) | parseInt(mask.toBin().substr(16,16), 2)));\n}", "function parseIPv4(addr) {\n if (typeof(addr) !== 'string')\n throw new TypeError('addr (string) is required');\n\n var octets = addr.split(/\\./).map(function (octet) {\n return (parseInt(octet, 10));\n });\n if (octets.length !== 4)\n throw new TypeError('valid IP address required');\n\n var uint32 = ((octets[0] * Math.pow(256, 3)) +\n (octets[1] * Math.pow(256, 2)) +\n (octets[2] * 256) + octets[3]);\n return (uint32);\n}", "function isIPv4Address(inputString) {\n let charRegex = /[a-z]/;\n inputString = inputString.split('.');\n \n // return false if there are not 4 sets of numbers\n if(inputString.length !== 4)\n return false\n // return false if the sets of chars are not an integer between 0 and 256 or if its empty \n for(let i = 0; i < inputString.length; i++){\n if(inputString[i] < 0 || inputString[i] >= 256 || inputString[i] === '' || charRegex.test(inputString[i]))\n return false;\n }\n return true;\n}", "function calNetworkAddress(en1,en2,en3,en4,ss1,ss2,ss3,ss4 ){\r\n\r\n//-----------Network Address Output --------------------------------------\r\n\r\n var netOut = [] ;\r\n\r\n//--------Convert all input Value to Binary-------------------------------\r\n\r\n //-----Enter IP Portion ------\r\n // cen1 = en1.toString(2);\r\n\t\t\t\t // cen2 = en2.toString(2);\r\n\t\t\t\t\t// cen3 = en3.toString(2);\r\n\t\t\t\t\t //cen4 = en4.toString(2);\r\n\t\t\t\t\t//----Subnet IP Portion\r\n\t\t\t\t\t// css1 = ss1.toString(2);\r\n\t\t\t\t\t// css2 = ss2.toString(2);\r\n\t\t\t\t\t// css3 = ss3.toString(2);\r\n\t\t\t\t\t //css4 = ss4.toString(2);\r\n\t\t\t\t\t \r\n\t\t\t\t\t \r\n//--------------'And 'the User Input Value with the Subnet Value Selected to get the Network Address ------------------------------------------------\r\n\t\t\t\t\t \r\n netOut[1] = en1 & ss1 ;\r\n\t\t\t\t netOut[2] = en2 & ss2 ;\r\n\t\t\t\t netOut[3] = en3 & ss3 ;\r\n\t\t\t\t netOut[4] = en4 & ss4 ;\r\n\t\t\t\t \r\n\t\t\t\t \r\n//-----------Convert Binary Value Back to Decimal-----------------------------------------------------------------------------------------------------------\r\n\t\t\t\t \r\n return [netOut[1],netOut[2],netOut[3],netOut[4] ];\t\t\t\t \r\n\r\n}", "function isIPv4Address(inputString) {\n const octets = inputString.split('.'); // octets = ['172', '1', '254', '1']\n\n if (octets.length !== 4) return false; // .length = 4\n\n for (let i = 0; i < octets.length; i++) { // i = 0; length = 4\n const octet = octets[i]; // octets[0] = '172'\n if (isNaN(+octet)) return false; // isNaN(172) = false;\n if (+octet < 0 || +octet > 255) return false;\n if (octet.length > 1 && octet[0] === '0') return false;\n if (octet === '') return false;\n }\n\n return true;\n}", "function isIPv4Address(inputString) {\n let regex = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\n if (regex.test(inputString)) {\n inputString = inputString.split(\".\");\n for (let i = 0; i < inputString.length; i++) {\n if ((inputString[i] < 0 || inputString[i] > 255)) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n}", "function IPv4_Calc_netbcastBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netbcastBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = parseInt( addressBinStr.substr( pos, 1 ));\r\n\t\tnmBit = parseInt( netmaskBinStr.substr( pos, 1 ));\r\n\t\t\r\n\t\tif( nmBit ) {\tnmBit = 0;\t}\t/* flip netmask bits */\r\n\t\telse{\tnmBit = 1;\t}\r\n\t\t\r\n\t\tif( aBit || nmBit ) {\tnetbcastBinStr += '1'\t}\r\n\t\telse{\tnetbcastBinStr += '0';\t}\r\n\t}\r\n\treturn netbcastBinStr;\r\n}", "function convertIPv4StrToInt2(ipv4Str) {\n if (typeof ipv4Str !== \"string\") {\n throw TypeError(\"Illegal arguments, ipv4Str should be a string\");\n }\n\n let ipv4Int = 0,\n base = 1,\n digit,\n digitBase = 1,\n dotsCnt = 0,\n isSpaceAppearBeforeDigit = false,\n char;\n\n for (let i = ipv4Str.length - 1; i >= -1; i--) {\n char = ipv4Str[i];\n\n if (char === '.' || i === -1) { // dot or end\n dotsCnt = i !== -1 ? dotsCnt + 1 : dotsCnt;\n if (dotsCnt > 3 || (i === -1 && dotsCnt !== 3)) {\n throw Error(\"Invalid IPv4 address, it should be formated in A.B.C.D\");\n }\n if (digit === undefined) { // nothing between two dots, such as: 172.1..\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n if (digit >= 256) {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be less than 256\");\n }\n ipv4Int += digit * base;\n base *= 256;\n\n digit = undefined;\n digitBase = 1;\n isSpaceAppearBeforeDigit = false;\n } else if (/\\d/.test(char)) { // digit\n if (isSpaceAppearBeforeDigit) { // spaces between two digits, such as: 172.1.1 2\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n\n digit = parseInt(char) * digitBase + (digit === undefined ? 0 : digit);\n digitBase *= 10;\n } else if (char === ' ') { // space\n if (digit !== undefined) {\n isSpaceAppearBeforeDigit = true;\n }\n\n isSpaceAppear = true;\n } else {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n }\n\n return ipv4Int;\n}", "function IPAddress$IPv4ToInt(address) {\n var res = 0;\n // check that the input is a valid IPv4 address\n if (IPAddress$getValidIPv4(address) === address) {\n var parts = address.split('.');\n res += parseInt10(parts[0]) << 24;\n res += parseInt10(parts[1]) << 16;\n res += parseInt10(parts[2]) << 8;\n res += parseInt10(parts[3]);\n return res;\n }\n}", "static calculateNetmask(mask) {\n return NetworkUtils.numToIp(2 ** 32 - 2 ** (32 - mask));\n }", "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "function ipv4ToInt(stringIP) {\n\tvar ipParte = stringIP.split('.');\n\treturn ((((((+ipParte[0]) * 256) + (+ipParte[1])) * 256) + (+ipParte[2])) * 256)\n\t\t\t+ (+ipParte[3]);\n}", "function IPAddress$createIpv4Mask(maskSize) {\n return -1<<(32-maskSize);\n}", "generateAndMask(numberOfAddressBits) {\r\n /*\r\n this.andMask = 1\r\n for(let i = 0; i < numberOfAddressBits; i++) {\r\n this.andMask = (this.andMask << 1) + 1\r\n }\r\n */\r\n let andMask = (1 << numberOfAddressBits) - 1\r\n //console.log(\"DEBUG andMask=\" + andMask)\r\n return andMask\r\n }", "function isIPv4Address(inputString) {\n let ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; \n return inputString.match(ipformat) ? true : false;\n \n}", "function calculateIPCIDR(ip) {\n /*\n var x = mask.value;\n var re = new RegExp(\"^([0-9]{1,3}\\.){3}[0-9]{1,3}(( ([0-9]{1,3}\\.){3}[0-9]{1,3})|(/[0-9]{1,2}))$\");\n if( !re.test(mask.value) ) {\n var s = \"Use IP & CIDR Netmask: 10.0.0.1/22\";\n s += \"\\nOr IP & Netmask: 10.0.0.1 255.255.252.0\";\n //s += \"\\nOr IP & Wildcard Mask: 10.0.0.1 0.0.3.255\";\n mask.focus();\n mask.select();\n return false;\n }\n */\n\n var ipa = ip.split('/');\n if( ipa.length = 2 ) {\n var a = ipa[0].split('.');\n nAddr[0] = parseInt(a[0]);\n nAddr[1] = parseInt(a[1]);\n nAddr[2] = parseInt(a[2]);\n nAddr[3] = parseInt(a[3]);\n nMask = cidr2octet(ipa[1]);\n } else {\n nAddr = ip.split('.');\n }\n displayInfo();\n}", "function trigger(){\r\n\t_in = document.getElementById(\"subnet\");\r\n\t_ip = document.getElementById(\"ip_addr\")\r\n\t_dbg(\"\");\r\n\t\r\n\tvar subn = new IPv4SubnetUtils();\r\n\tsubn.initialize(_in.value);\r\n\t\t\r\n\tif (subn.is_valid_format() && IPv4SubnetUtils.is_valid_address(_ip.value)){\r\n\t\t\r\n\t\t/*\r\n\t\tvar bin_str = subn.get_binary_addr(false);\r\n\t\tconsole.log(\"Binary address: \"+bin_str);\r\n\t\t\r\n\t\tvar bin_nm = subn.get_binary_netm();\t\t\r\n\t\tconsole.log(\"Binary netmask: \"+bin_nm+\", \"+IPv4Subnet.bin2dot_decimal(bin_nm));\r\n\t\t\r\n\t\tvar bin_broadcast = subn.get_binary_broadcast();\r\n\t\tvar broadcast = subn.get_broadcast();\t\t\r\n\t\tconsole.log(\"Binary broadcast: \"+bin_broadcast+\", Broadcast IP: \" + broadcast );\r\n\t\t\r\n\t\tvar minhost = subn.get_binary_minhost();\r\n\t\tvar maxhost = subn.get_binary_maxhost();\r\n\t\tconsole.log(\"maxhost: \" + maxhost + \", IP: \" + subn.get_maxhost());\r\n\t\tconsole.log(\"minhost: \" + minhost + \", IP: \" + subn.get_minhost());\r\n\t\t*/\r\n\t\tvar isIn = subn.within(_ip.value);\r\n\t\tconsole.log(\"IP in given subnet: \" + isIn.toString());\r\n\t\t\r\n\t}\r\n\t\r\n}", "function extractIPformat(val,tpart,tpartip4) {\r\n var tpartip4txt = new Array(4); \r\n var tparttxt = new Array(8);\r\n var tparttxt2 = new Array(2);\r\n var typeIP;\r\n\r\n tparttxt[0]=tparttxt[1]=tparttxt[2]=tparttxt[3]=tparttxt[4]=tparttxt[5]=tparttxt[6]=tparttxt[7]='0';\r\n tpart[0]=tpart[1]=tpart[2]=tpart[3]=tpart[4]=tpart[5]=tpart[6]=tpart[7]=0;\r\n //IPv4 or IPv6 alternative \r\n tpartip4txt[0]=tpartip4txt[1]=tpartip4txt[2]=tpartip4txt[3]='0';\r\n tpartip4[0]=tpartip4[1]=tpartip4[2]=tpartip4[3]=0;\r\n typeIP=checkIPformat(val);\r\n if (typeIP>=0) {\r\n\t switch (typeIP) {\r\n\t\t case 1: {\r\n\t\t\t tpartip4 = val.split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 2: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t break;\r\n\t\t }\r\n\t\t case 3: {\r\n\t\t\t val = expended(val);\r\n\t\t\t tparttxt = val.split(':');\r\n\t\t\t tpartip4 = tparttxt[6].split('.');\r\n\t\t\t tparttxt[6]=(tpartip4[0]*256+tpartip4[1]*1).toString(16);\r\n\t\t\t tparttxt[7]=(tpartip4[2]*256+tpartip4[3]*1).toString(16);\r\n\t\t\t break;\r\n\t\t }\r\n\t }\r\n\t for (var i=0;i<8;i++) { tpart[i]=parseInt(tparttxt[i],16); }\r\n }\r\n return typeIP;\r\n}", "function IPv4_dotquadA_to_intA( strbits ) {\r\n\tvar split = strbits.split( '.', 4 );\r\n\tvar myInt = (\r\n\t\tparseFloat( split[0] * 16777216 )\t/* 2^24 */\r\n\t + parseFloat( split[1] * 65536 )\t\t/* 2^16 */\r\n\t + parseFloat( split[2] * 256 )\t\t/* 2^8 */\r\n\t + parseFloat( split[3] )\r\n\t);\r\n\treturn myInt;\r\n}", "parse4in6(address) {\n const groups = address.split(':');\n const lastGroup = groups.slice(-1)[0];\n const address4 = lastGroup.match(constants4.RE_ADDRESS);\n if (address4) {\n this.parsedAddress4 = address4[0];\n this.address4 = new Address4(this.parsedAddress4);\n for (let i = 0; i < this.address4.groups; i++) {\n if (/^0[0-9]+/.test(this.address4.parsedAddress[i])) {\n throw new AddressError(\"IPv4 addresses can't have leading zeroes.\", address.replace(constants4.RE_ADDRESS, this.address4.parsedAddress.map(spanLeadingZeroes4).join('.')));\n }\n }\n this.v4 = true;\n groups[groups.length - 1] = this.address4.toGroup6();\n address = groups.join(':');\n }\n return address;\n }", "function IPv4_BitShiftLeft( mask, bits ) {\r\n\treturn ( mask * Math.pow( 2, bits ) );\r\n}", "function valid_same_network(ip1, mask1, ip2, mask2)\n{\n\tvar ips1 = ip1.split('.');\n\tvar ips2 = ip2.split('.');\n\tvar m1 = mask1.split('.');\n\tvar m2 = mask2.split('.');\n\tvar ipv1 = (parseInt(ips1[0],10)<<24)|(parseInt(ips1[1],10)<<16)|(parseInt(ips1[2])<<8)|parseInt(ips1[3]);\n\tvar ipv2 = (parseInt(ips2[0],10)<<24)|(parseInt(ips2[1],10)<<16)|(parseInt(ips2[2])<<8)|parseInt(ips2[3]);\n\tvar msk1 = (parseInt(m1[0],10)<<24)|(parseInt(m1[1],10)<<16)|(parseInt(m1[2],10)<<8)|parseInt(m1[3],10);\n\tvar msk2 = (parseInt(m2[0],10)<<24)|(parseInt(m2[1],10)<<16)|(parseInt(m2[2],10)<<8)|parseInt(m2[3],10);\n\tif((ipv1 & msk1) == (ipv2 & msk2)) \n\t\treturn true; \n\telse \n\t\treturn false;\n}", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "maxAddress() {\n // min + (2^(32-mask)) - 1 [zero needs to count]\n return this.minAddress() + this.networkSize - 1;\n }", "function isIPInMachinePart() {\n // get the ip, the mask and the network address the user wrote\n let ip = document.getElementById('ip_address-f4').value;\n let ipParts = new Array(4);\n let mask = document.getElementById('mask-f4').value;\n let maskParts = new Array(4);\n let net = document.getElementById('net_address-f4').value;\n let netParts = new Array(4);\n\n // verifying data validity\n if(verifyIPAddress(ip, ipParts) && (verifyMaskCIDR(mask) || verifyMaskDecimal(mask, maskParts))\n && verifyIPAddress(net, netParts)) {\n // verify if the IPs are in the same network\n // if there aren't, IP can't be in the network machine part\n if(isInNetwork(ipParts, netParts, mask, maskParts)) {\n let unauthorizedAddress = [\"\", \"\", \"\", \"\"]; // broadcast address\n maskParts = convertMaskToBinary(mask);\n\n // calculating the broadcast part\n for (let i = 0 ; i < ipParts.length ; i++) {\n for (let j = 0; j < ipParts[i].length; j++) {\n if(maskParts[i][j].localeCompare(\"1\") == 0) {\n unauthorizedAddress[i] += ipParts[i][j];\n }\n else {\n unauthorizedAddress[i] += \"1\";\n }\n }\n }\n\n // converting in decimal and displaying the answer\n for (let i = 0 ; i < ipParts.length ; i++) {\n ipParts[i] = convert(ipParts[i], 2, 10);\n unauthorizedAddress[i] = convert(unauthorizedAddress[i], 2, 10);\n netParts[i] = convert(netParts[i], 2, 10);\n if(ipParts[i].localeCompare(netParts[i]) == 0 || ipParts[i].localeCompare(unauthorizedAddress[i]) == 0) {\n answerF4.innerText = \"This IP address is not authorized in this network.\";\n }\n else answerF4.innerText = \"This IP address is part of the network's machines address.\";\n }\n }\n else answerF4.innerText = \"This IPs are not in the same network.\";\n // data not valid\n } else {\n answerF4.innerText = \"\";\n if(!verifyIPAddress(ip, ipParts)) answerF4.innerText += \"IP address is not valid.\";\n if(!verifyMaskCIDR(mask)) answerF4.innerText += \"\\nMask is not valid.\";\n if(!verifyIPAddress(net, netParts)) answerF4.innerText += \"\\nNetwork address is not valid.\";\n }\n}", "function AllZeroesOrOnes(binary, subnet_hostID_bits) { \r\n\tvar i;\r\n\tvar result = 2;\r\n\r\n\t//alert(\"subnet_hostID_bits : \" + subnet_hostID_bits);\r\n\r\n\tfor(i = 0; i < subnet_hostID_bits && binary.charAt(i) == '0'; i ++);\r\n\tif(i == subnet_hostID_bits) {\r\n\t\tresult = 0;\r\n\t}\r\n\r\n\t//alert(\"After reversing, binary : \" + binary);\r\n\r\n\tfor(i = 0; i < subnet_hostID_bits && binary.charAt(i) == '1'; i ++);\r\n\tif(i == subnet_hostID_bits) {\r\n\t\tresult = 1;\r\n\t}\r\n\treturn result;\r\n}", "function validateIp(value, type)\n{\t\n\tvar ipv4 = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$';\n\tvar ipv4CIDR = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/(\\d|[1-2]\\d|3[0-2]))$';\n\t\n\tvar ipv6 = '^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*';\n\t\n\tvar ipv6CIDR = '^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*(\\/(\\d|\\d\\d|1[0-1]\\d|12[0-8]))$';\n\t\n\t\n\tvar return_val = false;\n\tswitch(type)\n\t{\n\t\tcase '4':\n\t\t\tvar ipRE = new RegExp( ipv4 );\n\t\t\tvar ipRE_CIDR = new RegExp( ipv4CIDR );\n\t\t\treturn_val = (ipRE.test( value ) || ipRE_CIDR.test( value ));\n\t\t\tbreak;\n\t\tcase '6':\n\t\t\tvar ipRE = new RegExp( ipv6 );\n\t\t\tvar ipRE_CIDR = new RegExp( ipv6CIDR );\n\t\t\treturn_val = (ipRE.test( value ) || ipRE_CIDR.test( value ));\n\t\t\tbreak;\n\t}\n\treturn return_val;\n}", "function check_ipv4_input(obj) {\n ip = obj.value;\n if (!ip.match('^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$')) {\n alert('IP format is not valid!');\n obj.value = '0.0.0.0';\n return true;\n }\n}", "function octet2cidr(aMask) {\n var mask = octet2dec(aMask);\n // get binary string\n mask = mask.toString(2);\n // return mask length\n return mask.indexOf(0);\n}", "function IPv4_intA_to_binstrA( strnum ) {\r\n\tvar numStr = strnum.toString( 2 ); /* Initialize return value as string */\r\n\tvar numZeros = 32 - numStr.length; /* Calculate no. of zeros */\r\n\tif (numZeros > 0) {\tfor (var i = 1; i <= numZeros; i++) { numStr = \"0\" + numStr }\t} \r\n\treturn numStr;\r\n}", "function maskInvert(mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return (((~parseInt(mask.toBin().substr(0,16), 2)) & 0xffff) * factor16 + (~parseInt(mask.toBin().substr(16,16), 2) & 0xffff));\n}", "function IPv4_intA_to_dotquadA( strnum ) {\r\n\tvar byte1 = ( strnum >>> 24 );\r\n\tvar byte2 = ( strnum >>> 16 ) & 255;\r\n\tvar byte3 = ( strnum >>> 8 ) & 255;\r\n\tvar byte4 = strnum & 255;\r\n\treturn ( byte1 + '.' + byte2 + '.' + byte3 + '.' + byte4 );\r\n}", "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "function testIsIp4AddressInCidrBlock() {\n assertTrue(ndebug.DNSResponsePacketAnalyzer.isIp4AddressInCidrBlock(\n '173.194.0.0', '173.194.0.0/16'));\n assertFalse(ndebug.DNSResponsePacketAnalyzer.isIp4AddressInCidrBlock(\n '173.192.0.0', '173.194.0.0/16'));\n assertTrue(ndebug.DNSResponsePacketAnalyzer.isIp4AddressInCidrBlock(\n '173.194.1.1', '173.194.0.0/16'));\n assertFalse(ndebug.DNSResponsePacketAnalyzer.isIp4AddressInCidrBlock(\n '173.195.0.0', '173.194.0.0/16'));\n}", "function isValidIP(objIP) \r\n\t{\r\n\t\tvar strIPtext = objIP.value; \r\n\t\tif ((strIPtext.length == 0) || IsAllSpaces(strIPtext)) \r\n\t\t{ \r\n\t\t\t// IP Empty\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\t\r\n\t\tif ( countChars(strIPtext,\".\") != 3) \r\n\t\t{ \r\n\t\t\t// Invalid Format, number of dots is not 3\r\n\t\t\treturn 2;\r\n\t\t}\r\n\t\tvar arrIP = strIPtext.split(\".\");\r\n\t\t\t\r\n\t\tfor(var i = 0; i < 4; i++)\r\n\t\t{\r\n\t\t\tif ( (arrIP[i].length < 1 ) || (arrIP[i].length > 3 ) )\r\n\t\t\t{\r\n\t\t\t\t// Invalid Format, continuous dots or more than 3 digits given between dots\r\n\t\t\t\treturn 2;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tif ( !isInteger(arrIP[i]) )\r\n\t\t\t{\r\n\t\t\t\t// non-integers present in the value\r\n\t\t\t\treturn 3;\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\tarrIP[i] = parseInt(arrIP[i]);\r\n\t\t\t\t\r\n\t\t\tif(i == 0)\r\n\t\t\t{\r\n\t\t\t\t// start IP value\r\n\t\t\t\tif(arrIP[i] == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP value must not be 0\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(arrIP[i] > 223)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be > 223\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\t}\r\n\t\t\t\tif(arrIP[i] == 127)\r\n\t\t\t\t{\r\n\t\t\t\t\t// start IP must not be 127 - Loopback ip\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// the 2nd, 3rd and 4th IP values between the dots\r\n\t\t\t\t// these must not be more than 255\r\n\t\t\t\tif (arrIP[i] > 255)\r\n\t\t\t\t{\r\n\t\t\t\t\t// IP out of bound\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\t\r\n\t\tobjIP.value = arrIP.join(\".\");\r\n\t\t\t\r\n\t\tif(objIP.value == \"0.0.0.0\")\r\n\t\t{\r\n\t\t\t// IP all zeros\r\n\t\t\treturn 7;\r\n\t\t}\t\r\n\t\t\t\r\n\t\treturn 0;\r\n\t\t\t\r\n\t}\t// end of isValidIP", "function convertIpToDecimal(ip) {\n // a not-perfect regex for checking a valid ip address\n\t// It checks for (1) 4 numbers between 0 and 3 digits each separated by dots (IPv4)\n\t// or (2) 6 numbers between 0 and 3 digits each separated by dots (IPv6)\n\tvar ipAddressRegEx = /^(\\d{0,3}\\.){3}.(\\d{0,3})$|^(\\d{0,3}\\.){5}.(\\d{0,3})$/;\n\tvar valid = ipAddressRegEx.test(ip);\n\tif (!valid) {\n\t\treturn false;\n\t}\n\tvar dots = ip.split('.');\n\t// make sure each value is between 0 and 255\n\tfor (var i = 0; i < dots.length; i++) {\n\t\tvar dot = dots[i];\n\t\tif (dot > 255 || dot < 0) {\n\t\t\treturn false;\n\t\t}\n\t}\n\tif (dots.length == 4) {\n\t\t// IPv4\n\t\treturn ((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3]);\n\t} else if \n (dots.length == 6) {\n\t\t// IPv6\n\t\treturn ((((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3])*256)+(+dots[4])*256)+(+dots[5]);\n\t}\n\treturn false;\n}", "function IPv4_BinaryDotQuad( binaryString ) {\r\n\treturn ( binaryString.substr( 0, 8 ) +'.'+ binaryString.substr( 8, 8 ) +'.'+ binaryString.substr( 16, 8 ) +'.'+ binaryString.substr( 24, 8 ) );\r\n}", "function validIP(str) {\n numbers = str.split(\".\");\n if (numbers.length !== 4) return false;\n\n for (let i = 0; i < numbers.length; i++) {\n let number = parseInt(numbers[i]);\n if (number < 0 || number > 255) {\n return false;\n }\n }\n\n return true\n}", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function subnetAddress(ip, mask) {\n var result = [];\n\n for (i = 0; i < ip.length; i++) {\n var ip_sub_array = [];\n var mask_sub_array = [];\n var pre_result = [];\n\n // Les deux strings deviennent des arrays\n ip_sub_array = ip[i].split(\"\");\n mask_sub_array = mask[i].split(\"\");\n\n for (x = 0; x < ip_sub_array.length; x++) {\n if (ip_sub_array[x] == 1 && mask_sub_array[x] == 1) {\n pre_result.push(1);\n }\n else {\n pre_result.push(0);\n }\n }\n result.push(pre_result.join(\"\"));\n }\n\n return result;\n }", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function normalizeCIDR(s) {\n var parts = s.split(\"/\");\n if (parts.length != 2) {\n return s;\n }\n\n if (parts[1] == \"32\") {\n /* Most of the time (JavaScript spec and hardware lshift instruction)\n * only 5 bits are used in right operand.\n */\n return s;\n }\n\n var mask = parseInt(parts[1]);\n var ip_int = $.su.func.ipToInt(parts[0]);\n var mask_int = ((1 << mask) - 1) << (32 - mask);\n var norm_ip_int = ip_int & mask_int;\n return $.su.func.intToIp(norm_ip_int) + \"/\" + mask;\n}", "function IPAddress$getValidIPv4(address) {\n debug$assertValidString(address);\n if (!isString(address) || !IPv4_REGEX.test(address)) {\n return;\n }\n\n var parts = address.split('.');\n // there are fewer than four parts to the address\n if (parts.length !== 4) {\n return;\n }\n\n // check that each address part has a valid value\n for (var i = 0; i < parts.length; i++) {\n var parsedOctet = parseInt10(parts[i]);\n if (parsedOctet < 0 || !isUInt(parsedOctet, 0, 255) ||\n (parts[i].length !== 1 && parts[i].indexOf('0') === 0)) {\n return;\n }\n }\n return address;\n}", "function checkIPformat(txt) {\r\n var res,formataddr,formataddr2,i,ltxt;\r\n res = -1;\r\n // IP4\r\n formataddr = checkIP4format(txt);\r\n if (formataddr<0) {\r\n\t// IPv6?\r\n\tltxt = txt.split(':');\r\n\tif (ltxt.length>2) {\r\n\t formataddr = 2;\r\n for (i=0;i<ltxt.length;i++) {\r\n\t if (i==(ltxt.length-1)) {\r\n\t\tformataddr2 = checkIP4format(ltxt[i]);\r\n\t formataddr3 = ltxt[i].search(/^([0-9]|[a-f]){1,4}$/i);\r\n\t\tres=2; \r\n\t\tif (ltxt[i]!='') {\r\n\t\t\tif ((formataddr2<0)&&(formataddr3<0)) {\r\n\t\t\t\tres = -1;\r\n\t\t } else {\r\n\t if (formataddr2>=0) formataddr = 3;\r\n\t\t }\r\n\t\t}\r\n\t } else {\r\n\t\tif (ltxt[i]!='') {\r\n\t res = ltxt[i].search(/^([0-9]|[a-f]){1,4}$/i);\r\n\t\t} else {\r\n\t\t\tres = 2;\r\n\t\t}\r\n\t }\r\n\t if (res<0){\r\n\t\t formataddr= -1\r\n\t\t break;\r\n\t }\r\n }\r\n\t}\r\n\r\n }\r\n return formataddr;\t\r\n}", "getBroadcastAddress () {\n\t\tlet num, inverse;\n\n\t\tif ((! this.isValid) || (this.netmaskOctets.length != 4)) {\n\t\t\treturn (\"\");\n\t\t}\n\t\tconst addr = [ ];\n\t\tfor (let i = 0; i < 4; ++i) {\n\t\t\tnum = this.octets[i];\n\t\t\tnum &= this.netmaskOctets[i];\n\t\t\tinverse = ~(this.netmaskOctets[i]);\n\t\t\tinverse &= 0xFF;\n\t\t\tinverse >>>= 0;\n\t\t\tnum |= inverse;\n\t\t\tnum >>>= 0;\n\t\t\taddr.push (num);\n\t\t}\n\t\treturn (addr.join (\".\"));\n\t}", "function isIPV4(url)\r\n{\r\n var reg = new RegExp(\"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$\");\r\n return reg.test(url);\r\n}", "function isValidIPv6Address(ipStr) {\n\t var validateIPv4Address = __webpack_require__(323).validateIPv4Address\n\t\n\t // We need to have at least one ':'\n\t if (ipStr.indexOf(':') == -1) {\n\t return false\n\t }\n\t\n\t // We can only have one '::' shortener\n\t if (String_count(ipStr, '::') > 1) {\n\t return false\n\t }\n\t\n\t // '::' should be encompassed by start, digits or end\n\t if (ipStr.indexOf(':::') != -1) {\n\t return false\n\t }\n\t\n\t // A single colon can neither start nor end an address\n\t if ((ipStr.charAt(0) == ':' && ipStr.charAt(1) != ':') ||\n\t (ipStr.charAt(ipStr.length - 1) == ':' &&\n\t ipStr.charAt(ipStr.length - 2) != ':')) {\n\t return false\n\t }\n\t\n\t // We can never have more than 7 ':' (1::2:3:4:5:6:7:8 is invalid)\n\t if (String_count(ipStr, ':') > 7) {\n\t return false\n\t }\n\t\n\t // If we have no concatenation, we need to have 8 fields with 7 ':'\n\t if (ipStr.indexOf('::') == -1 && String_count(ipStr, ':') != 7) {\n\t // We might have an IPv4 mapped address\n\t if (String_count(ipStr, '.') != 3) {\n\t return false\n\t }\n\t }\n\t\n\t ipStr = _explodeShorthandIPstring(ipStr)\n\t\n\t // Now that we have that all squared away, let's check that each of the\n\t // hextets are between 0x0 and 0xFFFF.\n\t var hextets = ipStr.split(':')\n\t for (var i = 0, l = hextets.length, hextet; i < l; i++) {\n\t hextet = hextets[i]\n\t if (String_count(hextet, '.') == 3) {\n\t // If we have an IPv4 mapped address, the IPv4 portion has to\n\t // be at the end of the IPv6 portion.\n\t if (ipStr.split(':').pop() != hextet) {\n\t return false\n\t }\n\t try {\n\t validateIPv4Address(hextet)\n\t }\n\t catch (e) {\n\t if (!(e instanceof ValidationError)) {\n\t throw e\n\t }\n\t return false\n\t }\n\t }\n\t else {\n\t if (!hexRE.test(hextet)) {\n\t return false\n\t }\n\t var intValue = parseInt(hextet, 16)\n\t if (isNaN(intValue) || intValue < 0x0 || intValue > 0xFFFF) {\n\t return false\n\t }\n\t }\n\t }\n\t\n\t return true\n\t}", "function isValidIP(str) {\n return (/^(?=\\d+\\.\\d+\\.\\d+\\.\\d+$)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\\.?){4}$/.test(str));\n}", "function HostIDBits(ip) {\r\n\tvar IPSegment;\r\n\tvar bits = 0;\r\n\r\n\tIPSegment = ip.split(\".\");\r\n\t\r\n\tif(IPSegment[0] == 127) {\r\n\t\treturn -1; // for loopback address\r\n\t} else if(IPSegment[0] >= 224 && IPSegment[0] < 240) {\r\n\t\treturn -2; // for multicast address\r\n\t} else if(IPSegment[0] >= 240) {\r\n\t\treturn -3; // for future use\r\n\t}\r\n\r\n\tif(IPSegment[0] < 127) { // Class A, by the way, 127 is for loopback address\r\n\t\tbits = 24;\r\n\t} else if(IPSegment[0] < 192) { // Class B\r\n\t\tbits = 16;\r\n\t} else if(IPSegment[0] < 224) { // Class C\r\n\t\tbits = 8;\r\n\t} \r\n\r\n\treturn bits;\r\n}", "function check(start, level, previous){ /* function check to see if the value is valid */\n let i = 0;\n let num;\n\n if (level === 3) {\n num = str.substring(start);\n if (num && num < 256) { /* need to make sure that numbers are lower than 256 (not part of IPv4) */\n result.push(`${previous}.${num}`); /* push results into the reserved array */\n }\n return;\n }\n \n num = str.substring(start, start + 1);\n \n if (num == 0) { /* */\n check(start + 1, level + 1, level === 0 ? `${num}`: `${previous}.${num}`);\n } \n \n else { \n while (num.length < 4 && num < 256 && start + i + 1 < length) { /* running this until IP is false */\n check(start + i + 1, level + 1, level === 0 ? `${num}`: `${previous}.${num}`);\n i++;\n num = str.substring(start, start + i + 1);\n }\n }\n }", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function ipMask(s2){\r\n\t \r\n \r\n var s2 = document.getElementById(s2);\r\n \r\n\t \r\n\t if(s2.value == \"1\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 255; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =32;\r\n\t\t\t\r\n\t\t\t hostBits =0 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 1 ;\r\n\t\t\t\t\t\t\t\t \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"2\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 254; \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =31;\r\n\t\t\t\r\n\t\t\t hostBits =1 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 2 ;\r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"3\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 252; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =30;\r\n\t\t\t\r\n\t\t\t hostBits =2 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 3 ;\r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"4\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 248; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =29;\r\n\t\t\t\r\n\t\t\t hostBits =3 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 4 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"5\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 240; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =28;\r\n\t\t\t\r\n\t\t\t hostBits =4 ;\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 5 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"6\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 224; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =27;\r\n\t\t\t\r\n\t\t\t hostBits =5 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 6 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"7\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 192; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =26;\r\n\t\t\t\r\n\t\t\t hostBits =6 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 7 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"8\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 128; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =25;\r\n\t\t\t\r\n\t\t\t hostBits =7 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 8 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//-------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"9\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 255;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =24;\r\n\t\t\t\r\n\t\t\t hostBits =8 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 9 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"10\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 254;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =23;\r\n\t\t\t\r\n\t\t\t hostBits =9 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 10 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"11\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 252;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =22;\r\n\t\t\t\r\n\t\t\t hostBits =10 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 11 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"12\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 248;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =21;\r\n\t\t\t\r\n\t\t\t hostBits =11 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 12 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"13\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 240;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =20;\r\n\t\t\t\r\n\t\t\t hostBits =12 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 13 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"14\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 224;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =19;\r\n\t\t\t\r\n\t\t\t hostBits =13 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 14 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"15\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 192;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =18;\r\n\t\t\t\r\n\t\t\t hostBits =14 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 15 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"16\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 128;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =17;\r\n\t\t\t\r\n\t\t\t hostBits =15 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 16 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//----------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"17\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 255;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\r\n //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =16;\r\n\t\t\t\r\n\t\t\t hostBits =16 ;\r\n\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 17 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"18\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 254;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 1;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =15;\r\n\t\t\t\r\n\t\t\t hostBits =17 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 18 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"19\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 252;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 3;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =14;\r\n\t\t\t\r\n\t\t\t hostBits =18 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 19 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"20\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 248;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 7;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 20 ; \r\n dropSelect =1;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =13;\r\n\t\t\t\r\n\t\t\t hostBits =19 ;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"21\"){\r\n \r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 240;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 15;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =12;\r\n\t\t\t\r\n\t\t\t hostBits =20 ;\r\n \r\n\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 21 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"22\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 224;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 31;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =11;\r\n\t\t\t\r\n\t\t\t hostBits =21 ;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 22 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"23\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 192;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 63;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =10;\r\n\t\t\t\r\n\t\t\t hostBits =22;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 23 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"24\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 128;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 127;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =9;\r\n\t\t\t\r\n\t\t\t hostBits =23;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 24 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------------------------------------------------------\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"25\"){\r\n \r\n ipA = 255;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\r\n //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 0;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =8;\r\n\t\t\t\r\n\t\t\t hostBits =24;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\r\n\t\t\t\t\t\t\t kase = 25 ; \r\n dropSelect =1;\r\n \r\n \r\n\t } \r\n \r\n else if(s2.value == \"26\"){\r\n \r\n \r\n ipA = 254;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 1;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =7;\r\n\t\t\t\r\n\t\t\t hostBits =25;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 26 ; \r\n dropSelect =1;\t\t\t\t\t\t\t\t\t\t\t \r\n \r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"27\"){\r\n \r\n \r\n ipA = 252;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 3;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =6;\r\n\t\t\t\r\n\t\t\t hostBits =26;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t kase = 27 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n \r\n \r\n \r\n \r\n else if(s2.value == \"28\"){\r\n \r\n \r\n ipA = 248;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 7;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =5;\r\n\t\t\t\r\n\t\t\t hostBits =27;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 28 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n \r\n else if(s2.value == \"29\"){\r\n \r\n \r\n ipA = 240;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 15;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =4;\r\n\t\t\t\r\n\t\t\t hostBits =28;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t kase = 29 ; \r\n dropSelect =1;\r\n \r\n }\r\n \r\n \r\n else if(s2.value == \"30\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 224;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 31;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =3;\r\n\t\t\t\r\n\t\t\t hostBits =29;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 30 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"31\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 192;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0; \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 63;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =2;\r\n\t\t\t\r\n\t\t\t hostBits =30;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 31 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\telse if(s2.value == \"32\"){\r\n \r\n \r\n \r\n\t\t\t\t\t\t\t\t\t\t\t ipA = 128;\r\n\t\t\t\r\n\t\t\t ipB = 0;\r\n\t\t\t\r\n\t\t\t ipC = 0;\r\n\t\t\t\r\n\t\t\t ipD = 0;\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t //-------Value to add for Broad Cast --------------\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t ipBr1 = 127;\r\n\t\t\t\t\t\t\t\t\t ipBr2 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr3 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t ipBr4 = 255;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t subBits =1;\r\n\t\t\t\r\n\t\t\t hostBits =31;\r\n\t\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t\t\t kase = 32 ; \r\n\t\t dropSelect =1; \r\n \r\n \r\n }\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n}", "function subnetID(aNet,aMask){\n var a = new Array(0,0,0,0);\n for(var i=0;i<4;i++){\n a[i] = aNet[i] & aMask[i];\n }\n return a;\n}", "function ip2long(IP) {\n // discuss at: http://phpjs.org/functions/ip2long/\n // original by: Waldo Malqui Silva (http://waldo.malqui.info)\n // improved by: Victor\n // revised by: fearphage (http://http/my.opera.com/fearphage/)\n // revised by: Theriault\n // example 1: ip2long('192.0.34.166');\n // returns 1: 3221234342\n // example 2: ip2long('0.0xABCDEF');\n // returns 2: 11259375\n // example 3: ip2long('255.255.255.256');\n // returns 3: false\n\n var i = 0;\n // PHP allows decimal, octal, and hexadecimal IP components.\n // PHP allows between 1 (e.g. 127) to 4 (e.g 127.0.0.1) components.\n IP = IP.match(\n /^([1-9]\\d*|0[0-7]*|0x[\\da-f]+)(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?(?:\\.([1-9]\\d*|0[0-7]*|0x[\\da-f]+))?$/i\n ); // Verify IP format.\n if (!IP) {\n // Invalid format.\n return false;\n }\n // Reuse IP variable for component counter.\n IP[0] = 0;\n for (i = 1; i < 5; i += 1) {\n IP[0] += !! ((IP[i] || '')\n .length);\n IP[i] = parseInt(IP[i]) || 0;\n }\n // Continue to use IP for overflow values.\n // PHP does not allow any component to overflow.\n IP.push(256, 256, 256, 256);\n // Recalculate overflow of last component supplied to make up for missing components.\n IP[4 + IP[0]] *= Math.pow(256, 4 - IP[0]);\n if (IP[1] >= IP[5] || IP[2] >= IP[6] || IP[3] >= IP[7] || IP[4] >= IP[8]) {\n return false;\n }\n return IP[1] * (IP[0] === 1 || 16777216) + IP[2] * (IP[0] <= 2 || 65536) + IP[3] * (IP[0] <= 3 || 256) + IP[4] * 1;\n}", "function isIPv4(string) {\n return !!/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(string);\n}", "function validateIP(attempt){\n const ip = attempt.split(\".\")\n const ipLengthIs4 = ip.length === 4\n const inRange = ip.every(segment => {\n return segment >= 0 && segment <= 255\n })\n return ipLengthIs4 && inRange\n }", "static validIp(ipAddress) {\n const octets = ipAddress.split('.');\n if (octets.length !== 4) {\n return false;\n }\n return octets.map((octet) => parseInt(octet, 10)).\n filter((octet) => octet >= 0 && octet <= 255).length === 4;\n }", "is_ip(value) {\n const net = require('net')\n return (net.isIPv4(value) || net.isIPv6(value));\n }", "minAddress() {\n const div = this.networkAddress % this.networkSize;\n return this.networkAddress - div;\n }", "static fourCCInt(str4) {\nvar cc0, cc1, cc2, cc3, has4, s;\n//---------\nhas4 = 4 <= str4.length;\ns = has4 ? str4 : str4 + String.fromCharCode(0, 0, 0, 0);\ncc0 = s.charCodeAt(0) & 0xFF;\ncc1 = s.charCodeAt(1) & 0xFF;\ncc2 = s.charCodeAt(2) & 0xFF;\ncc3 = s.charCodeAt(3) & 0xFF;\nreturn (((((cc3 << 8) | cc2) << 8) | cc1) << 8) | cc0;\n}", "function add32(a, b) {\nreturn (a + b) & 0xFFFFFFFF;\n}", "function add32(a, b) {\nreturn (a + b) & 0xFFFFFFFF;\n}", "function cidr2octet(bits) {\n var bits = parseInt(bits);\n if( bits < 0 | bits > 32 ) {\n alert(\"Invalid 32 bit DIDR mask. You entered \"+bits);\n return false;\n }\n // make up our mask\n var ones = \"11111111111111111111111111111111\";\n var mask = parseInt(ones.substring(0,bits),2);\n var shift = 32-bits;\n // poor mans bit shift because javascript uses 32 bit integers\n mask = mask * Math.pow(2,shift);\n\n return dec2octet(mask);\n}", "function isValidIP(str) {\n str = str.split('.');\n return str.length == 4 && str.every(\n (val) =>\n (\n val.length <= 3)\n && (/^\\d+/.test(val))\n && (parseInt(val) < 256)\n && val.indexOf(' ') == -1\n );\n}", "function checkForIPAdd()\r\n{\r\n\tvar vLB = $.trim($(\"#txtIPLB\").val());\r\n\tvar vUB = $.trim($(\"#txtIPUB\").val());\t\r\n\tif(vLB === \"\")\r\n\t{\r\n\t\treturn \"l\";\r\n\t}\r\n\telse if(vUB === \"\")\r\n\t{\r\n\t\treturn \"u\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\t\r\n\t\t//var vIPString = \"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$\";\r\n\t\t\r\n\t\t//var vIPString = \"/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/\";\r\n\t\t\r\n\t\t//var vIPString = \"/^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/\";\r\n\t\t\r\n\t\t\r\n\t\tvar splitLB = vLB.split('.');\r\n\t\tvar splitUB = vUB.split('.');\r\n\t\t\r\n\t\tif (splitLB.length != 4)\r\n\t\t{\r\n\t\t\treturn \"l\";\r\n\t\t}\r\n\t\telse if(splitLB.length === 4)\r\n\t\t{\r\n\t\t\tfor (var i=0; i<splitLB.length; i++) \r\n\t\t\t{\r\n\t\t\t\tvar s = splitLB[i];\r\n\t\t\t\tif (s.length==0 || isNaN(s) || s<0 || s>255)\r\n\t\t\t\t\treturn \"l\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(splitUB.length != 4)\r\n\t\t\treturn \"u\";\r\n\t\telse if(splitUB === 4)\r\n\t\t{\r\n\t\t\tfor (var i=0; i<splitUB.length; i++) \r\n\t\t\t{\r\n\t\t\t\tvar s = splitUB[i];\r\n\t\t\t\tif (s.length==0 || isNaN(s) || s<0 || s>255)\r\n\t\t\t\t\treturn \"u\";\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n}", "function _IsLegalSubnet(subnet, bits) {\r\n\tvar binary_subnet = \"\";\r\n\tvar i, arr;\r\n\tvar subnet_hostID_bits = 0;\r\n\tvar networkID_bits = 32 - bits;\r\n\r\n\r\n\t//alert(\"Bit : \" + bits);\r\n\tfor(i = 0, arr = subnet.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_subnet += ToBinary(arr[i]);\r\n\t}\r\n\t//alert(binary_subnet);\r\n\tfor(i = 0; i < binary_subnet.length; i ++) {\r\n\t\tif(binary_subnet.charAt(i) != '1') break;\r\n\t}\r\n\tsubnet_hostID_bits = i;\r\n\t//alert(\"netmask length : \" + subnet_hostID_bits);\r\n\tfor(i ++; i < binary_subnet.length; i ++) {\r\n\t\tif(binary_subnet.charAt(i) == '1') {\r\n\t\t\tsubnet_hostID_bits = -1;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(subnet_hostID_bits != -1) {\r\n\t\tif(networkID_bits > subnet_hostID_bits) {\r\n\t\t\tsubnet_hostID_bits = -1;\r\n\t\t} else {\r\n\t\t\tsubnet_hostID_bits -= networkID_bits;\r\n\t\t\tsubnet_hostID_bits = bits - subnet_hostID_bits;\r\n\t\t}\r\n\t}\r\n\r\n\treturn subnet_hostID_bits;\r\n}", "function addressToBytes32(address) {\n return '0x000000000000000000000000' + address.substr(2);\n}", "static calculateNetsize(mask) {\n return 2 ** (32 - mask);\n }", "function validIp(str) {\n let terms = str.split(\".\");\n for (let i = 0; i < terms.length; i++) {\n let term = parseInt(terms[i]);\n if (term > 255 || term < 0) {\n return false;\n }\n }\n return true;\n}", "function IPv4_binstrA_to_intA( binstr ) {\r\n\treturn parseInt( binstr, 2 );\r\n}", "IsIcmpTypeAllowed(NET_FW_IP_VERSION_, string, byte, Variant, Variant) {\n\n }", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "async function v10(v11,v12,v13,v14,v15) {\n var v16 = v3 & v14;\n // v16 = .integer | .bigint\n}", "function int64add4(dst, a, b, c, d) {\n\t var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff);\n\t var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16);\n\t var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16);\n\t var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16);\n\t dst.l = (w0 & 0xffff) | (w1 << 16);\n\t dst.h = (w2 & 0xffff) | (w3 << 16);\n\t }", "function safeAdd(x,y){var lsw=(x&0xffff)+(y&0xffff);var msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&0xffff;}", "function add32(a, b) {\n return a + b & 0xFFFFFFFF;\n}", "function add32(a, b) {\n return a + b & 0xFFFFFFFF;\n}", "function formatType(addrStr)\n{\n var pos = addrStr.indexOf(\"..\");\n if(pos != -1)\n\treturn -1; \n var a = addrStr.split(\".\");\n if(a.length < 2)\n\t\treturn false;\n var allInt = true;\n for(var i=0; i < a.length; i++)\n {\n if(!isIntStr(a[i]))\n\t\tallInt = false;\n }\n if(allInt)\n {\n\tif(a.length == 4)\n\t\treturn 0; //ip\n\treturn -1;//incorrect ip\n }\n return 1; // domain\n}", "function ipsBetween(start, end) {\n const arrStart = start.split('.')\n const arrEnd = end.split('.')\n let res = {\n \"0\": 0,\n \"1\": 0,\n \"2\": 0,\n \"3\": 0,\n };\n\n arrStart.forEach((value, i) => {\n if (value !== arrEnd[i]) {\n if (value < arrEnd[i]) {\n for (let j = +value; j < +arrEnd[i]; j++) {\n res[i] += 1\n }\n } else {\n res[i] = \"m \" + value\n }\n }\n })\n\n return Object.entries(res).reduce((acc, curr) => {\n switch (true) {\n case curr[0] === \"0\" && curr[1] !== 0:\n acc += (65536 * 256) * curr[1]\n return acc\n case curr[0] === \"1\" && curr[1] !== 0:\n acc += (256 ** 2) * curr[1]\n return acc\n case curr[0] === \"2\" && curr[1] !== 0:\n acc += (curr[1] * 256)\n return acc\n case curr[0] === \"3\" && curr[1] !== 0:\n if (curr[1][0] === 'm') {\n acc -= +curr[1].split(' ')[1]\n } else {\n acc += curr[1]\n }\n return acc\n }\n return acc;\n }, 0)\n}", "function add32(a, b) {\n return a + b & 0xFFFFFFFF;\n }", "function parseFourCC(value) {\n return value.charCodeAt(0) +\n (value.charCodeAt(1) << 8) +\n (value.charCodeAt(2) << 16) +\n (value.charCodeAt(3) << 24);\n }", "function result(number) {\n var mask = 1 << 3;\n var maskAndNumber = mask & number;\n var check = maskAndNumber >> 3;\n\n return check;\n}", "function isIPV4Private(ipAddr)\r\n{\r\n //Split IP address on dots, obtain 4 numbers\t\r\n var substrIP = ipAddr.split('.');\r\n //Convert IP address into array of 4 integers\r\n var ipArray = substrIP.map(function(val){\r\n return parseInt(val, 10);\r\n });\r\n //For each IPv4 locally served zone\r\n for (var i = 0; i < localIPV4DNSZones.length; i++)\r\n {\r\n \t//Split the zone into array of J numbers\r\n var zone = localIPV4DNSZones[i].split('.');\r\n var k = 0;\r\n //For each number of local zone IP\r\n //(Decrementing, because local zones IPs are reverted\r\n for (var j = zone.length - 1; j >= 0; j--)\r\n {\r\n //Check if the corresponding numbers match\r\n //If not, then break and move onto next local zone\r\n if (ipArray[k] != zone[j])\r\n {\r\n break;\r\n }\r\n else if(j == 0) //Checked all numbers of local zone\r\n {\r\n return true;\r\n }\r\n k++;\r\n }\r\n }\r\n return false;\r\n}", "function startingIP(aNet,aMask){\n var a = subnetID(aNet,aMask);\n var d = octet2dec(a);\n d = d+1;\n return dec2octet(d);\n}", "function IPAddress$dottedQuadNotation(ipv4part) {\n var ipv4 = IPAddress$IPv4ToInt(ipv4part);\n\n // convert to unsigned int\n var bits = ipv4 >>> 0;\n\n // take IPv4 bits and stuff them in two hextets\n var hextets = [];\n hextets.push(((bits >>> 16) & 0xffff).toString(16));\n hextets.push((bits & 0xffff).toString(16));\n\n return hextets;\n}", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF\n}", "function _sanitiseIPv4Mapping(ipStr) {\n\t if (ipStr.toLowerCase().indexOf('0000:0000:0000:0000:0000:ffff:') !== 0) {\n\t // Not an ipv4 mapping\n\t return ipStr\n\t }\n\t\n\t var hextets = ipStr.split(':')\n\t\n\t if (hextets[hextets.length - 1].indexOf('.') != -1) {\n\t // Already sanitized\n\t return ipStr\n\t }\n\t\n\t var ipv4Address = [\n\t parseInt(hextets[6].substring(0, 2), 16)\n\t , parseInt(hextets[6].substring(2, 4), 16)\n\t , parseInt(hextets[7].substring(0, 2), 16)\n\t , parseInt(hextets[7].substring(2, 4), 16)\n\t ].join('.')\n\t\n\t return hextets.slice(0, 6).join(':') + ':' + ipv4Address\n\t}", "getAddressChecksumString () {\n return secUtil.toChecksumAddress(this.getAddressString())\n }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n}", "function int64add4(dst, a, b, c, d) {\r\n var w0 = (a.l & 0xffff) + (b.l & 0xffff) + (c.l & 0xffff) + (d.l & 0xffff);\r\n var w1 = (a.l >>> 16) + (b.l >>> 16) + (c.l >>> 16) + (d.l >>> 16) + (w0 >>> 16);\r\n var w2 = (a.h & 0xffff) + (b.h & 0xffff) + (c.h & 0xffff) + (d.h & 0xffff) + (w1 >>> 16);\r\n var w3 = (a.h >>> 16) + (b.h >>> 16) + (c.h >>> 16) + (d.h >>> 16) + (w2 >>> 16);\r\n dst.l = (w0 & 0xffff) | (w1 << 16);\r\n dst.h = (w2 & 0xffff) | (w3 << 16);\r\n}", "static isIP(ip){ return F.isIP(ip) }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n }", "function add32(a, b) {\n return (a + b) & 0xFFFFFFFF;\n }", "function testIsGoogleIp4Address() {\n assertTrue(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address(\n '74.125.224.110'));\n assertFalse(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address(\n '99.23.29.13'));\n assertFalse(ndebug.DNSResponsePacketAnalyzer.isGoogleIp4Address(\n '209.230.12.23'));\n}", "function isValidIP(str) {\r\n if (!str.match(/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/) || str.match(/^\\s|^0\\d|(\\.0\\d)|\\s$/)) return false\r\n return str.split('.').filter(v => v > 255).length < 1\r\n}" ]
[ "0.6851703", "0.6516667", "0.6452689", "0.6411952", "0.6330019", "0.6179437", "0.6168678", "0.615925", "0.611519", "0.61085916", "0.6059655", "0.6057545", "0.6039801", "0.6007558", "0.5983626", "0.59814966", "0.59600306", "0.5897673", "0.584507", "0.57592183", "0.5719682", "0.5708587", "0.5680614", "0.565678", "0.5640741", "0.56117964", "0.561165", "0.5588308", "0.555464", "0.5537967", "0.55273086", "0.5516898", "0.55047745", "0.5502434", "0.5499909", "0.5492696", "0.5476317", "0.5474869", "0.54728186", "0.5467591", "0.5462658", "0.544744", "0.54430586", "0.543926", "0.5403982", "0.53937125", "0.539232", "0.53855807", "0.5368684", "0.5367138", "0.53617", "0.5347965", "0.53478205", "0.53298694", "0.53268284", "0.5298906", "0.527997", "0.5263221", "0.5248282", "0.5241189", "0.5237487", "0.52033126", "0.5200094", "0.51959676", "0.5193243", "0.5193243", "0.51829064", "0.5179915", "0.51748437", "0.5154176", "0.51535815", "0.51504475", "0.51406026", "0.51231724", "0.50982505", "0.50961345", "0.50876373", "0.5079195", "0.50716347", "0.50678706", "0.50678706", "0.5064504", "0.50314915", "0.50303745", "0.5029891", "0.50211203", "0.4996465", "0.49962282", "0.49924454", "0.49800822", "0.49730495", "0.49632722", "0.49557015", "0.4955664", "0.49431935", "0.49345595", "0.49345595", "0.4934513", "0.49330583", "0.4930986" ]
0.68596375
0
logical OR between address & NOT netmask
function IPv4_Calc_netbcastBinStr( addressBinStr, netmaskBinStr ) { var netbcastBinStr = ''; var aBit = 0; var nmBit = 0; for( pos = 0; pos < 32; pos ++ ) { aBit = parseInt( addressBinStr.substr( pos, 1 )); nmBit = parseInt( netmaskBinStr.substr( pos, 1 )); if( nmBit ) { nmBit = 0; } /* flip netmask bits */ else{ nmBit = 1; } if( aBit || nmBit ) { netbcastBinStr += '1' } else{ netbcastBinStr += '0'; } } return netbcastBinStr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maskOr(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) | parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) | parseInt(mask.toBin().substr(16,16), 2)));\n}", "function b_OR(masks){\n\t\t\tvar mask = [];\n\t\t\tfor(var bit=0; bit<arguments[0].length; bit++){\n\t\t\t\tvar flag = false;\n\t\t\t\tfor(var vector=0; vector<arguments.length; vector++){\n\t\t\t\t\tif (arguments[vector][bit] == true) {\n\t\t\t\t\t\tflag = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmask.push(flag);\n\t\t\t}\n\t\t\treturn mask;\n\t\t}", "function b_OR(masks){\n\t\t\tvar mask = [];\n\t\t\tfor(var bit=0; bit<arguments[0].length; bit++){\n\t\t\t\tvar flag = false;\n\t\t\t\tfor(var vector=0; vector<arguments.length; vector++){\n\t\t\t\t\tif (arguments[vector][bit] == true) {\n\t\t\t\t\t\tflag = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmask.push(flag);\n\t\t\t}\n\t\t\treturn mask;\n\t\t}", "function sc_bitOr(x, y) {\n return x | y;\n}", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x,y) { return x|y; }", "function op_or(x, y) { return x | y; }", "function or() {\r\n var mode = $(\"#filterMode\").val();\r\n var src1 = getRegisterVal(\"registerTwo\");\r\n var src2;\r\n if (mode == \"i\") {\r\n src2 = parseInt($(\"#immediate\").val());\r\n } else {\r\n src2 = getRegisterVal(\"registerThree\");\r\n }\r\n var result = src1 | src2;\r\n setRegisterVal(\"registerOne\", result);\r\n}", "function IsNetworkID_or_BroadcastIP(ip, subnet_hostID_bits) {\r\n\tvar binary_ip = \"\";\r\n\tvar i, arr;\r\n\tvar address_type = 2; \r\n\r\n\t\r\n\r\n\tfor(i = 0, arr = ip.split(\".\"); i < arr.length; i ++) {\r\n\t\tbinary_ip += ToBinary(arr[i]); // binary_ip is a string object\r\n\t}\r\n//\talert(\"Before : \" + binary_ip);\r\n\tbinary_ip = binary_ip.split(\"\").reverse().join(\"\"); // After reversing, it is still a string object\r\n\t\r\n\taddress_type = AllZeroesOrOnes(binary_ip, subnet_hostID_bits);\r\n\r\n\treturn address_type;\r\n}", "function _or(a, b) {\n return (a | b) >>> 0;\n}", "function op_or(x, y)\n{\n return x | y;\n}", "function maskAnd(ip, mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return ((parseInt(ip.toBin().substr(0,16), 2) & parseInt(mask.toBin().substr(0,16), 2)) * factor16 + (parseInt(ip.toBin().substr(16,16), 2) & parseInt(mask.toBin().substr(16,16), 2)));\n}", "function op_or(x, y) {\n return x | y;\n}", "function op_or(x, y) {\n return x | y;\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function op_or(x, y) {\n return x | y\n}", "function Or(n,t){for(var e in t)n[e]=t[e];return n}", "function op_or(x, y) {\n return x | y;\n}", "function op_or(x, y) {\n return x | y;\n }", "function op_or(x, y) {\n return x | y;\n }", "function op_or(x, y) {\n return x | y;\n }", "function op_or(x, y) {\n return x | y;\n }", "function op_or(x, y) {\n return x | y;\n }", "function op_or(x, y) {\r\n\t return x | y;\r\n\t}", "function op_or(x, y) {\r\n\t return x | y;\r\n\t}", "function op_or(x, y) {\n\t return x | y\n\t}", "function op_or(x, y) {\n\t return x | y\n\t}", "static calculateNetmask(mask) {\n return NetworkUtils.numToIp(2 ** 32 - 2 ** (32 - mask));\n }", "function or_n(n) {\n CPU.tCycles += 7;\n const a = r8.get(i8.A);\n let f = CPU.tables.orFlagsTable[(a << 8) | n];\n r8.set(i8.F, f);\n r8.set(i8.A, a | n);\n}", "function op_or(x, y) {\n return x | y;\n }", "generateAndMask(numberOfAddressBits) {\r\n /*\r\n this.andMask = 1\r\n for(let i = 0; i < numberOfAddressBits; i++) {\r\n this.andMask = (this.andMask << 1) + 1\r\n }\r\n */\r\n let andMask = (1 << numberOfAddressBits) - 1\r\n //console.log(\"DEBUG andMask=\" + andMask)\r\n return andMask\r\n }", "function maskInvert(mask) {\n /* The following line adjusts the ip address to match the first address in the subnet (filtering all non-subnet mask bits in the ip */\n /* Not that this is done for the left 16 bits and the right 16 bits separately since the bitwise operator works on 32 bit signed integers yielding negative values */\n return (((~parseInt(mask.toBin().substr(0,16), 2)) & 0xffff) * factor16 + (~parseInt(mask.toBin().substr(16,16), 2) & 0xffff));\n}", "function b_NOT(mask){\n\t\t\tfor(i=0; i<mask.length; i++){\n\t\t\t\tmask[i] = !mask[i];\n\t\t\t}\n\t\t\treturn mask;\n\t\t}", "function b_NOT(mask){\n\t\t\tfor(i=0; i<mask.length; i++){\n\t\t\t\tmask[i] = !mask[i];\n\t\t\t}\n\t\t\treturn mask;\n\t\t}", "function or(xs){\r\n return foldr(orOp, false, xs);\r\n}", "function OR(a, b) {\n return a || b ? true : false\n}", "function bitwiseOR()\n{\n\t//5 decimal is equal to 101 binary\n\t//3 decimal is equal to 011 binary\n\t//So, the comparison below will return 111, which it will display as a 7\n\tdocument.getElementById(\"bitOR\").innerHTML = 5 | 3;\n}", "function nor(blo1, blo2) {\n let and =blo1 || blo2\n return !and\n}", "function IPv4_Calc_netaddrBinStr( addressBinStr, netmaskBinStr ) {\r\n\tvar netaddressBinStr = '';\r\n\tvar aBit = 0; var nmBit = 0;\r\n\tfor( pos = 0; pos < 32; pos ++ ) {\r\n\t\taBit = addressBinStr.substr( pos, 1 );\r\n\t\tnmBit = netmaskBinStr.substr( pos, 1 );\r\n\t\tif( aBit == nmBit ) {\tnetaddressBinStr += aBit.toString();\t}\r\n\t\telse{\tnetaddressBinStr += '0';\t}\r\n\t}\r\n\treturn netaddressBinStr;\r\n}", "function ANDfromNOR(a,b) {\n return NOR(NOR(a,a), NOR(b,b))\n}", "function Or(t){return null==t}", "function logicalOr(a,b){\n\t\"use strict\";\n return a || b;\n}", "function op_andnot(x, y) { return x & ~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }" ]
[ "0.680771", "0.6219385", "0.6219385", "0.5997755", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.5931759", "0.59178996", "0.58372647", "0.57659125", "0.57206655", "0.569395", "0.5666956", "0.5654666", "0.5654666", "0.5641617", "0.5641617", "0.5641617", "0.5641617", "0.5641617", "0.5641617", "0.5641617", "0.5624849", "0.56228983", "0.5616808", "0.5616808", "0.5616808", "0.5616808", "0.5616808", "0.560889", "0.560889", "0.5606393", "0.5606393", "0.55940855", "0.5588084", "0.55852926", "0.5539193", "0.5512863", "0.54704475", "0.54704475", "0.54526293", "0.5397187", "0.53825897", "0.5379364", "0.5361891", "0.53473544", "0.5322149", "0.53030497", "0.5295242", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304", "0.528304" ]
0.0
-1
included as an example alternative for converting 8bit bytes to an integer in IPv4_dotquadA_to_intA
function IPv4_BitShiftLeft( mask, bits ) { return ( mask * Math.pow( 2, bits ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function IPv4_dotquadA_to_intA( strbits ) {\r\n\tvar split = strbits.split( '.', 4 );\r\n\tvar myInt = (\r\n\t\tparseFloat( split[0] * 16777216 )\t/* 2^24 */\r\n\t + parseFloat( split[1] * 65536 )\t\t/* 2^16 */\r\n\t + parseFloat( split[2] * 256 )\t\t/* 2^8 */\r\n\t + parseFloat( split[3] )\r\n\t);\r\n\treturn myInt;\r\n}", "function ba2int(x) {\n assert(x.length <= 8, 'Cannot convert bytearray larger than 8 bytes');\n var retval = 0;\n for (var i = 0; i < x.length; i++) {\n retval |= x[x.length - 1 - i] << 8 * i;\n }\n return retval;\n}", "function IPv4_binstrA_to_intA( binstr ) {\r\n\treturn parseInt( binstr, 2 );\r\n}", "function ipToInt32(ip) {\n const givenArr = ip.split('.');\n console.log({ givenArr });\n\n const binaryArr = givenArr.map(elm => {\n let stage1 = Number.parseInt(elm, 10).toString(2);\n\n if (stage1.length < 8) {\n while (stage1.length < 8) {\n stage1 = `0${stage1}`;\n }\n }\n\n return stage1;\n });\n console.log({ binaryArr });\n\n const binaryStr = binaryArr.join('');\n console.log({ binaryStr });\n\n const finalNum = Number.parseInt(binaryStr, 2);\n console.log({ finalNum });\n\n return finalNum;\n}", "function IPv4_intA_to_dotquadA( strnum ) {\r\n\tvar byte1 = ( strnum >>> 24 );\r\n\tvar byte2 = ( strnum >>> 16 ) & 255;\r\n\tvar byte3 = ( strnum >>> 8 ) & 255;\r\n\tvar byte4 = strnum & 255;\r\n\treturn ( byte1 + '.' + byte2 + '.' + byte3 + '.' + byte4 );\r\n}", "function IPAddress$IPv4ToInt(address) {\n var res = 0;\n // check that the input is a valid IPv4 address\n if (IPAddress$getValidIPv4(address) === address) {\n var parts = address.split('.');\n res += parseInt10(parts[0]) << 24;\n res += parseInt10(parts[1]) << 16;\n res += parseInt10(parts[2]) << 8;\n res += parseInt10(parts[3]);\n return res;\n }\n}", "function ToInt8(v) { return (v << 24) >> 24; }", "function octet2dec(a){\n //alert(\"octet2dec1 \"+a[0]+\"\\n\"+dec2bin(a[0])+\"\\n\"+dec2bin(a[0] * 16777216));\n // poor mans bit shifting (Int32 issue)\n var d = 0;\n d = d + parseInt(a[0]) * 16777216 ; //Math.pow(2,24);\n d = d + a[1] * 65536;\t //Math.pow(2,16);\n d = d + a[2] * 256;\t //Math.pow(2,8);\n d = d + a[3];\n return d;\n}", "function ipv4ToInt(stringIP) {\n\tvar ipParte = stringIP.split('.');\n\treturn ((((((+ipParte[0]) * 256) + (+ipParte[1])) * 256) + (+ipParte[2])) * 256)\n\t\t\t+ (+ipParte[3]);\n}", "function readInt8(){\n checkLen(1);\n var int = buf.readInt8(pos);\n pos++;\n return int.toString();\n }", "function convert32_to_8bit(){\n\n}", "function IPv4_intA_to_binstrA( strnum ) {\r\n\tvar numStr = strnum.toString( 2 ); /* Initialize return value as string */\r\n\tvar numZeros = 32 - numStr.length; /* Calculate no. of zeros */\r\n\tif (numZeros > 0) {\tfor (var i = 1; i <= numZeros; i++) { numStr = \"0\" + numStr }\t} \r\n\treturn numStr;\r\n}", "function IPToNumber(s) {\n\n var arr = s.split('.');\n var n = 0;\n for (var i = 0; i < 4; i++) {\n\n n = n * 256;\n n += parseInt(arr[i], 10);\n\n }\n\n return n;\n }", "function ip_to_int(ip) {\n\tif (!ip)\n\t\treturn 0;\n\tvar quads = ip.split(\".\");\n\tvar addr = (quads[0]&0xff)<<24;\n\taddr|=(quads[1]&0xff)<<16;\n\taddr|=(quads[2]&0xff)<<8;\n\taddr|=(quads[3]&0xff);\n\treturn addr;\n}", "function ipAddrToInt(ip) {\n // Split string into array of octets, converted to integers\n const octets = ip.split('.').map(n => parseInt(n, 10));\n\n // Convert to an integer. The trailing >>> 0 converts the number to unsigned so we\n // don't get huge negative values\n return ((octets[0] << 24) + (octets[1] << 16) + (octets[2] << 8) + octets[3]) >>> 0;\n}", "function bufToI32(buf) {\n // let addr = Integer.fromBits(buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0]);\n // return addr;\n\n\n // let bar = new ArrayBuffer(4);\n var conv = new DataView(buf);\n\n conv.setUint8(0, buf[3]);\n conv.setUint8(1, buf[2]);\n conv.setUint8(2, buf[1]);\n conv.setUint8(3, buf[0]);\n\n return conv.getUint32(0);\n}", "function binaryToDecimal(i1, i2, i3, i4)\n{\n return i1 * 8 + i2 * 4 + i3 * 2 + i4;\n}", "function dec2octet(d){\n //alert(\"d=\"+d+\" \"+d.toString(2)+\"=\"+d.toString(2).substring(0,8)+\"=\"+parseInt(d.toString(2).substring(0,8),2));\n var zeros = \"00000000000000000000000000000000\";\n var b = d.toString(2);\n var b = zeros.substring(0,32-b.length) + b;\n var a = new Array(\n parseInt(b.substring(0,8),2)\t// 32 bit integer issue (d & 4278190080)/16777216 //Math.pow(2,32) - Math.pow(2,24);\n , (d & 16711680)/65536\t //Math.pow(2,24) - Math.pow(2,16);\n , (d & 65280)/256\t\t //Math.pow(2,16) - Math.pow(2,8);\n , (d & 255)\n );\t\t //Math.pow(2,8);\n return a;\n}", "function convertIPv4StrToInt2(ipv4Str) {\n if (typeof ipv4Str !== \"string\") {\n throw TypeError(\"Illegal arguments, ipv4Str should be a string\");\n }\n\n let ipv4Int = 0,\n base = 1,\n digit,\n digitBase = 1,\n dotsCnt = 0,\n isSpaceAppearBeforeDigit = false,\n char;\n\n for (let i = ipv4Str.length - 1; i >= -1; i--) {\n char = ipv4Str[i];\n\n if (char === '.' || i === -1) { // dot or end\n dotsCnt = i !== -1 ? dotsCnt + 1 : dotsCnt;\n if (dotsCnt > 3 || (i === -1 && dotsCnt !== 3)) {\n throw Error(\"Invalid IPv4 address, it should be formated in A.B.C.D\");\n }\n if (digit === undefined) { // nothing between two dots, such as: 172.1..\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n if (digit >= 256) {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be less than 256\");\n }\n ipv4Int += digit * base;\n base *= 256;\n\n digit = undefined;\n digitBase = 1;\n isSpaceAppearBeforeDigit = false;\n } else if (/\\d/.test(char)) { // digit\n if (isSpaceAppearBeforeDigit) { // spaces between two digits, such as: 172.1.1 2\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n\n digit = parseInt(char) * digitBase + (digit === undefined ? 0 : digit);\n digitBase *= 10;\n } else if (char === ' ') { // space\n if (digit !== undefined) {\n isSpaceAppearBeforeDigit = true;\n }\n\n isSpaceAppear = true;\n } else {\n throw Error(\"Invalid IPv4 address, each block (A.B.C.D) should be an integer\");\n }\n }\n\n return ipv4Int;\n}", "function parseInt(off) {\n if (a[off] != UTIL_ASN_INT) return null;\n var l = a[off + 1] & 255;\n if (l & 0x80) return null; // INT.size too large\n if (off + 2 + l > a.length) return null; // Out of bounds\n return a.slice(off + 2, off + 2 + l);\n }", "function toNumber(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n b = match.reverse().join('');\r\n }\r\n }\r\n var result = parseInt(b, 16);\r\n if (result >= Number.MAX_SAFE_INTEGER) {\r\n throw new Error(\"Overflowed when converting to number: \" + bytes);\r\n }\r\n return result;\r\n}", "static read8(data, byteOffset) {\r\n const v0 = (data[byteOffset + 0] +\r\n (data[byteOffset + 1] << 8) +\r\n (data[byteOffset + 2] << 16) +\r\n (data[byteOffset + 3] << 24)) >>> 0;\r\n const v1 = (data[byteOffset + 4] +\r\n (data[byteOffset + 5] << 8) +\r\n (data[byteOffset + 6] << 16) +\r\n (data[byteOffset + 7] << 24)) >>> 0;\r\n return (BigInt(v1) << BigIntHelper.BIG_32) | BigInt(v0);\r\n }", "function bufferToInt(buf) {\n return new bn_js_1.default(toBuffer(buf)).toNumber();\n}", "function rsint8(buffer, endian, offset)\n{\n\tvar neg;\n\n\tif (endian === undefined)\n\t\tthrow (new Error('missing endian'));\n\n\tif (buffer === undefined)\n\t\tthrow (new Error('missing buffer'));\n\n\tif (offset === undefined)\n\t\tthrow (new Error('missing offset'));\n\n\tif (offset >= buffer.length)\n\t\tthrow (new Error('Trying to read beyond buffer length'));\n\n\tneg = buffer[offset] & 0x80;\n\tif (!neg)\n\t\treturn (buffer[offset]);\n\n\treturn ((0xff - buffer[offset] + 1) * -1);\n}", "function rsint8(buffer, endian, offset)\n{\n\tvar neg;\n\n\tif (endian === undefined)\n\t\tthrow (new Error('missing endian'));\n\n\tif (buffer === undefined)\n\t\tthrow (new Error('missing buffer'));\n\n\tif (offset === undefined)\n\t\tthrow (new Error('missing offset'));\n\n\tif (offset >= buffer.length)\n\t\tthrow (new Error('Trying to read beyond buffer length'));\n\n\tneg = buffer[offset] & 0x80;\n\tif (!neg)\n\t\treturn (buffer[offset]);\n\n\treturn ((0xff - buffer[offset] + 1) * -1);\n}", "function toNumber$1(bytes, le) {\r\n if (le === void 0) { le = false; }\r\n if (bytes.length > 8) {\r\n throw new Error('Cannot parse a number greater than u64');\r\n }\r\n var b = toHex$1(bytes).substr(2);\r\n if (le) {\r\n var match = b.match(/../g);\r\n if (match !== null) {\r\n b = match.reverse().join('');\r\n }\r\n }\r\n var result = parseInt(b, 16);\r\n if (result >= Number.MAX_SAFE_INTEGER) {\r\n throw new Error(\"Overflowed when converting to number: \" + bytes);\r\n }\r\n return result;\r\n}", "function readInt8(signed) {\n\t\t\tvar result = buffer[position];\n\t\t\tif (signed && result > 127) result -= 256;\n\t\t\tposition += 1;\n\t\t\treturn result;\n\t\t}", "function convertToInteger(str) {\n var binaryNum = parseInt(str, 2);\n return binaryNum;\n}", "function int32a_to_uint8a(arr){\n var arr2 = new Uint8Array(arr.length*4);\n for(var i = 0; i < arr.length; ++i){\n for(var j = 0; j < 4; ++j){\n var num = arr[i] << (j*8);\n num = num >>> 24;\n arr2[i*4+j] = num;\n }\n }\n return arr2;\n}", "function arrayToInt(arrIP, theThingToThrow) {\n let octets = arrIP.map((octet) => {\n if(typeof octet === 'string') {\n octet = octet.trim();\n if(!onlyDigits(octet))\n throw new theThingToThrow();\n octet = parseInt(octet);\n }\n else if(typeof octet === 'number')\n octet = parseInt(octet, 10);\n else\n throw new theThingToThrow();\n if(octet > 255)\n throw new theThingToThrow();\n return octet; \n });\n return octets[0] * factor24 + octets[1] * factor16 + octets[2] * factor8 + octets[3];\n}", "function ba2bigInt(data) {\n var mpi = str2bigInt('0', 10, data.length)\n data.forEach(function (d, i) {\n if (i) leftShift_(mpi, 8)\n mpi[0] |= d\n })\n return mpi\n }", "function parseIPv4(addr) {\n if (typeof(addr) !== 'string')\n throw new TypeError('addr (string) is required');\n\n var octets = addr.split(/\\./).map(function (octet) {\n return (parseInt(octet, 10));\n });\n if (octets.length !== 4)\n throw new TypeError('valid IP address required');\n\n var uint32 = ((octets[0] * Math.pow(256, 3)) +\n (octets[1] * Math.pow(256, 2)) +\n (octets[2] * 256) + octets[3]);\n return (uint32);\n}", "function extractInteger(buf, bufPos) {\n var x = buf[bufPos + 0] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 1] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 2] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 3] & 0xff;\n return x;\n }", "function extractInteger(buf, bufPos) {\n var x = buf[bufPos + 0] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 1] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 2] & 0xff;\n x <<= 8;\n x |= buf[bufPos + 3] & 0xff;\n return x;\n }", "function binaryToInt(arr)\n{\n return arr[0] * 1 + arr[1] * 2 + arr[2] * 4\n}", "function bitsToNum(ba)\n{\n return ba.reduce(function(s, n) {\n return s * 2 + n;\n }, 0);\n}", "function convertToInteger(str) {\n //pass 2 so the computer knows it is a binary number\n return parseInt(str, 2);\n}", "function readInt8(signed) {\n var result = str.charCodeAt(position);\n if (signed && result > 127) result -= 256;\n position += 1;\n return result;\n }", "function bytes_to_int32 (arr, off) {\n\tconst first = arr[off + 3] << 24;\n\tconst second = arr[off + 2] << 16;\n\tconst third = arr[off + 1] << 8;\n\tconst fourth = arr[off];\n\treturn first | second | third | fourth;\n}", "function int24(raw, start) {\n return (raw[start] << 8*2) + (raw[start+1] << 8) + raw[start+2];\n}", "function bytes_to_int32(arr, off) {\n return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off])\n }", "readInt8() {\n const buf = this.readBytes(1);\n return buf.readInt8();\n }", "static read4(data, byteOffset) {\r\n const v0 = (data[byteOffset + 0] +\r\n (data[byteOffset + 1] << 8) +\r\n (data[byteOffset + 2] << 16) +\r\n (data[byteOffset + 3] << 24)) >>> 0;\r\n return BigInt(v0);\r\n }", "function wsint8(value, endian, buffer, offset)\n{\n\tvar val;\n\n\tif (value === undefined)\n\t\tthrow (new Error('missing value'));\n\n\tif (endian === undefined)\n\t\tthrow (new Error('missing endian'));\n\n\tif (buffer === undefined)\n\t\tthrow (new Error('missing buffer'));\n\n\tif (offset === undefined)\n\t\tthrow (new Error('missing offset'));\n\n\tif (offset >= buffer.length)\n\t\tthrow (new Error('Trying to read beyond buffer length'));\n\n\tval = prepsint(value, 0x7f, -0x80);\n\tif (val >= 0)\n\t\twuint8(val, endian, buffer, offset);\n\telse\n\t\twuint8(0xff + val + 1, endian, buffer, offset);\n}", "function binToInt(a) {\n var decResult = 0;\n for (i = 0; i < ADDER_BITS; i++) {\n decResult += parseInt(a[i]) * Math.pow(2, i);\n }\n return decResult;\n}", "function bytes_to_int32(arr, off) {\n return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off]);\n }", "function DecodeVarLenUint8(br) {\n if (br.readBits(1)) {\n var nbits = br.readBits(3);\n if (nbits === 0) {\n return 1;\n } else {\n return br.readBits(nbits) + (1 << nbits);\n }\n }\n return 0;\n}", "function DecodeVarLenUint8(br) {\n if (br.readBits(1)) {\n var nbits = br.readBits(3);\n if (nbits === 0) {\n return 1;\n } else {\n return br.readBits(nbits) + (1 << nbits);\n }\n }\n return 0;\n}", "function DecodeVarLenUint8(br) {\n if (br.readBits(1)) {\n var nbits = br.readBits(3);\n if (nbits === 0) {\n return 1;\n } else {\n return br.readBits(nbits) + (1 << nbits);\n }\n }\n return 0;\n}", "function DecodeVarLenUint8(br) {\n if (br.readBits(1)) {\n var nbits = br.readBits(3);\n if (nbits === 0) {\n return 1;\n } else {\n return br.readBits(nbits) + (1 << nbits);\n }\n }\n return 0;\n}", "function DecodeVarLenUint8(br) {\n if (br.readBits(1)) {\n var nbits = br.readBits(3);\n if (nbits === 0) {\n return 1;\n } else {\n return br.readBits(nbits) + (1 << nbits);\n }\n }\n return 0;\n}", "function inet_aton(ip){\n var a = ip.split('.');\n var buffer = new Buffer(4);\n buffer.fill(0);\n for(var i = 0; i < 4; i++) {\n buffer.writeUInt8(parseInt(a[i]), i);\n }\n\n var intIp = buffer.readUInt32LE(0);\n console.log('0x' + intIp.toString(16));\n return intIp;\n}", "function int_to_ip(ip) {\n\treturn(format(\"%u.%u.%u.%u\"\n\t\t,(ip>>24)&0xff\n\t\t,(ip>>16)&0xff\n\t\t,(ip>>8)&0xff\n\t\t,ip&0xff\n\t\t));\n}", "function d2b4(integer){\n\t\tif (typeof integer !== \"string\" && integer.toString().length > 15){throw \"integer should be entered as a string for precision\";}\n\t\tvar padding = \"\";\n\t\tfor (i = 0; i < 31; i++){\n\t\t\tpadding += \"0\";\n\t\t}\n\t\tvar a = new JSBigInt(integer);\n\t\tif (a.toString(2).length > 64){throw \"amount overflows uint64!\";}\n\t\treturn swapEndianC((padding + a.toString(4)).slice(-32));\n\t}", "function getIntFromBits(hex, start, end = undefined) {\n const bin = encUtils.hexToBinary(hex);\n const bits = bin.slice(start, end);\n const int = encUtils.binaryToNumber(bits);\n return int;\n}", "function readInt8(signed) {\n\t\tvar result = str.charCodeAt(position);\n\t\tif (signed && result > 127) result -= 256;\n\t\tposition += 1;\n\t\treturn result;\n\t}", "function readInt8(signed) {\n\t\tvar result = str.charCodeAt(position);\n\t\tif (signed && result > 127) result -= 256;\n\t\tposition += 1;\n\t\treturn result;\n\t}", "function readInt8(signed) {\n\t\tvar result = str.charCodeAt(position);\n\t\tif (signed && result > 127) result -= 256;\n\t\tposition += 1;\n\t\treturn result;\n\t}", "function int32ToIp(int32){\n let remainder = int32;\n let result = [];\n\n while(remainder > 256){\n result.push(remainder % 256)\n remainder = Math.floor(remainder/256)\n }\n\n result.push(remainder)\n\n while(result.length < 4){\n result.unshift(0)\n }\n\n return result.reverse().join('.')\n}", "function Int8(name,\t{ transform = value => value } = {}) {\n\treturn Int(name, { size: 1, transform });\n}", "function readInt8(signed) {\n var result = str.charCodeAt(position);\n if (signed && result > 127)\n result -= 256;\n position += 1;\n return result;\n }", "function BinaryConverter(str) { \n return parseInt(str, 2);\n}", "function ab2ba(ab) {\n var view = new DataView(ab);\n var int_array = [];\n for (var i = 0; i < view.byteLength; i++) {\n int_array.push(view.getUint8(i));\n }\n return int_array;\n}", "function toBytesInt32(num) {\n arr = new Uint8Array([\n (num & 0xff000000) >> 24,\n (num & 0x00ff0000) >> 16,\n (num & 0x0000ff00) >> 8,\n (num & 0x000000ff)\n ]);\n return arr;\n }", "function U8toU32(u8)\r\n{\r\n\tvar len = u8.length;\r\n\tvar u32 = new Uint32Array((len >>> 2) + (len % 4 ? 1:0));\r\n\tif (len > 1) {\r\n\t\tlen--;\r\n\t\tfor(var i=0; i <= len; i++){\t\t\r\n\t\t\tu32[i >>> 2] += u8[i] << ((i%4)*8);\t\t\r\n\t\t}\r\n\t}else{\r\n\t\tif (len) u32[0]\t= u8[0];\r\n\t}\r\n\treturn u32;\r\n}", "function rgint32(buffer, endian, offset)\n{\n\tvar val = 0;\n\n\tif (endian == 'big') {\n\t\tval = buffer[offset+1] << 16;\n\t\tval |= buffer[offset+2] << 8;\n\t\tval |= buffer[offset+3];\n\t\tval = val + (buffer[offset] << 24 >>> 0);\n\t} else {\n\t\tval = buffer[offset+2] << 16;\n\t\tval |= buffer[offset+1] << 8;\n\t\tval |= buffer[offset];\n\t\tval = val + (buffer[offset + 3] << 24 >>> 0);\n\t}\n\n\treturn (val);\n}", "function rgint32(buffer, endian, offset)\n{\n\tvar val = 0;\n\n\tif (endian == 'big') {\n\t\tval = buffer[offset+1] << 16;\n\t\tval |= buffer[offset+2] << 8;\n\t\tval |= buffer[offset+3];\n\t\tval = val + (buffer[offset] << 24 >>> 0);\n\t} else {\n\t\tval = buffer[offset+2] << 16;\n\t\tval |= buffer[offset+1] << 8;\n\t\tval |= buffer[offset];\n\t\tval = val + (buffer[offset + 3] << 24 >>> 0);\n\t}\n\n\treturn (val);\n}", "function int32(data, offset) {\n return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;\n }", "readUB8() {\n return this._readInteger(8, false, false);\n }", "static read4(data, byteOffset) {\r\n const v0 = (data[byteOffset + 0] +\r\n (data[byteOffset + 1] << 8) +\r\n (data[byteOffset + 2] << 16) +\r\n (data[byteOffset + 3] << 24)) >>>\r\n 0;\r\n return bigInt(v0);\r\n }", "readInt8(signed) {\n let result = this.str.charCodeAt(this.position);\n if (signed && result > 127) {\n result -= 256;\n }\n this.position += 1;\n return result;\n }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function parse_PtgInt(blob) { blob.l++; return blob.read_shift(2); }", "function int2ip(ipInt) {\n return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));\n }", "function intToIP(int) {\n var part1 = int & 255;\n var part2 = ((int >> 8) & 255);\n var part3 = ((int >> 16) & 255);\n var part4 = ((int >> 24) & 255);\n\n return part4 + \".\" + part3 + \".\" + part2 + \".\" + part1;\n}", "function rgint16(buffer, endian, offset)\n{\n\tvar val = 0;\n\n\tif (endian == 'big') {\n\t\tval = buffer[offset] << 8;\n\t\tval |= buffer[offset+1];\n\t} else {\n\t\tval = buffer[offset];\n\t\tval |= buffer[offset+1] << 8;\n\t}\n\n\treturn (val);\n\n}", "function rgint16(buffer, endian, offset)\n{\n\tvar val = 0;\n\n\tif (endian == 'big') {\n\t\tval = buffer[offset] << 8;\n\t\tval |= buffer[offset+1];\n\t} else {\n\t\tval = buffer[offset];\n\t\tval |= buffer[offset+1] << 8;\n\t}\n\n\treturn (val);\n\n}", "function i(n){var t=parseInt(n,16);return[t>>16,t>>8&255,255&t]}", "function i(t){var n=parseInt(t,16);return[n>>16,n>>8&255,255&n]}", "ipToDecimal(ip){\n let nums = ip.split('.');\n nums.forEach((val, i, arr)=>{\n arr[i] = parseInt(val, 10);\n });\n let res = 0;\n for (let i=0;i<nums.length;i++){\n res+= Math.pow(256, i)*nums[nums.length-1-i];\n }\n return res;\n }", "function fromBinary(input){\n // We assume input is 8 digits long\n var result = 0;\n for ( i = 0 ; i < 8 ; i += 1 ){\n if ((input[i]) !== \"0\") result = result + Math.pow(2, 7 - i);\n }\n console.log(result);\n return result;\n }", "function int2bigInt(t,bits,minSize) { \n var i,k, buff;\n k=Math.ceil(bits/bpe)+1;\n k=minSize>k ? minSize : k;\n buff=new Array(k);\n copyInt_(buff,t);\n return buff;\n }", "function squashBytesToInts(inBytes, inOff, outInts, outOff, intLen) {\n for ( var i = 0; i < intLen; ++i)\n outInts[outOff + i] = ((inBytes[inOff + i * 4] & 0xff) << 24)\n | ((inBytes[inOff + i * 4 + 1] & 0xff) << 16)\n | ((inBytes[inOff + i * 4 + 2] & 0xff) << 8)\n | (inBytes[inOff + i * 4 + 3] & 0xff);\n }", "i8() {\n this._convo.u8[0] = this.buffer[this.at++]\n return this._convo.i8[0];\n }", "i32() {\n this._convo.u8.set(this.buffer.subarray(this.at, this.at += 4));\n return this._convo.i32[0];\n }", "function t(A){var e=parseInt(A,16);return[e>>16,e>>8&255,255&e]}", "function parseInt (buffer, size) {\n switch (size) {\n case 1:\n return buffer[buffer.read++];\n\n case 2:\n return (buffer[buffer.read++] << 8) + buffer[buffer.read++];\n\n case 4:\n return (buffer[buffer.read++] << 24) + (buffer[buffer.read++] << 16) +\n (buffer[buffer.read++] << 8) + buffer[buffer.read++];\n\n case 8:\n return (buffer[buffer.read++] << 56) + (buffer[buffer.read++] << 48) +\n (buffer[buffer.read++] << 40) + (buffer[buffer.read++] << 32) +\n (buffer[buffer.read++] << 24) + (buffer[buffer.read++] << 16) +\n (buffer[buffer.read++] << 8) + buffer[buffer.read++];\n\n default:\n throw new Error(\"cannot parse ints of that size\");\n }\n}", "function convertToInteger(str) {\n\n\n return parseInt(str, 2); // radix 2 -> binary base 2\n}", "function int2bigInt(t, bits, minSize) {\n var i, k;\n k = Math.ceil(bits / bpe) + 1;\n k = minSize > k ? minSize : k;\n buff = new Array(k);\n copyInt_(buff, t);\n return buff;\n }", "function getInt8(reg, byt){\r\n\tlet buffer = new ArrayBuffer(2);\r\n\tlet view = new DataView(buffer);\r\n\tview.setUint16(0, modbusValues[reg], true);\r\n\t//byt should be 0 or 1\r\n\treturn view.getUint8(byt, true);\r\n}", "influence () {\n return parseInt(this.I, 16);\n }", "readInt8 (signed) {\n\t\tlet result = this.array[this.position];\n\t\tif (signed && result > 127)\n\t\t\tresult -= 256;\n\t\tthis.position += 1;\n\n\t\treturn result;\n\t}", "function d2b(integer){\n\t\tif (typeof integer !== \"string\" && integer.toString().length > 15){throw \"integer should be entered as a string for precision\";}\n\t\tvar padding = \"\";\n\t\tfor (i = 0; i < 63; i++){\n\t\t\tpadding += \"0\";\n\t\t}\n\t\tvar a = new JSBigInt(integer);\n\t\tif (a.toString(2).length > 64){throw \"amount overflows uint64!\";}\n\t\treturn swapEndianC((padding + a.toString(2)).slice(-64));\n\t}", "function MakeI8( iVal )\n{\n var iVal8 = new Int8Array(2);\n iVal8[0] = iVal;\n \n return( iVal8[0] ); \n}", "function add8(a, b) {\n return (a + b) & 0xFF;\n}", "function add8(a, b) {\n return (a + b) & 0xFF;\n}", "function f2i(val)\n{ \n f64[0] = val;\n let tmp = Array.from(u32);\n return tmp[1] * 0x100000000 + tmp[0];\n}", "function stringToInt(strIP, theThingToThrow) {\n let octets = strIP.split('.');\n if(octets.length != 4)\n throw new theThingToThrow();\n return arrayToInt(octets, theThingToThrow);\n}", "static read8(data, byteOffset) {\r\n const v0 = (data[byteOffset + 0] +\r\n (data[byteOffset + 1] << 8) +\r\n (data[byteOffset + 2] << 16) +\r\n (data[byteOffset + 3] << 24)) >>>\r\n 0;\r\n const v1 = (data[byteOffset + 4] +\r\n (data[byteOffset + 5] << 8) +\r\n (data[byteOffset + 6] << 16) +\r\n (data[byteOffset + 7] << 24)) >>>\r\n 0;\r\n return bigInt(v1).shiftLeft(BigIntHelper.BIG_32).or(v0);\r\n }" ]
[ "0.7918755", "0.7236304", "0.70203555", "0.68247277", "0.67811215", "0.6688464", "0.6524969", "0.65107256", "0.6499168", "0.64725983", "0.63687384", "0.636617", "0.63246757", "0.63173294", "0.6210596", "0.62101173", "0.6203542", "0.61952233", "0.6150341", "0.6128387", "0.6043555", "0.6033661", "0.6025773", "0.600906", "0.600906", "0.5984683", "0.59796405", "0.59716624", "0.5921811", "0.59098035", "0.59087145", "0.5903026", "0.5901991", "0.5901991", "0.58933675", "0.58932954", "0.58925617", "0.5890265", "0.58879495", "0.58861554", "0.588112", "0.5867764", "0.58645004", "0.58521485", "0.5851239", "0.58328044", "0.58131677", "0.58131677", "0.58131677", "0.58131677", "0.58131677", "0.58060557", "0.5801949", "0.5793202", "0.57889736", "0.57875264", "0.57875264", "0.57875264", "0.57824624", "0.5761455", "0.57614154", "0.57604605", "0.5741569", "0.5738171", "0.5727909", "0.5695804", "0.5695804", "0.5692451", "0.56850314", "0.5678297", "0.56660473", "0.56581086", "0.56581086", "0.56581086", "0.56581086", "0.56565547", "0.5649076", "0.5634907", "0.5634907", "0.56343025", "0.5632107", "0.56308645", "0.56263405", "0.5622411", "0.56179273", "0.5612924", "0.5608287", "0.56081533", "0.5596564", "0.55887586", "0.558017", "0.5578286", "0.5576958", "0.55624205", "0.5559464", "0.55401087", "0.5527565", "0.5527565", "0.55082864", "0.5499636", "0.54828954" ]
0.0
-1
used for display purposes
function IPv4_BinaryDotQuad( binaryString ) { return ( binaryString.substr( 0, 8 ) +'.'+ binaryString.substr( 8, 8 ) +'.'+ binaryString.substr( 16, 8 ) +'.'+ binaryString.substr( 24, 8 ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get formattedDisplay() { \n if(this.props.display.length >= 7) { return this.props.display.substring(0, 7); }\n \n return this.props.display;\n }", "_replaceDisplay(value) {}", "get formattedText() {\n return this.i.b;\n }", "function IpadicFormatter() {\n}", "displayInfo() {\n\t\t\tlet info = super.displayInfo() + ', разработчики: ' + this.getDevelopers() ;\n\t\t\tconsole.log( info );\n\t\t\treturn info\n\t\t\t}", "function NzDisplayedMark() { }", "displayRender(label) {\n return label[label.length - 1]\n }", "getVisitsGraphics() {\n return 90 + ',' + 70 + ',' + 90 + ',' + 70+ ',' + 75 + ',' + 80 + ',' + 70;\n }", "displayInfo() {\n\t\t\tlet info = super.displayInfo() + ', менеджер: ' + this.manager.name ;\n\t\t\tconsole.log( info );\n\t\t\treturn info\n\t\t\t}", "renderSummary() {\n return ''; // @todo\n }", "function seDisplay(data, type, row, meta) {\n if(type === \"display\") {\n return formatNum(row[meta.col-1]) + \" (\" + formatNum(data) +\")\";\n } else {\n return toNumber(row[meta.col-1]);\n }\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}", "function e() {\n return \"4\" + h(3)\n }", "toString() {\n return this.name + ', scienficically known as ' + this.scientificName;\n }", "function qdisplay() {\n\t\t$('#main').html(\"<p>\" + test[count].b + \"</p>\");\n\t\tconsole.log(\"test[count].b\" + test[count].b)\n\t}", "print(){\n\t return `eta = ${this._eta}\ntau_SFE = ${this._tau_SFE}`;\n\t}", "function setSourceNumberDisplay(num)\n {\n sourceDisplay = num;\n document.getElementById(\"source\").innerHTML = \"<div valign='middle' dir='rtl' >\" + sourceDisplay +\" </div>\"\n }", "function toString()\n{\n\treturn \"Pos:\" + this.pos.toString() + \" Diff:\" + this.pos_diff.toString() + \"\\n Left: \" + this.keys[0].toString() +\n\t\t\"\\n Middle: \" + this.keys[1].toString() + \"\\n Right: \" + this.keys[2].toString();\n}", "renderPersistentObjects() {\n\t\t// Draw derivation descriptions\n\t\t//font-family: 'Space Mono', monospace;\n\t\tlet ctx = this.shadowCtx;\n\n\t\tctx.font = 'bold 15pt Space Mono, Monaco, Consolas';\n\t\tctx.fillStyle = '#000000';\n\t\tctx.textAlign = 'right';\n\n\t\t// Draw titles of the derivations (I-III, aVL, aVR, aVL, V1-V6)\n\t\tfor(let col = 0; col <= 1; col++) {\n\t\t\tfor(let row = 0; row <= 5; row++) {\n\t\t\t\tctx.fillText(\n\t\t\t\t\tthis.state().ecgDisplay.derivationNames[6*col + row],\n\t\t\t\t\tthis.variables.col[col] - 5,\n\t\t\t\t\tthis.variables.row[row] + this.variables.derivation.hHalf\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\n\t}", "get display() {\n return this._display.innerHTML;\n }", "_initDisplay(value) {}", "toString() {\n let info = \"<p>El nombre del Infante es \" + this.nombre + \"<br>\";\n info += \"El edad del Infante es \" + this.edad + \" años<br>\"\n info += \"La altura del Infante es \" + this.altura + \" cm<br></p>\";\n return (info);\n }", "function SLSdisplay() {\n return stack_arr;\n }", "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function VIEWAS_boring_default(obj) {\n //tabulator.log.debug(\"entered VIEWAS_boring_default...\");\n var rep; //representation in html\n\n if (obj.termType == 'literal')\n {\n var styles = { 'integer': 'text-align: right;',\n 'decimal': 'text-align: \".\";',\n 'double' : 'text-align: \".\";',\n };\n rep = myDocument.createElement('span');\n rep.textContent = obj.value;\n // Newlines have effect and overlong lines wrapped automatically\n var style = '';\n if (obj.datatype && obj.datatype.uri) {\n var xsd = tabulator.ns.xsd('').uri;\n if (obj.datatype.uri.slice(0, xsd.length) == xsd)\n style = styles[obj.datatype.uri.slice(xsd.length)];\n }\n rep.setAttribute('style', style ? style : 'white-space: pre-wrap;');\n\n } else if (obj.termType == 'symbol' || obj.termType == 'bnode') {\n rep = myDocument.createElement('span');\n rep.setAttribute('about', obj.toNT());\n thisOutline.appendAccessIcons(kb, rep, obj);\n\n if (obj.termType == 'symbol') {\n if (obj.uri.slice(0,4) == 'tel:') {\n var num = obj.uri.slice(4);\n var anchor = myDocument.createElement('a');\n rep.appendChild(myDocument.createTextNode(num));\n anchor.setAttribute('href', obj.uri);\n anchor.appendChild(tabulator.Util.AJARImage(tabulator.Icon.src.icon_telephone,\n 'phone', 'phone '+num,myDocument))\n rep.appendChild(anchor);\n anchor.firstChild.setAttribute('class', 'phoneIcon');\n } else { // not tel:\n rep.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n }\n } else { // bnode\n rep.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n }\n } else if (obj.termType=='collection'){\n // obj.elements is an array of the elements in the collection\n rep = myDocument.createElement('table');\n rep.setAttribute('about', obj.toNT());\n /* Not sure which looks best -- with or without. I think without\n\n var tr = rep.appendChild(document.createElement('tr'));\n tr.appendChild(document.createTextNode(\n obj.elements.length ? '(' + obj.elements.length+')' : '(none)'));\n */\n for (var i=0; i<obj.elements.length; i++){\n var elt = obj.elements[i];\n var row = rep.appendChild(myDocument.createElement('tr'));\n var numcell = row.appendChild(myDocument.createElement('td'));\n numcell .setAttribute('notSelectable','false')\n numcell.setAttribute('about', obj.toNT());\n numcell.innerHTML = (i+1) + ')';\n row.appendChild(thisOutline.outline_objectTD(elt));\n }\n } else if (obj.termType=='formula'){\n rep = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n rep.setAttribute('class', 'nestedFormula')\n\n } else {\n tabulator.log.error(\"Object \"+obj+\" has unknown term type: \" + obj.termType);\n rep = myDocument.createTextNode(\"[unknownTermType:\" + obj.termType +\"]\");\n } //boring defaults.\n tabulator.log.debug(\"contents: \"+rep.innerHTML);\n return rep;\n } //boring_default", "getFormattedTitle(){\n //.....this key word used to apply conversion logic to code (uppercase letter)\n return this.info.title.toUpperCase()\n }", "function pr(e,t,a,n,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),wr(e,new Oi([mr(e.sel.primary(),t,a,r)],0),n)}", "getBio() {\n return `${this.firstName} ${this.lastName} is a(n) ${this.position}.`\n }", "static rendered () {}", "static rendered () {}", "get display() {\n\t\treturn this.__display;\n\t}", "display() {\n \t\tfor (let key in this.ticket) {\n \t\t\tconsole.log(key + ' : ' + this.ticket[key] + this.currency);\n \t\t}\n }", "function deviceprint_display ()\n\t{\n\t\tt = \"\";\n\t\tif (self.screen)\n\t\t{\n\t\t\tt += screen.colorDepth +SEP+ screen.width +SEP+ screen.height +SEP+ screen.availHeight;\n\t\t}\n\t\treturn t;\n\t}", "getBiografia(){\n return super.getBiografia()+` Puesto: ${this.puesto}, Salario: ${this.sueldo}`;\n\n }", "function printDetailsModified() {\n\treturn `${this.name} (${this.type}) - ${this.age}`;\n}", "function negrita(val) {\n return '<b>' + val + '</b>';\n }", "getDisplayNumber(number) {\n return number;\n }", "toString() {\n const tileToString = {\n HEAD: 'O',\n TAIL: 'c',\n APPLE: 'x',\n EMPTY: '_'\n };\n return R.range(0, this.size.height).map(y =>\n R.range(0, this.size.width).map(x =>\n ({x, y})).map(pos => this.getTileContents(pos)).map(t => tileToString[t]).join('.')).join('\\n');\n }", "toString() {\n let info = \"<p>El nombre del Centurion es \" + this.nombre + \"<br>\";\n info += \"El edad del Centurion es \" + this.edad + \" años<br>\"\n info += \"La altura del Centurion es \" + this.altura + \" cm<br>\";\n info += \"El centurion lleva al cargo \" + this.tiempoEnCargo + \" años<br></p>\";\n return (info);\n }", "function displayHTML(){\n\t\tdom.name.innerHTML = \"1. Name: \"+studentArray[position].name;\n\t\tdom.address.innerHTML = \"2. Address: \"+studentArray[position].street+\n\t\t\", \"+studentArray[position].city+\n\t\t\", \"+studentArray[position].state;\n\t\tdom.grades.innerHTML = \"3. Grades: \"+studentArray[position].grades;\n\t\tdom.date.innerHTML = \"4. Date: \"+studentArray[position].getDate();\n\t\tdom.gpaAvg.innerHTML = \"5. Average GPA: \"+studentArray[position].getAverage(studentArray[position].grades).toFixed(2);\n\t}//close displayHTML function", "function displayChar(c) {\n LaunchBar.displayInLargeType({\n\ttitle: c.name,\n\tstring: c.c,\n });\n}", "updateDisplay() {\n this.currentText.innerText = this.formatNumber(this.currentTextValue);\n if (this.operation !== undefined) {\n this.previousText.innerText = `${this.previousTextValue} ${this.operation} `;\n } else {\n this.previousText.innerText = \"\";\n }\n }", "toString() {\n let info = \"<p>El nombre de la Centuria es \" + this.nombreCenturia + \"<br>\";\n info += \"El nombre de la Legion es \" + this.nombreLegion + \"<br>\"\n info += \"La centuria esta destinada en \" + this.provincia + \"<br></p>\";\n return (info);\n }", "function getText()\n\t{\n\t\tif (that.showUsed)\n\t\t\treturn \"Tries used: \" + that.current;\n\t\telse\n\t\t\treturn \"Tries left: \" + (that.maximum - that.current);\n\t}", "get display () {\n\t\treturn this._display;\n\t}", "get display () {\n\t\treturn this._display;\n\t}", "get display () {\n\t\treturn this._display;\n\t}", "get displayCalc() {\n return this._displayCalcEl.innerHTML;\n }", "get displayCalc() {\n return this._displayCalcEl.innerHTML;\n }", "function displayFrind(mate){\n\t\treturn mate.name + \" \" + mate.age + \" \" + mate.hoby + \" \"+ mate.gender\n\t}", "info() {\n if (this.numOfPages > 0) {\n return this.title + '<br>' + ' by ' + this.author + '<br>' + this.numOfPages + ' pages';\n } \n return this.title + '<br>' + ' by ' + this.author + '<br>'; \n }", "function sc_display(o, p) {\n if (p === undefined) // we assume not given\n\tp = SC_DEFAULT_OUT;\n p.appendJSString(sc_toDisplayString(o));\n}", "_constructDisplayWord(){\n let displayWord = \"\";\n for (let i=0;i<this._wordLetter.length;i++){\n if (this._wordLetter[i] == true){\n displayWord += \"&nbsp;&nbsp;&nbsp;\";\n }else if(this._wordLetter[i] == false){\n displayWord += \"_&nbsp;\"\n }else{\n displayWord += this._wordLetter[i]+\"&nbsp;\";\n }\n }\n return displayWord;\n }", "showLists() {\n return toIndexArray(this.lists)\n .map(listIdx => (\n <p key={`p-${listIdx}`}>List #{listIdx + 1}:\n {\n ' ' + toIndexArray(this.lists[listIdx])\n .map(itemIdx => `(${this.lists[listIdx][itemIdx]}, ${this.weights[listIdx][itemIdx]})`)\n .join(', ')\n }\n </p>\n ));\n }", "title() { return this.owner.name + \" - \" + this.label.replace('\\n', ' ') }", "function displayF (item)\n\t{\n\t\tlet display = document.querySelector(\"span\");\n\t\tdisplay.textContent = Number(item);\n\t}", "get displayX() {\n\t\treturn this.__Internal__Dont__Modify__.dispX;\n\t}", "function displayValue(value) {\r\n if (isNumber(value) && String(value).length > 14) value = value.toExponential(6);\r\n\r\n value = String(value);\r\n\r\n let sign = \"\";\r\n // If there is a sign ignore adding commas\r\n if (value[0] === \"-\" || value[0] === \"+\") {\r\n sign = value[0];\r\n value = value.slice(1);\r\n }\r\n\r\n // If it is a float number ignore commas after the dot\r\n let after_dot = \"\";\r\n if (isFloatNum(value)) {\r\n let dot_id = value.indexOf(\".\");\r\n after_dot = value.slice(dot_id);\r\n value = value.slice(0, dot_id);\r\n }\r\n\r\n let displayed_value = value;\r\n\r\n // Add commas every 3 characters\r\n if (value.length >= 4) {\r\n for (let i = value.length - 1; i >= 0; i--) {\r\n if (i % 3 === 0 && i != 0) displayed_value = displayed_value.slice(0, -i) + \",\" + displayed_value.slice(-i);\r\n }\r\n }\r\n // Display \r\n screen.innerHTML = sign + displayed_value + after_dot;\r\n}", "updateDisplay(){\r\n this.currentOperandTextElement.innerText = this.getDisplayNumber(this.currentOperand);\r\n // if the operation doesn't exist\r\n if (this.operation != null){\r\n this.previousOperandTextElement.innerText = `${this.previousOperand} ${this.operation}`\r\n } else{\r\n this.previousOperandTextElement.innerText = '';\r\n }\r\n }", "function displayText(x){\r\n \r\n document.getElementById(\"display\").innerHTML = (x[0].model)+\" \"+(x[0].make);\r\n \r\n \r\n}", "get_displayedText() {\n return this.liveFunc._displayedText;\n }", "function displayUnitTitle() {\n\n // Parts of the unit title\n var unitNo = 'སློབ་མཚན། ' + my.current.unitNo +\n '.' + my.current.subunitNo\n var space = '\\u00a0\\u00a0'\n var title = '[' + my.current.unit.title + ']'\n\n Util.setChildren(my.html.unitTitle, unitNo, space, title)\n }", "function Paper_format_other(){\n\n}", "show() {\n\t\tnoStroke();\n\t\tfill(150)\n\t\tcircle(this.x,this.y,this.r*2)\n\t\tfill(255)\n\t\ttextSize(30)\n\t\ttextAlign(CENTER, CENTER)\n\t\ttext(this.name, this.x, this.y)\n\t\t/*\n\t\ttext(this.one, 40, 461)\n\t\ttext(this.two, 121, 461)\n\t\ttext(this.three, 40+81*2, 461)\n\t\ttext(this.four, 40+81*3, 461)\n\t\ttext(this.five, 40+81*4, 461)\n\t\ttext(this.six, 40+81*5, 461)\n\t\ttext(this.ti, 40+81*6, 461)\n\t\ttext(this.te, 40+81*7, 461)\n\t\ttext(this.ta, 40+81*8, 461)\n\t\ttext(this.la, 40+81*9, 461)\n\t\ttext(this.le, 40+810, 461)*/\n\t}", "toString()\n {\n return \"Day: \"+this.Day+ \" Working hours: \"+this.DailyEmpHrs + \" Daily Emp Wage : \"+this.DailyEmpWage+\"\\n\";\n }", "function updateDisplay(){\n var num = $(this).text();\n var displayText = display.text();\n if (display.text() == '0'){\n display.text(num);\n } else {\n var output = display.text()+num;\n display.text(output);\n }\n }", "function show( obj )\r\n{ var r = \"\" ;\r\n for (var i in obj)\r\n r += i + \" = \" + obj[i] + \"\\n\" ;\r\n return r ;\r\n}", "display () {\n let output = ''\n const layout = JSON.parse(JSON.stringify(this.layout)) // Deep copy\n // Include the carts\n this.carts.forEach((cart) => {\n // If another cart is at the spot, draw a collision instead\n if (this.cartDirections.indexOf(layout[cart.y][cart.x]) >= 0) {\n layout[cart.y][cart.x] = 'X'\n } else {\n layout[cart.y][cart.x] = cart.direction\n }\n })\n layout.forEach((y) => {\n output += y.join('')\n output += '\\n'\n })\n\n return output\n }", "carInfo() {\n return \"This car is a \" + this.color + \" \" + this.make + \" \" + \"year: \" + this.modelYear;\n }", "print() {\n return console.log(\n \"Display: \" + this.list.map(num => [num]).join(\" \")\n );\n }", "function finalDisplay(a, b){\n\tword.display[a] = b;\n}", "getDescription() {\n return \"Nom : \"+this.nom+\"\\nAge : \"+this.age+\"\\nProfession : \"+this.profession;\n }", "function poscurToDisplay(pos){\n \"use strict\";\n var bd, fun = function(x){\n\tvar res;\n\tif(x===1){\n\t res = \" X \";\n\t}\n\telse if(x===-1){\n\t res = \" O \";\n\t}\n\telse if(x===0){\n\t res = \" \";\n\t}\n\treturn res;\n };\n bd = pos.map(function(r,i){\n\t\t return pos[i].map(fun);\n\t });\n return bd;\n}", "presentation() {\n\t\tconsole.log('Le personnage s\\'appelle : ' + this.NAME);\n\t\tconsole.log('current ID : ' + this.ID);\n\t\tconsole.log('IMG : ' + this.IMG);\n\t\tconsole.log('DESC : ' + this.DESC);\n\t\tconsole.log(\"-----------\");\n\t}", "function getDisplayValue(val) {\n if (isExplodedMine(row, col)) {\n return ( <img src=\"./img/mine.png\" height=\"20\" width=\"20\" /> )\n }\n if (isFlagged(row, col)) {\n return ( <img src=\"./img/flag.png\" height=\"20\" width=\"20\" /> )\n }\n if (isDigit(row, col)) { return val; }\n\n return '';\n }", "function renderTxtFormat(cards, attrib) {\n var output = 'Sideboard\\r\\n' + _.reduce(cards, function (memo, card) {\n return memo += card.count + ' ' + card.title + '\\r\\n';\n }, '');\n return output;\n }", "toString() {\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\n }", "updateDisplay(){\n this.currentOperandTextElement.innerText = this.getDisplayNumber(this.currentOperand)\n if(this.operation != null){\n this.previousOperandTextElement.innerText = `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`\n } else {\n this.previousOperandTextElement.innerText = ''\n }\n }", "displayNote() {\n return converter.makeHtml(this.note);\n }", "toString() {\n return this.symbol + \"_\" + this.subscript;\n }", "get unitFormatted() {\r\n\t\treturn this.count > 1 ? this.unit + 's' : this.unit;\r\n\t}", "cardToString(){\n return this.number + \" of \" + this.suit + \" (\" + this._isFaceUp + \")\";\n }", "get wordInfo() {\r\n\t\t\tlet node;\r\n\t\t\tlet para = document.createElement(\"li\");\r\n\t\t\tnode = document.createTextNode(this.word + \" No. of letters: \" + this.numLetters + \" No. of trys: \" + this.trys);\r\n\t\t\tpara.appendChild(node);\t\t\r\n\t\t\tlet element = document.getElementById(\"output\");\r\n\t\t\telement.appendChild(para);\r\n\t\t\r\n\t}", "get HTML() {\n\t\treturn `${this.worldTime.toDateString()}<br>${this.hour}:${this.minute} ${this.meridiem}<br>Sunlight ${this.game.sun.sunlight}`;\n\t}", "get displayText PS_displayText() {\n var {matchedName: sentence, _arguments: args} = this._verb;\n for (let x in args) {\n let obj = x === \"direct_object\";\n let {text} = this._argSuggs[x] || 0;\n if (text) sentence += (\" \" +\n (obj ? \"\" : args[x].flag + \" \") +\n (obj ? \"[ \" + text + \" ]\" : text));\n }\n return sentence;\n }", "updateDisplay(){\n this.currentOperandTextElement.innerText = \n this.getDisplayNumber(this.currentOperand)\n if(this.operation != null) {\n this.previousOperandTextElement.innerText = \n `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`\n } else {\n this.previousOperandTextElement.innerText= \"\"\n }\n }", "function display()\n\t\t{\n\t\t\tvar i;\n\t\t\tvar arr = [];\n\t\t\tfor(i=1;i<dd.value;i++)\n\t\t\t{\n\t\t\t\tif(prime(i))\n\t\t\t\t\tarr[arr.length] = \" \"+i+\" \";\n\t\t\t}\n\t\t\tdocument.getElementById(\"demo\").innerHTML = arr;\n\t\t}", "displayWordInfo() {\r\n this.displayHangman();\r\n this.displayLives();\r\n this.displayLetters();\r\n this.displayLettersToGuess();\r\n }", "toString() {\n // Adding space at the end if there is content to make concatenation code simpler in renderers.\n return this.length ? `${this.value} ` : '';\n }", "toString() {\n // Adding space at the end if there is content to make concatenation code simpler in renderers.\n return this.length ? `${this.value} ` : '';\n }", "function showStatus() \n{\n\t/* score */\n\tfill(255);\n\ttextSize(16);\n\ttext(\"score:\"+score, 5, 16);\n\t/* level */\n\tfill(255);\n\ttextSize(16);\n\ttext(\"level:\"+level, 5, 32);\n\t/* bullet left */\n\tfill(255);\n\ttextSize(16);\n\ttext(\"bullet:\"+bnum, 5, 48);\n\t/* blood */\n\tfill(255);\n\ttextSize(16);\n\ttext(\"blood:\"+blood, 5, 64);\n}", "function valueDescription(text) { }", "function showUsedLetters() {\n\t\t$(displayLetters).html(usedLetters.sort().join(\"\\xa0\\xa0\"));\n\t}", "getOneLineSummary() {\n const result = super.getOneLineSummary();\n return (result === this.constructor.LabelSingular) ? '' : result;\n }", "get informations() {\n return this.pseudo + ' (' + this.classe + ') a ' + this.sante + ' points de vie et est au niveau ' + this.niveau + '.'\n }", "function printInfo(text) {\n var str = '';\n for(var index in that.info_text) {\n if(str !== '' && that.info_text[index] !== '') {\n str += \" - \";\n }\n str += that.info_text[index];\n }\n document.getElementById(\"graph-info\").innerHTML = str;\n }", "toString(){\n \n }", "function showCurrentScore() {\n score1.innerHTML = `<p><strong>${gameData.score[0]}</strong><\\p>`;\n score2.innerHTML = `<p><strong>${gameData.score[1]}</strong><\\p>`;\n }", "print() {\n return `${this.name} | E: ${this.email} | P: ${this.phone} | R: ${this.relation}`;\n }", "function comportement (){\n\t }", "toDisplay() {\n return {\n player_names: this.p_name,\n player_LIDs: this.p_lid,\n player_active: this.p_active\n };\n }" ]
[ "0.6131478", "0.60869", "0.60769486", "0.59830856", "0.5966366", "0.59269834", "0.5898427", "0.5895316", "0.5881601", "0.5856703", "0.5841988", "0.58286303", "0.5799822", "0.5780264", "0.57791615", "0.5778942", "0.57748216", "0.5769433", "0.57661957", "0.57633346", "0.57543087", "0.5753928", "0.5750232", "0.57304764", "0.5730124", "0.57217664", "0.568622", "0.5671504", "0.5661299", "0.5661299", "0.56519085", "0.56498826", "0.56452215", "0.56386274", "0.5632464", "0.56287414", "0.5617325", "0.56117237", "0.5608803", "0.56027114", "0.5595982", "0.5593099", "0.55900675", "0.55870724", "0.55827814", "0.55827814", "0.55827814", "0.55824697", "0.55824697", "0.55671144", "0.5558887", "0.555266", "0.55484456", "0.5543174", "0.5542141", "0.55390847", "0.5536996", "0.5534319", "0.55254555", "0.55242485", "0.55184835", "0.55155253", "0.55134505", "0.55089617", "0.5506541", "0.5499163", "0.5497556", "0.5494503", "0.5489269", "0.5488821", "0.5484722", "0.54817504", "0.54752254", "0.54734015", "0.5473143", "0.5470453", "0.54660594", "0.5459579", "0.54586613", "0.54583985", "0.54583573", "0.5457647", "0.5453412", "0.544998", "0.5446371", "0.544575", "0.544453", "0.5443602", "0.54412574", "0.54412574", "0.5438844", "0.54370844", "0.54352164", "0.5430297", "0.54291433", "0.5428963", "0.5426861", "0.54242045", "0.5423979", "0.5420815", "0.5414248" ]
0.0
-1
It should return YES if they reach the same position at the same time, or NO if they don't. kangaroo has the following parameter(s): x1, v1: integers, starting position and jump distance for kangaroo 1 x2, v2: integers, starting position and jump distance for kangaroo 2 Output Format Print YES if they can land on the same location at the same time; otherwise, print NO. Note: The two kangaroos must land at the same location after making the same number of jumps. Sample Input 0 0 3 4 2 Sample Output 0 YES
function kangaroo(x1, v1, x2, v2) { if(v1 < v2) return 'NO'; if(((x2 - x1) % (v1 - v2)) == 0) return "YES" return "NO" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kangaroo(x1, v1, x2, v2) {\n //while loop to run that will keep a track of wether the fastest kangaroo is in the front, if it is, it will break.\n while (true) {\n // if condition is met\n if(x1 < x2 && v1 <= v2 || x1 > x2 && v1 >= v2){\n // break the loop\n break\n }\n // another condition that check's if v1 == v2, if it is\n if(x1 == x2){\n console.log(`They met at position ${x1}`)\n // returns yes\n return 'YES'\n // else...\n } else {\n // we move the kangaroo by summing it's current position + the distance of the jump \n x1 += v1\n x2 += v2\n }\n }\n // return no\n return 'NO'\n }", "function kangaroo(x1, v1, x2, v2) {\n\n // limiting condition:\n // if a kroo begins further from another AND hops faster than the other,\n // then there is no way the other can catch up. So print NO.\n if ((x1 > x2 && v1 > v2) || (x2 > x1 && v2 > v1)){\n return \"NO\"\n }\n\n // if they are jumping equally from the same point thent it's always a YES\n if (x1 == x2 && v1 == v2) {\n return 'YES'\n }\n // if they are starting from the same place and one of them hops higher than the other then its a NO\n if (x1 == x2 && (v1 != v2)) {\n return 'NO'\n }\n\n\n //// THIS IS BRUTEFORCE. EXPECT LARGE TEST CASES TO TIMEOUT/////\n // let found = false;\n // let steps = 0;\n // while (!found) {\n // console.log('not found yet.');\n // x1 += v1;\n // console.log('x1+v1: ', x1);\n // x2 += v2;\n // console.log('x2+v2: ', x2);\n // ++steps;\n // if (x1 == x2) {\n // found = true;\n // console.log('found something after steps: ', steps)\n // return \"YES\"\n // }\n // }\n //////////////////////////////////////////////////////////////\n\n // for YES, x2 - x1 and v2 - v1 must be positive\n if ((x2 - x1) % (v2 - v1) == 0) {\n return 'YES'\n }\n else return 'NO'\n\n\n}", "function kangaroo(x1, v1, x2, v2) {\n //in either of these cases, total fail.\nif (v1===v2 || v1<v2) {\n return \"NO\";\n}\nelse if (\n (x1-x2)%(v2-v1) === 0 ||\n // taking care of both velocity inequalities compared with x position inequalities\n (x1-x2)%(v1-v2) === 0\n) {\n return (\"YES\")\n // in all other cases, return no, becaues only \"they will meet\" conditions have not been met.\n} else {\n return \"NO\";\n}\n}", "function kangaroo(x1, v1, x2, v2) {\n if ((x1 < x2) && (v1 < v2)) {\n return \"NO\";\n } else {\n if ((v1 != v2) && ((x2 - x1) % (v1 -v2)) == 0) {\n return \"YES\";\n } else {\n return \"NO\";\n }\n }\n}", "function checkMarker(num1, num2){\n\n\t\t\t\t\t\t\t\t\t \t if ( parseInt(num1) > parseInt(num2) )\n\t\t\t\t\t\t\t\t\t \t \t {\n\n\t\t\t\t\t\t\t\t\t \t \t \treturn up;\n\t\t\t\t\t\t\t\t\t \t \t }\n\t\t\t\t\t\t\t\t\t \t else if (parseInt(num1) == parseInt(num2))\n\t\t\t\t\t\t\t\t\t \t \t {\n\n\t\t\t\t\t\t\t\t\t \t \t \treturn equal;\n\t\t\t\t\t\t\t\t\t \t \t }\n\t\t\t\t\t\t\t\t\t \t else \n\t\t\t\t\t\t\t\t\t \t \t {\n\n\t\t\t\t\t\t\t\t\t \t \t \treturn down;\n\t\t\t\t\t\t\t\t\t \t \t }\n\n\n\n\t\t\t\t\t\t\t\t\t }", "function checkTwoPosition(pos1, pos2) { \n \n if (checkCombo(pos1[0], pos1[1]).combo >= 3 || checkCombo(pos2[0], pos2[1]).combo >= 3 || arr[pos1[0]][pos1[1]] == 0 || arr[pos2[0]][pos2[1]] == 0) {\n \n// fromCol = Math.min(pos1[1] - checkCombo(pos1[0], pos1[1]).left, \n// pos2[1] - checkCombo(pos2[0], pos2[1]).left)\n// \n// toCol = Math.max(pos1[1] + checkCombo(pos1[0], pos1[1]).right,\n// pos2[1] + checkCombo(pos2[0], pos2[1]).right)\n// \n// toRow = Math.max(pos1[0] + checkCombo(pos1[0], pos1[1]).bottom, \n// pos2[0] + checkCombo(pos2[0], pos2[1]).bottom)\n// \n// if (checkCombo(pos1[0], pos1[1]).combo < 3) {\n// fromCol = pos2[1] - checkCombo(pos2[0], pos2[1]).left;\n// toCol = pos2[1] + checkCombo(pos2[0], pos2[1]).right;\n// toRow = pos2[0] + checkCombo(pos2[0], pos2[1]).bottom;\n// }\n// \n// if (checkCombo(pos2[0], pos2[1]).combo < 3) {\n// fromCol = pos1[1] - checkCombo(pos1[0], pos1[1]).left;\n// toCol = pos1[1] + checkCombo(pos1[0], pos1[1]).right;\n// toRow = pos1[0] + checkCombo(pos1[0], pos1[1]).bottom;\n// }\n// setRemovedValue();\n// console.log(arr)\n //auto check after every move\n setTimeout(autoCheck, 200);\n\n } else {\n //no available combo\n //add some animation of swapping icons back and forth\n \n //swap back elements\n setTimeout(swap, 200);\n if (allowSound) { playInvalidMoveNoComboMove.play() };\n }\n}", "function kangaroo(x1, v1, x2, v2) {\n if (v1 > v2) {\n remainder = (x1 - x2) % (v2 - v1)\n\n if(remainder === 0) {\n return 'YES'\n }\n }\n return 'NO'\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 kangaroo(x1, v1, x2, v2) {\n if ((v2<v1)&&(x1-x2)%(v2-v1)===0) {\n return 'YES'\n } else {return 'NO'} \n}", "checkCollide(pos1, pos2){\n if (Math.abs(pos1[0] - pos2[0]) < 50 &&\n pos1[1] === pos2[1]){\n\n return true;\n } else {\n return false;\n }\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}", "function checkValidMove(position_1, position_2) { \n if ((position_1[0] == position_2[0] && Math.abs(position_1[1] - position_2[1]) <= 1) || \n (position_1[1] == position_2[1] && Math.abs(position_1[0] - position_2[0]) <= 1)) {\n return true\n } else return false\n}", "function obstacleCheck() {\n if (rover.x == 5){\n if (rover.y++ == 5 || rover.y-- == 5){\n console.log(\"Crashed into a rock at coordinates 5,5. Refresh to try again.\");\n return(true);\n } else if (rover.y == 5){\n if (rover.x++ == 5 || rover.x-- == 5){\n console.log(\"Crashed into a rock at coordinates 5,5. Refresh to try again.\");\n return(true);\n }\n }\n \n\n } \n\n else {\n return(false);\n }\n}", "function areYouHere(arr1, arr2) {\n let eyeTicks = 1;\n let jayTicks = 1;\n for (let i=0; i<arr1.length; i++) {\n eyeTicks++;\n console.log('ticks for EYE', eyeTicks);\n const el1 = arr1[i];\n for (let j=0; j<arr2.length; j++) {\n jayTicks++;\n console.log('ticks for JAY', jayTicks);\n const el2 = arr2[j];\n if (el1 === el2) return true ;\n }\n }\n return false;\n}", "function collision(e1, e2) {\n var response = false;\n const st1 = parseInt(e1.starttime, 10);\n const et1 = parseInt(e1.starttime,10) + parseInt(e1.duration, 10);\n const st2 = parseInt(e2.starttime, 10);\n const et2 = parseInt(e2.starttime, 10) + parseInt(e2.duration, 10);\n\n if(e1.day === e2.day && e1.gren !== e2.gren) {\n if(st2 <= et1 && st2 >= st1) {\n response = true;\n }\n if(st1 <= et2 && st1 >= st2) {\n response = true;\n }\n }\n\n return response;\n}", "function matchCheck(){\n return (points == match);\n }", "function checkOverlap(location, length, orientation, genFleet) {\n\t var loc = location;\n\t // Player 2 Overlap Horizontal Check //\n \tif (orientation == \"horz\") {\n \t\tvar end = location + length;\n\t \tfor (; location < end; location++) {\n\t \t\tfor (var i = 0; i < genFleet.currentShip; i++) {\n\t \t\t\tif (genFleet.ships[i].locationCheck(location)) {\n\t \t\t\t\tif (genFleet == player1Fleet) randomSetupMultiP2(genFleet);\n\t \t\t\t\telse return true;\n\t \t\t\t}\n\t \t\t} \n\t \t} \n\t } else {\n\t\t var end = location + (10 * length);\n\t\t // Player 2 Overlap Vertical Check //\n\t \tfor (; location < end; location += 10) {\n\t \t\tfor (var i = 0; i < genFleet.currentShip; i++) {\n\t \t\t\tif (genFleet.ships[i].locationCheck(location)) {\n\t \t\t\t\tif (genFleet == player1Fleet) randomSetupMultiP2(genFleet);\n\t \t\t\t\telse return true;\n\t \t\t\t}\n\t \t\t}\n\t \t}\n\t } \n\t // If Player 2 Ships Do not Overlap Then All Is Good & Create Hits //\n\tif (genFleet == player1Fleet && genFleet.currentShip < genFleet.numOfShips) {\n\t\tif (orientation == \"horz\") genFleet.ships[genFleet.currentShip++].populateHorzHits(loc);\n\t \telse genFleet.ships[genFleet.currentShip++].populateVertHits(loc);\n\t \tif (genFleet.currentShip == genFleet.numOfShips) {\n\t \t\t// Delay For Smoother User Experience //\n\t \t\tsetTimeout(500);\n\t \t} else randomSetupMultiP2(genFleet);\n\t }\n\treturn false;\n }", "function checkOverlapMulti(location, length, orientation, genFleet) {\n\tvar loc = location;\n\t// Player 1 Overlap Horizontal Check //\n\tif (orientation == \"horz\") {\n\t\tvar end = location + length;\n\t\tfor (; location < end; location++) {\n\t\t\tfor (var i = 0; i < genFleet.currentShip; i++) {\n\t\t\t\tif (genFleet.ships[i].locationCheck(location)) {\n\t\t\t\t\tif (genFleet == player2Fleet) randomSetupMulti(genFleet);\n\t\t\t\t\telse return true;\n\t\t\t\t}\n\t\t\t} \n\t\t} \n\t} else {\n\t\tvar end = location + (10 * length);\n\t\t// Player 1 Overlap Vertical Check //\n\t\tfor (; location < end; location += 10) {\n\t\t\tfor (var i = 0; i < genFleet.currentShip; i++) {\n\t\t\t\tif (genFleet.ships[i].locationCheck(location)) {\n\t\t\t\t\tif (genFleet == player2Fleet) randomSetupMulti(genFleet);\n\t\t\t\t\telse return true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} \n\t// If Player 1 Ships Do not Overlap Then All Is Good & Create Hits //\n if (genFleet == player2Fleet && genFleet.currentShip < genFleet.numOfShips) {\n\t if (orientation == \"horz\") genFleet.ships[genFleet.currentShip++].populateHorzHits(loc);\n\t\telse genFleet.ships[genFleet.currentShip++].populateVertHits(loc);\n\t\tif (genFleet.currentShip == genFleet.numOfShips) {\n\t\t\t// Delay For Smoother User Experience //\n\t\t\tsetTimeout(500);\n\t\t} else randomSetupMulti(genFleet);\n\t}\n return false;\n}", "checkCollide(pos1, pos2){\n\t if (Math.abs(pos1[0] - pos2[0]) < 50 &&\n\t pos1[1] === pos2[1]){\n\t\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t }", "intersect(other){\n let flag_intersect = false;\n let d2 = dist(this.locX, this.locY, other.locX, other.locY);\n if (d2 <= this.ballSize/2 + other.ballSize/2) {\n flag_intersect = true;\n //print(flag_intersect);\n }\n return flag_intersect;\n }", "function isPosEqual(pos1, pos2){\n return Math.abs(pos1[0]-pos2[0])<10 && Math.abs(pos1[1]-pos2[1])<10;\n}", "function collision(playerOne, playerTwo) {\n var x1 = $('.playerOne').offset().left;\n var y1 = $('.playerOne').offset().top;\n var x2 = $('.playerTwo').offset().left;\n var y2 = $('.playerTwo').offset().top;\n // console.log(x1 + \"is player one's x coordinate\");\n // console.log(y1 + \"is player one's y coordinate\");\n // console.log(x2 + \"is player two's x coordinate\");\n // console.log(y2 + \"is player two's y coordinate\");\n if (playerOneAlive===true && playerTwoAlive===true &&(y1 + $('.playerOne').outerHeight(true)) < y2 ||\n y1 > (y2 + $('.playerTwo').outerHeight(true)) ||\n (x1 + $('.playerOne').outerWidth(true)) < x2 ||\n x1 > (x2 + $('.playerTwo').outerWidth(true))) {\n // console.log(false);\n }else {\n // console.log(true);\n $('.playerOne').css({\n left: $('.playerOne').position().left - 30 + \"px\"\n })\n $('.playerTwo').css({\n right: $('.playerTwo').position().right - 30 + \"px\"\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 isSnakePosOK(x,y){\n //not on the other snake\n for (var k = 0; k < snakes[1-i].body.length; k++){\n if ((x == snakes[1-i].body[k][0] || x-1 == snakes[1-i].body[k][0] || x-2 == snakes[1-i].body[k][0]) && y == snakes[1-i].body[k][1])\n return false; \n }\n //not on food\n if ((x == foodPos[0] || x-1 == foodPos[0] || x-2 == foodPos[0]) && y == foodPos[1])\n return false;\n return true;\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}", "function test() {\n let pippo = [0, 4];\n if (pippo[0] == pippo[1]) {\n return console.log(true);\n } else {\n return console.log(false);\n }\n}", "function checkWon(){\n if(((arr1[0][0]===arr1[0][1])&&(arr1[0][1]!==\"\")) && (arr1[0][1]===arr1[0][2])){\n if(arr1[0][0]===\"X\"){\n player1Won(); //call player1Won to show the message\n }\n\n else if(arr1[0][0]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[1][0]===arr1[1][1]) && (arr1[1][1]!==\"\")) && (arr1[1][1]===arr1[1][2])){\n if(arr1[1][0]===\"X\"){\n player1Won();// call player1Won to show the message\n }\n\n else if(arr1[1][0]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[2][0]===arr1[2][1]) && (arr1[2][1]!==\"\")) && (arr1[2][1] ===arr1[2][2])){\n if(arr1[2][0]===\"X\"){\n player1Won();// call player1Won to show the message\n }\n else if(arr1[2][0]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n\n else if(((arr1[0][2]===arr1[1][1])&&(arr1[1][1]===arr1[2][0]))&&(arr1[1][1]!==\"\")){\n if(arr1[0][2]===\"X\"){\n player1Won();// call player1Won to show the message\n }\n\n else if(arr1[0][2]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[0][0]===arr1[1][1])&& (arr1[1][1]===arr1[2][2]))&& (arr1[1][1]!==\"\")){\n if(arr1[0][0]===\"X\"){\n player1Won(); // call player1Won to show the message\n }\n else if(arr1[0][0]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[0][0]===arr1[1][0])&& (arr1[1][0]===arr1[2][0]))&& (arr1[1][0]!==\"\")){\n if(arr1[0][0]===\"X\"){\n player1Won();// call player1Won to show the message\n }\n else if(arr1[0][0]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[0][1]===arr1[1][1]) && (arr1[1][1]===arr1[2][1]))&&(arr1[1][1]!==\"\")){\n if(arr1[0][1]===\"X\"){\n player1Won();//call player1Won to show the message\n }\n else if(arr1[0][1]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[0][2]===arr1[1][1])&& (arr1[1][1]===arr1[2][0]))&& (arr1[1][1]!==\"\")){\n if(arr1[0][2]===\"X\"){\n player1Won();//call player1Won to show the message\n }\n else if(arr1[0][2]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(((arr1[0][2]===arr1[1][2])&& (arr1[1][2]===arr1[2][2]))&& (arr1[1][2]!==\"\")){\n if(arr1[0][2]===\"X\"){\n player1Won();//call player1Won to show the message\n }\n else if(arr1[0][2]===\"O\"){\n player2Won();//call player2Won to show the message\n }\n }\n else if(countGame>=9){\n $('#message').text(\"Keep trying\");\n gameOver=true;// gameover will be true\n countTIE++;\n $(\"#TIE\").text(\"TIE: \"+\" \"+(countTIE));//there is no win\n setTimeout(clearBox,3000);\n }\n}//end function", "function isFoodPosOK(x,y){\n //not on snake0\n for (var i = 0; i < snakes[0].body.length; i++){\n if (x == snakes[0].body[i][0] && y == snakes[0].body[i][1])\n return false;\n }\n //not on snake1\n for (var i = 0; i < snakes[1].body.length; i++){\n if (x == snakes[1].body[i][0] && y == snakes[1].body[i][1])\n return false;\n }\n return true;\n }", "function jumpCollision(rectOne, rectTwo) {\n \n // Check whether the previous y location is greater than the top of the platform\n if (prevY < rectTwo.y + gridSquareSizeY) {\n return false;\n }\n \n // Check whether there is a collision on the x and y\n return Math.abs((rectOne.x + rectOne.width / 2) - (rectTwo.x + rectTwo.width / 2)) < rectOne.width / 2 + rectTwo.width / 2 && Math.abs((rectOne.y + rectOne.height / 2) - (rectTwo.y + rectTwo.height / 2)) < rectOne.height / 2 + rectTwo.height / 2;\n \n}", "function Over(ship1, ship2){\n //Definition of the orientation axe of ship1\n var axe = orientation(ship1);\n\n // Definition of the orientation of ship2\n var axe2 = orientation(ship2);\n\n switch(axe){\n case axe2: //If ships' orientation is on the same axe\n if(ship1[0][axe] == ship2[0][axe2]){ //If ships are on the same axe coordinate\n if(ship1[0][(axe-1)*(-1)] < ship2[0][(axe-1)*(-1)] && ship1[1][(axe-1)*(-1)] < ship2[0][(axe-1)*(-1)]-1){ //If origin and end of ship1 < origin of ship2\n return false;\n }\n else if(ship2[0][(axe-1)*(-1)] < ship1[0][(axe-1)*(-1)] && ship2[1][(axe-1)*(-1)] < ship1[0][(axe-1)*(-1)]-1){ //If origin and end of ship2 < origin of ship1\n return false;\n }\n else { //Else, ship2 is over ship1\n return true;\n }\n }\n else {\n return false; //Else -> they are paralels, return false\n }\n break;\n\n default: //If ships are not oriented the same way\n for(var x = ship1[0][(axe-1)*(-1)]; x <= ship1[1][(axe-1)*(-1)]; x++){ //For each axe coordinate of ship1\n if(x == ship2[0][axe2]){ //If the coordinate is equal to the orientation axe of ship2\n for(var y = ship2[0][(axe2-1)*(-1)]; y <= ship2[1][(axe2-1)*(-1)]; y++){ //For each axe coordinate of ship2\n if(y == ship1[0][axe] || y == ship1[0][axe]-1){ //If the coordinate is equal to the orientation axe of ship1\n return true; //Ships are superimposed\n }\n }\n return false;\n break;\n }\n }\n break;\n }\n}", "advancedOnStairCheck(android) {\n const stairPosition = this.getRealPosition();\n const currentPositions = {\n stair: {x: stairPosition.x, y: stairPosition.y, w: this.w, h: this.h},\n android: {x: android.x, y: android.y, w: android.w, h: android.h},\n };\n\n if (!this.previousPositions || android.velocity.y < 0) {\n this.previousPositions = currentPositions;\n return false;\n }\n\n // If the basic collision check passes, there wouldn't be any need\n // for further calculation.\n if (this.basicOnStairCheck(android, stairPosition)) {\n this.previousPositions = currentPositions;\n return true;\n }\n\n const android1 = this.previousPositions.android;\n const android2 = currentPositions.android;\n const stair1 = this.previousPositions.stair;\n const stair2 = currentPositions.stair;\n\n const leftFootMovement = {\n from: {\n x: android1.x,\n y: android1.y + android1.h,\n },\n to: {\n x: android2.x,\n y: android2.y + android2.h,\n },\n };\n const rightFootMovement = {\n from: {\n x: leftFootMovement.from.x + android1.w,\n y: leftFootMovement.from.y,\n },\n to: {\n x: leftFootMovement.to.x + android2.w,\n y: leftFootMovement.to.y,\n },\n };\n const stairLine = {\n from: {\n x: Math.min(stair1.x, stair2.x),\n y: stair1.y,\n },\n to: {\n x: Math.max(stair1.x + stair1.w, stair2.x + stair2.w),\n y: stair2.y,\n }\n };\n\n this.previousPositions = currentPositions;\n return movementIntersect(stairLine, leftFootMovement, rightFootMovement);\n }", "function checkRedCastling(x1, x2, y1, y2) {\n if(String.fromCharCode(x1) === \"D\" && y1 === '1') { //King at starting position\n //Check Kings destination and if original rook is in place RIGHT SIDE\n if(String.fromCharCode(x2) === \"F\" && y2 === '1' && document.getElementById('H1').firstElementChild.id === 'R4'){\n if(rowPathIsClear(x1, 'H'.charCodeAt(), y1)) {\n document.getElementById('E1').appendChild(document.getElementById('R4'));\n return true;\n }\n }\n //Check Kings destination and if original rook is in place LEFT SIDE\n if(String.fromCharCode(x2) === \"B\" && y2 === '1' && document.getElementById('A1').firstElementChild.id === 'R3'){\n if(rowPathIsClear('A'.charCodeAt(),x1, y1)) {\n document.getElementById('C1').appendChild(document.getElementById('R3'));\n return true;\n }\n }\n }\n return false;\n}", "function checkForLocationMatch() {\n // we need to check for each of the obstacles if it overlaps with the players current position\n let check = false;\n obstacles.forEach(obstacle => {\n playElement = document.getElementById(\"player\");\n if (\n Math.abs(obstacle.offsetLeft - playElement.offsetLeft) <\n widthObjects - 18 &&\n Math.abs(obstacle.offsetTop - playElement.offsetTop) < heightObjects - 18\n ) {\n check = true;\n }\n });\n return check;\n}", "function snakeEatsFood() {\n return snakeHead.coordinates[0] === food.coordinates[0] && snakeHead.coordinates[1] === food.coordinates[1]\n }", "ifInBound(currentPos, coordinates1, coordinates2){\n \n //check for inverted squares\n if(coordinates1.latitude < coordinates2.latitude){\n //swap\n var temp = coordinates1\n coordinates1 = coordinates2\n coordinates2 = temp\n }\n else{\n\n }\n console.log(\"====ALL MY COORDINATES ==== \")\n console.log(currentPos)\n console.log(coordinates1)\n console.log(coordinates2)\n\n if((currentPos.coords.latitude <= coordinates1.latitude) && (currentPos.coords.latitude >= coordinates2.latitude)){\n console.log(\"latitude inbound\")\n if((currentPos.coords.longitude >= coordinates1.longitude) && (currentPos.coords.longitude <= coordinates2.longitude)){\n console.log(\"longitude inbound\")\n return true\n }\n }\n return false\n\n }", "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 }", "checkAndMove(x2, y2, matrix) {\n if (matrix[y2][x2] && matrix[this.yPos][this.xPos].type === \"pawn\") {\n //if position is filled and it is valid, return true, else return false\n if (\n this.validCapture.hasOwnProperty(x2) &&\n this.validCapture[x2] === y2\n ) {\n let position = this.changePosition(this.xPos, this.yPos, x2, y2, matrix);\n console.log('position 2', position);\n\n if(position === 'capture-king') return position;\n this.updatePos(x2, y2);\n return true;\n } else {\n return false;\n }\n }\n console.log(\"place it is moving\", matrix[y2][x2]);\n if (this.validMoves.hasOwnProperty(x2)) {\n let yArr = this.validMoves[x2];\n console.log(\"valid x\");\n if (yArr.indexOf(parseInt(y2)) >= 0) {\n console.log(\"valid x and y\");\n\n let position = this.changePosition(this.xPos, this.yPos, x2, y2, matrix);\n console.log('position 3', position);\n\n if(position === 'capture-king') return position;\n this.updatePos(x2, y2);\n return true;\n }\n }\n console.log(\"not valid move\");\n return false;\n }", "function pairingCheck(instruction1, instruction2, fillNoop) {\n\t\t\n\t\t//const pairableBoth = [\"MOV\", \"PUSH\", \"POP\", \"LEA\", \"NOP\", \"INC\", \"DEC\", \"ADD\", \"SUB\", \"CMP\", \"CMP\", \"AND\", \"OR\", \"XOR\"];\n\t\t//const pairableU = [\"ADC\", \"SBB\", \"SHR\", \"SAR\", \"SHL\", \"SAL\", \"ROR\", \"ROL\", \"RCR\", \"RCL\"];\n\t\t//const pairableV = [\"NC\", \"SJ\", \"NJ\", ]\n\t\t//colocar ou uma lista aqui com as instrucoes pareaveis ou colocar uma tag em cada instrucao\n\t\t\n\t\t\n\t\t\n\t\tif(instruction1.params.dest)\n\t\t\tconsole.log(instruction1.params.dest);\n\t\tif(instruction1.params.source)\n\t\t\tconsole.log(instruction1.params.source);\n\t\tif(instruction2.params.dest)\n\t\t\tconsole.log(instruction2.params.dest);\n\t\tif(instruction2.params.source)\n\t\t\tconsole.log(instruction2.params.source);\n\t\tconsole.log(\"fnop: \" + fillNoop);\n\t\t\n\t\t\n\t\tif(fillNoop > 0)\n\t\t\treturn true;\n\t\t\n\t\t//console.log(instruction1.name, instruction1.type);\n\t\t//para parear instrucao1 nao pode ser um jump\n\t\tif(instruction1.type === DATA_TYPES.CONTROL)\n\t\t{\n\t\t\tconsole.log(\"instruction1 is jump, no pair!\");\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t//verificar condicoes de disputa (rule 2)\n\t\tif(instruction1.params.dest !== undefined && typeof instruction1.params.dest === 'object')//se nao for objeto, nao eh registrador\n\t\t{\n\t\t\tif(instruction2.params.dest !== undefined && typeof instruction2.params.dest === 'object')//se nao for objeto, nao eh registrador\n\t\t\t{\n\t\t\t\tif(instruction1.params.dest === instruction2.params.dest)//se o destino de 1 for igual ao destino de 2 ja nao pode parear\n\t\t\t\t{\n\t\t\t\t\t//se fizer registradores parciais, colocar ifs aqui\n\t\t\t\t\tconsole.log(\"destino de 1 igual ao destino de 2\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse//eh um registrador, mas os destinos sao diferentes\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if(instruction2.params.source !== undefined && typeof instruction2.params.source === 'object')\n\t\t\t{\n\t\t\t\tif(instruction1.params.dest === instruction2.params.source)//se o destino de 1 for igual a fonte de 2 ja nao pode parear\n\t\t\t\t{\n\t\t\t\t\t//se fizer registradores parciais, colocar ifs aqui\n\t\t\t\t\tconsole.log(\"destino de 1 igual a fonte de 2\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse//destino de 1 eh diferente da fonte de 2\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\treturn true;//else, a instrucao 1 nao tem destino\n\t}", "isKingThreatened(kingPos, queenPos) {\n if (kingPos[0] == queenPos[0]) { // checking column\n return true;\n } else if (kingPos[1] == queenPos[1]) { // checking row\n return true;\n } else { // check diagonals next\n let colDiff = Math.abs(kingPos[0] - queenPos[0]);\n let rowDiff = Math.abs(kingPos[1] - queenPos[1]);\n if (colDiff == rowDiff) {\n return true;\n }\n }\n return false;\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 cerca (posicion1, posicion2) {\n var distancia;\n // debugger;\n distancia = Math.pow((Math.pow(posicion1.latitud - posicion2.latitud, 2) + Math.pow(posicion1.longitud - posicion2.longitud,2)), 0.5);\n console.log(distancia);\n return distancia <= distancia_max;\n }", "function alreadyTrackedKobon(k) {\n var kPoints = k.getUniquePoints();\n for (var i = 0; i < kobons.length; i++) {\n var points = kobons[i].getUniquePoints();\n var aMatch, bMatch, cMatch;\n aMatch = bMatch = cMatch = false;\n for (var j = 0; j < points.length; j++) {\n if (points[j].equals(kPoints[0])) aMatch = true;\n if (points[j].equals(kPoints[1])) bMatch = true;\n if (points[j].equals(kPoints[2])) cMatch = true;\n }\n if (aMatch && bMatch && cMatch) return true;\n }\n return false;\n }", "function posnEqual(posn1, posn2) {\n return ((posn1.x === posn2.x) && (posn1.y === posn2.y));\n}", "function checkIfFoodEaten() {\n // [x,y]\n const snakeHeadX = snake.location[0];\n const snakeHeadY = snake.location[1];\n const foodLocation = food.location;\n if (snakeHeadX === foodLocation[0] && snakeHeadY === foodLocation[1])\n {\n return true;\n }\n return false;\n }", "function checkExtrapolatedSnake1(newSnake)\r\n\t{\r\n //Variables for finding distance\r\n\t var a = newSnake[0].x - snake1[0].x;\r\n\t var b = newSnake[0].y - snake1[0].y;\r\n\t var c = Math.sqrt(a * a + b * b);\r\n\t //Checks to see if snake goes into itself\r\n\t //If snake is going to bite itself then extrapolated position = actual position\r\n\t //Otherwise this is an old packet\r\n\t if (c < 1 && snake1.indexOf(newSnake[0]) > -1)\r\n\t snake1 = newSnake;\r\n\t //Checks to see if new position is >= 3 steps away\r\n\t //This implies an odd packet has been received.\r\n\t //Either we have diverged greatly from the authoritative state\r\n\t //Or the packet was a fluke and out of order.\t \r\n\t}", "function istouch(loop1,loop2){\n\t\t\t\n\t\tfor(var i = 0; i < loop1.length; i++){\n\t\t\tfor(var j = 0; j < loop2.length; j++){\n\t\t\t\tif(loop1[i] == loop2[j]){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function findPlaces(loc_1, loc_2, time_threshold, velocity_threshold){\n\tlat1 = sevenDays[loc_1]['latitudeE7'];\n\tlon1 = sevenDays[loc_1]['longitudeE7'];\n\tlat2 = sevenDays[loc_2]['latitudeE7'];\n\tlon2 = sevenDays[loc_2]['longitudeE7'];\n\t//console.log(haversineDist(lat1, lon1, lat2, lon2));\n\tdist = haversineDist(lat1, lon1, lat2, lon2);\n\ttime1 = parseInt(sevenDays[loc_1]['timestampMs']);\n\ttime2 = parseInt(sevenDays[loc_2]['timestampMs']);\n\tvelocity = getVelocity(dist, time1, time2);\n\ttime_diff = time2 - time1;\n\tif (time_diff > time_threshold) {\n\t\tif (velocity < velocity_threshold) {\n\t\t\treturn true;\n\t\t}\n\t}\n\telse {\n\t\treturn false;\n\t}\n}", "neighbors(index1, index2) {\n const tile1 = this.getTilePosition(index1);\n const tile2 = this.getTilePosition(index2);\n\n const tile1pos = {x: tile1.x / this.tileWidth, y: tile1.y / this.tileHeight};\n const tile2pos = {x: tile2.x / this.tileWidth, y: tile2.y / this.tileHeight};\n\n if((tile1pos.x == tile2pos.x && Math.abs(tile2pos.y - tile1pos.y) == 1) ||\n (tile1pos.y == tile2pos.y && Math.abs(tile2pos.x - tile1pos.x) == 1) ) {\n return true;\n }\n\n return false;\n if((emptyTile.x == clickedTile.x || emptyTile.y == clickedTile.y) && (clickedTile.x != emptyTile.x || clickedTile.y != emptyTile.y)\n && (Math.abs(emptyTile.x - clickedTile.x) == 1 || Math.abs(emptyTile.y - clickedTile.y) == 1)) {\n\n }\n }", "function checkOverlap() {\n let d = dist(circle1.x, circle1.y, circle2.x, circle2.y);\n if (d < circle1.size/3 + circle2.size/3) {\n state = `love`;\n }\n }", "function isAdjacent(tile_1,tile_2){\n\tvar i1 = tile_1.coord.x;\n\tvar j1 = tile_1.coord.y;\n\tvar\ti2 = tile_2.coord.x;\n\tvar j2 = tile_2.coord.y;\n\tif(i1==i2 && j1==j2+1)\n\t\treturn true;\n\telse if(i1==i2 && j1==j2-1)\n\t\treturn true;\n\telse if(j1==j2 && i1==i2+1)\n\t\treturn true;\n\telse if(j1==j2 && i1==i2-1)\n\t\treturn true;\n\telse if(i1==i2-1 && j1==j2-1)\n\t\treturn true;\n\telse if(i1==i2-1 && j1==j2+1)\n\t\treturn true;\n\telse if(i1==i2+1 && j1==j2-1)\n\t\treturn true;\n\telse if(i1==i2+1 && j1==j2+1)\n\t\treturn true;\n\telse\n\t\treturn false;\n}", "function canPawnOrKingMove(notAnyToolCanMoveCheck, xFrom, yFrom, xTo, yTo)\r\n{\r\n \r\n if (isLocationInsideBoard (xFrom, yFrom) && isLocationInsideBoard(xTo, yTo))\r\n {\r\n // check if destination cell is empty\r\n if ((Math.abs(xTo - xFrom) == 1) && notAnyToolCanMoveCheck == true)\r\n {\r\n return isCellEmpty (xTo, yTo); // return true if the cell is really empty for this values\r\n }\r\n\r\n // if we jump, test if there is a tool of other color within\r\n if (Math.abs(xTo - xFrom) == 2)\r\n {\r\n if (isCellEmpty(xTo, yTo))\r\n {\r\n let xMiddle = (xTo + xFrom) / 2;\r\n let yMiddle = (yTo + yFrom) / 2;\r\n let myTool = getToolSymbolAt(xFrom, yFrom);\r\n let toolInTheMiddle = getToolSymbolAt(xMiddle, yMiddle);\r\n\r\n if ((myTool == whitePawnSymbol) || (myTool == whiteKingToolSymbol))\r\n {\r\n if ((toolInTheMiddle == blackPawnSymbol) || (toolInTheMiddle == blackKingToolSymbol))\r\n {\r\n return true; // white pawn can eat black pawn or king\r\n }\r\n }\r\n\r\n if ((myTool == blackPawnSymbol) || (myTool == blackKingToolSymbol))\r\n {\r\n if ((toolInTheMiddle == whitePawnSymbol) || (toolInTheMiddle == whiteKingToolSymbol))\r\n {\r\n return true; // black pawn can eat white pawn or king\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n}", "function areYouHere(arr1, arr2) {\n let ticks = 0;\n for (let i=0; i<arr1.length; i++) {\n ticks++;\n const el1 = arr1[i];\n for (let j=0; j<arr2.length; j++) {\n ticks++;\n const el2 = arr2[j];\n if (el1 === el2) {\n return {\n result: true,\n ticks: ticks\n };\n }\n }\n }\n return {\n results: false,\n ticks: ticks\n };\n}", "static samePos(a, b) {\r\n return a && b && a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;\r\n }", "function compareTwoCoordPositions(object1coord1, object1coord2, object2coord1, object2coord2) {\n return (Grid.vectorEquals(object1coord1, object2coord1) && Grid.vectorEquals(object1coord2, object2coord2))\n || (Grid.vectorEquals(object1coord1, object2coord2) && Grid.vectorEquals(object1coord2, object2coord1));\n}", "function testJackpot(result) {\n for (i = 0; i < result.length; i++)\n if(result[3] == result[i]){\n return true\n } else {\n return false\n }\n}", "function collision(sharkObject, fishObject) {\n var objectOne = $(sharkObject);\n var objectTwo = $(fishObject);\n var objectOneX = objectOne.offset().left;\n var objectOneW = objectOne.width();\n var objectOneY = objectOne.offset().top;\n var objectOneH = objectOne.height();\n var objectTwoX = objectTwo.offset().left;\n var objectTwoW = objectTwo.width();\n var objectTwoY = objectTwo.offset().top;\n var objectTwoH = objectTwo.height();\n if (objectOneY + objectOneH < objectTwoY || objectTwoY + objectTwoH < objectOneY || objectTwoX + objectTwoW < objectOneX || objectOneX + objectOneW < objectTwoX) {\n return false;\n }\n else {\n return true;\n }\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}", "function areYouHere(arr1, arr2) {\n let ticks = 0, result = false;\n for (let i=0; i<arr1.length; i++) {\n ticks++;\n const el1 = arr1[i];\n for (let j=0; j<arr2.length; j++) {\n ticks++;\n const el2 = arr2[j];\n if (el1 === el2) return result = true;\n }\n }\n return {\n result: result,\n ticks: ticks\n };\n}", "function isOverGoal(pI, pJ){\n //define player position on goal1\n if (goal1PosI == pI && goal1PosJ == pJ){\n return true;\n // define player position on goal2\n } else if (goal2PosI == pI && goal2PosJ == pJ){\n return true;\n // define player position on goal 3\n } else if (goal3PosI == pI && goal3PosJ == pJ){\n return true;\n // if not than do not consider other option\n } else {\n return false;\n }\n}", "function checkGoal()\n{\n\tvar goal1 = (block1Index[0] == block1Goal[0] && block1Index[1] == block1Goal[1]);\n\tvar goal2 = (block2Index[0] == block2Goal[0] && block2Index[1] == block2Goal[1]);\n\tvar goal3 = (block3Index[0] == block3Goal[0] && block3Index[1] == block3Goal[1]);\n\n\treturn (goal1 && goal2 && goal3);\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 checkwino(buttonNodes) {\n var flag = false;\n console.log(\"in check O: \");\n if (\n (buttonNodes[0][0].innerHTML === \"O\" &&\n buttonNodes[0][1].innerHTML === \"O\" &&\n buttonNodes[0][2].innerHTML === \"O\") ||\n (buttonNodes[1][0].innerHTML === \"O\" &&\n buttonNodes[1][1].innerHTML === \"O\" &&\n buttonNodes[1][2].innerHTML === \"O\") ||\n (buttonNodes[2][0].innerHTML === \"O\" &&\n buttonNodes[2][1].innerHTML === \"O\" &&\n buttonNodes[2][2].innerHTML === \"O\")\n ) {\n console.log(\"ai win!\");\n flag = true;\n console.log(flag);\n } else if (\n (buttonNodes[0][0].innerHTML === \"O\" &&\n buttonNodes[1][0].innerHTML === \"O\" &&\n buttonNodes[2][0].innerHTML === \"O\") ||\n (buttonNodes[0][1].innerHTML === \"O\" &&\n buttonNodes[1][1].innerHTML === \"O\" &&\n buttonNodes[2][1].innerHTML === \"O\") ||\n (buttonNodes[0][2].innerHTML === \"O\" &&\n buttonNodes[1][2].innerHTML === \"O\" &&\n buttonNodes[2][2].innerHTML === \"O\")\n ) {\n console.log(\"ai win!\");\n flag = true;\n console.log(flag);\n } else if (\n (buttonNodes[0][0].innerHTML === \"O\" &&\n buttonNodes[1][1].innerHTML === \"O\" &&\n buttonNodes[2][2].innerHTML === \"O\") ||\n (buttonNodes[0][2].innerHTML === \"O\" &&\n buttonNodes[1][1].innerHTML === \"O\" &&\n buttonNodes[2][0].innerHTML === \"O\")\n ) {\n console.log(\"ai win!\");\n flag = true;\n }\n return flag;\n}", "function checkBlueCastling(x1, x2, y1, y2) {\n if(String.fromCharCode(x1) === \"D\" && y1 === '8') { //King at starting position\n //Check Kings destination and if original rook is in place RIGHT SIDE\n if(String.fromCharCode(x2) === \"F\" && y2 === '8' && document.getElementById('H8').firstElementChild.id === 'R6'){\n if(rowPathIsClear(x1, 'H'.charCodeAt(), y1)) {\n document.getElementById('E8').appendChild(document.getElementById('R6'));\n return true;\n }\n }\n //Check Kings destination and if original rook is in place LEFT SIDE\n if(String.fromCharCode(x2) === \"B\" && y2 === '8' && document.getElementById('A8').firstElementChild.id === 'R5'){\n if(rowPathIsClear('A'.charCodeAt(),x1, y1)) {\n document.getElementById('C8').appendChild(document.getElementById('R5'));\n return true;\n }\n }\n }\n return false;\n}", "function onSnake(position){\n for (var i = 0; i < snake.length; ++i){ //Iterates through the snake\n if (position.x == snake[i].x && position.y == snake[i].y) { //if position of x & y is the same as the position of the snake x and y\n return true;\n }\n }\n return false; //Default false\n}", "function checkProblem(firstXMarker, lastXMarker) {\n\n var flagUpper = false;\n var flagLower = false;\n\n var upperBoundProblem = dangerValues[0];\n var lowerBoundProblem = dangerValues[1];\n\n for(var i = 0; i < upperBoundProblem.length; i++) {\n\n firstXProblem = upperBoundProblem[i][0];\n lastXProblem = upperBoundProblem[i][1];\n if(firstXProblem <= lastXMarker && lastXProblem >= firstXMarker) {\n flagUpper = true;\n break;\n }\n }\n\n for(var i = 0; i < lowerBoundProblem.length; i++) {\n firstXProblem = lowerBoundProblem[i][0];\n lastXProblem = lowerBoundProblem[i][1];\n if(firstXProblem <= lastXMarker && lastXProblem >= firstXMarker) {\n flagLower = true;\n break;\n }\n }\n\n if(flagUpper === true) {\n if(flagLower === true) {\n // Supera sia sopra che sotto\n return 3;\n } else {\n // Supera solo sopra\n return 1;\n }\n } else {\n if(flagLower === true) {\n // Supera solo sotto\n return 2;\n } else {\n // Nessun problema\n return 0;\n }\n }\n}", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function collision (first, second){\n const w = (first.width + second.width) / 2;\n const h = (first.height + second.height) / 2;\n const dx = Math.abs(first.x - second.x);\n const dy = Math.abs(first.y - second.y);\n if (dx <= w && dy <= h){\n const wy = w * (first.y - second.y);\n const hx = h * (first.x - second.x);\n if (wy > hx){\n if (wy > -hx){\n stopUp = true;\n // console.log('collision: up');\n return true;\n } else {\n stopRight = true;\n // console.log('collision: right');\n return true;\n }\n }else{\n if (wy > -hx){\n stopLeft = true;\n // console.log('collision: left');\n return true;\n } else {\n stopDown = true;\n // console.log('collision: down');\n return true;\n };\n };\n }else{\n stopUp = false;\n stopRight = false;\n stopDown = false;\n stopLeft = false;\n return false;\n };\n}", "function areNeighbors(char1, char2) {\n if (!char1 || !char2) {\n return false;\n }\n if (this.adjKeys[char1] && this.adjKeys[char2]) {\n if (this.adjKeys[char1][char2]) {\n if (this.adjKeys[char2][char1]) {\n return true;\n } else {\n return \"maybe true\";\n }\n }\n } else {\n return false;\n }\n }", "function is_collision()\n{\n\tif (frog.lane > 6 && frog.lane < 12) {\n\t\tvar lane = frog.lane - 7;\n\t\tfor (car in cars[lane].x) {\n\t\t\tif (frog.x + frog.w >= cars[lane].x[car] &&\n\t\t\t\tfrog.x <= cars[lane].x[car] + cars[lane].w) {\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}", "function elementsOverlap(pos) {\n if (snake.x == pos.x && snake.y == pos.y)\n return true;\n if(food){\n if(food.x == pos.x && food.y == pos.y)\n return true;\n }\n if(barriers && barriers.length>0 && food){\n for(var i = 0; i < barriers.length; i++){\n for(var j = 0; j < barriers[i].positions.length; j++){\n if(barriers[i].positions[j].pos.x == pos.x && barriers[i].positions[j].pos.y == pos.y){\n return true;\n }\n if(barriers[i].positions[j].pos.x == food.x && barriers[i].positions[j].pos.y == food.y){\n return true;\n }\n }\n }\n }\n for (var i = 0; i < snake.tail.length; i++) {\n if (snake.tail[i].x == pos.x && snake.tail[i].y == pos.y)\n return true;\n }\n return false;\n}", "function foodObsCheck(obstacle, newX, newY) {\r\n let oGood = false;\r\n for (let i = 0; i < obstacle.length; i++) {\r\n if (newX == obstacle[i].x && newY == obstacle[i].y) {\r\n oGood = false;\r\n return oGood;\r\n } else {\r\n oGood = true;\r\n }\r\n }\r\n return oGood;\r\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}", "function differentNumbers(guess1, guess2) {\n if (guess1 === guess2) {\n console.log(\"SAME GUESS\");\n highOrLow1.innerText = \"There can\";\n highOrLow2.innerText = \"Only be ONE\"\n return true;\n }\n }", "function gameOver(){\n\tfor (var i =1;i<snakeTail; i++) {\n \t\tif (snakeCordinates[0].xaxis==snakeCordinates[i].xaxis && snakeCordinates[0].yaxis==snakeCordinates[i].yaxis){\n printGameOver();\n break;\n }\n }\n if (snakeCordinates[0].xaxis>390 || snakeCordinates[0].xaxis<0 || snakeCordinates[0].yaxis>390 || snakeCordinates[0].yaxis<0){\n printGameOver(); \n }\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 }", "hasjumps() {\n return this._t != this._f;\n }", "function checkanswer(){\r\n if (userClickedPattern[currentspot]===gamePattern[currentspot])\r\n {\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n}", "function checkExtrapolatedSnake2(newSnake) {\r\n\t //Variables for finding distance\r\n\t var a = newSnake[0].x - snake2[0].x;\r\n\t var b = newSnake[0].y - snake2[0].y;\r\n\t var c = Math.sqrt(a * a + b * b);\r\n\t //Checks to see if snake goes into itself\r\n\t //If snake is going to bite itself then extrapolated position = actual position\r\n\t //Otherwise this is an old packet\r\n\t if (c < 1 && snake2.indexOf(newSnake[0]) > -1)\r\n\t snake2 = newSnake;\r\n\t}", "function areYouHere(arr1, arr2) {\n let ticks = 0;\n for (let i = 0; i < arr1.length; i++) {\n ticks++\n const el1 = arr1[i];\n for (let j = 0; j < arr2.length; j++) {\n ticks++\n const el2 = arr2[j];\n if (el1 === el2) return true, ticks;\n }\n }\n return false, ticks;\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}", "isGameOverFor(marker) {\n let playerChecked = this.state.humanMarker === marker ? 'human' : 'computer';\n\n if (\n (this.state.spaces[0] === marker && this.state.spaces[1] === marker && this.state.spaces[2] === marker) ||\n (this.state.spaces[3] === marker && this.state.spaces[4] === marker && this.state.spaces[5] === marker) ||\n (this.state.spaces[6] === marker && this.state.spaces[7] === marker && this.state.spaces[8] === marker) ||\n (this.state.spaces[0] === marker && this.state.spaces[3] === marker && this.state.spaces[6] === marker) ||\n (this.state.spaces[1] === marker && this.state.spaces[4] === marker && this.state.spaces[7] === marker) ||\n (this.state.spaces[2] === marker && this.state.spaces[5] === marker && this.state.spaces[8] === marker) ||\n (this.state.spaces[0] === marker && this.state.spaces[4] === marker && this.state.spaces[8] === marker) ||\n (this.state.spaces[2] === marker && this.state.spaces[4] === marker && this.state.spaces[6] === marker)\n ) {\n // a win\n if (playerChecked === 'human') {\n this.getEndState('human');\n return true;\n } else if (playerChecked === 'computer') {\n this.getEndState('computer');\n return true;\n }\n } else if (this.getOpenSpaces().length === 0) {\n this.getEndState('tie');\n return true;\n } else {\n // no win, no tie yet\n return false;\n }\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 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}", "function collision($div1, $div2) {\n var x1 = $div1.offset().left;\n var y1 = $div1.offset().top;\n var h1 = $div1.outerHeight(true);\n var w1 = $div1.outerWidth(true);\n var b1 = y1 + h1;\n var r1 = x1 + w1;\n var x2 = $div2.offset().left;\n var y2 = $div2.offset().top;\n var h2 = $div2.outerHeight(true);\n var w2 = $div2.outerWidth(true);\n var b2 = y2 + h2;\n var r2 = x2 + w2;\n\n if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) return false;\n return true;\n }", "_detectCollision () {\n let doContinue = true\n app.needleSelection.getNeedles().each(d => {\n if (d.passed) return\n const mm = app.getMmByLevel(app.ctx.level)\n const fromY = d.y + constant.NEEDLE_HOLE_DY\n const toY = fromY + mm\n const thread = app.threadDS\n if (thread.cx >= d.x) {\n if (fromY <= thread.cy - thread.r && thread.cy + thread.r <= toY) { // Passed\n app.statusTextScore++\n app.ctx.level = this._calcLevelByScore(app.statusTextScore) // May Lv. Up\n d.passed = true\n } else { // Failed\n doContinue = false\n }\n }\n })\n return doContinue\n }", "function checksPoints(){\n\n //llegada al checkpoint 1 por estrellas\n if ((score==40) && (checkpoints[0] == false)) {\n\n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[0] = true;\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110);\n\n \n }\n\n //llegada al checkpoint 1 al pasar 10 asteriodes\n if (counAsteroids>10) {\n\n if (checkpoints[0] == false) {\n\n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[0] = true;\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110)\n \n }\n if (checkpoints[0] == true) {\n\n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[1] == true;\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110)\n \n }\n \n }\n\n //llegada al checkpoint 2 al pasar 20 asteriodes\n if (counAsteroids>20){\n \n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[1] == true\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110)\n\n }\n \n //llegada al checkpoint 3 al pasar 30 asteriodes\n if (counAsteroids>30){\n \n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[2] == true\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110)\n\n }\n\n //llegada al checkpoint 4 al pasar 40 asteriodes\n if (counAsteroids>40){\n \n //Circulo Checks points\n checkp1 = this.physics.add.group();\n var ch = checkp1.create(160,-50,\"check1\");\n ch.setVelocity(0,120);\n\n //Annadir checkPoint al arreglo de chpoints\n checkpoints[2] == true\n progress+=25;\n\n //Annadir el mensaje de checkpoint\n var msm = this.physics.add.group();\n msm.create(180,-80,\"msmCheck\");\n msm.setVelocity(0,110)\n\n }\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}", "function collision($div1, $div2) {\n var x1 = $div1.offset().left;\n var y1 = $div1.offset().top;\n var h1 = $div1.outerHeight(true);\n var w1 = $div1.outerWidth(true);\n var b1 = y1 + h1;\n var r1 = x1 + w1;\n var x2 = $div2.offset().left;\n var y2 = $div2.offset().top;\n var h2 = $div2.outerHeight(true);\n var w2 = $div2.outerWidth(true);\n var b2 = y2 + h2;\n var r2 = x2 + w2;\n \n if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) return false;\n return true;\n}", "function equalPoints(point1, point2) {\r\n\treturn (point1.x == point2.x) && (point1.y == point2.y)\r\n}", "function _check_slot( offset, result ) {\n if ( now - that.lastUpdate > SPINTIME ) {\n var c = parseInt(Math.abs( offset / SLOT_HEIGHT)) % ITEM_COUNT;\n if ( c == result ) {\n if ( result == 0 ) {\n if ( Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) {\n return true; // done\n }\n } else if ( Math.abs(offset + (result * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) {\n return true; // done\n }\n }\n }\n return false;\n }", "function checkCollision(z1, z2) {\n if (z1 >= z2 - 3 && z1 <= z2 + 3) {\n return true;\n }\n\n return false;\n}", "function pairCheck(plane1, plane2) { // checks the distance between two pairs\n distanceX = plane1.x - plane2.x;\n distanceX = Math.pow(distanceX, 2);\n distanceY = plane1.y - plane2.y;\n distanceY = Math.pow(distanceY, 2);\n finDistance = distanceX + distanceY;\n finDistance = Math.sqrt(finDistance);\n return finDistance;\n}", "function 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}", "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 }", "function gameEqual(g1, g2) {\n if((g1 == undefined && g2 != undefined) || (g1 != undefined && g2 == undefined)) {\n return false;\n }\n return g1.round == g2.round && g1.tuhtot == g2.tuhtot &&\n g1.ottu == g2.ottu && g1.forfeit == g2.forfeit && g1.team1 == g2.team1 &&\n g1.team2 == g2.team2 && g1.score1 == g2.score1 && g1.score2 == g2.score2 &&\n g1.notes == g2.notes;\n}", "function Combat_attaquePossible (Territoire1,Territoire2) {\r\n var voisin = Combat_estVoisin(Territoire1,Territoire2) ;\r\n var assezArmees = (Territoire1.army > 1) ;\r\n var voisinsDifferents = (Territoire1.proprietaire != Territoire2.proprietaire);\r\n if (voisin && assezArmees && voisinsDifferents){\r\n return true\r\n }\r\n else {\r\n return false\r\n }\r\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 igualdad(matriz1, matriz2) {\n var doble = compararMatriz(matriz1, matriz2);\n if (doble == true) {\n var long1 = matriz1.length;\n var long2 = matriz2.length;\n var long1_2 = matriz1[0].length;\n var long2_2 = matriz2[0].length;\n var valor3 = long1 * long1_2;\n var valor = 0;\n if (long1 == long2 && long1_2 == long2_2) {\n for (var i = 0; i < long1; i++) {\n for (var j = 0; j < long1_2; j++) {\n if (matriz1[i][j] == matriz2[i][j]) {\n valor = valor + 1;\n }\n else {\n console.log(matriz1[i][j] + \" no es igual a \" + matriz2[i][j]);\n }\n }\n }\n if (valor == valor3) {\n console.log(\"efectivamente son iguales\");\n }\n }\n else {\n console.log(\"hablas piedras ni cagando son iguales\");\n }\n }\n else {\n console.log(\"hablas piedras ni cagando son iguales\");\n }\n}", "function checkCollision() {\n snake1.checkCollision();\n if(snake2) {\n snake2.checkCollision();\n if(snake1.collidesWith(snake2)) {\n $('#ouch_girl').trigger('play');\n }\n if(snake2.collidesWith(snake1)) {\n $('#ouch_boy').trigger('play');\n }\n }\n }" ]
[ "0.7940926", "0.74936295", "0.7074402", "0.6178513", "0.61657846", "0.6160895", "0.614676", "0.611185", "0.6065985", "0.6028716", "0.59783024", "0.5953841", "0.5896727", "0.5822159", "0.58109325", "0.5800604", "0.579731", "0.5784387", "0.5780059", "0.5774632", "0.574037", "0.5690527", "0.5683517", "0.5665073", "0.5661219", "0.5651233", "0.5634129", "0.56330323", "0.56267315", "0.56228393", "0.5603635", "0.5600974", "0.5561044", "0.55541044", "0.55364865", "0.5530131", "0.5524207", "0.552013", "0.55170465", "0.55170333", "0.55163836", "0.55052745", "0.55041456", "0.54963964", "0.5486744", "0.54844815", "0.5481157", "0.5466586", "0.54653364", "0.5464966", "0.5446579", "0.54410887", "0.54409975", "0.5435541", "0.5423824", "0.54232436", "0.54173", "0.54122925", "0.5409438", "0.54056823", "0.5392883", "0.5384121", "0.5376728", "0.5371391", "0.53679633", "0.53511935", "0.53511935", "0.533337", "0.53323096", "0.5330112", "0.5329306", "0.5323955", "0.5313642", "0.53096485", "0.5307112", "0.5301069", "0.5299307", "0.5291652", "0.5289189", "0.52874243", "0.52773327", "0.5274009", "0.5273877", "0.5273422", "0.52733773", "0.52724826", "0.5272074", "0.5271067", "0.52669704", "0.52624786", "0.52612096", "0.52599263", "0.52567965", "0.52524894", "0.5245539", "0.52452767", "0.52404904", "0.5239581", "0.52376664", "0.52363086" ]
0.57884353
17
Clamps a value n between min and max values.
function clampValue(min, n, max) { return Math.min(Math.max(min, n), max); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clamp(min, n, max) {\n\t return Math.max(min, Math.min(n, max));\n\t}", "function clamp(min, n, max) {\n return Math.max(min, Math.min(n, max));\n}", "function clamp(n, min, max) {\n if (n > max) { n = max; }\n if (n < min) { n = min; }\n\n return n;\n }", "function clamp(n, min, max) {\n return Math.max(min, Math.min(max, n));\n}", "function clamp(n, min, max) {\n if (n < min) return min;\n if (n > max) return max;\n return n;\n }", "function clamp(n, min, max) {\n if (n < min) { return min }\n if (n > max) { return max }\n return n;\n}", "function clamp (x, m, n) {\n\treturn Math.max(Math.min(x, n), m);\n}", "function clamp(n, min, max) {\n if (!_.isNumber(n))\n return min;\n if (n < min)\n return min;\n if (n > max)\n return max;\n return n;\n}", "function clip(n, minValue, maxValue) {\n return Math.min(Math.max(n, minValue), maxValue);\n}", "function clamp(min, max, value) {\n return Math.min(Math.max(value, min), max);\n }", "function clamp(value, min, max) {\n // TODO: Your code goes here.\n return 1337;\n}", "function clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n }", "function clamp( val, min, max ) { //takes a min and max and makes sure the number is in the middle\n return Math.min( Math.max( min, val ), max );\n }", "function clamp(value, min, max){\n if ( value < min ) return min;\n if ( value > max ) return max;\n return value;\n }", "function clamp(value, min, max) {\n value = value < min ? min : value;\n if (max) {\n value = value > max ? max : value;\n }\n return value\n}", "function clamp(value, min, max) {\n return value < min ? min : value > max ? max : value;\n }", "function clamp(val, min, max){\n\t return val < min? min : (val > max? max : val);\n\t }", "function clamp(min,max,value){\n if (value < min){ return min; }\n if (value > max){ return max; }\n return value;\n}", "function clamp(value, min, max){\n return (value > max ? max : (value < min ? min : value));\n }", "static clamp(value, min, max) {\n return (value < min ? min : value > max ? max : value);\n }", "function clamp(value, min, max) {\n \treturn Math.min(Math.max(value, min), max);\n}", "function clamp(value, min, max) {\n\t return Math.min(Math.max(value, min), max);\n\t}", "function clamp(val, min, max){\n\t return val < min ? min : (val > max ? max : val);\n }", "function clamp(min, x, max) { return Math.min(Math.max(x, min), max); }", "function clamp(min, value, max) {\n\n if (value < min)\n {\n return min;\n }\n else if (value > max)\n {\n return max;\n }\n else\n {\n return value;\n }\n\n}", "function clamp(min, max, value) {\n return (value < min) ? min : ((value > max) ? max : value);\n}", "function clamp(value, min, max) {\n if (value < min) {\n return min;\n }\n else if (value > max) {\n return value;\n }\n else {\n return value;\n }\n }", "function clamp(num, min, max) {\n\t return Math.min(Math.max(num, min), max);\n\t}", "function clamp( value, min, max ) {\n\treturn Math.min( max, Math.max( min, value ));\n}", "function clamp(val, min, max){\n\treturn Math.max(min, Math.min(max, val));\n}", "function clamp(val, min, max){\n\treturn Math.max(min, Math.min(max, val));\n}", "function clamp(val, min, max){\n\treturn Math.max(min, Math.min(max, val));\n}", "function clamp(val, min, max) {\n return Math.min(Math.max(min, val), max);\n}", "function clamp(val, min, max) {\n return val < min ? min : (val > max ? max : val);\n}", "function clamp(val, min, max) {\n\treturn Math.max(min, Math.min(max, val));\n}", "static clamp(val, min, max) {\n return Math.max(Math.min(val, max), min);\n }", "function clamp(val, min, max)\n{\n return val < min ? min : val > max? max : val;\n}", "function clamp(value, min, max) {\n if (max < min) {\n return NaN;\n }\n return Math.min(Math.max(value, min), max);\n}", "function clamp(val, min, max) {\n /* Random near-zero value used as \"zero\" to prevent two sequential updates from being\n exactly the same (which would cause them to be ignored) */\n if (val > max) {\n val = max - nearZero;\n } else if (val < min) {\n val = min + nearZero;\n }\n return val;\n }", "function clamp( num, min, max ) {\n return num < min ? min : num > max ? max : num\n}", "function clamp(num, min, max) {\n return num < min ? min : num > max ? max : num;\n}", "function clamp(val, min, max) {\n\t\treturn Math.min(Math.max(val, min), max);\n\t}", "function clamp$1(value, max) {\n return Math.max(0, Math.min(max, value));\n }", "function clamp(a,min,max)\r\n{return Math.min(Math.max(a,min),max);}", "function clamp(val, min, max) {\n if (val < min) return min;\n if (val > max) return max;\n return val;\n}", "function clamp(min, x, max) {\n return Math.max(min, Math.min(x, max));\n}", "function clamp(min, x, max) {\n return Math.max(min, Math.min(x, max));\n}", "function clamp(value, max, min) {\r\n if (min === void 0) { min = 0; }\r\n return value < min ? min : value > max ? max : value;\r\n}", "function clamp(num, min, max) {\n return Math.min(Math.max(num, min), max);\n}", "function clamp(value, min, max) {\n\tif (value < min) {\n\t\treturn min;\n\t}\n\tif (value > max) {\n\t\treturn max;\n\t}\n\treturn value;\n}", "function clamp(x, min, max) {\r\n return x < min ? min : x > max ? max : x;\r\n }", "function clamp(value, max, min) {\n if (min === void 0) { min = 0; }\n return value < min ? min : value > max ? max : value;\n}", "function ClampNumber(num, min, max)\n{\n var clampNo = Math.max(Math.min(num, Math.max(min, max)), Math.min(min, max));\n return clampNo;\n}", "function clamp(x, min, max) {\n return Math.min(max, Math.max(min, x))\n}", "function clamp(x, min, max){\n if (x < min){x = min;}\n else if (x > max){x = max;}\n return x;\n}", "function clamp(x, min, max) {\n return x < min ? min : x > max ? max : x;\n}", "function increaseMinMax() {\n min -= 10;\n max += 10;\n }", "static clamp(value: number, min: number, max: number): number {\n if (max < min) {\n throw new Error(`max of ${max} is less than min ${min} (with value of ${value})`);\n }\n if (value < min) {\n value = min;\n }\n if (value > max) {\n value = max;\n }\n return value;\n }", "function clamp(value, min, max) {\n if (isNaN(value) || isNaN(min) || isNaN(max)) return false;\n if (min > value) return min;\n if (max < value) return max;\n return value;\n }", "clamp(min, max) {\r\n if (this.data < min) return FNumber(min)\r\n if (this.data > max) return FNumber(max)\r\n\r\n return FNumber(this.data)\r\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }", "function clamp(x, min, max) {\n return Math.max(Math.min(x, max), min);\n }" ]
[ "0.7785194", "0.7721507", "0.7696209", "0.7658065", "0.756306", "0.7496826", "0.72142243", "0.7176106", "0.6973683", "0.6969374", "0.68676674", "0.6848788", "0.6822472", "0.6794801", "0.6776545", "0.6768619", "0.6762097", "0.6760018", "0.67585105", "0.6755517", "0.67548186", "0.67408395", "0.6734696", "0.6723157", "0.67162097", "0.671604", "0.67124057", "0.667676", "0.66702914", "0.6649968", "0.6649968", "0.6649968", "0.66408926", "0.66385955", "0.66325474", "0.66319865", "0.66256887", "0.66233575", "0.6609594", "0.66094613", "0.6597673", "0.65956235", "0.65940964", "0.6583438", "0.65829754", "0.65766436", "0.65766436", "0.6573554", "0.6563495", "0.6554888", "0.6542419", "0.65401", "0.6528227", "0.6524585", "0.6518553", "0.64995986", "0.6490492", "0.6475843", "0.6450905", "0.6447908", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864", "0.6434864" ]
0.78985715
1
get formatted address based on current position and set it to input
function setCurrentPosition(pos) { var geocoder = new google.maps.Geocoder(); var latlng = {lat: parseFloat(pos.coords.latitude), lng: parseFloat(pos.coords.longitude)}; geocoder.geocode({ 'location' :latlng }, function (responses) { console.log(responses); if (responses && responses.length > 0) { $("#to").val(responses[1].formatted_address); $("#origin").val(responses[1].formatted_address); // console.log(responses[1].formatted_address); } else { alert("Cannot determine address at this location.") } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFormattedAddress() {\n\n }", "function formatAddress(address) {\n\treturn address;\n}", "fillInAddress() {\n const place = this.autocomplete.getPlace();\n console.log(\"fill\",place);\n let str = place.formatted_address;\n console.log(\"str\", str);\n this.entered_address = str;\n }", "formatAddress(address, str) {\n const formattedAddress = address.split(',');\n const streetAddress = formattedAddress.splice(0, 1);\n const cityAddress = formattedAddress.join('');\n\n if (str === 'street') {\n return streetAddress;\n }\n return cityAddress;\n }", "function formatAddress(acc) {\n return T_Address.canonicalize(acc); // TODO: typing\n }", "function updateAddressField(){\n geocoder.geocode({\n 'latLng': pos\n }, function (results, status) {\n if (status === google.maps.GeocoderStatus.OK) {\n if (results[1]) {\n $('#start-address').val(results[1].formatted_address);\n }\n }\n });\n}", "function parseAddress(user){\n let address = '';\n return address = `${user.location.street.number} ${user.location.street.name}, ${user.location.city}, ${user.location.state} ${user.location.postcode}`\n}", "function handleChangeInput(e){\n setInputAddress(e.target.value)\n }", "function userInput2Address (state, city, zip, street){\n var address = street.trim()+\"%20\"+zip.trim()+\"%20\"+city.trim()+\"%20\"+state.trim();\n var address2 = address.replace(/ /g, \"%20\");\n return address2;\n}", "validateAddress() {\n // Remove white space from start and end\n let newAddress = this.addressInput.node.textContent.trim();\n // Remove initial @ sign if necessary\n const atStringNumber = newAddress.search(\"@\");\n if (atStringNumber === 0) {\n newAddress = newAddress.substring(1);\n }\n return newAddress;\n }", "setAddress(e){\n\t\tvar place = this.autocomplete.getPlace();\n\t\tlet addressModel = {};\n\t\tplace.address_components.forEach(item => {\n\t\t\tif(item.types.includes('country')){ addressModel.addressCountry = item.long_name }\n\t\t\tif(item.types.includes('locality')){ addressModel.addressLocality = item.long_name }\n\t\t\tif(item.types.includes(\"administrative_area_level_1\")){ addressModel.addressRegion = item.short_name }\n\t\t\tif(item.types.includes(\"postal_code\")){ addressModel.postalCode = item.short_name }\n\t\t})\n\t\t//LAT LONG\n\t\tlet lat = place.geometry.location.lat();\n\t\tlet lng = place.geometry.location.lng();\n\t\taddressModel.disambiguatingDescription = `${lat},${lng}`;\n\t\t//Send to value, so it can handle it\n\t\tthis.value = addressModel;\n\t}", "function setAddress(geocoding) {\n geocoding.geocode({'latLng': latLng}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n if (results[0]) {\n if(results[0].formatted_address.length>64){\n $(\"#snapspot_address\").val(results[0].formatted_address.substring(0,64)+'...')\n }\n else {\n $(\"#snapspot_address\").val(results[0].formatted_address.substring(0,64)+'...')\n }\n }\n }\n });\n }", "function fixInputAddress( addr ) {\r\n\t//if( addr == pref.example )\r\n\t//\taddr = addr.replace( /^.*: /, '' );\r\n\treturn addr;\r\n}", "function fixAddresses(oldAddress){\n var newAddress = oldAddress.substring(0,oldAddress.indexOf(',')) + ' New York, NY';\n return newAddress;\n}", "address(value) {\n return Object(address_lib_esm[\"a\" /* getAddress */])(value);\n }", "function formatAddresses() {\n var output = ss.getSheetByName(\"Formatted Addresses\");\n var values = input.getDataRange().getValues();\n var name = values[0].indexOf(\"NAME\");\n var street1 = values[0].indexOf(\"Street\");\n var street2 = values[0].indexOf(\"Street #2\");\n var city = values[0].indexOf(\"CITY\");\n var state = values[0].indexOf(\"STATE\");\n var zip = values[0].indexOf(\"ZIP\");\n var destRange = output.getDataRange();\n destRange.clear();\n var nameArr = [];\n var stArr = [];\n var cityArr = [];\n var stackedAddress = [];\n\n values.filter (function (row) {\n return (row[name] !== \"\");\n })\n .forEach(function (row) {\n nameArr.push(row[name]);\n if(row[street2] !== \"\") {\n stArr.push(row[street1] + \" \" + row[street2]);\n }\n else {\n stArr.push(row[street1]);\n };\n cityArr.push(row[city] + \", \" + row[state] + \" \" + row[zip]);\n });\n stackedAddress.push([nameArr],[stArr], [cityArr]);\n var nameRange = output.getRange(1, 1, 1, stackedAddress[0][0].length);\n var stRange = output.getRange(2, 1, 1, stackedAddress[0][0].length);\n var cityRange = output.getRange(3, 1, 1, stackedAddress[0][0].length);\n nameRange.setValues(stackedAddress[0]);\n stRange.setValues(stackedAddress[1]);\n cityRange.setValues(stackedAddress[2]);\n}", "function formatAddress(response, index) {\n const physAddressObj = getStreetAddress(response, index);\n const addressLines = format(physAddressObj);\n return `\n ${addressLines}\n ${physAddressObj.city}, ${physAddressObj.stateCode} ${physAddressObj.postalCode}\n `;\n}", "function fillInAddress() {\n // Get the place details from the autocomplete object.\n place = autocomplete.getPlace();\n console.log(place);\n // updating address data \n number = place.address_components[0].long_name;\n street = place.address_components[1].long_name;\n city = place.address_components[3].long_name;\n state_short = place.address_components[5].short_name;\n zipCode = place.address_components[7].long_name;\n // undating geocode data\n latitude = place.geometry.location.lat();\n longitude = place.geometry.location.lng();\n\n // replacing “ ” to \"+\" \n number = number.replace(\" \", \"+\");\n street = street.replace(\" \", \"+\");\n city = city.replace(\" \", \"+\");\n street = street.replace(\" \", \"+\");\n zipCode = zipCode.replace(\" \", \"+\");\n }", "function AddressString(input, addressFormat, _address) {\n\t babelHelpers.classCallCheck(this, AddressString);\n\n\t _classPrivateMethodInitSpec$5(this, _convertAddressToString$2);\n\n\t _classPrivateMethodInitSpec$5(this, _isPureAddressStringModified);\n\n\t _classPrivateMethodInitSpec$5(this, _actualizePureString);\n\n\t _classPrivateFieldInitSpec$6(this, _input, {\n\t writable: true,\n\t value: null\n\t });\n\n\t _classPrivateFieldInitSpec$6(this, _value, {\n\t writable: true,\n\t value: ''\n\t });\n\n\t _classPrivateFieldInitSpec$6(this, _pureAddressString, {\n\t writable: true,\n\t value: ''\n\t });\n\n\t _classPrivateFieldInitSpec$6(this, _addressFormat$3, {\n\t writable: true,\n\t value: null\n\t });\n\n\t if (!(input instanceof HTMLInputElement)) {\n\t throw new TypeError('Wrong input type');\n\t }\n\n\t babelHelpers.classPrivateFieldSet(this, _input, input);\n\n\t if (!(addressFormat instanceof location_core.Format)) {\n\t throw new TypeError('Wrong addressFormat type');\n\t }\n\n\t babelHelpers.classPrivateFieldSet(this, _addressFormat$3, addressFormat);\n\n\t if (_address && !(_address instanceof location_core.Address)) {\n\t throw new TypeError('Wrong address type');\n\t }\n\n\t if (_address) {\n\t this.setValueFromAddress(_address);\n\t }\n\t }", "function positionToAddress() {\n var sheet = SpreadsheetApp.getActiveSheet();\n var cells = sheet.getActiveRange();\n\n var popup = SpreadsheetApp.getUi();\n \n // Must have selected at least 3 columns (Address, Lat, Lng).\n // Must have selected at least 1 row.\n\n var columnCount = cells.getNumColumns();\n\n if (columnCount < 3) {\n popup.alert(\"Select at least 3 columns: Latitude, Longitude in the first 2 columns; the reverse-geocoded Address will go into the last column.\");\n return;\n }\n\n var latColumn = 1;\n var lngColumn = 2;\n\n var addressRow;\n var addressColumn = columnCount;\n\n var geocoder = Maps.newGeocoder().setRegion(getGeocodingRegion());\n var location;\n \n for (addressRow = 1; addressRow <= cells.getNumRows(); ++addressRow) {\n var lat = cells.getCell(addressRow, latColumn).getValue();\n var lng = cells.getCell(addressRow, lngColumn).getValue();\n \n // Geocode the lat, lng pair to an address.\n location = geocoder.reverseGeocode(lat, lng);\n \n // Only change cells if geocoder seems to have gotten a \n // valid response.\n Logger.log(location.status);\n if (location.status == 'OK') {\n var address = location[\"results\"][0][\"formatted_address\"];\n\n cells.getCell(addressRow, addressColumn).setValue(address);\n }\n }\n}", "function GetPosition(position) {\n lattitude = position.coords.latitude;\n longitude = position.coords.longitude;\n\n console.log(\"coordinates: \" + lattitude + \" \" + longitude);\n\n var latLng = new google.maps.LatLng(lattitude, longitude);\n var geocoder = new google.maps.Geocoder();\n var address;\n geocoder.geocode({ 'latLng': latLng }, function (results, status) {\n console.log(results[0].formatted_address);\n address = results[0].formatted_address;\n $(\"#location\").val(address);\n });\n}", "function handleAddress(value) {\n if (value === '0x') {\n return null;\n }\n return address_1.getAddress(value);\n}", "function fixAddresses(oldAddress) {\n // want to get rid of anything in () before the comma\n var newAddress = oldAddress.substring(0, oldAddress.indexOf(',')) + ' New York, NY';\n // console.log(newAddress);\n return newAddress; \n}", "function formatAddress(place) {\n var returnString;\n if (place.vicinity.split(\",\").length > 2) {\n returnString = place.vicinity.split(\",\")[0] + \", Trondheim\";\n } else {\n returnString = place.vicinity;\n }\n return returnString;\n}", "function formatPhoneInput() {\n let inputNode = document.querySelector(\"#phone-input\");\n let originalCursorPosition = inputNode.selectionStart;\n let originalValue = inputNode.value;\n\n let validChars = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"];\n let unformattedNumber = \"\";\n\n for (let char of originalValue) {\n if (char in validChars) {\n unformattedNumber += char;\n }\n }\n\n if (unformattedNumber.length <= 3) {\n formattedNumber = unformattedNumber;\n\n } else if (unformattedNumber.length <= 6) {\n formattedNumber = unformattedNumber.substring(0, 3) + \" \" + unformattedNumber.substring(3); \n\n } else {\n formattedNumber = unformattedNumber.substring(0, 3) + \" \" + unformattedNumber.substring(3, 6) + \" \" + unformattedNumber.substring(6, 10); \n }\n\n let newCursorPosition = originalCursorPosition + (formattedNumber.length - originalValue.length);\n\n inputNode.value = formattedNumber;\n inputNode.setSelectionRange(newCursorPosition, newCursorPosition);\n}", "function formatAddress(employee) {\n let city = capitalize(employee.location.city);\n let state = capitalize(employee.location.state);\n let address = employee.location.street + '<br>'\n address += city + ', ' + state;\n address += ' ' + employee.location.postcode + ', ';\n address += employee.nat + '<br>';\n return address;\n}", "function OnAddress_Change( e , type )\r\n{\r\n Alloy.Globals.ShedModeShedPosition[\"ADDRESS\"] = $.widgetAppTextFieldShedModeFormsShedPositionAddress.get_text_value() ;\r\n}", "function fixaddress(address) {\n //console.log(\"Fix address\", address);\n if (!strStartsWith(address, '0x')) {\n return ('0x' + address);\n }\n return address;\n}", "function getAddress(placemark) {\n return placemark.address;\n }", "addressChange(e){\n var change = Object.assign({}, this.state);\n change.modValues[0].address = e.target.value;\n this.setState(change);\n }", "addressInput()\n {\n let updatedAddress\n console.log(\"Enter address to update..\")\n let uAddress=input.question()\n obPerson.setAddress(uAddress)\n updatedAddress=obPerson.getAddress()\n return updatedAddress\n }", "function fillInAddress() {\n\n // Get the place details from the autocomplete object.\n var place = autocomplete.getPlace();\n\n // Get each component of the address from the place details and fill the corresponding field on the form.\n var addressComponent = \"\";\n\n for (var i = 0; i < place.address_components.length; i++) {\n\n console.log(place.address_components[i])\n\n if (place.address_components[i].types[0] == 'street_number' || place.address_components[\n i].types[0] == 'route') {\n addressComponent += place.address_components[i]['short_name'] + \" \";\n $('#address2').val(addressComponent);\n }\n if (place.address_components[i].types[0] == 'postal_code') {\n $('#postcode').val(place.address_components[i]['short_name']);\n }\n if (place.address_components[i].types[0] ==\n 'administrative_area_level_1') {\n $('#state').val(place.address_components[i]['short_name']);\n }\n if (place.address_components[i].types[0] == 'locality') {\n $('#city').val(place.address_components[i]['short_name']);\n }\n }\n }", "getAddress() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n (position) => {\n var requestOptions = {\n method: \"GET\",\n redirect: \"follow\",\n };\n\n fetch(\n `https://maps.googleapis.com/maps/api/geocode/json?latlng=${position.coords.latitude},${position.coords.longitude}&key=AIzaSyDtU4wnc7N3-U9QMpRCG5CCaqCJc2nYuz8&language=en_AU`,\n requestOptions\n )\n .then((response) => response.text())\n .then((result) => {\n // console.log(\"address\",result);\n let res = JSON.parse(result);\n // console.log(\"address\", res.results[0].formatted_address);\n this.entered_address = res.results[0].formatted_address;\n })\n .catch((error) => console.log(\"error\", error));\n }\n // () => {\n // handleLocationError(true, infoWindow, map.getCenter());\n // }\n );\n } else {\n // Browser doesn't support Geolocation\n // handleLocationError(false, infoWindow, map.getCenter());\n }\n }", "function formatAddress(address) {\n if (conf.hasOwnProperty(address)) {\n if (conf[address].hasOwnProperty('nickname')) {\n return conf[address]['nickname'] + \":\" + address;\n }\n }\n return address;\n}", "getAddressString () {\n return secUtil.bufferToHex(this.getAddress())\n }", "address (state, address) {\n state.address = address\n }", "function coordsToAdress(coords) {\n const url =`https://www.mapquestapi.com/geocoding/v1/reverse?key=${GAPI_KEY}&location=${coords.coords.latitude},${coords.coords.longitude}`;\n console.log(coords);\n $.getJSON(url, function (response) {\n const addressObject = response.results[0].locations[0];\n const address = `${addressObject.street}, ${addressObject.adminArea5}, ${addressObject.adminArea3}`\n $(\"#from\").val(address);\n console.log(coords);\n });\n }", "function getAddress(addr) \r\n\t{\r\n let address = '';\r\n address = addr ? addr : document.getElementById('address').value;\r\n address = address.trim();\r\n\t\t\r\n\t\tif ( ! _delta.web3.isAddress(address))\r\n\t\t{\r\n\t\t\t//check if url ending in address\r\n\t\t\tif(address.indexOf('/0x') !== -1)\r\n\t\t\t{\r\n\t\t\t\tlet parts = address.split('/');\r\n\t\t\t\tlet lastSegment = parts.pop() || parts.pop(); // handle potential trailing slash\r\n\t\t\t\tif(lastSegment)\r\n\t\t\t\t\taddress = lastSegment;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(! _delta.web3.isAddress(address)) \r\n\t\t\t{\r\n\t\t\t\tif (address.length == 66 && address.slice(0, 2) === '0x') \r\n\t\t\t\t{\r\n\t\t\t\t\t// transaction hash, go to transaction details\r\n\t\t\t\t\twindow.location = window.location.origin + window.location.pathname + 'tx.html#' + address;\r\n\t\t\t\t\treturn;\r\n\t\t\t\t} \r\n\r\n\t\t\t\t// possible private key, show warning (private key, or tx without 0x)\r\n\t\t\t\tif (address.length == 64 && address.slice(0, 2) !== '0x') \r\n\t\t\t\t{\r\n\t\t\t\t\tif (!addr) // ignore if in url arguments\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tshowError(\"You likely entered your private key, NEVER do that again\");\r\n\t\t\t\t\t\t// be nice and try generate the address\r\n\t\t\t\t\t\taddress = _util.generateAddress(address);\r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t\telse if (address.length == 40 && address.slice(0, 2) !== '0x') \r\n\t\t\t\t{\r\n\t\t\t\t\taddress = `0x${addr}`;\r\n\t\t\t\t\t\r\n\t\t\t\t} \r\n\t\t\t\telse \r\n\t\t\t\t{\r\n\t\t\t\t\tif (!addr) // ignore if in url arguments\r\n\t\t\t\t\t{\r\n\t\t\t\t\t showError(\"Invalid address, try again\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn undefined;\r\n\t\t\t\t}\r\n\t\t\t\tif(! _delta.web3.isAddress(address))\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!addr) // ignore if in url arguments\r\n\t\t\t\t\t{\r\n\t\t\t\t\t showError(\"Invalid address, try again\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn undefined;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tdocument.getElementById('address').value = address;\r\n\t\tdocument.getElementById('addr').innerHTML = 'Address: <a target=\"_blank\" href=\"' + _delta.addressLink(address) + '\">' + address + '</a>';\r\n\t\tsetAddrImage(address);\r\n\t\treturn address;\r\n }", "function prettify() {\n var output = ss.getSheetByName(\"Formatted Addresses\");\n var destRange = output.getDataRange();\n var destValues = destRange.getValues();\n destRange.setNumberFormat('@STRING@');\n output.autoResizeColumns(1, destValues[0].length);\n destRange.setHorizontalAlignment(\"center\");\n output.setFrozenColumns(1);\n}", "get fromAddressInput() {\n return this._fromAddress;\n }", "function normalisePlacesApiAddress(details, fromGP) {\r\n\t\t\tvar ac = fromGP.address_components;\r\n\r\n\t\t\t// Copy Googles version of an address to something more useable for us\r\n\t\t\tvar street = findPart(ac, \"street_address\");\r\n\t\t\tif (street === \"\")\r\n\t\t\t// not present so fallback to \"route\"\r\n\t\t\t\tstreet = findPart(ac, \"route\");\r\n\r\n\t\t\tvar town = findPart(ac, \"locality\"),\r\n\t\t\t\t\tarea = findPart(ac, \"administrative_area_level_1\"),\r\n\t\t\t\t\tpostCode = findPart(ac, \"postal_code\")\r\n\t\t\t;\r\n\r\n\t\t\tdetails.street = street;\r\n\t\t\tdetails.town = town;\r\n\t\t\tdetails.area = area;\r\n\t\t\tdetails.postCode = postCode;\r\n\r\n\t\t\t// and some other bits\r\n\t\t\tdetails.name = fromGP.name || \"\";\r\n\t\t\tif (fromGP.photos && fromGP.photos.length > 0)\r\n\t\t\t\tdetails.photo = fromGP.photos[0];\r\n\t\t\tdetails.url = fromGP.url || \"\";\r\n\t\t\tdetails.website = fromGP.website || \"\";\r\n\t\t\tdetails.telNo = fromGP.formatted_phone_number || fromGP.telNo || \"\";\r\n\r\n\t\t} // normalisePlacesApiAddress", "function fillInAddressSource() {\n var coords = sourceQuery.getPlace().geometry.location;\n lat = coords.lat();\n lon = coords.lng();\n}", "function formatAddress(address) {\n address = address.trim();\n if (address === \"\" || address.startsWith(\"LOT:\"))\n return \"\";\n // Pop tokens from the end of the array until a valid suburb name is encountered (allowing\n // for a few spelling errors).\n let tokens = address.split(\" \");\n let suburbName = null;\n for (let index = 1; index <= 4; index++) {\n let suburbNameMatch = didyoumean2_1.default(tokens.slice(-index).join(\" \"), Object.keys(SuburbNames), { caseSensitive: false, returnType: didyoumean.ReturnTypeEnums.FIRST_CLOSEST_MATCH, thresholdType: didyoumean.ThresholdTypeEnums.EDIT_DISTANCE, threshold: 2, trimSpaces: true });\n if (suburbNameMatch !== null) {\n suburbName = SuburbNames[suburbNameMatch];\n tokens.splice(-index, index); // remove elements from the end of the array\n break;\n }\n }\n if (suburbName === null) { // suburb name not found (or not recognised)\n console.log(`The development application will be ignored because the suburb was not recognised: ${address}`);\n return \"\";\n }\n // Add the suburb name with its state and post code to the street name.\n let streetName = tokens.join(\" \").trim();\n address = (streetName + ((streetName === \"\") ? \"\" : \", \") + suburbName).trim();\n if (/^\\d,\\d\\d\\d/.test(address))\n address = address.substring(0, 1) + address.substring(2); // remove the comma\n return address;\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 }", "function format(fieldLabel) {\n\t\t\t if (fieldLabel === \"address1\" || fieldLabel === \"city\") address += \", \";\n\t\t\t else if (fieldLabel === \"address2\") address += \"\\n\";\n\t\t\t else if (fieldLabel === \"state\") address += \" \";\n\t\t\t }", "function addressFill(no_mymap = false) {\n var fullAddress = '';\n\n opcion = $('#spaceAddress').val();\n\n previous = '';\n if ($('#spaceAddress').val() != '' && ($(\"#spaceCountry option:selected\").val() != '' || $(\"#spaceState option:selected\").text() != '' || $(\"#spaceCities option:selected\").text() != '' || $(\"#selectedZipcode\").text() != '')) {\n previous = ', ';\n }\n if (opcion == '') {\n opcion = '';\n }\n //console.log('Address: ' + opcion+ ' Previous: ' + previous);\n fullAddress += opcion + previous;\n $(\"#selectedAddress\").text(opcion + previous);\n\n opcion = $('#spaceZipcode').val();\n\n previous = '';\n if ($('#spaceZipcode').val() != '' && ($(\"#spaceCountry option:selected\").val() != '' || $(\"#spaceState option:selected\").text() != '' || $(\"#spaceCities option:selected\").text() != '')) {\n previous = ', ';\n }\n if (opcion == '') {\n opcion = '';\n }\n //console.log('Zipcode: ' + opcion+ ' Previous: ' + previous);\n fullAddress += opcion + previous;\n $(\"#selectedZipcode\").text(opcion + previous);\n\n opcion = $(\"#spaceCities option:selected\").text();\n\n previous = '';\n if (opcion != 'Seleccione una Ciudad' && opcion != '' && ($(\"#spaceCountry option:selected\").val() != '' || $(\"#spaceState option:selected\").text() != '')) {\n previous = ', ';\n }\n if (opcion == 'Seleccione una Ciudad') {\n opcion = '';\n }\n //console.log('City: ' + opcion+ ' Previous: ' + previous);\n fullAddress += opcion + previous;\n $(\"#selectedCity\").text(opcion + previous);\n\n opcion = $(\"#spaceState option:selected\").text();\n\n previous = '';\n if (opcion != 'Seleccione un Estado' && opcion != '' && ($(\"#spaceCountry option:selected\").val() != '')) {\n previous = ', ';\n }\n if (opcion == 'Seleccione un Estado') {\n opcion = '';\n }\n //console.log('Estado: ' + opcion + ' Previous: ' + previous);\n fullAddress += opcion + previous;\n $(\"#selectedState\").text(opcion + previous);\n\n\n opcion = $('#spaceCountry option:selected').text();\n //alert(opcion);\n if (opcion == 'Selecciona un Pais') {\n opcion = '';\n //alert(opcion);\n }\n //console.log('Pais: ' + opcion);\n fullAddress += opcion;\n $(\"#selectedCountry\").text(opcion);\n\n console.log(fullAddress);\n if (no_mymap) {\n\n } else {\n myMap(fullAddress);\n }\n\n }", "function cleanupAddress(text) {\n text2 = text.trim();\n // without modification, strings will look like this:\n // '\\n\\t\\t\\t\\t\\t\\t351 East 74th Street, 2nd Floor Front Room, \\n\\t\\t\\t\\t\\t\\t',\n // '(Betw. 1st & 2nd Avenues) 10021\\n\\t\\t\\t\\t\\t\\t',\n // so remove\n console.log(\"Calling cleanup with: \" + text2 );\n text2 = text2.replace(/\\n/g, \"\");\n text2 = text2.replace(/\\t/g, \"\");\n text2 = text2.replace(/E /g, \"East \");\n text2 = text2.replace(/W /g, \"West \");\n text2 = text2.replace(/E\\. /g, \"East \");\n text2 = text2.replace(/W\\. /g, \"East \");\n text2 = text2.replace(/Rm 306/g, \"\");\n text2 = text2.replace(/502 West165th Street/g, \"502 West 165th Street\");\n text2 = text2.replace('\\. Meeting in the gym\\.',\"\");\n text2 = text2.replace('@ Fort Washington Avenue',\"\");\n\n if (text.trim() == '80 St. Mark\\'s Place, 2nd Floor,'){\n text2 = text2;\n }\n else { \n text2 = text2.replace(/St\\./g, \"Street\");\n }\n\n text2 = text2.replace(/\\(Basement\\)/g, \"\");\n text2 = text2.replace(/\\(Red Door/g, \"\");\n text2 = text2.replace(/Strert/g, \"Street\");\n text2 = text2.split(',')[0];\n\n if (text.trim() == '206-208 East 11th Street,'){\n text2 = text2;\n }\n else if (text.trim() == '58-66 West 135th Street,') {\n }\n else {\n text2 = text2.split('-')[0];\n }\n if (text2 == 'Church of the Good Shepard') {\n text2 = '543 Main Street'\n }\n if (text.trim() == '189th Street & Bennett Avenue, Kitchen,') {\n text2 = '178 Bennett Avenue'\n //second floor\n }\n if (text.trim() == '502 West165th Street, Basement,') {\n text2 = '502 West 165th Street'\n //basement\n }\nreturn text2.trim();\n}", "getAddressField(telegram) {\n let values = telegram.getValues();\n\n return values.has('BLOCK1_A') ?\n values.get('BLOCK1_A') : null;\n }", "function bindAddress(){\n\n \t// retrieve the address value\n \tvar address=$(\"#address\").val();\n\n \t// perform ajax call to nominatim\n \t$.ajax({\n \t\ttype: \"GET\",\n \t\turl: \"https://nominatim.openstreetmap.org/search\",\n \t\tdata: { q: address, format: \"json\", polygon : \"1\" , addressdetails :\"1\" }\n \t\t})\n \t\t.done(function( data ) { // if address found\n\n \t\t// takes the first geolocated data\n \t\t// and record current_marker variable\n \t\tcurrent_marker = data[0];\n \t\t// draws a marker from geolocated point\n \t\tsetMarker();\n\n \t});\n\n }", "function displayAddressTimeFromCurrentPos() {\n var latLng = current_position;\n geocoder.geocode({\"location\": latLng}, function(data, status) {\n if(status == \"OK\") {\n // this is the format that matches that in the address bar, but seemed to be different for the different positions, so went for simpler \n //formatted_address = data[0].address_components[0][\"long_name\"] + ' (' + data[2].formatted_address + ')';\n position_html = \"<center><b>Selected Position: </b>\" + data[0].formatted_address + \"<b>&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Selected time: </b>\" + selected_time + \"</center>\";\n $(\"#selected_spacetimepos\").html(position_html);\n \n //position_html poorly named as it includes the selected_time too.\n } else {\n console.log(status);\n }\n });\n}", "function updateMarkerAddress(str) {\n $('#markerAddress').empty().html(str);\n $('#location').val(str);\n $('#dialog-confirm code').html(str); // download popup text\n }", "function setLocationByAddress(){\n\tvar addres_str = document.getElementById(\"address_string\").value;\n\tif(addres_str != \"\"){\n\t\tvar geocoder = new google.maps.Geocoder();\n geocoder.geocode({'address' : addres_str}, function(data, status){\n if(status == google.maps.GeocoderStatus.OK){\n \tif(currentMarker != null){\n \t currentMarker.setMap(null);\n \t};\n \tcurrentPosition = {lat : data[0].geometry.location.lat(), lng : data[0].geometry.location.lng()};\n \tcurrentMarker = new google.maps.Marker({\n \tposition: currentPosition,\n \tmap: map,\n \ttitle: \"\"\n });\n currentMarker.setMap(map);\n \tmap.panTo(currentPosition);\n } else {\n \twindow.alert(\"Address is invalid\");\n }\n })\n\t}\n\treturn false;\t\n}", "function prepAddress(param) {\n return $.param(param).replace(\"%20\", \"+\");\n }", "function getAddressDetails(place) {\n \t\n \t for (var component in componentForm) {\n document.getElementById(component).value = ''; \t \n }\n\n // Get each component of the address from the place details\n // and fill the corresponding field on the form.\n \t\n for (var i = 0; i < place.address_components.length; i++) {\n var addressType = place.address_components[i].types[0];\n if (componentForm[addressType]) {\n var val = place.address_components[i][componentForm[addressType]];\n document.getElementById(addressType).value = val;\n \n }\n }\n }", "function bindingAddressField(){\n\n try {\n var input = _qAll('.billing_address_field'),\n billingAddress = _qById('billing_address1'),\n streetName = _qById('billing_streetname'),\n streetNumber = _qById('billing_streetnumber');\n\n if( !streetName && !streetNumber){\n return;\n }\n for (let item of input){\n item.addEventListener('keyup', function(){\n billingAddress.value = streetNumber.value +' '+ streetName.value;\n })\n }\n } catch (err){\n console.log('error: ', err);\n }\n }", "function setupDragAddress(addressElem, mapPinMainElem) {\n\n var posBlockLeft = parseInt(mapPinMainElem.style.left, 10);\n var posBlockTop = parseInt(mapPinMainElem.style.top, 10);\n\n var address = {\n x: posBlockLeft + HELPERS.get.addressOnLB2().x,\n y: posBlockTop + HELPERS.get.addressOnLB2().y\n };\n\n addressElem.value = address.x + ', ' + address.y;\n }", "function geocodeLatLng() {\n var latlng = {lat: userLat, lng: userLng};\n geocoder.geocode({'location': latlng}, function (results, status) {\n if (status === 'OK') {\n if (results[0]) {\n formattedAddress = results[0].formatted_address;\n formattedAddressPrint = formattedAddress.split(', India')\n $(\".your_address\").removeClass('hidden');\n $(\".your_address2\").html(formattedAddressPrint);\n\n }\n }\n });\n }", "function GetAddress(address) {\n return ParseAddress(address)[1];\n}", "function finalAddrParse ( addrObj ) {\n\n if (addrObj.city == \"nocity\") addrObj.city = \"\";\n \n addrObj.streetName = (addrObj.streetNumber.trim()+\" \"+addrObj.streetName.trim());\n \n if (addrObj.streetName == \" RR\") addrObj.streetName = \"\";\n \n const \n addrStr = addrObj.streetName.split(\" \"),\n lastAddrStr = addrStr[addrStr.length-1];\n \n const regExTes1 = /[A-Z|0-9][A-Z]/;\n const regExTes2 = /[A-Z|0-9][A-Z][a-z]/;\n \n if (regExTes1.test(lastAddrStr) && lastAddrStr.length != 2) { \n \n const splitIndex = indexOfRegex(regExTes1, addrObj.streetName, addrObj.streetName.indexOf(lastAddrStr));\n const newStreetName = addrObj.streetName.substr(0,splitIndex);\n const newCityName = addrObj.streetName.substr(splitIndex+1)\n addrObj.streetName = newStreetName;\n addrObj.city = newCityName+\" \"+addrObj.city.trim()\n \n } else if (regExTes2.test(addrObj.city)) {\n \n const splitIndex = indexOfRegex(regExTes2, addrObj.city, 0);\n const streetAdd = addrObj.city.substr(0,splitIndex+1);\n const newCityName = addrObj.city.substr(splitIndex+1)\n addrObj.streetName = addrObj.streetName+\" \"+streetAdd;\n addrObj.city = newCityName;\n \n } else if (regExTes1.test(addrObj.city) && !regExTes2.test(addrObj.city)) {\n \n addrObj.streetName = addrObj.streetName+\" \"+addrObj.city;\n addrObj.city = \"Washington\"\n addrObj.state = \"DC\"\n \n } else if (addrObj.city.length == 2 && addrObj.city != 'of') {\n \n addrObj.streetName = addrObj.streetName+\" \"+addrObj.city\n addrObj.city = \"\";\n \n }\n \n \n const cityArr = addrObj.city.split(\" \");\n const len = cityArr.length;\n \n if (\n stateMap[cityArr[1]] != undefined\n || ( len > 2 && stateMap[(cityArr[len-2]+\" \"+cityArr[len-1])] != undefined )\n ) {\n addrObj.city = cityArr[0];\n }\n \n return addrObj;\n \n}", "function getAddressString() {\n let address_phone = \"\";\n if(address === undefined && postalCode === undefined && city === undefined) { \n address_phone = \"No information available\";\n }\n else {\n address_phone += (address !== undefined ? `${address} <br />` : \" \");\n address_phone += (postalCode !== undefined ? postalCode : \" \") + (city !== undefined ? ` ${city} <br />`: \" \");\n }\n \n return address_phone;\n }", "handlePlaceSelect() {\n this.props.onUpdatePosition({\n latitude: this.autocomplete.getPlace().geometry.location.lat(),\n longitude: this.autocomplete.getPlace().geometry.location.lng(),\n address:\n this.autocomplete.getPlace().address_components[0].short_name +\n \" \" +\n this.autocomplete.getPlace().address_components[1].short_name,\n home: this.autocomplete.getPlace().address_components[0].short_name\n });\n }", "function fillCoords(coord){\n\tlet [x, y] = coord.split('|');\n\tdocument.forms[0].x.value = x;\n\tdocument.forms[0].y.value = y;\n $('#place_target').find('input').val(coord);\n}", "function companyAddress(number, st, postal, building, officeNumber) {\n var that = address(number, st, postal);\n //Augment that object\n that.building = building;\n that.officeNumber = officeNumber;\n that.toString = function() {\n let {number, st, postal, building, officeNumber} = that;\n return `${number} ${st}, ${building}-${officeNumber}, P.C. ${postal}`;\n }\n return that;\n}", "function sanitizeAddress(input) {\n input = input || \"\";\n input = input.trim();\n // etc\n return input;\n}", "function onchangeAddress() {\n\tgetGeoByAddress();\t\n}", "onAddressChanged(inputAddress) {\n this.setState({\n address: inputAddress\n });\n }", "function oneLineAddress( address ) {\r\n\tif( ! address )\r\n\t\treturn '';\r\n\t//if( typeof address == 'string' )\r\n\t//\treturn H(address).replace( /, USA$/, '' );\r\n\treturn H( S(\r\n\t\taddress.line1 ? address.line1 + ', ' : '',\r\n\t\taddress.line2 ? address.line2 + ', ' : '',\r\n\t\taddress.city, ', ', address.state,\r\n\t\taddress.zip ? ' ' + address.zip : ''\r\n\t) );\r\n}", "function callSearchLocation(){\n\tif(\"undefined\" != address && null != address && 0 < address.length && currentlyEmittedAddressIndex < address.length-1){\n\t\taddressString = address.slice(currentlyEmittedAddressIndex + 1,address.length).join(\" \");\n\t\tcurrentlyEmittedAddressIndex ++;\n\t\tsearchLocationOnMapAddressArray(addressString);\n\t}\n}", "function enterAddressAutocomplete() {\n //TODO: Add to firestore\n var input = document.getElementById('set-address');\n var autocomplete = new google.maps.places.Autocomplete(input);\n\n // Set the data fields to return when the user selects a place.\n autocomplete.setFields(\n ['address_components', 'geometry', 'icon', 'name']);\n\n autocomplete.addListener('place_changed', function() {\n var place = autocomplete.getPlace();\n\n //Reconstruct address from the place API components\n var address = '';\n if (place.address_components) {\n address = [\n (place.address_components[0] && place.address_components[0].short_name || ''),\n (place.address_components[1] && place.address_components[1].short_name || ''),\n (place.address_components[2] && place.address_components[2].short_name || '')\n ].join(' ');\n }\n\n //Set the input address to use in the main page\n document.getElementById('set-address').value = address;\n });\n}", "concatDorAddress(parcel, includeUnit) {\n includeUnit = !!includeUnit;\n var STREET_FIELDS = [ 'STDIR', 'STNAM', 'STDES', 'STDESSUF' ];\n var props = parcel.properties;\n\n // handle house num\n var addressLow = this.cleanDorAttribute(props.HOUSE);\n var addressHigh = this.cleanDorAttribute(props.STEX);\n // maybe should be props.SUF below (it said props.SUFFIX)\n var addressSuffix = this.cleanDorAttribute(props.SUF);\n var address = addressLow;\n address = address + (addressHigh ? '-' + addressHigh : '');\n address = address + (addressSuffix || '');\n\n // handle unit\n var unit = this.cleanDorAttribute(props.UNIT);\n if (unit) {\n unit = '# ' + unit;\n }\n\n // clean up attributes\n var comps = STREET_FIELDS.map(function(streetField) {\n return props[streetField];\n });\n comps = comps.map(this.cleanDorAttribute);\n // TODO handle individual address comps (like mapping stex=2 => 1/2)\n // addressLow = comps.HOUSE,\n // addressHigh = comps.STEX,\n // streetPredir = comps.STDIR,\n // streetName = comps.STNAM,\n // streetSuffix = comps.STDES,\n // streetPostdir = comps.STDESSUF,\n\n // add address to front\n comps = [ address ].concat(comps);\n\n // add unit to end\n if (includeUnit) {\n comps = comps.concat([ unit ]);\n }\n\n // remove nulls and concat\n address = comps.filter(Boolean).join(' ');\n\n // console.log('concatDorAddress address result:', address);\n if (address === '') {\n address = 'Parcel has no address';\n }\n return address;\n }", "function getCurrentAddress() {\n var address = [], \n addressKeys = Maptimize.AddressChooser.AddressKeys;\n\n for (var i = addressKeys.length-1; i>=0; --i) {\n var k = addressKeys[i];\n if (this[k]) {\n var value = valueForElement(this[k]);\n // Strip string\n value = value.replace(/^\\s+/, '').replace(/\\s+$/, '');\n if (value.length > 0) address.unshift(value);\n }\n }\n return address;\n }", "function initAutoComplete() {\n\n var addrComplete = new google.maps.places.Autocomplete(addr);\n\n addrComplete.addListener('place_changed', fillInAddress);\n\n var componentForm = {\n street_number: 'short_name',\n route: 'long_name',\n locality: 'long_name',\n administrative_area_level_1: 'short_name',\n country: 'long_name',\n postal_code: 'short_name'\n };\n\n function fillInAddress() {\n var place = addrComplete.getPlace();\n $('#address').val(\"\").css({ 'background-color': '#ffffff'});\n $('#city').val(\"\").css({ 'background-color': '#ffffff'});;\n $('#state').val(\"\").css({ 'background-color': '#ffffff'});;\n $('#zipcode').val(\"\").css({ 'background-color': '#ffffff'});;\n var street = \"\";\n\n for (var i = 0; i < place.address_components.length; i++) {\n var addressType = place.address_components[i].types[0];\n if (componentForm[addressType]) {\n var val = place.address_components[i][componentForm[addressType]];\n console.log(addressType, val)\n switch (addressType) {\n case \"street_number\":\n street = val;\n break;\n case \"route\":\n val = street+val\n $('#address').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"locality\":\n $('#city').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"administrative_area_level_1\":\n $('#state').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n case \"postal_code\":\n $('#zipcode').val(val).css({ 'background-color': '#F3FEFF'})\n break;\n }\n }\n }\n\n }\n }", "function convertAddress() {\n const address = $(\"#address\").val();\n if (address) {\n if (bchaddr.isValidAddress(address)) {\n $(\"#errorMessage\").addClass(\"d-none\");\n // Conversion\n const cash = bchaddr.toCashAddress(address);\n const legacy = bchaddr.toLegacyAddress(address);\n // Replace values\n $(\"#cashAddr\").text(cash);\n $(\"#legacyAddr\").text(legacy);\n // Display converted address\n $(\"#convertedAddr\").removeClass(\"d-none\");\n // Display QR codes\n QRCode.toCanvas(document.getElementById(\"cashAddrQR\"), cash, function (error) {\n if (error) console.error(error);\n });\n QRCode.toCanvas(document.getElementById(\"legacyAddrQR\"), legacy, {width: 164}, function (error) {\n if (error) console.error(error);\n });\n } else {\n // Show error message\n $(\"#convertedAddr\").addClass(\"d-none\");\n $(\"#errorMessage\").removeClass(\"d-none\");\n $(\"#errorMessage\").text(address + \" \" + $(\"#isNotValid\").text());\n }\n }\n}", "function fillInAddress() {\n var place = autocomplete.getPlace();\n}", "function doGeocode() {\n var addr = document.getElementById(\"address\");\n // Get geocoder instance\n var geocoder = new google.maps.Geocoder();\n\n // Geocode the address\n geocoder.geocode({\n 'address': addr.value\n }, function(results, status) {\n if (status === google.maps.GeocoderStatus.OK && results.length > 0) {\n\n // set it to the correct, formatted address if it's valid\n //addr.value = results[0].formatted_address;;\n\n // show an error if it's not\n } else {alert(\"Invalid address\");return;}\n });\n}", "function reloadGetAddress() {\n var input = document.getElementById(\"sensorAddress\").value;\n \n \n \n document.getElementById(\"status\").innerHTML = '<div class=\"connectionbuttonOK\"> <div class=\"connectvalid\"><i class=\"mdsmall material-icons connectOK\">check</i></div> <p class=\"connectiontext\" id=\"ipadd\"></p> </div>';\n \n document.getElementById(\"ip\").innerHTML = input;\n \n document.getElementById(\"ipadd\").innerHTML = input;\n}", "function updateAddressText()\n{\n nlapiLogExecution('DEBUG', 'updateAddressText', 'Begin');\n \n var addressId = nlapiGetFieldValue('custrecord_jobopt_address');\n if (addressId) {\n var addressText = '';\n var address = nlapiLoadRecord('customrecord_address', addressId);\n var addressee = address.getFieldValue('custrecord_ad_addressee');\n if (addressee) {\n addressText += addressee;\n }\n var address1 = address.getFieldValue('custrecord_ad_address1');\n if (address1) {\n addressText += '\\n' + address1;\n }\n var address2 = address.getFieldValue('custrecord_ad_address2');\n if (address2) {\n addressText += '\\n' + address2;\n }\n var city = address.getFieldValue('custrecord_ad_city');\n if (city) {\n addressText += '\\n' + city;\n }\n var postcode = address.getFieldValue('custrecord_ad_postcode');\n if (postcode) {\n addressText += ', ' + postcode;\n }\n var countryId = address.getFieldValue('custrecord_ad_country');\n var countryName = '';\n if (countryId) {\n var country = nlapiLoadRecord('customrecord_country', countryId);\n countryName = country.getFieldValue('name');\n }\n if (countryName) {\n addressText += '\\n' + countryName;\n }\n \n nlapiSetFieldValue('custrecord_jobopt_addresstext', addressText);\n }\n \n nlapiLogExecution('DEBUG', 'updateAddressText', 'Exit Successfully');\n}", "function parsePlace(original, fixed){\n\t//complicated\n\t//parses place to only get the location\n\t//all three places have the name of the location after \"of\" or nothing at all\n\tfor(var s=0; s<original.length; s++){\n\t\tif (original[s]==='of'){\n\t\t\tvar stop = s;\n\n\t\t\tfor(var p=s+1; p<original.length; p++){\n\t\t\t\tfixed += \" \" + original[p];\n\t\t\t}\n\t\t}\n\t}\n\t//if there's no \"of\" then it just marks location as the place\n\tif(fixed===''){\n\t\tfixed = original.join(' ');\n\t}\n\n\treturn fixed;\n}", "function geocodePosition(marker) {\n var geocoder = new google.maps.Geocoder();\n var location = new google.maps.LatLng(marker.getPosition().lat(),marker.getPosition().lng() );\n geocoder.geocode({ 'location': location }, function (results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n if (results[1]) {\n document.getElementById('street_number').value=results[1].address_components[0].long_name;\n document.getElementById('sublocality').value=results[1].address_components[1].long_name;\n console.log(results[1].address_components[2].long_name);\n console.log(results[1].address_components[3].long_name);\n }\n }\n });\n}", "function getAddressComponents(formattedAddress) {\n\n\t\tvar Address = function() {\n\t\t\treturn { \n\t\t\t\tstreet:'',\n\t\t\t\tcity:'',\n\t\t\t\tstate:'',\n\t\t\t\tzip:''\n\t\t\t};\n\t\t};\n\n\t\tvar addr = new Address();\n\n\t\tvar addrSplit = formattedAddress ? formattedAddress.split(',') : ['','',''];\n if(addrSplit.length === 4){\n addr.street = $.trim(addrSplit[0]);\n addr.city = $.trim(addrSplit[1]);\n addr.state = $.trim(addrSplit[2]);\n }\n else if (addrSplit.length === 3){\n \taddr.city = $.trim(addrSplit[0]);\n \taddr.state = $.trim(addrSplit[1]);\n }\n \n if (addr.state){\n \tvar zipSplit = addr.state.split(' ');\n \tif (zipSplit.length === 2) {\n \taddr.state = zipSplit[0];\n \taddr.zip = zipSplit[1];\n \t}\n }\n\n return addr;\n\t}", "getAddress(address, name) {\n return name ? { address, name } : { address };\n }", "function formatAddressForPrint(address) {\r\n var arr = [];\r\n address.address && arr.push(address.address);\r\n _.isObject(address.city) && arr.push(address.city.name);\r\n _.isObject(address.state) && arr.push(address.state.name);\r\n _.isObject(address.country) && arr.push(address.country.name);\r\n \r\n return arr.join('\\n\\r');\r\n }", "function chooseAddr(lat1, lng1, event, current_place) {\r\n containerId = event.target.closest('.leaflet-main').getAttribute('id');\r\n var i = event.target.closest('.leaflet-main').getElementsByClassName('mapframe')[0].getAttribute('id');\r\n markers[i].closePopup();\r\n var zoom = 15;\r\n maps[i].setView([lat1, lng1, zoom]);\r\n maps[i].setZoom(zoom);\r\n markers[i].setLatLng([lat1, lng1]);\r\n lat = lat1.toFixed(8);\r\n lon = lng1.toFixed(8);\r\n maps[i].invalidateSize();\r\n formatted_address = event.target.getAttribute(\"data-formatted\");\r\n event.target.closest('.leaflet-main').getElementsByClassName('latitude')[0].value = lat;\r\n event.target.closest('.leaflet-main').getElementsByClassName('longitude')[0].value = lon;\r\n event.target.closest('.leaflet-main').getElementsByClassName('formatted_address')[0].value = formatted_address;\r\n current_place = event.target.closest('.leaflet-main').getElementsByClassName('address')[0].value;\r\n\r\n markers[i].bindPopup(\"<i><b>\" + current_place + \" ligger här!</b><br>Lat: </i>\" + \"<b>\" + lat + \r\n \"</b>\" + \"<i><br />Lon: </i>\" + \"<b>\" + lon + \"</b>\").openPopup();\r\n}", "editAddress() {\n this.addressRevertData = {\n address : this.vendor.address,\n state : this.vendor.state,\n zip_code: this.vendor.zip_code,\n city : this.vendor.city\n }\n }", "function fnConvertAddress() {\n //Get the values from the text box\n var sAddress = $(\"#txtCreatePropertyAddress\").val();\n //Create a new Geocoder object\n geocoder = new google.maps.Geocoder();\n //Initiate function to convert the variable sAddress to two coordinates\n geocoder.geocode({ 'address': sAddress }, function(results, status) {\n //If the Geocoder status is ok then run the following\n if (status == google.maps.GeocoderStatus.OK) {\n //Store the latitude and longitude in two new variables\n var iLat = results[0].geometry.location.lat();\n var iLng = results[0].geometry.location.lng();\n //Put the values in the text input boxes\n $(\"#txtCreatePropertyLat\").val(iLat);\n $(\"#txtCreatePropertyLng\").val(iLng);\n }\n });\n}", "function formatPhone(x){\n var areaCode = x.slice(0, 3);\n var first3 = x.slice(3, 6);\n var last4 = x.slice(6, 11);\n var phone = areaCode + \"-\" + first3 + \"-\" + last4;\n return phone;\n}", "function formatAddressComponent(component) {\n let formattedComponent = component.replace(/[-_]/g, \" \");\n\n // Capitalize the first letter of each word\n const componentWords = formattedComponent.toLowerCase().split(\" \");\n formattedComponent = componentWords.map((word) => {\n return word.charAt(0).toUpperCase() + word.substring(1);\n }).join(' ');\n\n return formattedComponent;\n }", "getAddress()\n {\n return this.adress;\n }", "function parseAddress(str) {\n var addr = {}, base,\n arr = str.split(\"/\")\n \n if (arr.length < 2) // no id\n base = str; \n else { // has id\n addr.id = arr[1]; \n base = arr[0]; \n }\n \n arr = base.split(\"@\")\n if (arr.length < 2) // group only\n addr.group = base; \n else { // group and user\n addr.user = arr[0];\n addr.group = arr[1];\n }\n \n return addr;\n}", "function addressToAensPointee (address) {\n const key = {\n ak: 'AENS.AccountPt',\n ct: 'AENS.ContractPt',\n ok: 'AENS.OraclePt',\n ch: 'AENS.ChannelPt',\n }[address.substring(0, 2)];\n return { [key]: [`ak${address.substring(2)}`] }\n }", "function locate() {\n map.graphics.clear();\n var address = {\n \"SingleLine\": $('#address').val()\n };\n locator.outSpatialReference = map.spatialReference;\n var options = {\n address: address,\n outFields: [\"Loc_name\"]\n }\n locator.addressToLocations(options);\n }", "function handleChangeAdressFields(event) {\n setAdressCurrentState({\n ...addressCurrentState,\n [event.target.name]: event.target.value,\n });\n }", "_address(parameter, mode)\n {\n return mode === 2 ? parameter + this.relativeBase : parameter;\n }", "function parsePhone(phone){\n // changes (###)-###-#### to ##########\n}", "function showPosition(position) {\n setUserInput([position.coords.latitude, position.coords.longitude]);\n setToAddress(true)\n }", "geocodeNewAddress(address) {\n\n\t\tymaps.geocode(address, {results: 1}).then((result) => {\n\n\t\t\t// Get first result\n\t\t\tlet coordinates = result.geoObjects.get(0).geometry.getCoordinates();\n\n\t\t\t// Transfer map view to geocoded coordinates\n\t\t\tthis.myMap.panTo(coordinates, {flying: true});\n\n\t\t\t// Set placemark from geocoded coordinates\n\t\t\tthis.setPlacemark(coordinates);\n\n\t\t\tthis.$timeout(() => this.$rootScope.$broadcast(\"geocoded:coordinates\", coordinates));\n\t\t});\n\n\t}", "function addressForData(streetString,cityString,stateString,postalCode,countryString) {\n \n var completeAddress = \"\";\n \n if (streetString != null && streetString.length>0) {\n completeAddress = streetString + \",\";\n }\n if (cityString != null && cityString.length > 0) {\n completeAddress = completeAddress + cityString + \",\";\n }\n if (stateString != null && stateString.length > 0) {\n completeAddress = completeAddress + stateString + \" \";\n }\n if (postalCode != null && postalCode.length > 0) {\n completeAddress = completeAddress + postalCode + \",\";\n }\n if (countryString != null && countryString.length > 0) {\n completeAddress = completeAddress + countryString;\n }\n return completeAddress;\n \n}" ]
[ "0.69287354", "0.6755671", "0.6567135", "0.65388316", "0.6373146", "0.6230345", "0.62207747", "0.61034846", "0.6046665", "0.60404474", "0.5932829", "0.59213233", "0.5913287", "0.589963", "0.58830035", "0.58764935", "0.58323574", "0.58228993", "0.5789428", "0.57707477", "0.5768816", "0.5757153", "0.57459223", "0.5672534", "0.56449604", "0.56294596", "0.5624211", "0.5621226", "0.5597695", "0.55952305", "0.5572885", "0.5550848", "0.5523015", "0.55052763", "0.54981285", "0.5495985", "0.54742706", "0.546451", "0.5464407", "0.5464356", "0.54576063", "0.54570174", "0.54490805", "0.5440938", "0.5440938", "0.5440938", "0.5440938", "0.542739", "0.5403753", "0.53958327", "0.53914183", "0.5370199", "0.5368632", "0.53639185", "0.5361274", "0.536063", "0.5341613", "0.5338827", "0.53360325", "0.53139734", "0.5312475", "0.53035605", "0.52985525", "0.52900034", "0.52766037", "0.5270282", "0.5265996", "0.5261062", "0.5256531", "0.5244918", "0.52415043", "0.52412665", "0.52403086", "0.5214914", "0.5212076", "0.52023643", "0.51978964", "0.5192535", "0.5183311", "0.517763", "0.51716244", "0.5151756", "0.5146573", "0.5146393", "0.51268995", "0.51267517", "0.51222605", "0.51209277", "0.5095642", "0.5093953", "0.50924456", "0.5078897", "0.5068315", "0.50634825", "0.50585294", "0.50542223", "0.50494534", "0.5040008", "0.502855", "0.50279427" ]
0.5741885
23
AS PER COOPER > optionChanged, then "getElement" ById not class
function optionChanged(passdata) { table(passdata); charts(passdata); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function optionChanged(id) {\n getData(id);\n}", "function optionChanged(id) {\n\n getData(id);\n}", "function optionChanged(){\n init();\n}", "function optionChanged(id) {\n charting(id);\n meta(id);\n}// change(id)", "function optionChanged(id) {\n display_data(id);\n dyna_demos(id);\n}", "function optionChanged(id) {\n getPlots(id);\n getDemoInfo(id);\n}", "function optionChanged(id) {\n doplot(id);\n getInfo(id);\n}", "function optionChanged(id) {\n buildCharts(id);\n displayMetadata(id);\n}", "function optEventFunction() {\n\n\n let optSetElement = document.querySelectorAll('.optionSet');\n\n optSetElement.forEach(opt => {\n\n valuesObject[layoutObj[opt.id][0]] = layoutObj[opt.id][1];\n\n opt.addEventListener('change', anElmnt => {\n\n isSame(anElmnt)\n })\n })\n}", "function optionChanged(id) {\n namePlots(id);\n getDemoInfo(id);\n }", "function optionChanged(newid) {\n buildPanel(newid);\n buildBar(newid);\n buildBubble(newid);\n}", "function optionChanged(id) {\n // console.log(id);\n barPlots(id);\n // guagePlots(id);\n\n bubblePlots(id);\n guagePlots(id);\n\n}", "function optionChanged(newSampleID) {\n showDemographicInfo(newSampleID); \n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID); \n\n console.log(\"Dropdown changed to:\", newSampleID);\n}", "change() {\n\n const divs = this.parent.querySelectorAll('[class^=\"toggle-select-\"],[class*=\" toggle-select-\"]');\n const selectOption = this.select.options[this.select.selectedIndex];\n let value;\n\n if(this.options.field == 'group')\n {\n value = selectOption.parentNode.label ? selectOption.parentNode.label.toLowerCase() : null;\n } else {\n value = selectOption.value;\n }\n\n // Toggle each div\n divs.forEach(div => {\n const isVisible = div.classList.contains('toggle-select-'+value);\n const inputs = div.querySelectorAll('select,textarea,input:not([type=\"hidden\"],[type=\"checkbox\"],[type=\"radio\"])');\n\n // Toggle the visible div\n isVisible ? div.classList.remove('d-none') : div.classList.add('d-none');\n\n // Toggle the inputs\n if(inputs)\n {\n this.toggleForm(inputs,isVisible);\n }\n\n });\n\n // Run the custom callback\n this.options.onChanged(value);\n\n }", "function optionChanged (newID) {\n buildPlots(newID);\n demographicPanel(newID);\n}", "function optionChanged(id){\n showPlots(id);\n infoCard(id);\n}", "function optionChanged(newid) {\n buildMetadata(newid);\n buildCharts(newid);\n}", "function optionChanged(id) {\n getPlots(id);\n getmetadata(id);\n}", "function optionChanged(id) {\n getSamplesData(id);\n getSamplesInfo(id);\n}", "function optionChanged(id) {\r\n buildplot(id);\r\n}", "function optionChanged(id){\n metadatainfo(id);\n draw(id);\n}", "function optionChanged(newID) {\n buildtable(newID);\n plotbar(newID);\n plotbubble(newID);\n buildGauge(newID);\n \n}", "function triggerChangeOnField(win, chosenId)\n {\n var name = windowname_to_id(win.name);\n var elem = document.getElementById(name);\n $(elem).change();\n }", "function triggerChangeOnField(win, chosenId) {\n // In Django 4.2, the popup index is appended to the window name.\n // Hence, we remove that before selecting the element.\n $(document.getElementById(win.name.replace(/__\\d+$/, ''))).change();\n }", "function optionChanged(newsampleID)\n{\n console.log(\"Dropdown changed to:\", newsampleID);\n \n DrawBarGraph(newsampleID);\n DrawBubbleChart(newsampleID);\n ShowMetaData(newsampleID);\n}", "function optionChanged(newId) {\n Plot(newId);\n}", "function optionChanged(newID) {\n fillTable(newID);\n makeCharts(newID);\n}", "function optionChanged(id) {\n console.log(id)\n console.log('id has changed for new chart to print')\n plotBarBubblecharts(id);\n console.log('refreshed chart for new id successfully')\n\n //call fucntion for demo date\n dispDemodata(id);\n\n // plot bonus chart\n plotGaugechart(id)\n\n }", "onchange() {}", "function selectChange(elemid, mode) {\r\n $(elemid).val(mode);\r\n $(elemid).selectmenu(\"refresh\");\r\n}", "function optionChanged(changed){\n charts(changed);\n metadata(changed);\n}", "function optionChanged() {\n let value = document.getElementById(this.id).value;\n\n bubblePlot(value);\n}", "function doAfterSelectOptionChangedForHospitalExt(fieldName)\n{\n //Custom handling\n}", "function showChangeOption()\n{\n var action = document.getElementById('action_type_1_id');\n var change = document.getElementById('fs_has_change');\n\n if (action != undefined && change != undefined && action.options['0'] != undefined)\n {\n if (action.options['0'].selected == true && action.options['0'].value == 1754)\n change.style.display = '';\n else\n change.style.display = 'none';\n }\n else\n change.style.display = 'none';\n}", "function change() {\n document.getElementsByClassName('options').style.display=\"block\";\n }", "function clickOptiontoSelect(){\n\n}", "function selectchange(x,res,selectedval,targetdiv)\n {\n \n }", "function onChangeEvent() {\n 'use strict';\n\n // retrieve index of selected item\n var start = 'option_'.length;\n var reminder = this.value.substr(start);\n\n // store currently selected class (index of this class) in closure\n classesSelectedIndex = parseInt(reminder);\n }", "function initOptions() {\n $('select#variant-select').change();\n}", "function optionEventListener() {\n let optionLi = document.querySelectorAll(\".option\");\n for (let i = 0; i < optionLi.length; i++) {\n optionLi[i].addEventListener(\"click\", optionListener);\n }\n}", "function optionChanged(patientID) {\n console.log(patientID);\n buildCharts(patientID);\n populateDemoInfo(patientID);\n}", "_optionChanged(...args) {\n const prop = args[0];\n const optionMethodName = `_option${pascalCase(prop)}`;\n\n this.__notify(EV.BEFORE_OPTION_CHANGE, prop);\n\n if (this[optionMethodName]) {\n this[optionMethodName]();\n }\n else {\n this.update(...args);\n }\n\n this.__notify(EV.OPTION_CHANGED, prop);\n }", "function listen(e, p) {\n if (Sys.UI.DomElement.isDomElement(e) && /^select$/i.test(e.tagName) && /^(selectedIndex|value)$/i.test(p)) {\n Sys.Observer.addEventHandler(e, \"optionsChanged\", this._onOptionsUpdated);\n return true;\n }\n return false;\n }", "function highlightOption(divid) {\n\n\tvar columns = document.getElementsByName('columnlist');\n\tfor(var j = 0; j < columns.length; j++)\n\t\tcolumns[j].className = 'out'; \n\n\tdocument.getElementById(divid).className = 'selected';\n\n\tshowDescription(divid);\n\n//panos: to IMPROVE \n\tif (document.getElementById('selectperiod'+divid))\n\t\tdocument.getElementById('selectperiod'+divid).value = document.getElementById('period'+divid).value;\n\n}", "function optionChanged(name){\r\n // Testing option change\r\n // console.log(name)\r\n buildCharts(name) \r\n demographicData(name)\r\n}", "function optionChanged(SubjectID){\n demographicInfo(SubjectID);\n barChart(SubjectID);\n bubbleChart(SubjectID);\n}", "function updateField(elementID){\n var curDropdown= document.getElementById(elementID);\n var selectorValue= curDropdown.options[curDropdown.selectedIndex].value;\n if(selectorValue==3){\n makeWeight(elementID);\n }\n if(selectorValue==4){\n makeWeightRange(elementID);\n }\n if(selectorValue!=3 && selectorValue!=4){\n makeStandard(elementID);\n }\n}", "function optionChanged(samplechoice) {\n\n buildCharts(samplechoice);\n meta(samplechoice);\n\n}", "function optionChanged(newSampleID) {\n\n // Verify event handler\n // console.log(`User selected ID (${newSampleID}).`);\n\n // Call functions to draw bar graph plot, bubble chart plot, update demographic info panel, and gauge chart\n drawBarGraph(newSampleID);\n drawBubbleChart(newSampleID);\n updateDemographicInfo(newSampleID);\n drawGaugeChart(newSampleID);\n\n}", "function optionChanged (sample) {\ndemographic_panel(sample);\ncreate_charts(sample);\n}", "function tutor_questionGuessChanged(o) {\n var id = o.getAttribute('id');\n var selection = o.getAttribute('option_number');\n var value = o.getAttribute('value');\n \n gwt_tutorQuestionGuessChanged(id, selection, value);\n}", "updateHtml(element, type){\n\t\t\tif (type == constants.CLASS_LANGUAGE){\n\t\t\t\tvar selectedOption = element.options[element.selectedIndex];\n\t\t\t\tvar options = element.children;\n\t\t\t\tfor (var i = 0 ; i < options.length ; i++){\n\t\t\t\t\tvar option = options[i];\n\t\t\t\t\tif (option == selectedOption){\n\t\t\t\t\t\toption.setAttribute(\"selected\", \"selected\");\n\t\t\t\t\t} else if (option.hasAttribute(\"selected\")){\n\t\t\t\t\t\toption.removeAttribute(\"selected\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (type == constants.CLASS_INTEREST){\n\t\t\t\tvar value = element.value;\n\t\t\t\telement.setAttribute(\"value\", value);\n\t\t\t}\n\t\t}", "function optionChanged(id) {\n plot_samples(id);\n get_demographics(id);\n}", "function optionChanged(newSampleID)\n\n { \n //Log new selection\n console.log(`User selected ${newSampleID}`) ;\n\n //Run functions to display data\n FillMetaData(newSampleID) ;\n\n DrawBarGraph(newSampleID) ;\n\n DrawBubbleChart(newSampleID) ;\n\n }", "function addOnChange (){\n\t // data input fields\n\t var f = document.getElementsByTagName('input');\n\t for(var i=0;i<f.length;i++){\n\t if(f[i].getAttribute('type')!='submit'){\n\t\t addChangeEvent(f[i]);\n\t }\n\t }\n\t // dropdowns\n\t var f = document.getElementsByTagName('select');\n\t for(var i=0;i<f.length;i++){\n\t\t addChangeEvent(f[i]);\n\t\t }\n\t // text areas\n\t var f = document.getElementsByTagName('textarea');\n\t for(var i=0;i<f.length;i++){\n\t\t addChangeEvent(f[i]);\n\t\t }\n\t // dojo dropdowns\n\t \tvar elem = document.getElementById('advance').elements;\n\t // var box = dijit.byId('box');\n\t for(var i = 0; i < elem.length; i++){\n\t var dijitElement = dijit.byId(elem[i].id);\n\t if (dijitElement != undefined)\n\t if (dijitElement.declaredClass == 'dijit.form.ComboBox' || (dijitElement.declaredClass == 'dijit.form.FilteringSelect'))\n\t \t dojo.connect(dijitElement, 'onChange', setChanged);\n\t }\n\t \n\t // Date images, used onclick since onchange won't fire when the\n\t\t\t// field\n\t // is modified through a script\n\t dojo.connect(dojo.byId(\"requestDateSelector\"), 'onclick', setChanged);\n\t dojo.connect(dojo.byId(\"fromDateSelector\"), 'onclick', setChanged);\n\t dojo.connect(dojo.byId(\"toDateSelector\"), 'onclick', setChanged);\n\t }", "function updateOptionElement(option, element) { // 26642\n option.element = element; // 26643\n element.disabled = option.disabled; // 26644\n // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive // 26645\n // selects in certain circumstances when multiple selects are next to each other and display // 26646\n // the option list in listbox style, i.e. the select is [multiple], or specifies a [size]. // 26647\n // See https://github.com/angular/angular.js/issues/11314 for more info. // 26648\n // This is unfortunately untestable with unit / e2e tests // 26649\n if (option.label !== element.label) { // 26650\n element.label = option.label; // 26651\n element.textContent = option.label; // 26652\n } // 26653\n if (option.value !== element.value) element.value = option.selectValue; // 26654\n } // 26655", "function ddChangeAllElements(object,elemIds) {\n var index = object.selectedIndex;\n if (index > 0) {\n for (var i = 0; i < elemIds.length; i++) {\n var elem = getElementByIdCS(elemIds[i]);\n if (elem) elem.selectedIndex = index - 1;\n }\n }\n}", "function optionChanged(changedSample){\n demographicInfo(changedSample);\n barChart(changedSample);\n bubbleChart(changedSample);\n}", "function optionChanged(id) {\n CreatePlot(id);\n MetaData(id);\n }", "function optionChanged (newSelection) {\n buildCharts(newSelection);\n buildMetadata(newSelection);\n}", "function alPeriodChange(currentSelectElement){\r\n\tvar alSelectVal = currentSelectElement.value;\r\n\t//get several attributes ie id\r\n\tvar alIdAttr = currentSelectElement.getAttribute(\"id\");\r\n\tvar attrArray = stringToArray(alIdAttr,\"_\");\r\n\tvar selectNameDifferentiator = attrArray[0];\r\n\tvar selectUniqueIdentifier = attrArray[attrArray.length-1];\r\n\t//function\r\n\talSelectHideUnhide(alSelectVal,selectNameDifferentiator,selectUniqueIdentifier);\r\n\t}", "function changeEpisode(elem)\n{\n var chosen = document.getElementById(\"episodeName\").object.getSelectedIndex();\n updateEpisode(results[chosen]);\n}", "function optionChanged(selected){\n\tmakeBar(selected);\n\tmakeTable(selected);\n\tmakeBubbleMap(selected);\n}", "function option_changed (input) {\n var panel = input.closest('.panel'),\n specs = $('.summary .specs'),\n label = input.closest('li').find('label');\n\n var add_ons = $('.server-configurator .summary .specs ul'),\n target = add_ons.find('.' + input.attr('name'));\n\n if(target.length < 1) {\n var data_target = input.closest('[data-target]');\n\n if (data_target.length) {\n data_target = data_target.attr('data-target');\n\n target = $('ul.' + data_target).find('.' + input.attr('name'));\n }\n }\n\n if(input.attr('type') == 'checkbox'){\n handle_checkbox_addon(input, target, add_ons, label);\n }else{\n handle_radio_addon(input, target, add_ons, label);\n }\n\n if(add_ons.find('li').length > 1){\n $('#no_add_ons').hide();\n }else{\n $('#no_add_ons').show();\n }\n\n update_config_total_price();\n }", "function loadChangeFunctions() {\n //Getting the div ID drop down list selected item changed\n $(\".ddlType\").change(function () {\n drawChart($(this).closest('div[id*=OutputControl]').attr('id'));\n });\n\n //Getting the div ID drop down list selected item changed\n $(\".ddlflds\").change(function () {\n drawChart($(this).closest('div[id*=OutputControl]').attr('id'));\n });\n}", "function optionChanged(newSelection) {\n console.log(newSelection);\n updateTable(newSelection);\n}", "function response(){\n //finds out which element user chooses\n var elem = document.getElementById(\"page-elem\");\n var elemName= elem.options[elem.selectedIndex].value;\n //alert(elemName);\n\n //finds out which change the user wants\n var opt = document.getElementById(\"toggle-option\");\n var optChoice = opt.options[opt.selectedIndex].value;\n\n //traverse through DOM\n var elemObjects = document.getElementsByTagName(elemName);\n\n //apply changes\n if(elemObjects[0]==null && elemName!=\"\")\n alert(\"element does not exist in this page\");\n else{\n\n if (optChoice == \"bigFont\")\n for (let i=0; i<elemObjects.length; i++){\n let elemChildren = elemObjects[i].children;\n for (let j=0;j<elemChildren.length;j++)\n elemChildren[j].style.fontSize = \"1.25em\";\n }\n\n if (optChoice == \"smallFont\")\n for (let i=0; i<elemObjects.length; i++){\n let elemChildren = elemObjects[i].children;\n\n for (let j=0;j<elemChildren.length;j++){\n elemChildren[j].style.fontSize = \"0.75em\";\n }\n }\n if (optChoice == \"theme\")\n for (let i=0; i<elemObjects.length; i++)\n elemObjects[i].style.backgroundColor = \"green\";\n\n //reload webpage to reverse changes\n if (optChoice == \"default\")\n for (let i=0; i<elemObjects.length; i++)\n window.location.reload();\n }\n}", "function handleOptsClick() {\n let option = this.id;\n log('Handling checkbox change for ' + option);\n switch (option) {\n case \"xedx-loggingEnabled-opt\":\n opt_loggingEnabled = this.checked;\n GM_setValue(\"opt_loggingEnabled\", opt_loggingEnabled);\n debugLoggingEnabled = opt_loggingEnabled;\n debug('Saved value for opt_loggingEnabled');\n break;\n case \"xedx-hidefedded-opt\":\n opt_hidefedded = this.checked;\n GM_setValue(\"opt_hidefedded\", opt_hidefedded);\n debug('Saved value for opt_hidefedded');\n break;\n case \"xedx-hidefallen-opt\":\n opt_hidefallen = this.checked;\n GM_setValue(\"opt_hidefallen\", opt_hidefallen);\n debug('Saved value for opt_hidefallen');\n break;\n case \"xedx-devmode-opt\":\n opt_devmode = this.checked;\n GM_setValue(\"opt_devmode\", opt_devmode);\n hideDevOpts(!opt_devmode);\n debug('Saved value for opt_devmode');\n break;\n case \"xedx-hidetravel-opt\":\n opt_hidetravel = this.checked;\n GM_setValue(\"opt_hidetravel\", opt_hidetravel);\n debug('Saved value for opt_hidetravel');\n break;\n case \"xedx-showcaymans-opt\":\n opt_showcaymans = this.checked;\n if (opt_showcaymans) {\n $('#xedx-hidetravel-opt').prop(\"checked\", false);\n opt_hidetravel = false;\n GM_setValue(\"opt_hidetravel\", opt_hidetravel);\n }\n GM_setValue(\"opt_showcaymans\", opt_showcaymans);\n debug('Saved value for opt_showcaymans');\n break;\n case \"xedx-hidehosp-opt\":\n opt_hidehosp = this.checked;\n GM_setValue(\"opt_hidehosp\", opt_hidehosp);\n debug('Saved value for opt_hidehosp');\n break;\n case \"xedx-disabled-opt\":\n opt_disabled = this.checked;\n opt_disabled ? observerOFF() : observerON();\n indicateActive();\n GM_setValue(\"opt_disabled\", opt_disabled);\n debug('Saved value for opt_disabled');\n break;\n case \"xedx-viewcache-btn\":\n displayCache();\n break;\n default:\n debug('Checkbox ID not found!');\n }\n updateUserLevels('handleOptsClick');\n }", "function optionChanged(selectedPatientID) {\n console.log(selectedPatientID);\n buildCharts(selectedPatientID);\n populateDemographicInfo(selectedPatientID);\n}", "function enableOptions(arg) {\n var appearance = document.getElementById(\"propertypanel\");\n var selectedElement = document.getElementsByClassName(\"e-remove-selection\");\n if (arg.newValue) {\n if (arg.newValue[0] instanceof ej2_react_diagrams_1.Node) {\n selectedElement[0].classList.remove(\"e-remove-selection\");\n }\n else {\n if (!appearance.classList.contains(\"e-remove-selection\")) {\n appearance.classList.add(\"e-remove-selection\");\n }\n }\n }\n}", "function change_episode(elem) \n{\n\tvar chosen = elem.options[elem.selectedIndex].value;\n\tfor(var i=0; chosen != results[i].title; ++i) { }\t\n\tupdate_episode(results[i]);\n}", "function optionChanged(personId) {\n //create barchart, bubblechart, demo stuff, and gauge chart\n demographicstuff(personId);\n barchart(personId);\n bubblechart(personId);\n gaugechart(personId);\n}", "function elementChange(yourLs, element) {\n\tif (element.value.length > 0) {\n\t\t// Try to find element in waypoint list\n\t\tviaNr = element.parentNode.attributes['waypointnr'].value;\n\t\twait_image = jQuery(\".via_image\", element.parentNode);\n\t\tmessage_div = jQuery(\".via_message\", element.parentNode);\n\t\tyourLs.selectWaypoint(viaNr);\n\n\t\twait_image.css(\"visibility\", \"visible\");\n\t\t// Choose between Namefinder or Nominatim\n\t\t//Yours.NamefinderLookup( Yours.lookupMethod.nameToCoord, jQuery.trim(element.value), MyFirstWayPoint, map, myCallback);\n\t\tYours.NominatimLookup( Yours.lookupMethod.nameToCoord, jQuery.trim(element.value), yourLs.Selected, map, myCallback);\n\t}\n}", "function optionChanged(newSample) {\n\n // Display metadata Fucntion and Change\n metadata(newSample);\n\n // Display otu Function and Change \n otu(newSample);\n guage(newSample);\n}", "function OtherOptionSwitch(strOtherOptionTagId, objTag) {\n objOtherOptionTag = document.getElementById(strOtherOptionTagId);\n strOtherOptionClassName = objOtherOptionTag.className;\n strSelectControlTagId = strOtherOptionTagId + \"Enable\";\n objSelectControlTag = document.getElementById(strSelectControlTagId);\n if (objSelectControlTag) {\n if (objSelectControlTag.tagName == \"OPTION\") { // Dropdown (or multiselect, but only dropdowns are available in surveys for now)\n if (objTag[objTag.selectedIndex].id == objSelectControlTag.id) { // Relies on the option being a child of objTag\n OtherOptionShowText(strOtherOptionTagId);\n } else {\n OtherOptionDeselect(strOtherOptionTagId, objOtherOptionTag);\n }\n } else { // Radio or checkbox\n if (objSelectControlTag.checked) {\n OtherOptionShowText(strOtherOptionTagId);\n } else {\n OtherOptionDeselect(strOtherOptionTagId, objOtherOptionTag);\n }\n }\n }\n}", "function optionChanged(newSampleId) {\n // console.log(`User selected ${newSampleId}`);\n\n DrawBargraph(newSampleId);\n DrawBubblechart(newSampleId);\n ShowMetadata(newSampleId);\n}", "function getSelectedOption(){\n\n}", "function optionChanged () {\n id = d3.select('#selDataset').property('value');\n reload(id)\n return id\n}", "onChange(hsva, instance) {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function updateElement(elementId, choice) {\n var element = document.getElementById(elementId);\n element.innerHTML = choice;\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}", "function updateSelect() {\n let options = document.querySelectorAll(\".select_form-country option\");\n document\n .querySelector(\".option_form-country\")\n .classList.remove(\"option_form-country\");\n options[event.target.selectedIndex].classList.remove(\"fluidCountry\");\n options[event.target.selectedIndex].classList.add(\"option_form-country\");\n}", "function 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}", "function OtherOptionLoad(strOtherOptionTagId) {\n strFieldTagId = strOtherOptionTagId.substring(0, strOtherOptionTagId.indexOf(\"Other\"));\n OtherOptionSwitch(strOtherOptionTagId, document.getElementById(strFieldTagId));\n\n //objOtherOptionTag = document.getElementById(strOtherOptionTagId);\n //strOtherOptionClassName = objOtherOptionTag.className;\n //strSelectControlTagId = strOtherOptionTagId + \"Enable\";\n //objSelectControlTag = document.getElementById(strSelectControlTagId);\n \n // Hide the text box if this is a \"SelectTextHidden\" option\n //if (strOtherOptionClassName == \"otherOptionSelectTextHidden\") {\n // if (objSelectControlTag && objSelectControlTag.tagName == \"INPUT\") { // Radio or checkbox\n // if (objSelectControlTag.checked) {\n // OtherOptionShowText(strOtherOptionTagId);\n // } else {\n // OtherOptionHideText(strOtherOptionTagId);\n // }\n // } else if (objSelectControlTag && objSelectControlTag.tagName == \"SELECT\") { // Dropdown\n // }\n //}\n}", "function unevenFireEventSelectChange() {\n var selects = document.getElementsByClassName(\"coral-SelectList-item\");\n for (var i = 0; i < selects.length; i++) {\n\n var select = selects[i];\n select.addEventListener(\"click\", function(select) {\n var value = this.getAttribute(\"data-value\");\n unevenToogleField(value);\n\n });\n }\n\n}", "function SelectionChange() { }", "function SelectionChange() { }", "function optionChanged(val) {\n updateMetaTable(val);\n updateBarChart(val);\n updateBubbleChart(val);\n updateGaugeChart(val);\n}", "function optionChanged(newSelection) {\n buildChart(newSelection);\n}", "function colrPickerToBlockElmsFn(colrPickerId, colrToElmsClassName) {\r\n \r\n //fn:bind:onchange\r\n $(colrPickerId)\r\n\t\t.change(function () {\r\n\t\t \r\n\t\t //local var\r\n\t\t var str = '';\r\n\t\t //filter through children\r\n\t\t $(colrPickerId + ' option:selected').each(function () {\r\n\t\t //save it's text into str\r\n\t\t str += $(this).text() + ' ';\r\n\t\t });\r\n\t\t //notify target element and change its color\r\n\t\t $(colrToElmsClassName).css('fill', str);\r\n\t\t //testIt\r\n\t\t //console.log(str);\r\n\t\t})\r\n\t\t.change();\r\n\t\t\t\t\r\n}", "function optionChanged(sample_id){\n // Prevent the page from refreshing\n d3.event.preventDefault();\n // Select the input value from the dropdown\n var sample_id = d3.select(\"#selDataset\").node().value;\n console.log(sample_id);\n\n // d3.select(\"#selDataset\").node().value = \"\";\n // Call the plot and demo functions with the new sample_id\n buildPlots(sample_id);\n buildDemo(sample_id);\n }", "function optionChanged(){\r\n var data=d3.select('option').node().value;\r\n getData(data)\r\n }", "function bsInpChn(inpt) {\n switch (inpt.type) {\n case \"select-one\":\n if (!inpt.options[inpt.selectedIndex].defaultSelected && !inpt.classList.contains('changed')) {\n inpt.classList.add('changed');\n return true;\n } else if(inpt.options[inpt.selectedIndex].defaultSelected && inpt.classList.contains('changed')) {\n inpt.classList.remove('changed');\n return true;\n }\n return false;\n case \"checkbox\":\n return bsChekbChd(inpt);\n case \"radio\":\n var radios = document.getElementsByName(inpt.name);\n var isChanged = false;\n for (i = 0; i < radios.length; i++) {\n if (radios[i].type == \"radio\") { //filter hidden from main form\n if (bsChekbChd(radios[i])) {\n isChanged = true;\n }\n }\n }\n return isChanged;\n default:\n if (inpt.value != inpt.defaultValue && !inpt.classList.contains('changed')) {\n inpt.classList.add('changed');\n return true;\n } else if(inpt.value == inpt.defaultValue && inpt.classList.contains('changed')) {\n inpt.classList.remove('changed');\n return true;\n }\n return false;\n }\n}", "function onParentOptionSelect(element) {\n var nextDiv = element.parent().parent().next();\n if (nextDiv.is('.sub-options')) {\n if (element.is(':checked')) {\n nextDiv.removeClass('disabled-options');\n nextDiv.find('input').removeAttr('disabled');\n } else {\n nextDiv.addClass('disabled-options');\n nextDiv.find('input').attr('disabled', true);\n }\n }\n}", "function optionChanged(newState){\n buildMetadata(newState);\n buildCharts(newState);\n}", "function optionChanged(optionValue) {\n console.log(optionValue);\n const id_idx = parseInt(optionValue);\n buildBarChart(id_idx);\n buildBubbleChart(id_idx);\n buildDemographics(id_idx);\n buildGaugeChart(id_idx);\n}", "function optionChanged(sample) {\n // The parameter being passed in this function is new sample id from dropdown menu\n\n // Update metadata with newly selected sample USE ON CHANGE\n buildMetadata(sample);\n // Update charts with newly selected sample\n buildCharts(sample);\n}" ]
[ "0.6837175", "0.6836005", "0.68077844", "0.67821676", "0.67299134", "0.66542745", "0.6618144", "0.65580136", "0.6507251", "0.6471823", "0.6433838", "0.6367044", "0.6342445", "0.6284793", "0.62757593", "0.6263431", "0.62594545", "0.6253683", "0.6240902", "0.6238548", "0.622419", "0.6121299", "0.6061287", "0.6054733", "0.605422", "0.6047448", "0.6034132", "0.6011932", "0.6010259", "0.5950718", "0.5920587", "0.5919176", "0.5904331", "0.59037304", "0.58962625", "0.58778936", "0.5872991", "0.5868344", "0.58669716", "0.5853347", "0.5851058", "0.5841105", "0.5821734", "0.5801793", "0.5781792", "0.5779498", "0.5773755", "0.57700557", "0.5768243", "0.57584304", "0.5754513", "0.57500094", "0.5742982", "0.5739519", "0.57381487", "0.5734197", "0.57282054", "0.5726088", "0.57253504", "0.5723292", "0.57201076", "0.5708417", "0.57076174", "0.5700482", "0.5688523", "0.56700903", "0.5661855", "0.5656443", "0.5648053", "0.5643658", "0.56417537", "0.56326264", "0.56279296", "0.56273806", "0.56235427", "0.5612697", "0.5603874", "0.56023806", "0.56008327", "0.5594035", "0.5594035", "0.5594035", "0.5594035", "0.5592351", "0.5591552", "0.5591045", "0.5589858", "0.55878913", "0.5577262", "0.55733407", "0.55733407", "0.5562124", "0.55492663", "0.5547977", "0.5547776", "0.55413437", "0.5538301", "0.55326915", "0.5525419", "0.55244374", "0.5518668" ]
0.0
-1
For documentation, see updateOptions below
function updateOptions() { var type, i; // Update all-checked status if ($scope.ngModel.checkAll) { for (type in $scope.ngModel.checked) { if ($scope.ngModel.checked[type]) { $scope.ngModel.checkAll = false; } } } // Update the current filters string $scope.ngModel.filtersString = ''; if (!$scope.ngModel.checkAll) { for (i = 0; i < $scope.ngModel.types.length; i += 1) { // If the type key corresponds to a checked option... if ($scope.ngModel.checked[$scope.ngModel.types[i].key]) { // ... add it to the string list of current filter options if ($scope.ngModel.filtersString === '') { $scope.ngModel.filtersString += $scope.ngModel.types[i].name; } else { $scope.ngModel.filtersString += ', ' + $scope.ngModel.types[i].name; } } } // If there's still nothing in the filters string, there are no // filters selected if ($scope.ngModel.filtersString === '') { $scope.ngModel.checkAll = true; } } // Re-filter results $scope.ngModel.filter(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "optionsUpdateHook() { }", "function updateOptions(options)\n\t{\n\t\t_options = jQuery.extend(true, {}, _options, options);\n\t}", "updateOptions(options, ...args) { return args; }", "updateOptions (options) {\n this.options = _extend({}, this.options, options);\n\n for (let block of this.blocks) {\n block.options = _extend({}, block.options, options);\n }\n }", "function updateOptions ( optionsToUpdate ) {\n\t\n\t\t\tvar v = valueGet(), i, newOptions = testOptions({\n\t\t\t\tstart: [0, 0],\n\t\t\t\tmargin: optionsToUpdate.margin,\n\t\t\t\tlimit: optionsToUpdate.limit,\n\t\t\t\tstep: optionsToUpdate.step,\n\t\t\t\trange: optionsToUpdate.range,\n\t\t\t\tanimate: optionsToUpdate.animate,\n\t\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\n\t\t\t});\n\t\n\t\t\t['margin', 'limit', 'step', 'range', 'animate'].forEach(function(name){\n\t\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\t\toptions[name] = optionsToUpdate[name];\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t\t// doesn't rely on current direction\n\t\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\t\tscope_Spectrum = newOptions.spectrum;\n\t\n\t\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\t\tscope_Locations = [-1, -1];\n\t\t\tvalueSet(v);\n\t\n\t\t\tfor ( i = 0; i < scope_Handles.length; i++ ) {\n\t\t\t\tfireEvent('update', i);\n\t\t\t}\n\t\t}", "function updateOptions(optionsToUpdate) {\n var v = valueGet(),\n i, newOptions = testOptions({\n start: [0, 0],\n margin: optionsToUpdate.margin,\n limit: optionsToUpdate.limit,\n step: optionsToUpdate.step,\n range: optionsToUpdate.range,\n animate: optionsToUpdate.animate,\n snap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate\n .snap\n });\n ['margin', 'limit', 'step', 'range', 'animate'].forEach(function(\n name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = optionsToUpdate[name];\n }\n });\n // Save current spectrum direction as testOptions in testRange call\n // doesn't rely on current direction\n newOptions.spectrum.direction = scope_Spectrum.direction;\n scope_Spectrum = newOptions.spectrum;\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [-1, -1];\n valueSet(v);\n for (i = 0; i < scope_Handles.length; i++) {\n fireEvent('update', i);\n }\n }", "setOptions(options) {\n this.options = options;\n }", "updateOptions(options) {\n for (const property of Object.keys(options)) {\n if (options.hasOwnProperty(property)) {\n this._odataOptions[property] = options[property]; // replace of the property\n }\n // we need to keep the defaultSortBy for references whenever the user removes his Sorting\n // then we would revert to the defaultSortBy and the only way is to keep a hard copy here\n if (property === 'orderBy' || property === 'sortBy') {\n let sortBy = options[property];\n // make sure first char of each orderBy field is capitalize\n if (this._odataOptions.caseType === CaseType.pascalCase) {\n if (Array.isArray(sortBy)) {\n sortBy.forEach((field, index, inputArray) => {\n inputArray[index] = titleCase(field);\n });\n }\n else {\n sortBy = titleCase(options[property]);\n }\n }\n this._odataOptions.orderBy = sortBy;\n this._defaultSortBy = sortBy;\n }\n }\n }", "mergeOptions (options, notMerge, lazyUpdate) {\n this.delegateMethod('setOption', options, notMerge, lazyUpdate)\n }", "setOptions(options) {\n if (typeof options !== 'undefined') {\n for (let key in options) {\n this.options[key] = options[key];\n }\n }\n }", "setOptions(options) {\n this._options = options || {};\n }", "setOptions (options) {\n for(let [i, val] of Object.entries(this.opt)) {\n if(options.hasOwnProperty(i)) {\n this.opt[i] = options[i];\n }\n }\n }", "updateOptions(data) {\n this.options = data;\n\n if (this.options.isPlaying) {\n this.startCloning(this.options);\n } else {\n this.stopCloning();\n }\n }", "function updateOptions(scope, name, prop, options) {\n if (prop.widget === 'multi-select') {\n scope.widgetDataset = scope.widgetDataset || {};\n scope.widgetDataset[name] = options;\n } else if (prop.widget === 'list-typeahead') {\n var optionObjects = [],\n defaultOptions = [],\n optionCategoryName = 'Field';\n\n // default options for live list\n if (scope.widgettype === 'wm-livelist') {\n defaultOptions = [{\"name\": \"Javascript\", \"category\": \"Script\"}];\n if (_.includes(scope[prop], '(')) {\n defaultOptions.push({\n 'category': 'Script',\n 'name': scope[prop]\n });\n }\n }\n\n optionObjects = defaultOptions;\n options.forEach(function (option) {\n optionObjects.push({\n 'category': optionCategoryName,\n 'name': option\n });\n });\n prop.options = optionObjects;\n } else {\n prop.options = options;\n }\n }", "function updateAllOptions() {\n updateMusicOption();\n updateEffectsOption();\n updateSpeedOption();\n updateStatsOption();\n}", "function updateOptions() {\n // Reset the options and set them\n options.length = 0;\n optionsEls.forEach((optionEl) => {\n if (optionEl.checked) options.push(optionEl.name);\n });\n\n updateReplay();\n}", "function updateOptions(optionsToUpdate, fireSetEvent) {\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n var updateAble = [\n \"margin\",\n \"limit\",\n \"padding\",\n \"range\",\n \"animate\",\n \"snap\",\n \"step\",\n \"format\",\n \"pips\",\n \"tooltips\",\n ];\n // Only change options that we're actually passed to update.\n updateAble.forEach(function (name) {\n // Check for undefined. null removes the value.\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n var newOptions = testOptions(originalOptions);\n // Load new options into the slider state\n updateAble.forEach(function (name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n scope_Spectrum = newOptions.spectrum;\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n }\n else {\n removePips();\n }\n // Update tooltips, removes existing.\n if (options.tooltips) {\n tooltips();\n }\n else {\n removeTooltips();\n }\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);\n }", "function updateOptions(optionsToUpdate, fireSetEvent) {\n\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n\n var updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n // Only change options that we're actually passed to update.\n updateAble.forEach(function (name) {\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n\n var newOptions = testOptions(originalOptions);\n\n // Load new options into the slider state\n updateAble.forEach(function (name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n\n scope_Spectrum = newOptions.spectrum;\n\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n }\n\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(optionsToUpdate.start || v, fireSetEvent);\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}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\r\n\r\n\t\t\t// Spectrum is created using the range, snap, direction and step options.\r\n\t\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\r\n\t\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\r\n\t\t\tvar v = valueGet(), newOptions = testOptions({\r\n\t\t\t\tstart: [0, 0],\r\n\t\t\t\tmargin: optionsToUpdate.margin,\r\n\t\t\t\tlimit: optionsToUpdate.limit,\r\n\t\t\t\tstep: optionsToUpdate.step === undefined ? options.singleStep : optionsToUpdate.step,\r\n\t\t\t\trange: optionsToUpdate.range,\r\n\t\t\t\tanimate: optionsToUpdate.animate,\r\n\t\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\r\n\t\t\t});\r\n\r\n\t\t\t['margin', 'limit', 'range', 'animate'].forEach(function(name){\r\n\r\n\t\t\t\t// Only change options that we're actually passed to update.\r\n\t\t\t\tif ( optionsToUpdate[name] !== undefined ) {\r\n\t\t\t\t\toptions[name] = optionsToUpdate[name];\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// Save current spectrum direction as testOptions in testRange call\r\n\t\t\t// doesn't rely on current direction\r\n\t\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\r\n\t\t\tscope_Spectrum = newOptions.spectrum;\r\n\r\n\t\t\t// Invalidate the current positioning so valueSet forces an update.\r\n\t\t\tscope_Locations = [-1, -1];\r\n\t\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\r\n\t\t}", "function updateOption(event) \n\t\t\t{\t\n\t\t\t\tvar options = _.clone(this.model.get('options'));\n\t\t\t\tvar optionName = event.target.name;\n\t\t\t\t//support checkbox type of backend\n\t\t\t\tif(event.target.type === 'checkbox')\n\t\t\t\t{\n\t\t\t\t\tif(this.model.__customFieldsMetadata[optionName].type === 'checkbox')\n\t\t\t\t\t{\t\t\t\t\n\t\t\t\t\t\toptions[optionName] = event.target.checked ? '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\toptions[optionName] = event.target.checked ? event.target.value : '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\toptions[optionName] = jQuery(event.target).val();\t\n\t\t\t\t}\n\t\t\t\tthis.model.set('options', options);\n\t\t\t}", "setOptions(options) {\n this.options = deepExtend({}, this.defaultOptions, options);\n }", "set options(value) {}", "applyOptions(options) {\n Object.assign(this[$options], options);\n // Re-evaluates clamping based on potentially new values for min/max\n // polar, azimuth and radius:\n this.setOrbit();\n // Prevent interpolation in the case that any target spherical values\n // changed (preserving OrbitalControls behavior):\n this[$spherical].copy(this[$targetSpherical]);\n }", "function updateOptions(optionsToUpdate, fireSetEvent) {\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n\n var updateAble = [\n \"margin\",\n \"limit\",\n \"padding\",\n \"range\",\n \"animate\",\n \"snap\",\n \"step\",\n \"format\",\n \"pips\",\n \"tooltips\"\n ];\n\n // Only change options that we're actually passed to update.\n updateAble.forEach(function(name) {\n // Check for undefined. null removes the value.\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n\n var newOptions = testOptions(originalOptions);\n\n // Load new options into the slider state\n updateAble.forEach(function(name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n\n scope_Spectrum = newOptions.spectrum;\n\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n } else {\n removePips();\n }\n\n // Update tooltips, removes existing.\n if (options.tooltips) {\n tooltips();\n } else {\n removeTooltips();\n }\n\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(optionsToUpdate.start || v, fireSetEvent);\n }", "function updateOptions(optionsToUpdate, fireSetEvent) {\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n\n var updateAble = [\n \"margin\",\n \"limit\",\n \"padding\",\n \"range\",\n \"animate\",\n \"snap\",\n \"step\",\n \"format\",\n \"pips\",\n \"tooltips\"\n ];\n\n // Only change options that we're actually passed to update.\n updateAble.forEach(function(name) {\n // Check for undefined. null removes the value.\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n\n var newOptions = testOptions(originalOptions);\n\n // Load new options into the slider state\n updateAble.forEach(function(name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n\n scope_Spectrum = newOptions.spectrum;\n\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n } else {\n removePips();\n }\n\n // Update tooltips, removes existing.\n if (options.tooltips) {\n tooltips();\n } else {\n removeTooltips();\n }\n\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(optionsToUpdate.start || v, fireSetEvent);\n }", "function updateOptions(optionsToUpdate, fireSetEvent) {\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n\n var updateAble = [\n \"margin\",\n \"limit\",\n \"padding\",\n \"range\",\n \"animate\",\n \"snap\",\n \"step\",\n \"format\",\n \"pips\",\n \"tooltips\"\n ];\n\n // Only change options that we're actually passed to update.\n updateAble.forEach(function(name) {\n // Check for undefined. null removes the value.\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n\n var newOptions = testOptions(originalOptions);\n\n // Load new options into the slider state\n updateAble.forEach(function(name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n\n scope_Spectrum = newOptions.spectrum;\n\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n } else {\n removePips();\n }\n\n // Update tooltips, removes existing.\n if (options.tooltips) {\n tooltips();\n } else {\n removeTooltips();\n }\n\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(optionsToUpdate.start || v, fireSetEvent);\n }", "function updateOptions(optionsToUpdate, fireSetEvent) {\n // Spectrum is created using the range, snap, direction and step options.\n // 'snap' and 'step' can be updated.\n // If 'snap' and 'step' are not passed, they should remain unchanged.\n var v = valueGet();\n\n var updateAble = [\n \"margin\",\n \"limit\",\n \"padding\",\n \"range\",\n \"animate\",\n \"snap\",\n \"step\",\n \"format\",\n \"pips\",\n \"tooltips\"\n ];\n\n // Only change options that we're actually passed to update.\n updateAble.forEach(function(name) {\n // Check for undefined. null removes the value.\n if (optionsToUpdate[name] !== undefined) {\n originalOptions[name] = optionsToUpdate[name];\n }\n });\n\n var newOptions = testOptions(originalOptions);\n\n // Load new options into the slider state\n updateAble.forEach(function(name) {\n if (optionsToUpdate[name] !== undefined) {\n options[name] = newOptions[name];\n }\n });\n\n scope_Spectrum = newOptions.spectrum;\n\n // Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n options.margin = newOptions.margin;\n options.limit = newOptions.limit;\n options.padding = newOptions.padding;\n\n // Update pips, removes existing.\n if (options.pips) {\n pips(options.pips);\n } else {\n removePips();\n }\n\n // Update tooltips, removes existing.\n if (options.tooltips) {\n tooltips();\n } else {\n removeTooltips();\n }\n\n // Invalidate the current positioning so valueSet forces an update.\n scope_Locations = [];\n valueSet(optionsToUpdate.start || v, fireSetEvent);\n }", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Update pips, removes existing.\n\t\tif ( options.pips ) {\n\t\t\tpips(options.pips);\n\t\t}\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet(), newOptions = testOptions({\n\t\t\tstart: [0, 0],\n\t\t\tmargin: optionsToUpdate.margin,\n\t\t\tlimit: optionsToUpdate.limit,\n\t\t\tstep: optionsToUpdate.step === undefined ? options.singleStep : optionsToUpdate.step,\n\t\t\trange: optionsToUpdate.range,\n\t\t\tanimate: optionsToUpdate.animate,\n\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\n\t\t});\n\n\t\t['margin', 'limit', 'range', 'animate'].forEach(function(name){\n\n\t\t\t// Only change options that we're actually passed to update.\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t// doesn't rely on current direction\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [-1, -1];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet(), newOptions = testOptions({\n\t\t\tstart: [0, 0],\n\t\t\tmargin: optionsToUpdate.margin,\n\t\t\tlimit: optionsToUpdate.limit,\n\t\t\tstep: optionsToUpdate.step === undefined ? options.singleStep : optionsToUpdate.step,\n\t\t\trange: optionsToUpdate.range,\n\t\t\tanimate: optionsToUpdate.animate,\n\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\n\t\t});\n\n\t\t['margin', 'limit', 'range', 'animate'].forEach(function(name){\n\n\t\t\t// Only change options that we're actually passed to update.\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t// doesn't rely on current direction\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [-1, -1];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "updateOptions() {\n let platform = this.requestData['platform'];\n if (this.platforms['all'] && platform == this.platforms['all']['value']) {\n this.updateToAll();\n } else if (\n this.platforms['bit9'] && platform == this.platforms['bit9']['value']) {\n this.updateToBit9();\n } else if (\n this.platforms['santa'] &&\n platform == this.platforms['santa']['value']) {\n this.updateToSanta();\n } else {\n this.updateToAll();\n }\n }", "willUpdate(options) {\n console.log('willUpdate ejecutado!', options);\n }", "manageOptions () {\n if (Utils.isFunction(this.data.options)) {\n if (!this.options) {\n this.options = new Map();\n }\n const newOptions = this.data.options(this);\n // Looks for options not available anymore\n this.options.forEach((option) => {\n if (!newOptions.includes(option.getId())) {\n option.lock();\n }\n });\n // Add new options\n for (let i = 0, l = newOptions.length; i < l; ++i) {\n const id = newOptions[i];\n if (!this.options.has(id)) {\n const option = new Action(id, this.owner, this);\n this.options.push(option);\n this.optionsWrapper.appendChild(option.html);\n }\n }\n }\n }", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\r\n\r\n\t\t// Spectrum is created using the range, snap, direction and step options.\r\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\r\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\r\n\t\tvar v = valueGet(), newOptions = testOptions({\r\n\t\t\tstart: [0, 0],\r\n\t\t\tmargin: optionsToUpdate.margin,\r\n\t\t\tlimit: optionsToUpdate.limit,\r\n\t\t\tstep: optionsToUpdate.step === undefined ? options.singleStep : optionsToUpdate.step,\r\n\t\t\trange: optionsToUpdate.range,\r\n\t\t\tanimate: optionsToUpdate.animate,\r\n\t\t\tsnap: optionsToUpdate.snap === undefined ? options.snap : optionsToUpdate.snap\r\n\t\t});\r\n\r\n\t\t['margin', 'limit', 'range', 'animate'].forEach(function(name){\r\n\r\n\t\t\t// Only change options that we're actually passed to update.\r\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\r\n\t\t\t\toptions[name] = optionsToUpdate[name];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// Save current spectrum direction as testOptions in testRange call\r\n\t\t// doesn't rely on current direction\r\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\r\n\t\tscope_Spectrum = newOptions.spectrum;\r\n\r\n\t\t// Invalidate the current positioning so valueSet forces an update.\r\n\t\tscope_Locations = [-1, -1];\r\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\r\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t// doesn't rely on current direction\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit and margin depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t// doesn't rely on current direction\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\n\n\t\t// Spectrum is created using the range, snap, direction and step options.\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\n\t\tvar v = valueGet();\n\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\n\n\t\t// Only change options that we're actually passed to update.\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\n\t\t\t}\n\t\t});\n\n\t\tvar newOptions = testOptions(originalOptions);\n\n\t\t// Load new options into the slider state\n\t\tupdateAble.forEach(function(name){\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\n\t\t\t\toptions[name] = newOptions[name];\n\t\t\t}\n\t\t});\n\n\t\t// Save current spectrum direction as testOptions in testRange call\n\t\t// doesn't rely on current direction\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\n\t\tscope_Spectrum = newOptions.spectrum;\n\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\n\t\toptions.margin = newOptions.margin;\n\t\toptions.limit = newOptions.limit;\n\t\toptions.padding = newOptions.padding;\n\n\t\t// Invalidate the current positioning so valueSet forces an update.\n\t\tscope_Locations = [];\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\n\t}", "function setOptionsValues(newValues) {\n for(var key in newValues) {\n options[key] = newValues[key];\n }\n }", "setter( options ) {\n\t\tfor ( key in options ) {\n\t\t\tthis[ key ] = options[ key ];\n\t\t}\n\t}", "onOptionsChange(options) {\n this.vssue.setOptions(options);\n }", "function setOptions(new_options) {\n options = jQuery.extend({}, defaults, options, new_options);\n }", "function setOptions(new_options) {\n options = jQuery.extend({}, defaults, options, new_options);\n }", "function updateOptions ( optionsToUpdate, fireSetEvent ) {\r\n\r\n\t\t// Spectrum is created using the range, snap, direction and step options.\r\n\t\t// 'snap' and 'step' can be updated, 'direction' cannot, due to event binding.\r\n\t\t// If 'snap' and 'step' are not passed, they should remain unchanged.\r\n\t\tvar v = valueGet();\r\n\r\n\t\tvar updateAble = ['margin', 'limit', 'padding', 'range', 'animate', 'snap', 'step', 'format'];\r\n\r\n\t\t// Only change options that we're actually passed to update.\r\n\t\tupdateAble.forEach(function(name){\r\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\r\n\t\t\t\toriginalOptions[name] = optionsToUpdate[name];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tvar newOptions = testOptions(originalOptions);\r\n\r\n\t\t// Load new options into the slider state\r\n\t\tupdateAble.forEach(function(name){\r\n\t\t\tif ( optionsToUpdate[name] !== undefined ) {\r\n\t\t\t\toptions[name] = newOptions[name];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// Save current spectrum direction as testOptions in testRange call\r\n\t\t// doesn't rely on current direction\r\n\t\tnewOptions.spectrum.direction = scope_Spectrum.direction;\r\n\t\tscope_Spectrum = newOptions.spectrum;\r\n\r\n\t\t// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)\r\n\t\toptions.margin = newOptions.margin;\r\n\t\toptions.limit = newOptions.limit;\r\n\t\toptions.padding = newOptions.padding;\r\n\r\n\t\t// Invalidate the current positioning so valueSet forces an update.\r\n\t\tscope_Locations = [];\r\n\t\tvalueSet(optionsToUpdate.start || v, fireSetEvent);\r\n\t}", "set options(options) {\n const {\n debug = false,\n clientId,\n endpoint = 'https://stream.bionic-app.com/flags',\n } = options;\n this._options = {\n debug,\n clientId,\n endpoint,\n };\n }", "async function onOptionsUpdated() {\n globalOptions = await getNewOptions(null);\n}", "updateOption(value, data) {\n var self = this;\n var item, item_new;\n var value_new, index_item, cache_items, cache_options, order_old;\n value = hash_key(value);\n value_new = hash_key(data[self.settings.valueField]); // sanity checks\n\n if (value === null) return;\n if (!self.options.hasOwnProperty(value)) return;\n if (typeof value_new !== 'string') throw new Error('Value must be set in option data');\n order_old = self.options[value].$order; // update references\n\n if (value_new !== value) {\n delete self.options[value];\n index_item = self.items.indexOf(value);\n\n if (index_item !== -1) {\n self.items.splice(index_item, 1, value_new);\n }\n }\n\n data.$order = data.$order || order_old;\n self.options[value_new] = data; // invalidate render cache\n\n cache_items = self.renderCache['item'];\n cache_options = self.renderCache['option'];\n\n if (cache_items) {\n delete cache_items[value];\n delete cache_items[value_new];\n }\n\n if (cache_options) {\n delete cache_options[value];\n delete cache_options[value_new];\n } // update the item if it's selected\n\n\n if (self.items.indexOf(value_new) !== -1) {\n item = self.getItem(value);\n item_new = self.render('item', data);\n if (item.classList.contains('active')) addClasses(item_new, 'active');\n item.parentNode.insertBefore(item_new, item);\n item.remove();\n } // invalidate last query because we might have updated the sortField\n\n\n self.lastQuery = null; // update dropdown contents\n\n if (self.isOpen) {\n self.refreshOptions(false);\n }\n }", "function saveOptions() {}", "slottedOptionsChanged(prev, next) {\n super.slottedOptionsChanged(prev, next);\n this.setProxyOptions();\n this.updateValue();\n }", "function setOptions(options) {\n for(var optionKey in options) {\n if(optionKey in _options) {\n _options[optionKey] = options[optionKey];\n }\n }\n }", "setOptions(options) {\n Object.assign(this.options, options || {});\n return this.options;\n }", "function updateOptions() {\n\tpush();\n\t\tfill([255,255,255]);\n\t\ttextSize(cellwidth/2);\n\t\ttextAlign(CENTER,CENTER);\n\t\ttranslate(screen.w/2,screen.h/2);\n\t\ttext(\"What options do you need?\",0,0);\n\tpop();\n}", "async overrideData(options, additionalModules, callback) {\n const prevOption = Object.assign({}, this.options);\n const prevAdditionalModules = this.additionalModules;\n\n this.additionalModules = additionalModules;\n this.options = Object.assign({}, this.options, options);\n\n await callback();\n this.options = prevOption;\n this.additionalModules = prevAdditionalModules;\n }", "setOptions() {\n let defaultObj = {numChar: 1, limitNum: 3, orderBlock: [\"suggest\",\"collection\",\"product\"]};\n if(!this.options)\n {\n this.options = defaultObj; // set default if user not put arg\n }\n else {\n for(let key in defaultObj) // \n {\n if(!this.options[key])\n {\n this.options[key] = defaultObj[key];\n }\n }\n }\n \n\n \n }", "_handleRequestUpdateSetFunction(options)\n {\n this._updater.setCollections(options.collections);\n }", "function updateSearchOptions(searchOption) {\n filterParams = searchOption[HOTEL_SEARCH_FILTER] ? searchOption[HOTEL_SEARCH_FILTER] : filterParams;\n filterBody = searchOption[HOTEL_SEARCH_BODY] ? searchOption[HOTEL_SEARCH_BODY] : filterBody;\n filterAdvance = searchOption[HOTEL_SEARCH_ADVANCE] ? searchOption[HOTEL_SEARCH_ADVANCE] : filterAdvance;\n filterFromCache = searchOption[HOTEL_SEARCH_FROM_CACHE] ? searchOption[HOTEL_SEARCH_FROM_CACHE] : filterFromCache;\n filterParams.hotel_code = selectedDestination.code || \"\";\n _searchFilterChanged();\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 newOption(options) {\n\n options = normalizeOptions(options);\n\n $j.ajax({\n type: \"POST\",\n url: OPTION_ENDPOINT,\n async: false,\n dataType: \"json\",\n data: {},\n success: function(data) {\n if (typeof options.success == 'function') {\n pollOptions.push(data);\n options.success.call(pollID, data);\n }\n },\n error: function(data) {\n if (typeof options.error == 'function') {\n options.error.call(pollID, data);\n }\n }\n\n });\n\n }", "function options(id, options) {\n id = parseInt(id);\n log.info(\"TURTLES - Set options for #\"+ id);\n log.debug(\"TURTLES - Options: \", options);\n if (instances[id] == null){\n log.error(\"TURTLES - Unknown instance: #\" + id);\n return;\n }\n\n var turtle = instances[id];\n\n // update collection options\n if (typeof turtle.collection != 'undefined')\n turtle.collection.options = _.extend(turtle.collection.options, options);\n\n // update view options\n if (typeof turtle.view != 'undefined')\n turtle.view.options = _.extend(turtle.view.options, options);\n\n // trigger reconfigure event\n trigger(id, \"reconfigure\");\n }", "_resetOptions() {\n const changedOrDestroyed = Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(this.options.changes, this._destroy);\n this.optionSelectionChanges.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed)).subscribe(event => {\n this._onSelect(event.source, event.isUserInput);\n if (event.isUserInput && !this.multiple && this._panelOpen) {\n this.close();\n this.focus();\n }\n });\n // Listen to changes in the internal state of the options and react accordingly.\n // Handles cases like the labels of the selected options changing.\n Object(rxjs__WEBPACK_IMPORTED_MODULE_12__[\"merge\"])(...this.options.map(option => option._stateChanges))\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(changedOrDestroyed))\n .subscribe(() => {\n this._changeDetectorRef.markForCheck();\n this.stateChanges.next();\n });\n }", "function upgradeOptions(which, value) {\n const options = {\n url: \"https://console.kamatera.com/service/server/\" + serverID + \"/\" + which,\n method: 'PUT',\n headers: {\n 'content-type': 'application/json',\n 'AuthClientId': process.env.KAMATERA_AUTH_ID,\n 'AuthSecret': process.env.KAMATERA_AUTH_SECRET\n },\n body: JSON.stringify({\n which: value,\n \"index\": 0,\n \"provision\": 1\n })\n }\n\n return options;\n}", "function handleOptions(object, options, incremental) {\n // options = _.extend(object.options || {}, options);\n options = (options || {});\n if (!incremental) {\n object.options = options;\n }\n\n // override properties with options if specified\n _.each(object.optionProperties, function (property) {\n if (options[property]) {\n object[property] = options[property];\n }\n });\n }", "updateFilterEgeOptionsSettings_(options) {\n return options.map(option => {\n option.type = 'number';\n option.maxLength = 3;\n option.isHidden = !this.isEgeResultOptionVisible_(option);\n return option;\n });\n }", "update(options) {\n return __awaiter(this, void 0, void 0, function* () {\n if (options) {\n this.swalOptions = options;\n }\n if (!this.isCurrentlyShown)\n return;\n const swal = yield this.sweetAlert2Loader.swal;\n const allOptions = this.swalOptions;\n const updatableOptions = Object.keys(allOptions)\n .filter((key) => swal.isUpdatableParameter(key))\n .reduce((obj, key) => {\n obj[key] = allOptions[key];\n return obj;\n }, {});\n swal.update(updatableOptions);\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 }", "setOptions(options) {\n this.options = Object.assign({\n labels: ['Vssue'],\n state: 'Vssue',\n prefix: '[Vssue]',\n admins: [],\n perPage: 10,\n proxy: (url) => `https://cors-anywhere.herokuapp.com/${url}`,\n issueContent: ({ url }) => url,\n autoCreateIssue: false,\n }, options);\n // check options\n const requiredOptions = ['api', 'owner', 'repo', 'clientId'];\n for (const opt of requiredOptions) {\n if (!this.options[opt]) {\n console.warn(`[Vssue] the option '${opt}' is required`);\n }\n }\n // set locale\n if (this.options.locale) {\n this.$i18n.locale = this.options.locale;\n }\n else {\n const locales = Object.keys(this.$i18n.messages);\n const navLangs = window.navigator.languages;\n this.$i18n.locale =\n navLangs.filter(item => locales.includes(item)).shift() || 'en';\n }\n }", "function setOptions() {\n vm.optionParams = angular.fromJson(vm.options);\n vm.optionKeys = Object.keys(vm.optionParams);\n\n if(-1 >= optionsInterprete('initIndex', vm.optionKeys) || !isNumberic(vm.optionParams.initIndex)) {\n vm.selectedIndex = 0;\n } else {\n vm.selectedIndex = vm.optionParams.initIndex;\n }\n\n if(-1 >= optionsInterprete('omitLen', vm.optionKeys) || !isNumberic(vm.optionParams.omitLen)) {\n vm.omitLen = 0;\n } else {\n vm.omitLen = vm.optionParams.omitLen;\n }\n\n if(-1 >= optionsInterprete('filter', vm.optionKeys)) {\n vm.filterName = null;\n } else {\n vm.filterName = vm.optionParams.filter;\n }\n\n if (0 >= vm.optionKeys.length || 1 > vm.optionKeys.length) {\n // console.log('dropdown optionParams format not correct.');\n return;\n } else {\n vm.duplexOptionsArray = vm.optionParams['' + vm.optionKeys[0] + ''];\n }\n\n if (!angular.isArray(vm.duplexOptionsArray) || 0 >= vm.duplexOptionsArray.length) {\n vm.duplexOptionsArray.length = 0;\n vm.duplexOptionsArray.push('--');\n }\n\n // selectedIndex check\n if (vm.duplexOptionsArray.length <= vm.selectedIndex) {\n // console.log('duplexSelectPanel initIndex oversize.');\n vm.selectedIndex = 0;\n }\n updateSeletecItem();\n }", "setOptions(options) {\n for (var name in options) {\n if (options.hasOwnProperty(name)) {\n this.setOption(name, options[name])\n }\n }\n return this\n }", "updateEnabledOptions() {\n const config = this.getConfig();\n for (const displayedOption of this.displayedOptions) {\n const enabled = displayedOption.block.updateConfig(displayedOption.option.value, config).isValid();\n displayedOption.input.disabled = !enabled;\n }\n this.configureAcceptButton(config);\n }", "function update() {\n\t\tvar $this = $( this ),\n\t\t\toptions = $this.data( 'options' );\n\t\tif(typeof options === 'undefined' || !options){\n options = {}\n\t\t}\n\t\tif(options && (options.minimumResultsForSearch && (options.minimumResultsForSearch == -1 || options.minimumResultsForSearch == 'Infinity')) || options.multiple){\n options.dropdownCssClass = 'iwj-select-2-wsearch';\n\t\t}\n $this.siblings( '.select2-container' ).remove();\n\t\t$this.show().select2( options );\n\n\t\tiwjmbSelect.bindEvents( $this );\n\t}", "setOptions(options) {\n\n // save for later use\n this.options = Object.assign(DEFAULT_OPTIONS, options);\n\n if(this.options.Binding) {\n SerialPort.Binding = this.options.Binding;\n }\n }", "function setOptions(newOptions) {\n var channel = _addons2.default.getChannel();\n if (!channel) {\n throw new Error('Failed to find addon channel. This may be due to https://github.com/storybooks/storybook/issues/1192.');\n }\n\n var options = newOptions;\n\n // since 'undefined' and 'null' are the valid values we don't want to\n // override the hierarchySeparator if the prop is missing\n if (Object.prototype.hasOwnProperty.call(newOptions, 'hierarchySeparator')) {\n options = (0, _extends3.default)({}, newOptions, {\n hierarchySeparator: regExpStringify(newOptions.hierarchySeparator)\n });\n }\n\n channel.emit(_shared.EVENT_ID, { options: options });\n}", "update(options = {}) {\n const { mouse_x, mouse_y, range, particles } = options;\n if (this.animated) {\n this._updatePosition()\n }\n if (this.interactive) {\n this._addInteractivity(mouse_x, mouse_y, range);\n }\n if (this.gravity) {\n this._addGravity();\n }\n if (this.collision) {\n this._addCollision(mouse_x, mouse_y, range, particles);\n this.draw2();\n return;\n }\n if (this.fp) {\n this._updateParticles(mouse_x, mouse_y, range);\n }\n this.draw();\n }", "function save_options_() {\r\n save_options();\r\n }", "function OnOptions()\n{\n\t// show options \n\tshowOptions = true;\n}", "get options() {\n return this._options;\n }", "get options() {\n return { throttleDelay: this.throttleDelay, passive: this.passive };\n }", "update(opts) {\n const canvasEl = this.getCanvasElementFromOptions(opts);\n\n // Restart if a different canvas is given\n if (this.canvas && canvasEl !== this.canvasEl) {\n this.start(opts);\n return;\n }\n\n this.setGlobalOptions(opts);\n\n if (this.particleManager) {\n this.particleManager.particleOptions = this.getParticleOptions(opts);\n this.particleManager.refresh();\n }\n }", "function ApplyOptions(opt) {\n\tvar opts =renderoptions[opt].parameters;\n\tvar opts = Ext.encode({filtermetadata:{parameters:opts}});\n\topts = opts.replace(/uid/gi,'@uid');\n\topts = opts.replace(/value/gi,'@value');\n\topts = opts.replace(/\"id\"/gi,'\"@id\"');\n\targs = {\n\t\tbackgroundcolor: \"0xFF000000\",\n\t\tformat: \"jpg\",\n\t\tquality: 100,\n\t\tscale: 1,\n\t\tfilepath: originalimage,\n\t\tfilterid: 24,\n\t\tcols: 0,\n\t\trows: 0,\n\t\tcellwidth: 0,\n\t\tcellheight: 0,\n\t\tcalltype: \"filteruse\",\n\t\tfilterid: Ext.getCmp(\"filterselect\").getValue(),\n\t\tmethod: \"render\",\n\t\trenderparameters: opts,\n\t\treturnformat: \"json\"\n\t};\n\tExt.Msg.wait(\"Filter is being applied...\",\"A few more seconds\");\n\tExt.Ajax.request({\n\t\turl:\t\t\"handler_json.cfm\",\n\t\tmethod: \t\"POST\",\n\t\tparams:\t\targs,\n\t\tsuccess: \tfunction(req) {\n\t\t\tRefreshImage(Ext.decode(req.responseText).response.ostrichrenderresponse.url);\n\t\t\tExt.WindowMgr.hideAll();\n\t\t}\n\t});\n}", "function ac_update_options(self, event, kw, src)\n {\n var cols = self.config.cols;\n if(!cols) {\n cols = self.config.schema;\n }\n\n // redefine columns\n var $table = $$(build_name(self, \"list_table\"));\n if($table) {\n $table.config.columns = cols2webix_table_cols(self, cols);\n $table.refreshColumns();\n } else {\n log_error(\"$table not found: \" + build_name(self, \"list_table\"));\n }\n\n // redefine elements\n var eles = cols2webix_form_elements(self, cols, \"create\");\n var $create_form = $$(build_name(self, \"create_form\"));\n if($create_form) {\n $create_form.define(\"elements\", eles[0]);\n $create_form.reconstruct();\n } else {\n log_error(\"$form create not found: \" + build_name(self, \"create_form\"));\n }\n\n var eles = cols2webix_form_elements(self, cols, \"update\");\n var $update_form = $$(build_name(self, \"update_form\"));\n if($update_form) {\n $update_form.define(\"elements\", eles[0]);\n $update_form.reconstruct();\n } else {\n log_error(\"$form update not found: \" + build_name(self, \"update_form\"));\n }\n\n // Hemos destruido esquema y por lo tanto los datos, restáuralos\n self.gobj_send_event(\"EV_UNDO_RECORD\", {}, self);\n\n return 0;\n }", "function updateAvailableCriteriaOptions(){\n\t\n\tupdateAvailableTeamOptions();\n\t\n\tupdateAvailableWeekOptions();\n\t\n\t//updateAvailableWeekOptions.................\n\t//\n\t//main_updateAvailableTeamOptions\n}", "setTestOptions (callback) {\n\t\tthis.teamOptions.creatorIndex = 1;\n\t\tthis.userOptions.numRegistered = 3;\n\t\tthis.repoOptions.creatorIndex = 1;\n\t\tthis.repoOptions.numRepos = 2;\n\t\t/*\n\t\tthis.streamOptions.creatorIndex = 1;\n\t\tif (this.streamType === 'team stream') {\n\t\t\tObject.assign(this.streamOptions, {\n\t\t\t\ttype: 'channel',\n\t\t\t\tisTeamStream: true\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis.streamOptions.type = this.streamType || 'channel';\n\t\t}\n\t\t*/\n\t\tObject.assign(this.postOptions, {\n\t\t\tcreatorIndex: 0,\n\t\t\twantReview: true,\n\t\t\tnumChanges: 2,\n\t\t\twantMarkers: 2\n\t\t});\n\t\tcallback();\n\t}", "update(options) {\n this._checkProjectConfig().\n then(() => this._initDeviceGroup(options)).\n then(() => this._updateDeviceGroup(options)).\n then(() => this._processSourceFiles(options)).\n then(() => this._saveProjectConfig()).\n then(() => this._info()).\n then(info => {\n UserInteractor.printInfo(UserInteractor.MESSAGES.ENTITY_UPDATED, this.entityType);\n UserInteractor.printResultWithStatus(info);\n }).\n catch(error => UserInteractor.processError(error));\n }", "_updateMap() {\n const options = get(this, '_options');\n get(this, 'map').setOptions(options);\n }", "_setFormOptions () {\n this.formOptions = {\n limit: this._get('limit'),\n strict: this._get('strict')\n }\n }", "constructor(options) {\n\t\tthis.options = Object.assign({}, defaultOptions, options)\n\t}", "_handleRequestUpdateClear(options)\n {\n this._updater.clear();\n }", "setOptions() {\r\n this.slickGrid.setOptions(this.slickGridOptions);\r\n this.slickGrid.invalidate();\r\n }", "function _updateTraceOptions(name)\n\t{\n\t\tvar displayerUpdates = _getDisplayerUpdates(name);\t\t//updated by EZtrace.html\n\t\tvar updatedOptions = displayerUpdates.options;\n\t\tif (!updatedOptions) return;\n\n\t\tvar updatedTime = EZ.getTime(updatedOptions.time, 0);\t\n\t\tif (updatedTime > EZ.getTime(EZ.trace.options.time))\n\t\t{\n\t\t\tEZ.trace.options = EZ.merge(EZ.trace.options, updatedOptions)\n\t\t\tEZ.trace.options.time = EZ.formatDate();\n\t\t}\n\t\t//=========================================================================\n\t\tif (updatedTime < EZ.getTime(EZ.trace.options.time))\n\t\t\tEZ.store.set(_getNameKey('options') + '@', EZ.trace.options);\n\t\t//=========================================================================\n\t}", "_optionChanged(...args) {\n const prop = args[0];\n const optionMethodName = `_option${pascalCase(prop)}`;\n\n this.__notify(EV.BEFORE_OPTION_CHANGE, prop);\n\n if (this[optionMethodName]) {\n this[optionMethodName]();\n }\n else {\n this.update(...args);\n }\n\n this.__notify(EV.OPTION_CHANGED, prop);\n }", "_setOptions(options) {\n //Refresh the widget\n let refresh = false, \n //recreate the pieces\n recreatePieces = false, \n //complete recreate the puzzle\n recreate = false;\n for (let option in options) {\n switch (option) {\n case \"namespace\":\n case \"classes\":\n recreate = true;\n break;\n case \"rows\":\n case \"columns\":\n recreatePieces = true;\n break;\n case \"onlyDropOnValid\":\n case \"feedbackOnHover\":\n case \"backgroundInSlots\":\n case \"randomPieceStartPosition\":\n refresh = true;\n break;\n }\n }\n if (recreate) {\n this._destroy();\n //@ts-ignore\n this._super(options);\n this._create();\n }\n else if (recreatePieces) {\n //@ts-ignore\n this._super(options);\n this.pieces = [];\n this.reset(false);\n this._construct();\n }\n else if (refresh) {\n //@ts-ignore\n this._super(options);\n this._applyClassModifiers();\n this.refresh();\n }\n }", "function setOptions(context, options) {\n _(options).each(function(value, option) {\n context[option] = options[option];\n });\n }", "handleOptionChange(target) {\n const updatedState = { svgNeedsUpdating: true, options: this.state.options };\n\n if (target.id === 'color') {\n updatedState.options[target.id] = this.allColorFunctions[parseInt(target.value, 10)];\n } else if (target.id === 'gradient') {\n updatedState.options[target.id] = this.allGradientFunctions[parseInt(target.value, 10)];\n } else if (target.step === 1) updatedState.options[target.id] = parseInt(target.value, 10);\n else updatedState.options[target.id] = parseFloat(target.value);\n\n // Enforce safe width\n if (target.id === 'width' || target.id === 'height') {\n console.log('yes')\n updatedState.options[target.id] = Math.max(updatedState.options[target.id], 256);\n }\n\n // Enforce stroke\n if (!updatedState.options.strokeOnly) updatedState.options.strokeWidth = 1;\n\n this.setState(updatedState);\n }", "get options() { return this.optionsService.options; }" ]
[ "0.77665013", "0.7427309", "0.7236019", "0.716939", "0.7058448", "0.7055208", "0.6913157", "0.6900687", "0.6801161", "0.67821443", "0.67190325", "0.6703122", "0.67009795", "0.6641766", "0.6618978", "0.6543863", "0.65289295", "0.64959806", "0.6463441", "0.64504987", "0.6449319", "0.6447367", "0.6442097", "0.64363", "0.6423679", "0.6423679", "0.6423679", "0.6423679", "0.6409323", "0.6409323", "0.6409323", "0.6409323", "0.6409323", "0.6409323", "0.6409323", "0.63811433", "0.63811433", "0.6358901", "0.6349623", "0.63427913", "0.6341448", "0.6297141", "0.62714493", "0.62714493", "0.62593806", "0.6256244", "0.6255751", "0.62114733", "0.62114733", "0.6207264", "0.6198528", "0.6171036", "0.61695814", "0.6160062", "0.61476517", "0.6144324", "0.6123442", "0.60842437", "0.60808474", "0.607457", "0.6054148", "0.6052183", "0.60365915", "0.60032624", "0.59892577", "0.5972982", "0.59573966", "0.5945442", "0.59454405", "0.59277457", "0.5922869", "0.59151065", "0.5899285", "0.5884405", "0.5884089", "0.5830278", "0.5802603", "0.5789316", "0.57828873", "0.5780956", "0.5775119", "0.576497", "0.57626516", "0.5753882", "0.57535374", "0.57459605", "0.5740814", "0.57387716", "0.57233065", "0.5715918", "0.56984895", "0.5693597", "0.56885624", "0.5680578", "0.5669022", "0.5663051", "0.5662365", "0.5642906", "0.56417716", "0.5639515" ]
0.6032672
63
For documentation, see checkAll below
function checkAll() { // Reset all the other options to original/default position Object.keys($scope.ngModel.checked).forEach(function (type) { $scope.ngModel.checked[type] = false; }); // This setting will make the filters display hidden $scope.ngModel.filtersString = ''; // Do not let checkAll become unchecked when it is the only checked filter if (!$scope.ngModel.checkAll) { $scope.ngModel.checkAll = true; } // Re-filter results $scope.ngModel.filter(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkAll() {\n this.checkEnyo(this.props.example.resultEnyo)\n ? this.setEnyoCheckState('OK')\n : this.setEnyoCheckState('KO');\n this.checkCSS(this.props.example.resultCSS)\n ? this.setCssCheckState('OK')\n : this.setCssCheckState('KO');\n }", "function checkAllHelper(){\n\tcheckAll(selected_furn);\n}", "static allChecks() {\n return [];\n }", "function testAllItemsChecked() {\n ctrl.allItemsChecked = ctrl.itemsCount > 0 && ctrl.checkedItemsCount === ctrl.itemsCount;\n }", "get validateAll () {\n\t\treturn true;\n\t}", "get validateAll () {\n\t\treturn true;\n\t}", "get validateAll () {\n\t\treturn true;\n\t}", "function checkFieldsAll ( $target ) {\n \n }", "function checkAll() {\n\tvar args\t= checkAll.arguments;\n\tif (args.length > 1) {\n\t\tvar formObj\t\t= args[0];\n\t\tvar allBoxObj\t= args[1];\n\t\tvar\tcheckBoxName;\n\t\tvar checkedVal\t= allBoxObj.checked;\n\t\tif (args.length > 2) {\n\t\t\tcheckBoxName = args[2];\n\t\t}\n\t\tfor (var i=0; i<formObj.elements.length; i++) {\n\t\t\tif (formObj.elements[i].type == 'checkbox') {\n\t\t\t\tif (args.length == 2) {\n\t\t\t\t\tformObj.elements[i].checked = checkedVal;\n\t\t\t\t} else if (formObj.elements[i].name == checkBoxName) {\n\t\t\t\t if(!formObj.elements[i].disabled){\n\t\t\t\t\tformObj.elements[i].checked = checkedVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function all() {\n return true;\n }", "function onCheckAll() {\n ctrl.allItemsChecked = !ctrl.allItemsChecked;\n ctrl.checkedItemsCount = ctrl.allItemsChecked ? ctrl.itemsCount : 0;\n\n $rootScope.$broadcast('action-checkbox-all_check-all', {\n checked: ctrl.allItemsChecked,\n checkedCount: ctrl.checkedItemsCount,\n itemsType: !lodash.isEmpty(ctrl.itemsType) ? ctrl.itemsType : null\n });\n\n if (angular.isFunction(ctrl.onCheckChange)) {\n ctrl.onCheckChange({checkedCount: ctrl.checkedItemsCount});\n }\n }", "checkAll() {\n this.toggleCheckedAll(true);\n }", "all (reporter) { return this.every(reporter) }", "function checkAllPrices() {\r\n\tcheckMarketPrices();\r\n\tcheckUpgradesPrices(birds);\r\n\tcheckUpgradesPrices(machines);\r\n}", "function checkAll() {\n jQuery(\"input[type='text']\").each(function() {\n check(this, this.name);\n });\n}", "function check_and_report() {\n \n }", "function checkAllRoles() {\n roleIsDirty = false;\n $('#orgRoleList input').each(function (index, value) {\n if ($(value).prop('checked')) {\n roleIsDirty = true;\n }\n });\n }", "function isAllValid(){\n return (\n BILL_REGEX.test(billInput.value) && \n (NUM_REGEX.test(customPercent.value) || \n document.querySelector('input[name=\"tip-amount\"]:checked')) && \n NUM_REGEX.test(numPeople.value)\n )\n}", "function isAllCBChecked( all_checkboxs )\n{\n if (!$(all_checkboxs+':not(:checked)').length == true) // Is all checked\n {\n return 1;\n } \n else \n {\n return 0;\n }\n}", "function checkAll(program) {\n\n function check(condition, message) {\n if (!condition) {\n if (message) logger.error(message);\n program.help();\n }\n }\n\n // Display help if no arguments passed\n check(program.rawArgs.slice(2).length);\n\n // Check all required args present\n check(\n (program.username && program.wordlist && program.target),\n 'Ensure all required arguments are provided (user, wordlist, url)'\n );\n\n // Don't allow a framework choice and a custom config file\n check(\n !(program.type && program.config),\n 'Selecting a custom config file will overwrite the target framework choice'\n );\n\n // Require either a framework choice or config file\n check(\n (program.type || program.config),\n 'Select either a supported framework or provide a config file'\n );\n}", "function check() {\n\n // decrement number of founded processing datasets\n counter--;\n\n // finished processing of all founded datasets? => perform callback\n if ( counter === 0 && callback) callback( results );\n\n }", "async check(context) {\n for (let check of this.Checks) {\n if (!await check.check(context)) {\n return false;\n }\n }\n return true;\n }", "function checkAll(){\n //verificam daca toate intrebarile au fost completate\n let ok=1;\n for(let i=0;i<=answersScoreArray.length;i++)\n if(answersScoreArray[i]===\"NULL\") {alert('Toate intrebarile sunt obligatorii! Reintoarce-te si completeaza intrebarea '+ (i+1) + \"!\"); ok=0; break}\n if(ok===1) show(score);\n}", "function check() {}", "function verifyAllSelectedCheckBox(count) {\n\t\t\t\n\t\t\tif(count == parseInt($(\"#selectedAllCount\").val())) {\n\t\t\t\t$('#rowSelectAll').prop('checked',true);\n\t\t\t} else {\n\t\t\t\t$('#rowSelectAll').prop('checked',false);\n\t\t\t}\n\t\t}", "function checkedAll()\n\t{\n\t \t var pollchecks = document.getElementsByTagName(\"INPUT\");\n\t\t var _return = false;\t \n\t\t for (var i = 0; i < pollchecks.length; i++)\n\t\t {\t\t\t\n\t\t\tif(pollchecks[i].type == \"checkbox\")\n\t\t\t{\n\t\t\t\t pollchecks[i].checked = true ;\n\t\t\t\t\n\t\t\t}\n\t\t }\n\t\t \n\t}", "function checkAll() {\n allchecked = !allchecked;\n for (i=0; i<ADDRESSES.length; i++) {\n ADDRESSES[i].checked = allchecked;\n }\n displayTbl(ADDRESSES);\n}", "function checkAllBalances() {\n linkgearPOS.checkAllBalances();\n}", "function checkSelectedItems(list) {\n if (list.every(item => item.done === true)) {\n selectedAll = true;\n selectBtn.innerHTML = 'Unselect All';\n } else {\n selectedAll = false;\n selectBtn.innerHTML = 'Select All';\n }\n}", "validateAll () {\n for (let fieldID of Object.keys(this.fields)) {\n this.fields[fieldID].validate()\n }\n }", "eachCheck(elements, checkFunc, expected, isFilterMask = false) {\n const diffs = {};\n if (util_1.isArray(expected) && expected.length !== elements.length) {\n throw new Error(\n // tslint:disable-next-line:prefer-template\n `${this.constructor.name}: ` +\n `Length of expected (${expected.length}) did not match length of list (${elements.length})\\n` +\n `( ${this._selector} )`);\n }\n for (let i = 0; i < elements.length; ++i) {\n const _expected = util_1.isArray(expected) ? expected[i] : expected;\n const element = elements[i];\n if (isFilterMask) {\n if (helpers_1.isNullOrUndefined(expected) || this._includedInFilter(_expected)) {\n if (!checkFunc(element, _expected)) {\n diffs[`[${i + 1}]`] = element.__lastDiff;\n }\n }\n }\n else {\n if (typeof _expected !== 'undefined') {\n if (!checkFunc(element, _expected)) {\n diffs[`[${i + 1}]`] = element.__lastDiff;\n }\n }\n }\n }\n this._lastDiff = {\n tree: diffs,\n };\n return Object.keys(diffs).length === 0;\n }", "validationCheckMethod() {\n const allValid1 = [\n ...this.template.querySelectorAll(\".reqData\")\n ].reduce((validSoFar, inputCmp) => {\n inputCmp.reportValidity();\n return validSoFar && inputCmp.checkValidity();\n }, true);\n return allValid1;\n }", "function checkAll() {\n $j = $('.selectAll input:checked').length;\n if( $j > 0 ) {\n $('input').prop('checked',true);\n } else {\n $('input').prop('checked',false);\n }\n return;\n}", "function checkAll(checkboxname)\n{\n var checkall = $(\"chkAllOkDoUpdate\");\n var rowsNum = beanGrid.getRowsNum(); // Get the total rows of the grid\n\n if( checkall.checked ) {\n\t\tfor(var p = 1 ; p < (rowsNum*1+1) ; p ++) {\n\t\t\tvar cid = checkboxname+p;\n\t\t\tif( ! $(cid).disabled && !$(cid).checked) {\n\t\t\t\t$(cid).checked = true;\n\t\t\t\tupdateHchStatusA(cid); //This function is to update the global variable for hchstatus\n\t\t\t}\n\t\t}\n }\n else {\n\t\tfor(var p = 1 ; p < (rowsNum+1) ; p ++) {\n\t\t\tvar cid = checkboxname+p;\n\t\t\tif( !$(cid).disabled && $(cid).checked) {\n\t\t\t\t$(cid).checked = false;\n\t\t\t\tupdateHchStatusA(cid); //This function is to update the global variable for hchstatus\n\t\t\t}\n\t\t}\n }\n return true;\n}", "function checkAll(target, notSelect){\r\n\t\tvar state = $.data(target, 'datagrid');\r\n\t\tvar opts = state.options;\r\n\t\tvar rows = state.data.rows;\r\n\t\tif (!notSelect && opts.selectOnCheck){\r\n\t\t\tselectAll(target, true);\t// don't check rows again\r\n\t\t}\r\n\t\tvar dc = state.dc;\r\n\t\tvar hck = dc.header1.add(dc.header2).find('input[type=checkbox]');\r\n\t\tvar bck = opts.finder.getTr(target, '', 'allbody').addClass('datagrid-row-checked').find('div.datagrid-cell-check input[type=checkbox]');\r\n\t\thck.add(bck)._propAttr('checked', true);\r\n\t\tif (opts.idField){\r\n\t\t\tfor(var i=0; i<rows.length; i++){\r\n\t\t\t\taddArrayItem(state.checkedRows, opts.idField, rows[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\topts.onCheckAll.call(target, rows);\r\n\t}", "checkCheckers() {\n return this.unusedCheckers.length === 0 ? false : true;\n }", "async checkSubItems() {\n if (this.processingState.canContinue && !this.processingState.isProcessedToConsensus)\n await this.checkSubItemsOf(this.item);\n }", "function AllChecked()\n{\n\tvar checked = true;\n\n\tfor (i in Filters)\n\t{\n\t\tchecked = checked && Filters[i].Column.DownSortCheck().prop('checked');\n\t}\n\n\treturn checked;\n}", "function allCheckboxCheck() {\n // storing of all other categorieCheckboxes\n var allChecked = true;\n var cbs = document.querySelectorAll('input[id^=\"catCheckbox\"]');\n // checking if one of the checkboxes is not checked\n for (var cb of cbs) {\n if (cb.checked === false) {\n allChecked = false;\n break;\n }\n }\n // checks allCategoriesCheckbox if all other checkboxes are checked\n if (allChecked === true) {\n document.getElementById('checkboxAllCategories').checked = true;\n }\n // unchecks allCategoriesCheckbox if one other checkbox is unchecked\n else {\n document.getElementById('checkboxAllCategories').checked = false;\n }\n}", "function checkAll(options, cli, next) {\n\n calipso.lib.step(\n function validateInstall() {\n this();\n },\n function validateInstalledModules() {\n var group = this.group();\n for (var moduleName in calipso.modules) {\n var options = [];\n options.push('install');\n options.push(moduleName);\n options.push(true);\n installModule(options, cli, group());\n }\n },\n function done(err) {\n console.log(\"\");\n if (err) {\n console.log(\"All modules processed, but there were errors,please check output above for status.\".red.bold);\n } else {\n console.log(\"All modules processed with no apparent errors, please check output above to confirm.\".green.bold);\n }\n next(err);\n }\n )\n}", "function checkAll(target, notSelect, state) {\n if (!state) state = $.data(target, 'datagrid');\n var opts = state.options;\n var data = state.data;\n if (!notSelect && opts.selectOnCheck) {\n selectAll(target, true, state);\t// don't check rows again\n }\n var allck = opts.finder.getTr(target, '', 'allbody', undefined, state).add(opts.finder.getTr(target, '', 'editor', undefined, state)).find('div.datagrid-cell-check input:enabled[type=checkbox]');\n $.fn.prop ? allck.prop('checked', true) : allck.attr('checked', true);\n opts.onCheckAll.call(target, data.rows);\n }", "function performCheck (options) {\n checks.forEach(function (check) {\n check(options || {});\n });\n }", "function CheckAll(checkAllBox)\n\t {\n\t\t\tre=new RegExp(':' + aspCheckBoxID + '$')\n\t\t\tfor(i = 0; i < document.forms[0].elements.length; i++) \n\t\t\t{\n\t\t\t\telm = document.forms[0].elements[i];\n\t\t\t\tif (elm.type == 'checkbox') \n\t\t\t\t{\n\t\t\t\t\tif (re.test(elm.name)) \n\t\t\t\t\t{\n\t\t\t\t\t\telm.checked = checkVal\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n }", "get allCheckboxesSelected() {\n return this.checkboxTargets.every(target => target.checked)\n }", "function checkAll(id) {\n if ($(\"[name='chkAll_\" + id + \"']\").not('.deprecated').prop(\"checked\")) {\n $(\"[chk_name='chk_table_\" + id + \"']\").not('.deprecated').prop(\"checked\", true);\n $('[parent_table=\"' + id + '\"]').not('.deprecated').addClass(\"rowSelected\");\n } else {\n $(\"[chk_name='chk_table_\" + id + \"']\").not('.deprecated').prop(\"checked\", false);\n $('[parent_table=\"' + id + '\"]').not('.deprecated').removeClass(\"rowSelected\");\n }\n //to remove loaded text\n $('#num_selected' + id).text(\"\");\n\n //we update the counter label\n checkTableCounter(id);\n}", "checkAllEvent(checkedValue) {\n let updatedDecisionCards = {};\n Object.keys(this.state.decision_cards).forEach((dc, i) => {\n this.updateFinaleOutputWhenCheckboxIsChecked(dc, i, checkedValue);\n updatedDecisionCards[dc] = (checkedValue);\n });\n this.updateDecisionCardsAndCheckedStorageWhenCheckboxIsChecked(updatedDecisionCards)\n }", "function isAllChecked( selector ) \n{\n if (!$( selector+':not(:checked)').length == true) // Is all checked\n {\n return true;\n } else {\n return false;\n }\n}", "function CheckAll() {\n\tvar frm = document.forms[0];\n\tvar len = frm.elements.length;\n\tfor (var i = 0; i < len; i++) {\n\t\tvar e = frm.elements[i];\n\t\tif(e.type=='checkbox') e.checked=true;\n\t}\n}", "function page1ex7() {\n // 1. Write a function allPassed(students) that gets an array of students\n // (name, grade) and returns true if they all passed (grade >= 70)\n\n var gStudents = [\n { name: 'miku', grade: 70 },\n { name: 'muki', grade: 80 },\n { name: 'cc', grade: 70 },\n { name: 'dd', grade: 100 }\n ];\n\n console.log('Did all the students passed?', allPassed(gStudents));\n\n function allPassed(students) {\n return students.every(function(student) {\n return student.grade >= 70;\n });\n }\n}", "function validateAll() {\r\n var result = true;\r\n\r\n if (!validateUsername()) result = false;\r\n if (!validatePassword()) result = false;\r\n if (!validateConfirmPassword()) result = false;\r\n if (!validateEmail()) result = false;\r\n if (!validateConfirmEmail()) result = false;\r\n if (!validatePersonalMessage()) result = false;\r\n\r\n return result;\r\n}", "function CheckAll(name,id )\n\t\t{\n\t\t $(\"#\"+id).click(function()\t\t\t\t\n\t\t\t{\n\t\t\t\tvar checked_status = this.checked;\n\t\t\t\tthis.checked=true;\n\t\t\t\t$(\"input[name='\"+ name +\"']\").each(function()\n\t\t\t\t{\n\t\t\t\t\tthis.checked = false;\n\t\t\t\t});\n\t\t\t});\n\t\t\t\n\t\t\t\t$(\"input[name='\"+ name +\"']\").click(function()\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\tvar checked_status = this.checked;\n\t\t\t\t\tif (checked_status){\n\t\t\t\t\t\t$(\"#\"+id).each(function()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.checked = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}", "handleCheckAllChange() {\n console.log(\"test\");\n if (this.checkedRatings.length !== 6) {\n this.checkedRatings = [\"5\", \"4\", \"3\", \"2\", \"1\", \"All Ratings\"];\n } else this.checkedRatings = [];\n }", "_validateAll() {\n console.log(\"Validating all fields\")\n const { items } = this.props\n const { data } = this.state\n const errors = {}\n const touched = {}\n items.forEach(({ name }) => {\n const fieldErrors = this._validate(name, data)\n Object.assign(errors, fieldErrors)\n touched[name] = true\n })\n this.setState({ errors, touched })\n return errors\n }", "validateInputs() {\n let inps = [].concat(\n this.queryAll(\"lightning-combobox\"),\n this.queryAll(\"lightning-input-field\"),\n );\n return inps.filter(inp => !inp.reportValidity()).length === 0;\n }", "function checkAll() {\n $(\"#move-unallocated-grid input[type='checkbox']\").each(function (index, element) {\n element.setAttribute(\"checked\", \"true\");\n });\n}", "function validateactivity () {\n for (var i = 0; i < checkboxes.length; i++) {\n if (checkboxes[i].checked) {\n return true;\n } \n }\n}", "checkAndRun(){\n var checks=this.checkPointers();\n\n if(checks.passed){\n this.passedRun=true;\n this.update();\n //this doesn't find if there are any fails in the update...\n }else{\n checks.errors.forEach(function(error){console.error (error)})\n this.passedRun=false;\n }\n }", "validateAllDirty () {\n for (let fieldID of Object.keys(this.fields)) {\n let field = this.fields[fieldID]\n\n if (field.dirty) {\n field.validate()\n }\n }\n }", "function resultCheck() {\n var chk1 = check(arr[0], arr[1], arr[2]);\n var chk2 = check(arr[3], arr[4], arr[5]);\n var chk3 = check(arr[6], arr[7], arr[8]);\n var chk4 = check(arr[0], arr[3], arr[6]);\n var chk5 = check(arr[1], arr[4], arr[7]);\n var chk6 = check(arr[2], arr[5], arr[8]);\n var chk7 = check(arr[0], arr[4], arr[8]);\n var chk8 = check(arr[2], arr[4], arr[6]);\n\n if (chk1 || chk2 || chk3 || chk4 || chk5 || chk6 || chk7 || chk8) {\n setTimeout(empty, 500);//1500\n return true;\n }\n return false;\n }", "function isCheckAll() {\n\tvar temp = true;\n\t$(\"input[name=chooses]\").each(function() {\n\t\tif (!this.checked) {\n\t\t\ttemp = false;\n\t\t\treturn temp;\n\t\t}\n\t});\n\treturn temp;\n}", "function all_in() {\n raise('all in');\n}", "static checkIfisAllSelected(list){\n let checked = true;\n list.forEach((value) => {\n if(!value.checked){\n checked = false;\n }\n });\n return checked\n }", "function checkAll(field){\n\tif(field.master.checked== true){\n\t\tfor(var i=0; i < field.length; i++){\n\t\t\tfield[i].checked=true;\n\t\t}\n\t}\n\telse {\n\t\tfor(var i=0; i < field.length; i++){\n\t\t\tfield[i].checked=false;\n\t\t}\n\t}\n}", "static check_all(rows) {\n\n $.each(rows, function(index, value) {\n let elem = value.find(\"th>input\")[0];\n $(elem).prop('checked', true);\n });\n\n return true;\n }", "allTrue() {\n const rules = this.state.formRules;\n for (let rule of rules) {\n if (!rule.valid) return false;\n }\n return true;\n }", "function checkAll() {\n const input = sentence;\n hanspell.spellCheckByDAUM(input, HTTP_TIMEOUT, \n fixTypos, function() {\n hanspell.spellCheckByPNU(input, HTTP_TIMEOUT, \n fixTypos, writeFixedSentence);\n });\n}", "function checkBox () {\n for (i=0; i <= allCheckArray.length-1; i++) {\n if (allCheckArray[i].checked) {\n checkBoxResult = true;\n break;\n } else {\n checkBoxResult = false;\n }\n }\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}", "function checkAll(id){\n toggleAll(id, true);\n}" ]
[ "0.73139626", "0.7157105", "0.71000874", "0.7014745", "0.685499", "0.685499", "0.685499", "0.6822014", "0.6777876", "0.67584294", "0.6613201", "0.6580736", "0.651293", "0.648199", "0.6352774", "0.63065636", "0.62550265", "0.62134784", "0.6195519", "0.6179318", "0.6166899", "0.61407995", "0.61157584", "0.6101762", "0.60951996", "0.6081428", "0.6080633", "0.607435", "0.6038482", "0.6035278", "0.60225844", "0.60222715", "0.59550136", "0.5953732", "0.5948232", "0.59472096", "0.5921056", "0.59109545", "0.59022945", "0.5900857", "0.5900412", "0.5882369", "0.5880729", "0.58773994", "0.58720523", "0.58372366", "0.58325297", "0.5812697", "0.5810861", "0.58028233", "0.5792288", "0.57828176", "0.57774484", "0.5774488", "0.5773177", "0.57578737", "0.5756106", "0.57476574", "0.57461596", "0.5741371", "0.57413137", "0.5735651", "0.57180333", "0.57053137", "0.5694738", "0.5693632", "0.5692075", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365", "0.56870365" ]
0.61127836
23
1) definition of class property 2) definition of class method 3) link method to external function 4) constructor doesnt return object 5) exernal function
function Person(firstName, lastName){ this.firstName=firstName; //1)this.property this.lastName=lastName; this.sayHello = function(){ //2)this.method console.log('Hello '+this.firstName); } this.anotherMethod=externalFunction; //3)this.method=function //4) no return }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function constructor() {\n // Private members\n var privateVar1 = \"Nishant\";\n var privateVar2 = [1,2,3,4,5];\n\n function privateMethod1() {\n // code stuff\n }\n\n function privateMethod1() {\n // code stuff\n }\n\n return {\n attribute1 : \"Nishant\",\n publicMethod: function() {\n //alert(\"Nishant\");// some code logic\n }\n }\n }", "function Class(){}", "function Class(){}", "function Class(){}", "consstructor(){\n \n\n }", "function Class() {}", "function Obj() {}", "function HelperConstructor() {}", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "function _ctor() {\n\t}", "function HidPrivate (age, status){\n\n var abullah = {\n x : 20,\n y : 30\n }\n// 1 number way to get\n this.getAbdulla = function (){\n return abullah\n }\n\n// 2 number way to get\n Object.defineProperty(this, 'getabdullah', {\n get:function(){\n return abullah\n },\n // setter\n set:function (value){\n abullah = value;\n }\n })\n\n var rahim = function (){\n lg( 'I am ' + age +'and ' + status +'marriged')\n }\nthis.age = age;\nthis.status = status;\n\nthis.all = function(){\n\n\n lg( this.age + this.status)\n\n function Naem (){\n lg(age - status)\n }\n\n this.she = function (){\n return Naem()\n \n\n}\nrahim()\n}\n}", "function myClass() {\r\n\tlet p = new Person(\"Anh\", 35);\r\n\tp.sayHi();\r\n}", "function Instance() {\n this.prop = 'value';\n this.someMethod = function () {\n /* ... */\n }\n }", "constructor(getter, setter) {\n this.getter = getter;\n this.setter = setter;\n }", "function IamConstructor(val1, val2) {\n this.prop1 = val1,\n this.prop2 = val2\n\n this.firstFunc = function (val4) {\n return this.prop1 = val4;\n }\n\n this.compare = function (condition) {\n if (condition === \"hello World\") {\n return this.prop4 = \"hey hey world\"\n } else {\n return this.prop4 = \"bye bye world\"\n }\n }\n\n}", "function Ctor() {}", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Class() { }", "function Car() {}", "function SomeConstructor() {\n\n}", "constructur() {}", "function PersonConstructor(name, address, age) {\n\t// empty object\n\t//let personObj = {};\n\n\t//property creation and assignments\n\t// personObj.name = name;\n\t// personObj.address = address;\n\t// personObj.age = age;\n\n\t// new\n\tthis.name = name;\n\tthis.address = address;\n\tthis.age = age;\n\n\tthis.details = getDetails;\n\n\t//using the above created function --> getDetails\n\t// personObj.details = function() {\n\t// \treturn \"My name is \" + personObj.name + \" and I am from \" + personObj.address + \" and I am \" + personObj.age + \" years old.\";\n\t// };\n\n\t// returns the above created object;\n\t//return personObj;\n}", "function powerConstructor(x) {\n let that = {}; // object creates\n let privateVar = \"\"; // private members\n let privateFunc = function () {}; // private members\n that.privilegedPublicMethod = function () {\n // use private secret function variable here ..\n };\n}", "function Class() {\n \n if(!(this instanceof arguments.callee)) {\n //return new arguments.callee(options);\n throw new Error('Please used \"new\" keyword to create object!');\n }\n\n // All construction is actually done in the init method\n if (/* !initializing && */this.init )\n this.init.apply(this, arguments);\n }", "function MiClass2() {\n\n this.property = 2\n this.method = function() {\n //soy un methodo\n\n }\n}", "function Bar() {\n return {\n someProp: \"value\",\n someMethod: function(){ return \"I'm a method\" }\n }\n}", "function Car() { // can pass in make, model, and year, just like in python (without using SELF)\n //this is one way of creating a CLASS\n this.make = \"\" //=make if passing make into the function\n this.model = \"\"\n this.year = \"\"\n}", "consructor() {\n }", "function MyCustom(){\nthis.property1 = \"something\";\n}", "function Car(){}", "function tempCtor() {}", "function IDEObjectType()\r\n{\r\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\r\n}", "function _construct()\n\t\t{;\n\t\t}", "function makeClass() {\n \"use strict\";\n /* Alter code below this line */\n class Thermostat {\n constructor(farenheit){\n this._farenheit = farenheit;\n }\n\n get temperatureInC(){\n // console.log('this._farenheit', this._farenheit);\n // console.log('temperatureInC', 5/9 * (this._farenheit - 32));\n \n return 5/9 * (this._farenheit - 32); \n }\n\n set temperatureInC(celsius){\n console.log('temperatureInC', celsius * 9/5 +32);\n this._farenheit = celsius * 9/5 +32;\n }\n\n get temperatureInF() {\n return this._farenheit;\n }\n\n set temperatureInF(farenheit) {\n this._farenheit = farenheit;\n }\n }\n /* Alter code above this line */\n return Thermostat;\n}", "__previnit(){}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "function IDEObjectType()\n{\n\tassert2(this instanceof arguments.callee, \"Constructor called as a function\");\n}", "constructor(x, y) { // Constructor function to initialize new instances.\n this.x = x; // This keyword is the new object being initialized.\n this.y = y; // Store function arguments as object properties.\n }", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function CommissionedEmployee(name, title) {\n let emp = Employee(name, title);\n emp.setBaseSalary = setBaseSalary;\n emp.setCommissionRate = setCommissionRate;\n emp.setSalesVolume = setSalesVolume;\n emp.getPay = getPay;\n let baseSalary = 0;\n let commissionRate = 0;\n let salesVolume = 0;\n return emp;\n\n/* Define new methods to the CommissionedEmployee class */\n\n function setBaseSalary(dollars) {\n baseSalary = dollars;\n }\n\n function setCommissionRate(rate) {\n commissionRate = rate;\n }\n\n function setSalesVolume(dollars) {\n salesVolume = dollars;\n }\n\n function getPay() {\n return baseSalary + commissionRate * salesVolume;\n }\n\n}", "function MyConstructor(){\n\t\tthis.prop1 = \"Maxsuel\";\n\t\tthis.prop2 = \"Storch\";\n\t}", "function NewObj(){}", "function __Object__() {\n }", "function Car() {\r\n}", "function Car() { }", "static initialize(obj, method, path) { \n obj['method'] = method;\n obj['path'] = path;\n }", "function internalClass() { }", "function ParentClass(){\n this.parent_property1 = \"Hola\";\n this.parentmethod1 =function parentmethod1(arg1){\n return arg1+ \"Parent method 1 return data -- \";\n }\n }", "function BasicObject(){}", "function BasicObject(){}", "__init2() {this.noAnonFunctionType = false}", "function ObjectConstructor() {\n this.name = 'Johnson';\n this.talk = function() {\n console.log(`Hello, my name is ${this.name}.`);\n };\n}", "function IDEObjectType() {\n\tassert2(this instanceof arguments.callee, 'Constructor called as a function')\n}", "function MyObj() {}", "function Obj()\r\n{\r\n return {\r\n name: 'hamza',\r\n lastName : 'mubeen'\r\n }\r\n}", "function ES5Class(){ }", "function Vehicle(name, wheels,passengers,speed) {\n this.name = name;\n this.speed = speed;\n this.wheels = wheels;\n this.passengers = passengers;\n this.makeNoise = function (noise) {\n console.log(noise,noise);\n };\n var self = this;\n var distance_travelled = 0; //privateMethod\n var updateDistanceTravelled = function () {\n distance_travelled += self.speed;\n };//privateMethod\n // Object can access the privateMethod;\n // privateMethod uses self to refer object and access object attribute\n this.move = function (noise) {\n updateDistanceTravelled();\n this.makeNoise(noise);\n return this;\n };\n //use return to chain function \n this.checkMiles = function () {\n console.log(distance_travelled);\n };\n }", "function GeneratorClass () {}", "function objectName(prperty1, property2) {\n let objectName = Object.create(objectName.prototype);\n\n objectName.property1 = \"test\";\n objectName.property2 = \"test2\";\n\n objectName.prototype.doSomething1 = function name(params) {\n console.log(\"do something1\");\n };\n objectName.prototype.doSomething2 = function name(params) {\n console.log(\"do something2\");\n }\n return objectName;\n}", "function PenguinClass() {}", "function PrototypeBasedClass () {\n}", "function Car(model, year, miles){\n this.model = model;\n this.year = year;\n this.miles = miles;\n this.test = function(){\n return \"hello\";\n }\n}", "function constructor(spec){\n // 1. initialize own members from spec\n let {member} = spec;\n\n // 2. composition with other objects\n // you can select only the parts that you want to use\n // you only \"inherit\" the stuff that you need\n let {other} = other_constructor(spec);\n\n // 3. methods\n let method = function(){ // close over other methods, variables and spec };\n\n // 4. Expose public API\n // Note new ES6 that lets you define object properties like this:\n // {method, other}\n // instea of\n // { method : method, other : other}\n return Object.freeze({ // immutable (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)\n method,\n other\n });\n }\n}" ]
[ "0.6355889", "0.6313863", "0.6313863", "0.6313863", "0.6235644", "0.61712515", "0.61492634", "0.6117808", "0.6101189", "0.6101189", "0.6101189", "0.6096892", "0.6078937", "0.605987", "0.60179394", "0.60070187", "0.59815913", "0.59646124", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59252024", "0.59251446", "0.5897768", "0.5886509", "0.58736914", "0.5858504", "0.584773", "0.5841425", "0.5839224", "0.5831397", "0.5831222", "0.5814007", "0.5808552", "0.57935226", "0.57892346", "0.5788177", "0.57864314", "0.57845116", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5782977", "0.5770585", "0.577037", "0.577037", "0.577037", "0.577037", "0.577037", "0.577037", "0.5767062", "0.57608557", "0.57585394", "0.5740985", "0.5734803", "0.5730752", "0.5727236", "0.5719247", "0.5714078", "0.56913304", "0.56913304", "0.5680339", "0.56792325", "0.56742716", "0.5671293", "0.5663133", "0.5655038", "0.56541735", "0.5649186", "0.56450945", "0.56441605", "0.56374496", "0.56328255", "0.5629692" ]
0.67150396
0
5)Not recommended but possible
function externalFunction(){ console.log(this.lastName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "static transient private protected internal function m55() {}", "static private internal function m121() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static transient final private internal function m43() {}", "static final private internal function m106() {}", "static transient final private protected internal function m40() {}", "transient final protected internal function m174() {}", "static transient final protected internal function m47() {}", "static protected internal function m125() {}", "static transient private protected public internal function m54() {}", "static private protected internal function m118() {}", "static transient final protected public internal function m46() {}", "static transient private public function m56() {}", "static private protected public internal function m117() {}", "transient final private protected internal function m167() {}", "transient final private internal function m170() {}", "transient private protected public internal function m181() {}", "static final private protected internal function m103() {}", "static transient private internal function m58() {}", "function StupidBug() {}", "static transient final protected function m44() {}", "static transient final private public function m41() {}", "static final private protected public internal function m102() {}", "transient final private protected public internal function m166() {}", "static transient final private protected public internal function m39() {}", "static final protected internal function m110() {}", "static transient final private protected public function m38() {}", "transient private public function m183() {}", "function _____SHARED_functions_____(){}", "static final private public function m104() {}", "static transient protected internal function m62() {}", "static private public function m119() {}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "static transient final private public internal function m42() {}", "transient final private public function m168() {}", "function miFuncion (){}", "static get INVALID()\n\t{\n\t\treturn 2;\n\t}", "function used(value) { }", "function ea(){}", "function oi(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function fourth() {}", "__previnit(){}", "function o0(o1,o2,o3)\n{\n try {\no4.o5(o39 === true + \" index:\" + o2 + \" Object:\" + o3);\n}catch(e){}\n try {\nreturn true;\n}catch(e){}\n}", "function reserved(){}", "function o0(stdlib,o1,buffer) {\n try {\no8[4294967294];\n}catch(e){}\n function o104(o49, o50, o73) {\n try {\no95(o49, o50, o73, this);\n}catch(e){}\n\n try {\no489.o767++;\n}catch(e){}\n\n try {\nif (o97 === o49) {\n try {\nreturn true;\n}catch(e){}\n }\n}catch(e){}\n\n try {\nreturn false;\n}catch(e){}\n };\n //views\n var o3 =this;\n\n function o4(){\n var o30\n var o6 = o2(1.5);\n try {\no3[1] = o6;\n}catch(e){}\n try {\nreturn +(o3[1])\n}catch(e){}\n }\n try {\nreturn o4;\n}catch(e){}\n}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}", "function i(e,t){0}" ]
[ "0.720994", "0.71367985", "0.6876539", "0.6830809", "0.6814598", "0.67249227", "0.67030543", "0.6684032", "0.66240966", "0.65675277", "0.656446", "0.6525953", "0.64829737", "0.64069176", "0.63816625", "0.6378103", "0.63487446", "0.62759686", "0.6212764", "0.62018466", "0.61985576", "0.6189003", "0.615079", "0.61474186", "0.61212254", "0.60588115", "0.60565615", "0.59879136", "0.59612244", "0.5939054", "0.591769", "0.58763695", "0.58120716", "0.58012944", "0.57911396", "0.56272954", "0.5610254", "0.55349314", "0.55349314", "0.55349314", "0.55329686", "0.5503725", "0.5496835", "0.5428983", "0.5415348", "0.54132485", "0.5408816", "0.5406413", "0.5406413", "0.5406413", "0.5397545", "0.5383861", "0.5365919", "0.53502315", "0.53380734", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914", "0.5324914" ]
0.0
-1
delete restaurants from the db that there are not in YELP
function showNumRestDeleted(results){ $("#restaurants-deleted").html("Congratulations! the database has been updated: " + results + " restaurants deleted.") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static clearRestaurants() {\n self.idb.open(dbName, dbVersion).then(function (db) {\n const tx = db.transaction(JSONStore, \"readwrite\");\n tx.objectStore(JSONStore).delete('restaurants');\n return tx.complete;\n });\n }", "function removeRestaurants(allRestaurants) {\n allRestaurants([]);\n}", "function removeRestaurant(req, res, next) {\n var id = req.params.wl_id;\n Wishlist.findById(id, function(err, wishlist) {\n if (err) res.send(err);\n //pulls restaurant's id which also pulls restaurant\n //from array\n wishlist.restaurants.pull({_id: req.params.rs_id})\n //saves wishlist after removing restaurant from\n //wishlist\n wishlist.save(function(err, wishlist){\n if (err) res.send(err);\n res.json(wishlist);\n });\n });\n}", "deleteById(id) {\n let sqlRequest = \"DELETE FROM restaurants WHERE id=$id\";\n let sqlParams = {\n $id: id\n };\n return this.common.run(sqlRequest, sqlParams);\n }", "deleteRatings() {\n // console.log(\"deleteRatings()\");\n return store.delete('CURRENT_RATINGS');\n }", "static deleteAllFromDB(dbElementName) {\r\n\t\treturn DBHelper.openDB('restaurant-review-DB').then(db => {\r\n\t\t\tconst tx = db.transaction(dbElementName, 'readwrite');\r\n\t\t\ttx.objectStore(dbElementName).clear();\r\n\t\t\treturn tx.complete;\r\n\t\t});\r\n\t}", "function resetRestaurants(restaurants) {\n // Remove all restaurants\n main.restaurants = [];\n const ul = document.getElementById('restaurants-list');\n ul.innerHTML = '';\n\n // Remove all map markers\n main.markers.forEach(m => m.setMap(null));\n main.markers = [];\n main.restaurants = restaurants;\n}", "static unFavoritesRestaurant(id) {\n\t\tthis.updateRestaurantFavoriteStatus(id, 'is_favorite=false');\n\t}", "function deleteAllAnimeFromUserList() {\n db.transaction((tx) => {\n tx.executeSql(\"delete from userlist\", [], () => {\n console.log(\"useDB: Deleted all anime from userlist in database!\");\n });\n });\n dispatch(clearUserData());\n }", "function removeAll() {\n // Check if there are locations on screen\n let locationItems = Array.from(document.querySelectorAll(\".locationItem\"));\n if (locationItems.length > 0) {\n // There are, delete all of them\n fetch(\"http://localhost:3000/location/removeall\", {\n method: \"POST\",\n })\n .then((data) => {\n window.location.replace(\"http://localhost:3000\");\n })\n .catch((err) => {\n console.log(err);\n });\n } else {\n // There are no locations, do nothing\n }\n }", "function removeRestaurantMarkers(restaurant) {\n for (var j = 0; j < markers.length; j++) {\n if (markers[j].place_id === restaurant.getAttribute(\"place_id\")) {\n markers[j].setMap(null);\n }\n }\n}", "deleteAll() {\n\n return new Promise(resolve => {\n\n (async () => {\n\n // Abrir connection\n let request = await this.request(this.connection, this.store);\n\n // Excluir item\n request.openCursor().onsuccess = (event) => {\n\n let current = event.target.result;\n\n if (current) {\n\n let currentValue = current.value;\n\n current.delete(currentValue);\n\n current.continue();\n\n } else {\n resolve();\n }\n\n }\n\n })();\n });\n\n }", "function removeFromplates(itemId) {\n\t$.indexedDB(\"PlateSlateDB\").objectStore(\"plates\")[\"delete\"](itemId).done(\n\t\t\tfunction() {\n\t\t\t\tloadFromDBAfterLoadSelectOptions(\"plates\");\n\t\t\t});\n}", "function removeFavorite(r){\n for(var x = 0; x < favorites.length; x++){\n if(r.name == favorites[x].name){\n //adds a null resturant object if the only favorite is about to removed\n if(favorites.length == 1){\n favorites.push(new restaurantModel.Restaurant(null, null, null));\n }\n favorites.splice(x,1);\n break;\n\n }\n }\n}", "function deleteAllEquipos(req, res){\n\n // El objeto vacio recoge todos los elementos de la colección\n Equipo.remove({},function(err,docs){\n if(!err){\n console.log(` **** Eliminando todos los Equipos ----> ${new moment()}`);\n res.status(200).send({message : 'Equipo borrados correctamente'})\n }else{\n res.status(500).send({error : 'Error al borrar equipos'})\n }\n });\n}", "delete(req, res) {\n Hotel.remove({_id: req.params.id}, function(err, result) {\n if (err) {\n return res.send(err);\n }\n return res.json(results);\n });\n }", "function dropArds(){\n\tvar db = openDatabase ('ManobraMassiva', '1.0', 'Banco local Manobra Massiva', 2 * 1024 * 1024);\n\tdb.transaction (function (tx) {\n\t\t\ttx.executeSql (\"drop table ARDS\");\n\t\t\ttx.executeSql (\"CREATE TABLE IF NOT EXISTS ARDS (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, uf, cidade, armario, shelf, tecnologia)\");\n\t\t});\n}", "async function delet_me(){\n const match = await DButils.execQuery(\n `select match_id from dbo.matches WHERE \n home_team = 1 and out_team = 3 AND league_id = 1 and season_name = '2021-2022'`\n );\n await DButils.execQuery(\n `delete from dbo.matches where match_id = '${match[0].match_id}'`\n );\n}", "function removeAllRegistrosIndexedDb() {\n\n registros = [];\n var request = db.transaction([constDbObject], \"readwrite\")\n .objectStore(constDbObject)\n .clear();\n request.onsuccess = function(event) {\n fillTable(registros);\n drawGraficos(registros);\n };\n\n}", "function del(){\r\nCustomer.deleteMany({dni:\"32111111-A\",dni:\"32111112-B\",dni:\"32111113-C\",dni:\"32111114-D\"}, (err, ret) =>{\r\n\t\r\n\tif(err) {\r\n\t\tconsole.error(err);\r\n\t\t\r\n\t} else {\r\n\t\tconsole.log(\"Los dueños que coinciden con el criterio de busqueda han sido borrados: \", ret);\r\n\t\tconsole.log(\"Todo correcto!!\");\r\n\t\t\r\n\t}\r\n\t\r\n\t\r\n});\r\n\r\n}", "function remove(id){\n return db('trips').where('id',id).del();\n}", "async destroy({view, auth, request, response,params}) {\n // const x = await auth.user.recipe().fetch().rows[params].id\n // console.log(x.rows[0].id)\n const recipeDataBase = await Recipe.findOrFail(params.id)\n await recipeDataBase.delete() \n }", "async deleteNews() {\n const allNews = await News.query().where('user_id', this.id);\n\n if (allNews) {\n allNews.map(news => news.deleteAllRelationship());\n\n await News.query()\n .delete()\n .where('user_id', this.id);\n }\n\n return allNews;\n }", "function clearNotIn(list) {\n app.db.songs.remove({location: { $nin: list }}, {multi: true}, function(err, numRemoved) {\n console.log(numRemoved + ' tracks deleted');\n });\n}", "removeAll(req, res) {\n const userId = req.session.user.id;\n Location.destroy({\n where: { userId },\n })\n .then((response) => {\n // Remove all locations from session\n let newUser = {\n ...req.session.user,\n locations: [],\n };\n req.session.user = newUser;\n res.sendStatus(200);\n })\n .catch((err) => {\n res.send(err);\n });\n }", "function deleteAllItinFlights(req, res, next) {\n var query = `\n DELETE FROM itineraryflight\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n next()\n }\n });\n }\n });\n}", "function removeRestaurantsByType (type) {\n for(var i in sampleData) {\n if(sampleData[i].type == type) {\n markers_arr[i].setMap(null);\n markers_arr[i] = null;\n sampleData[i] = null;\n count--;\n i--;\n }\n }\n sampleData = sampleData.filter(n => n);\n markers_arr = markers_arr.filter(n => n);\n createPieChart();\n updateCountDisplay(count);\n}", "function removeAcceptance(){\n\tunaccepted.forEach(function(toRemove){\n\t\tdatabase.collection('offers').doc(toRemove.id)\n\t\t\t.get().then(scholarship =>{\n\t\t\t\t\tconst updatedOffers = scholarship.data().scholarshipID.splice(toRemove.arrayLocation-1,1);\n\t\t\t\t\tconst updatedDates = scholarship.data().acceptDate.splice(toRemove.arrayLocation-1,1);\n\t\t\t\t\t\n\t\t\t\t\tdatabase.collection('offers').doc(toRemove.id).update({\n\t\t\t\t\t\tacceptDate: updatedDates,\n\t\t\t\t\t\tscholarshipID: updatedOffers\n\t\t\t\t\t});\n\t\t});\n\t});\n\n}", "function deleteL(req, res) {\n const update = [0, req.sanitize('id').escape()];\n const query = connect.con.query('UPDATE sponsor SET active = ? WHERE idSponsor =?',\n update,\n function(err, rows, fields) {\n console.log('query: ', query.sql);\n if(!err) {\n res.status(jsonMessages.db.successDelete.status).send(jsonMessages.db.successDelete);\n } else {\n console.log('err: ', err);\n res.status(jsonMessages.db.dbError.status).send(jsonMessages.db.dbError);\n }\n });\n}", "deleteRecipe(rid) {\n // read recipes delete rid\n let data = JSON.parse(localStorage.getItem(\"recipes\"))\n data = data.filter(info => info.recipe_id !== rid)\n localStorage.setItem(\"recipes\", JSON.stringify(data))\n }", "function queryDb(restaurant_id) {\n}", "function removeAll() {\n stationList = [];\n saveToDatabase();\n }", "static deleteAll() {\n return store.remove('schedules.saved');\n }", "static updateRestaurants() {\r\n return new Promise((resolve,reject) => {\r\n\r\n fetch(DBHelper.DATABASE_URL + '/restaurants')\r\n .then(response => {\r\n response.json()\r\n .then(restaurants => {\r\n DBHelper.openDatabase()\r\n .then(db => {\r\n var tx = db.transaction(\"restaurants\", \"readwrite\");\r\n var store = tx.objectStore(\"restaurants\");\r\n restaurants.forEach(element => {\r\n element.is_favorite = element.is_favorite ? (element.is_favorite.toString() == \"true\" ? true : false) : false;\r\n store.put(element);\r\n });\r\n });\r\n DBHelper.updateReviews();\r\n return resolve(restaurants);\r\n });\r\n });\r\n\r\n })\r\n\r\n }", "_deleteItem () {\n let itemToDelete = favs.filtered('name = $0', name)\n realm.write(() => {\n realm.delete(itemToDelete)\n })\n this.forceUpdate()\n }", "function deleteAllTasks() {\n todoDb.remove({}, { multi: true }, function (error, todo) {\n clearDatabase();\n getTodos();\n });\n}", "async function main() {\n\tconst deletedPlace = await prisma.deleteManyPlaces({\n\t\twhere: {\n\t\t\tpublished: false\n\t\t}\n\t})\n}", "function removeApplication(){\n\tunaccepted.forEach(function(toRemove){\n\t\tdatabase.collection('Scholarship Database').doc(toRemove.scholarshipID)\n\t\t\t.get().then(scholarship =>{\n\t\t\t\t\tconst scholarshipApplicants = scholarship.data().applicants;\n\t\t\t\t\tconst numTaken = scholarship.data().numberTaken;\t\t\t\t\n\t\t\t\t\tconst databaseRef = database.collection('Scholarship Database').doc(toRemove.scholarshipID);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tfor( var applicantNum = 0; applicantNum < scholarshipApplicants.length; applicantNum++)\n\t\t\t\t\t\t{ if ( scholarshipApplicants[applicantNum] == toRemove.id) \n\t\t\t\t\t\t\t{ scholarshipApplicants.splice(applicantNum, 1); applicantNum--; }}\n\t\t\t\t\t\n\t\t\t\t\tdatabaseRef.update({\n\t\t\t\t\t\tapplicants: scholarshipApplicants,\n\t\t\t\t\t\tnumberTaken: numTaken - 1\n\t\t\t\t\t});\t\n\t\t});\n\t});\n}", "function deleteAllItinBus(req, res, next) {\n var query = `\n DELETE FROM itinerarybusiness\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n next()\n }\n });\n }\n });\n}", "deleteFantasmas(){\n this.fantasmas.forEach((fantasma) => {\n this.remove(fantasma);\n });\n }", "function deleteHotel(req, res){\n Hotel.deleteHotel(req.query.id, (err, hotel) => {\n if (err) {\n res.status(500).send({ status: false, message: \"Fallo al eliminar el Hotel\" });\n } else {\n res.status(200).send({ status: true, message: \"Hotel eliminado exitosamente\" });\n }\n });\n}", "static clearAll() {\n localStorage.removeItem('foods');\n }", "deleteComboFood(req,res,next){\n let comboId = req.query.id;\n let query = `delete from combo_food where combo_id = ${comboId}`;\n db.query(query,(err,result,fields)=>{\n if(!err) res.send(result);\n else res.send(err); \n })\n }", "static deleteFoods(foods) {\n foods.forEach(food => {\n fetch(`${this.url}/foods/${food.id}`, {\n method: 'DELETE'\n })\n .then(response => response.json())\n .then(data => {\n Food.delete(data.id);\n AppContainer.renderFoods();\n })\n .catch(err => alert(err))\n })\n \n }", "delete(req, res) {\n //console.log(req);\n let queryVars = req.query;\n Region.destroy({\n where: {\n id: queryVars.id\n }\n })\n .then(function (deletedRecords) {\n res.status(200).json(deletedRecords);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }", "function cleanupTrash() {\n const trash = getTrashList()\n for (const item of trash) {\n delete DB[item.id]\n }\n saveToLocalStorage()\n}", "deleteModalities(modalities){\n for (var i = 0; i < modalities.length; i++) {\n Modalities.remove({_id: modalities[i]});\n }\n }", "function ClearPets(tx)\n {\n tx.executeSql(\"DELETE FROM pets\", [], onSuccess, onError); \n }", "async function removeRide(req, res) {\n if (req.body.id) {\n let ride_id = req.body.id;\n let ride = await Ride.deleteOne({\n _id: ride_id,\n });\n let booking = await Booking.deleteMany({\n ride_id: ride_id\n });\n //need to show rider if some thing bad for better use js in client side\n if (ride && booking) {\n res.json({\n \"status\": \"success\",\n msg: \"Successfully Removed\"\n });\n } else {\n res.json({\n \"status\": \"Failure\",\n msg: \"Sorry Something went wrong!\"\n });\n }\n return;\n }\n res.render(\"error\");\n}", "async deleteFavorite(req, res, next) {\n console.log('delete');\n try {\n const anuncio = req.body;\n const userId = req.param('id');\n await Usuario.updateOne({_id: userId}, {$pull: {favoritos: anuncio._id}});\n const favs = await Usuario.findOne({_id:userId}).populate('favoritos').exec();\n res.json({success: true, favorites: favs});\n }catch (e) {\n console.log('ERROR: ', e);\n next(e);\n }\n }", "deleteFood(food){\n let foods = this.items.foods[food]\n foods.pop();\n if(foods.length < 1){\n delete this.items.foods[food]\n }\n }", "delete_all() {\n Meteor.call('tasks.removeAll');\n }", "function toggleRestaurant(req, res) {\n let user = req.user;\n let done = false;\n let removed = false;\n let match = false;\n\n //find the restaurant\n db.Restaurant.findOne({ restaurantId: req.body.restaurant.restaurantId }, function(err, restaurant) {\n let interval = setInterval(function() {\n if (done) {\n //should only execute if a restaurant exists but it is not linked to the current user\n clearInterval(interval);\n //add to user list\n user.visited.push(restaurant._id);\n //save\n user.save();\n //return restaurant to the frontend\n res.json(restaurant);\n } else if (removed) {\n clearInterval(interval);\n }\n }, 1);\n //if it exists\n if (restaurant) {\n console.log(\"found restaurant\");\n //find all user's restaurants they visited\n db.Restaurant.find({ _id: { $in: user.visited } }, function(err, restaurants) {\n //for each restaurant\n for (var i = 0; i < restaurants.length; i++) {\n console.log(\"loop\");\n // if they match\n if (restaurants[i].restaurantId === restaurant.restaurantId) {\n //remove the current restaurant from the user\n user.visited.splice(i, 1);\n //save\n user.save();\n res.send(\"Removed.\");\n clearInterval(interval);\n match = true;\n }\n if (i === restaurants.length - 1 && !match) {\n console.log(\"COnditional\");\n done = true;\n }\n }\n });\n if (user.visited.length === 0) {\n console.log(\"empty array\");\n done = true;\n }\n } else {\n console.log(\"Making new db entry for restaurant\");\n db.Restaurant.create(req.body.restaurant, function(err, restaurant) {\n user.visited.push(restaurant._id);\n user.save();\n res.json(restaurant);\n });\n }\n });\n // if not linked:link to user.\n //if linked => unlink;\n\n}", "function removerDetalhesExcluidosTable() {\n $scope.detalhesExcluir.forEach(detalhe => {\n $scope.gestaoVendaResultados = $scope.gestaoVendaResultados.filter((element) => element.idDetalhe != detalhe.idDetalhe);\n });\n\n $scope.detalhesExcluir = [];\n }", "delete() { all = all.filter(task => task.id !== this.id) }", "filterNeighborhoods(restaurants) {\r\n const neighborhoods = restaurants.map((v, i) => restaurants[i].neighborhood);\r\n const uniqueNeighborhoods = neighborhoods.filter((v, i) => neighborhoods.indexOf(v) == i);\r\n return uniqueNeighborhoods;\r\n }", "getAllRestaurants() {\n return get(\n this.supportsOffline,\n getRestaurants,\n arrayCacheService(\n async (dbService, storename) => {\n const store = getStore(storename)(dbService);\n return store.getAll();\n },\n RESTAURANTS_STORE\n )\n );\n }", "deleteDiscount(req, res, next) {\n const discount_id = req.query.id;\n db.query(`\n DELETE FROM restaurant_discount_code WHERE id = ${discount_id}`,\n (err, result, fields) => {\n if (!err) res.send({\n data: {\n items: result\n }\n });\n else console.log(err);\n });\n }", "allDelete(){\n\n}", "async function updateMandatarisInRelatedTriples(mandatarisUri) {\n const q = `\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n\n DELETE {\n GRAPH ?g {\n ?s ?p ${sparqlEscapeUri(mandatarisUri)} .\n }\n } INSERT {\n GRAPH ?g {\n ?s ?p ?duplicatedMandataris .\n }\n } WHERE {\n GRAPH ?g {\n ${sparqlEscapeUri(mandatarisUri)} owl:sameAs ?duplicatedMandataris .\n ?s ?p ${sparqlEscapeUri(mandatarisUri)} .\n }\n FILTER (?g NOT IN (${sparqlEscapeUri(GRAVEYARD_GRAPH)}))\n }\n `;\n await updateSudo(q);\n}", "async movieNightRemoveFromList(ctx, movie) {\n let list = ctx.getters.getMovieNightList;\n await list.forEach((m, i) => {\n if(m == movie) {\n list.splice(i, 1);\n }\n });\n await ctx.commit('setMovieNightList', list);\n }", "async function removeRiderById(req, res) {\n if (req.body.id) {\n let rider_id = req.body.id;\n let rider = await Rider.deleteOne({\n _id: rider_id\n });\n //remove ride also\n let ride = await Ride.deleteMany({\n rider_id: rider_id\n });\n if (rider) {\n res.json({\n status: \"success\",\n msg: \"successfully removed\"\n });\n }\n } else {\n res.json({\n status: \"Failure\",\n msg: \"Don't be fool!\"\n })\n }\n}", "function deleteRecipeFromLocalStorage (recip) {\n\n if (localStorage.getItem(\"data\") !=null) {\n allRecipies = JSON.parse(localStorage.getItem(\"data\")); // jeśli są to konwertujemy je i zapisujemy do zmiennej\n console.log(recip)\n // zwroc nowa tablice bez skasowanego elementu\n allRecipies = allRecipies.filter(function(element, index, array) {\n return element.title != recip;\n });\n //reindeksuj\n for (let i=0; i < allRecipies.length; i++) {\n allRecipies[i].id = i+1;\n }\n localStorage.setItem(\"data\", JSON.stringify(allRecipies)); //Zapisujemy do localStorage nowe dane\n }\n }", "async deletePersonalSchedule() {\n const personalSchedules = await PersonalSchedule.query().where(\n 'user_id',\n this.id,\n );\n\n if (personalSchedules) {\n await PersonalSchedule.query()\n .delete()\n .where('user_id', this.id);\n }\n\n return personalSchedules;\n }", "static getRestaurants() {\r\n return new Promise((resolve,reject) => {\r\n\r\n DBHelper.openDatabase().then(db => {\r\n let tx = db.transaction('restaurants');\r\n let store = tx.objectStore('restaurants');\r\n store.getAll().then(restaurants => {\r\n if (restaurants && restaurants.length > 0) {\r\n resolve(restaurants);\r\n } else {\r\n DBHelper.updateRestaurants().then(listFromWeb => {\r\n resolve(listFromWeb);\r\n }).catch(reject);\r\n }\r\n });\r\n }).catch(reject);\r\n });\r\n }", "function deleteRoute(toDeleteRoutes){\n firebase.database().ref('routes').once('value').then((snapshot) => {\n var firebaseList = snapshot.val();\n var firebaseKeys = Object.keys(firebaseList);\n for (var i = 0; i < firebaseKeys.length; i++) {\n if(contains(toDeleteRoutes, firebaseList[firebaseKeys[i]]) >= 0){\n // var ref1 = new Firebase(config.databaseURL + \"/routes/\");\n firebase.database().ref('routes').child(firebaseKeys[i]).remove();\n }\n }\n }).catch((error) => console.log(error));\n}", "function deleteAllTasksFromDatabase () {\n firebase.database().ref('tasks').remove()\n updateCount()\n}", "function deleteFavorite(data) {\n dbPromised.then(function(db) {\n var tx = db.transaction('teams', 'readwrite');\n var store = tx.objectStore('teams');\n store.delete(data);\n return tx.complete;\n }).then(function() {\n console.log(\"team di hapus.\");\n getSavedTeams();\n }).catch(function(err) {\n console.log(err);\n })\n}", "function remove(req,res){\n var params = req.params; //user2id\n var data = {\n listingId: req.body.listingid,\n user: req.body.user\n };\n // Produce the query\n pg.connect(connectionString, (err,client, done) => {\n const query = client.query(\"DELETE FROM ShareGoods.renterrating \"+\n \" WHERE listingId = $1 AND user1id = $2 AND user2id = $3;\",\n [data.listingId,data.user,params.userId]);\n // After all data is returned, close connection and return results\n query.on('end', () => {\n done();\n return res.sendStatus(200);\n });\n });\n\n}", "async deleteMovieNightList(ctx, name) {\n await db.collection(auth.currentUser.uid).where('name', '==', name).get().then(snap => {\n snap.forEach(doc => \n db.collection(auth.currentUser.uid).doc(doc.id).delete()\n );\n })\n ctx.dispatch('fetchMovieNightLists');\n }", "async deleteNewsLike() {\n const newsLike = await NewsLike.query().where('user_id', this.id);\n\n if (newsLike)\n await NewsLike.query()\n .delete()\n .where('user_id', this.id);\n return newsLike;\n }", "deleteMentor(mentorName) {\n let deletedMentor = mentors.filter(mentor => {\n return mentor.name !== mentorName;\n });\n console.log(deletedMentor);\n }", "async deletar(req, res) {\n await db(\"resposta\")\n .where({ idresposta: req.params.idresposta })\n .del()\n .then(() => res.status(200).send({ Status: \"OK\" }))\n .catch(() => res.status(400).send({ status: \"ERRO\" }));\n }", "function database_delete_all() {\n\tlocalStorage.clear();\n\treturn true;\n}", "async function remove(req, res){\n try{\n const review = Review.findById(req.params.id).\n populate('guest').\n populate('property').\n exec(function (err, review) {\n if (err) return handleError(err);\n\n //remove review from guest reservations array\n // User.findById(reservation.guest.id).then(guest => {\n // guest.reservations.pull(req.params.id);\n // guest.save();\n // })\n \n //remove reservation from property reviews array\n Property.findById(review.property.id).then(property => {\n property.reviews.pull(req.params.id);\n property.save();\n });\n });\n\n //remove reservation\n await Review.findByIdAndRemove(req.params.id);\n\n res.status(200).json({success: true, data: review })\n\n }\n catch(err) {\n res.status(400).json({success: false, message:err.message})\n }\n}", "static saveToDB(restaurants){\r\n const dbPromise = DBHelper.openDB();\r\n dbPromise.then(db => {\r\n if(!db) return ;\r\n const transaction = db.transaction(\"restaurantList\", \"readwrite\");\r\n const store = transaction.objectStore(\"restaurantList\");\r\n restaurants.forEach(restaurant => {\r\n store.put(restaurant);\r\n });\r\n return transaction.complete;\r\n });\r\n }", "static DeleteAll() {}", "function removerTodasBalas(){\n\tbalas.forEach(removeBala);\n}", "fetchRestaurants() {\n return this._updateFromService()\n .then(() => this.db)\n .then(db => {\n const store = this._getStore(db, 'restaurants', false);\n const request = store.openCursor();\n return this._cursorToArray(request);\n });\n }", "async clear() {\n const tables = [\n 'authorities', 'counterUser', 'counters', 'shops', 'areas', 'products', 'customers', 'shopUser',\n 'cashiers', 'bills', 'eventsList', 'cashierSalesInfo', 'customerSalesInfo', 'productSalesInfo', 'eventTAT',\n ];\n\n tables.map(async table => {\n const str = `delete from ${table}`;\n\n await this.app.db.query(str);\n });\n\n this.ctx.body = this.service.util.generateResponse(200, 'clear database successed');\n }", "function deleteIdeaFromDB(res, body) {\r\n fs.readFile(path.join(rootPath, 'database', body.user + '.json'), function (err, data) {\r\n if (err) {\r\n console.error(err);\r\n res.writeHead(404, { 'Content-Type': 'text/html' });\r\n } else {\r\n let ideas = JSON.parse(data);\r\n let ID = body.id;\r\n delete ideas[\"\" + ID];\r\n\r\n fs.writeFile(path.join(rootPath, 'database', body.user + '.json'), JSON.stringify(ideas), (err) => {\r\n if (err) {\r\n console.error(err);\r\n res.writeHead(404, { 'Content-Type': 'text/html' });\r\n res.write(\"1\");\r\n return;\r\n } else {\r\n res.writeHead(200, { 'Content-Type': 'text/html' });\r\n res.write(\"0\");\r\n }\r\n res.end();\r\n });\r\n }\r\n });\r\n}", "function deleteAllProvider(req,res){\n providers.deleteMany({firstName: req.params.firstName}, (err) =>{\n if(!err) {\n res.send(\"Users with that name are deleted\");\n } \n });\n}", "deleteAllTasks () {\r\n this.eliminatedTask.splice(0, this.eliminatedTask.length);\r\n }", "async function deleteReview() {\n setLoading(true);\n // const token = state.token || window.sessionStorage.getItem(\"userToken\");\n try {\n await axios({\n method: \"DELETE\",\n url: `/api/restuarants/replies`,\n data: {\n reviewId,\n restuarantId,\n uid: state?.uid,\n },\n headers: { Authorization: `Bearer ${state?.accessToken}` },\n });\n\n toast({\n title: \"Review Deleted.\",\n description: \"successfully Delete Restaurant\",\n status: \"success\",\n duration: 1000,\n isClosable: true,\n onCloseComplete: () => {\n onClose();\n },\n });\n setLoading(false);\n } catch (error) {\n toast({\n title: \"Failed to Delete\",\n description: \"Sorry something went wrong, please try again\",\n status: \"error\",\n duration: 1500,\n isClosable: true,\n onCloseComplete: () => {\n onClose();\n },\n });\n setLoading(false);\n }\n }", "function eliminarEstudiante() {\n //funcion al botton \n\n $(\".eliminar\").click(function() {\n\n var cedula_estudiante = $(this).attr(\"id\");\n\n var estudiantes = JSON.parse(localStorage.getItem('estudiantes'));\n\n for (var i = 0; i < estudiantes.length; i++) {\n\n if (estudiantes[i] != undefined) {\n\n if (estudiantes[i].cedula == cedula_estudiante) {\n\n delete estudiantes[i];\n\n }\n }\n\n };\n\n localStorage.setItem('estudiantes', JSON.stringify(estudiantes));\n // alert\n alert('Estudiante eliminada');\n // refrescar\n location.reload(true);\n\n\n });\n}", "async function cleanup(db, option) {\n const emptyRates = [0, 0, 0, 0, 0];\n // 1. remove all comments\n option.collection = option.commentCol;\n option.criteria = {};\n option.type = \"deleteMany\";\n let result = await dbUtil(db, option);\n log.info(\"Clean up all comments!\");\n\n // 2. remove all tucao\n option.collection = option.tucaoCol;\n option.type = \"deleteMany\";\n result = await dbUtil(db, option);\n log.info(\"Clean up all tucao!\");\n\n // 3. clean all the tucao in city table\n option.collection = option.cityCol;\n option.type = \"updateMany\";\n option.update = {\n $set: {\n tucao: emptyRates,\n funTucao: emptyRates,\n eatTucao: emptyRates,\n lodgeTucao: emptyRates,\n travelTucao: emptyRates,\n shoppingTucao: emptyRates,\n otherTucao: emptyRates\n }\n };\n result = await dbUtil(db, option);\n log.info(\"Clean up all cities!\");\n\n // 4. clean all the tucao in resort table\n option.collection = option.resortCol;\n option.type = \"updateMany\";\n option.update = {\n $set: {\n tucao: emptyRates,\n funTucao: emptyRates,\n eatTucao: emptyRates,\n lodgeTucao: emptyRates,\n travelTucao: emptyRates,\n shoppingTucao: emptyRates,\n otherTucao: emptyRates\n }\n };\n result = await dbUtil(db, option);\n log.info(\"Clean up all resorts!\");\n\n // 5. clean all the tucao in user table\n option.collection = option.userCol;\n option.type = \"updateMany\";\n option.update = {\n $set: {\n tucaoNum: 0, tucao: [], userLevel: {\n \"level\": 0,\n \"name\": \"布衣\",\n \"medal\": \"灰铅\"\n }\n }\n };\n result = await dbUtil(db, option);\n log.info(\"Clean up all resorts!\");\n return result;\n}", "putRestaurants(restaurants, forceUpdate = false) {\n if (!restaurants.push) restaurants = [restaurants];\n return this.db.then(db => {\n const store = db.transaction('restaurants', 'readwrite').objectStore('restaurants');\n Promise.all(restaurants.map(networkRestaurant => {\n return store.get(networkRestaurant.id).then(idbRestaurant => {\n if (forceUpdate) return store.put(networkRestaurant);\n if (!idbRestaurant || new Date(networkRestaurant.updatedAt) > new Date(idbRestaurant.updatedAt)) {\n return store.put(networkRestaurant);\n }\n });\n })).then(function () {\n return store.complete;\n });\n });\n }", "function deleteItinerary(req, res) {\n deleteAllItinFlights(req, res, function () {\n deleteAllItinBus(req, res, function () {\n var query = `\n DELETE FROM itinerary\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n res.json(result)\n }\n });\n }\n });\n }) \n }) \n}", "function removeItem(restaurant, item) {\n let restaurant = findRestaurant(restaurant)\n let index = restaurant.items.indexOf(item)\n restaurant.items.splice(index, 1)\n return restaurant\n}", "async function deleteall(type){\n try{\n await type.deleteMany({});\n console.log('deletion done...')\n }\n catch(err)\n {\n console.log('deleting failed..')\n }\n}", "static updateFavoriteDb(restaurant) {\n let favoriteQuery = `${RESTAURANTS_URL}${restaurant.id}/?is_favorite=${restaurant.is_favorite}`;\n console.log(`favoriteQuery = ${favoriteQuery}`);\n fetch(favoriteQuery, {\n method: 'PUT'\n }).then(response => {\n return response.json();\n })\n .then(response => {\n let dbPromise = DBHelper.openDB();\n dbPromise.then(db => {\n if(!db) { return }\n let tx = db.transaction('offline-queue-favorite', 'readwrite');\n const store = tx.objectStore('offline-queue-favorite');\n store.delete(restaurant.id);\n return response;\n })\n })\n .catch(error => console.error('Error:', error))\n }", "purgeStale() {\n let deleted = false;\n for (const i of this.#rindexes({ allowStale: true })) {\n if (this.#isStale(i)) {\n this.delete(this.#keyList[i]);\n deleted = true;\n }\n }\n return deleted;\n }", "deleteParkingLot() {\n defaultLot = new ParkingLot();\n this.db.deleteParkingLot({parkingSpots: defaultLot.parkingSpots});\n }", "static storeRestaurants(idbPromise, restaurants) {\n idbPromise.then(db => {\n if (!db) return;\n \n let store = db.transaction('restaurant', 'readwrite')\n .objectStore('restaurant');\n restaurants.forEach(restaurant => {\n store.put(restaurant);\n });\n });\n }", "function deleteAll() {\n dispatch({\n type: TodosActionTypes.DELETE_ALL\n });\n }", "removeTrip (trip) {\n const i = this.allMyTrips.indexOf(trip)\n this.allMyTrips.splice(i, 1)\n }", "function imprimir(item, indice) {\n for (var i = 0; i < likes.length; i++) {\n if (item.id == likes[i]) {\n delete dataTrainers[indice];\n }\n }\n }", "static deleteReviewsFromIndexedDB(reviews) {\n\t\treturn dbPromise.then(function (db) {\n\t\t\tif (reviews) {\n\t\t\t\tconst tx = db.transaction('reviews', 'readwrite');\n\t\t\t\tconst reviewsStore = tx.objectStore('reviews');\n\t\t\t\tif (reviews instanceof Array) {\n\t\t\t\t\treviews.forEach(function (review) {\n\t\t\t\t\t\treviewsStore.delete(review);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treviewsStore.delete(reviews);\n\t\t\t\t}\n\t\t\t\treturn tx.complete;\n\t\t\t}\n\t\t}).then(function () {\n\t\t\treturn reviews;\n\t\t});\n\t}", "function eliminarFavoritos() {\n let favoritoId = $(this).attr(\"myAttr2\");\n let usuariosFavsLocalStorage = window.localStorage.getItem(\"AppProductosFavoritos\");\n let usuariosFavsJSON = JSON.parse(usuariosFavsLocalStorage);\n if (usuariosFavsJSON && usuariosFavsJSON.length > 0) {\n for (let i = 0; i < usuariosFavsJSON.length; i++) {\n let unFavJson = usuariosFavsJSON[i];\n if (unFavJson.usuario === usuarioLogueado.email) {\n let losFavoritos = unFavJson.favoritos;\n for (let j = 0; j < losFavoritos.length; j++) {\n let unFavorito = losFavoritos[j];\n if (unFavorito.elProducto._id == favoritoId) {\n losFavoritos.splice(j, 1);\n window.localStorage.setItem(\"AppProductosFavoritos\", JSON.stringify(usuariosFavsJSON));\n ons.notification.alert(\"Favorito Eliminado\", { title: 'Favoritos' });\n }\n }\n }\n }\n }\n crearListadoFavoritos();\n}", "function eliminarCarrito() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n let posicion = carrito.findIndex(producto => producto.id == this.id);\r\n carrito.splice(posicion, 1);\r\n seleccionado.cantidad=0;\r\n interfazCarrito(carrito);\r\n\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "deleteAvailability(availability){\n this.setState({\n loading: true\n }, () => {\n API.deleteAvailability(availability.id, this.state.dailyOpen, this.props.userStore.token, this.props.userStore.tokenType)\n .then(response => {\n if(response.status == 200){\n if(this.state.dailyOpen){\n const dailyItems = this.state.dailyItems;\n for(let i = dailyItems.length - 1; i >= 0; i--){\n if(dailyItems[i].id === availability.id){\n dailyItems.splice(i,1);\n }\n }\n this.setState({\n dailyItems: dailyItems,\n loading: false\n })\n } else {\n this.fetchAvailabilities();\n }\n } else {\n Alert.alert(\n 'Erreur',\n \"Votre horaire n'a pas pu être supprimé. Veuillez recommencer\"\n )\n }\n }).catch((error) => {\n console.log(error);\n Alert.alert(\n \"Erreur\",\n \"Erreur inconnue | \" + JSON.stringify(error)\n )\n })\n })\n }" ]
[ "0.7799481", "0.7284794", "0.6301324", "0.62953794", "0.6201827", "0.6109633", "0.6054848", "0.6042456", "0.6013336", "0.600633", "0.5987839", "0.5960524", "0.5944601", "0.5902572", "0.58777505", "0.5820541", "0.57928795", "0.5774862", "0.57592136", "0.5756183", "0.5738729", "0.57161605", "0.57129", "0.5683297", "0.56811076", "0.5675995", "0.56717825", "0.56569", "0.5615327", "0.5598802", "0.55939233", "0.55756694", "0.5573653", "0.55671555", "0.5529851", "0.55229026", "0.55217314", "0.550558", "0.55012", "0.5492012", "0.5486373", "0.5486069", "0.5476478", "0.54746443", "0.54641664", "0.5459911", "0.54524773", "0.545218", "0.5445848", "0.54417664", "0.5431677", "0.5417245", "0.54142463", "0.5407275", "0.540662", "0.54064727", "0.53981644", "0.5392616", "0.53906405", "0.53844786", "0.5376512", "0.53746194", "0.5362717", "0.5358133", "0.5355386", "0.53477573", "0.5346599", "0.53409004", "0.53364116", "0.5335862", "0.5334647", "0.5329009", "0.53264064", "0.53237003", "0.53217274", "0.5319757", "0.5298538", "0.529583", "0.5295365", "0.5292108", "0.52878666", "0.5284228", "0.5281728", "0.52809644", "0.5280162", "0.52790254", "0.5275179", "0.5272889", "0.5272596", "0.52710706", "0.52703214", "0.52700895", "0.5269954", "0.5264757", "0.5261356", "0.52563715", "0.52550924", "0.5254549", "0.52528846", "0.5252179", "0.52492565" ]
0.0
-1
un pur component n'a pas de state mais d props
render() { return <h1>{this.props.content}</h1> }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() { \n return ( \n <div>\n<h1>Componente de tipo Clase</h1>\n\n{/* Accedemos al estado \"texto\" del objeto state */}\n<h2 style={{color:this.props.colorText}}>{this.state.texto}</h2>\n<h3>Hola, {this.props.name}</h3>\n<ExampleProps nombre={this.props.name}/>\n</div>\n );\n }", "constructor(props) {\n super(props);\n\n // El ESTADO Es un valor de cualquier tipo que puede tener un valor por defecto y se puede actualizar cuantas veces lo requiramos\n // En el objeto state podemos definir varios estados a la vez\n this.state = { \n texto: 'Hola desde el componente CLASE', //Estado por defecto\n edad:0 //Estado por defecto\n }\n }", "constructor(props){\n super(props);\n \n this.state = {\n\n }\n\n }", "constructor(props){\n super(props)\n this.state={\n show:false,\n vall:null,\n }\n }", "constructor(){\n super()\n this.state = { contador: 1 } // estado inicial del componente es 1 \n }", "constructor(props) {\n\t\t super(props)\n\t\t this.state = {\n\t\t\t nom: \"test3\",\n\t\t }\n\t }", "constructor(props) {\n super(props);\n this.props = props;\n this.state = {\n visible: false\n };\n }", "constructor(props) { //Genero al constructor para inicializar propiedas y variables\n super(props); //Declaramos super para adaptar las propiedades en React\n this.state = { //Declaramos los estados de las propiedades\n prop1: 0,\n prop2: 0,\n prop3: 0\n }; \n }", "constructor(props) {\n super(props);\n this.state = {\n modal_cadastro: false,\n nome_cadastrar_produto: \"\",\n unidade_medida: \"Kg\",\n quantidade: \"\",\n preco_unitario: \"\",\n categoria: \"1\",\n validade: \"\",\n fornecedor: \"Nenhum\",\n produtos: \"\",\n input_preco_color: \"grey\",\n input_nome_color: \"grey\"\n }\n }", "constructor(props) {\n //Este es el contructor de nuestro componente base es decir de \"Component\"\n super(props);\n const { city } = props;\n //El this.state es el estado local del componente, es nuestro estado parcil del componente y ayuda a que el componenre se renderise \n this.state = {\n city,\n data: null,\n }\n }", "constructor(props){\n super(props);\n\n this.state = { package: \"\" };\n }", "constructor(props) {\n super(props);\n this.state = {\n description: \"\",\n debtorId: undefined,\n amount: 0\n };\n this.used = false;\n }", "constructor(props) {\n super(props);\n this.state = ({\n \n })\n }", "constructor(props) {\n //Call the constrictor of Super class i.e The Component\n super(props);\n //maintain the state required for this component\n this.state = {}\n }", "constructor(props) {\n super(props);\n \n this.state= {\n cardLogo : '',\n pairName : '',\n pairPrice : '',\n small_txt : ''\n }\n if(props.title) this.state={\n title : props.title,\n cardLogo : props.cardLogo,\n pairName : props.pairName,\n pairPrice : props.pairPrice\n }\n }", "constructor(props) {\n //Call the constrictor of Super class i.e The Component\n super(props);\n //maintain the state required for this component\n this.state = {};\n }", "constructor(props) {\n //Call the constrictor of Super class i.e The Component\n super(props);\n //maintain the state required for this component\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {\n\n }\n }", "constructor(props) {\n super(props);\n this.state = {\n header: \"Tugas Mod 3\",\n isi: \"Tugas kel 9\"\n }\n }", "constructor(props) {\n super(props);\n \n this.state = {\n };\n }", "constructor(props) {\n super(props);\n \n this.state = {\n };\n }", "constructor(props) {\n super(props);\n \n this.state = {\n };\n }", "constructor(props) {\n super(props);\n \n this.state = {\n src:'',\n author:'',\n GoToCreate_visible: false, \n Remind_visible: false\n \n };\n }", "constructor(props) {\n super(props)\n this.state = {\n }\n }", "constructor(props){\n super(props);\n this.state= {\n };\n }", "constructor(props) {\n //Super permet d'appeler et/ou acceder a des fonctions definie dans l'objet parent\n super(props);\n //Etat = données initial de l'application\n this.state = {\n items:[],\n text: ''\n }\n\n }", "constructor(props){\n // super chiama il costruttore della classe che estende (Component)\n super(props);\n // Inizializzo term ad una stringa vuota\n this.state = { term: ''};\n console.log('Ho inizializzato lo STATE:', this.state);\n }", "constructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t}\n\t}", "constructor(props){\n super(props);\n this.state ={\n datas:props.data\n }\n }", "constructor(props){\n super(props);\n this.state = {}\n }", "constructor(props) {\n super(props);\n this.state = {\n };\n }", "constructor(props) {\n super(props);\n this.state = {\n };\n }", "constructor(props) {\n super(props);\n this.state = {\n };\n }", "constructor(props) {\n super(props);\n this.state = {\n image: \"\",\n name: \"\",\n slug: \"\",\n price: 0,\n }\n }", "constructor(props) {\n super(props);\n this.state = {\n show: false,\n\n }\n }", "constructor(props){\n super(props)\n this.state = {\n show: false\n }\n }", "constructor(props){\n super(props);\n this.state = {\n name: '',\n style: '',\n brewery: '',\n abv: '',\n description: '',\n }\n }", "constructor(props) {\n super(props);\n this.state = {\n visible: false\n };\n }", "constructor(props){\n super(props);\n this.state={\n visible: false\n }\n }", "constructor(props) {\n super(props);\n\n this.state = {\n\n };\n }", "render() {\n return <ComposedComponent {...this.props}/>\n }", "constructor(props){\n super(props);\n this.state ={\n sTitle : '',\n sImg : '' ,\n sDesc : '',\n showModel : false\n };\n }", "constructor(props){\n super(props);\n this.state= {\n quatity:\"\",\n title: \"Products quantity in Database\"\n }\n }", "constructor (props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\t}", "renderNotConnected() {\n return <Component {...this.props} />;\n }", "constructor(props){\n\n super(props);\n this.state = {\n nome: 'Daniel Tokarski',\n contador: 0\n };\n this.aumentar = this.aumentar.bind(this); /*Para que a Funcao seja reconhecida pelo construtor caso contrario nao reconhece*/\n this.diminuir = this.diminuir.bind(this);\n }", "constructor(props){\n super(props)\n this.state={\n image: `${emptyImagen}`\n }\n }", "constructor(props) {\n //counter uses a class named react componenent which takes care of loading of props. if you create own constrcutor, say 'handle the props so I don't have to do it'\n super(props);\n\n this.state = {\n bgColor: 'peru',\n value: this.props.value\n };\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props)\n this.state = {}\n }", "constructor(props) {\n super(props)\n this.state = {}\n }", "componentWillReceiveProps(newProps) { //chay khi Props component thay doi truoc khi render\n // newProps dong vai tro la this.props sau khi lay du lieu tu redux ve\n // Dung du lieu do set lai state dong bo hoa du lieu giua props va state\n this.setState(newProps.sinhVienSua)\n\n }", "render() {\n return <ComposedComponent {...this.props} />\n }", "constructor(props) {\n super(props);\n this.state = {}\n }", "constructor(props){\n super(props);\n this.state={\n judul:\"Makanan Khas Indonesia\",\n daftar:\"Daftar Makanan Nusantara\",\n datali: this.props.datalist + \"diindonesia\",\n pesan: \"Not..\"\n };\n // this.handlemassge=this.handlemassge.bind(this); //ini digunkan untuk properties langsung ke dalam method\n}", "constructor(props){\n super()\n // Penggunaan state di Class Component\n // Untuk meng-update state, bisa kita gunakan this.setState()\n }", "constructor(props) {\n super(props);\n this.state = {\n title: \"\",\n description: \"\",\n author: \"\",\n authoiId: \"\"\n };\n }", "constructor(props) {\n super(props);\n this.state= {\n hasWheel: props.hasWheel\n };\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "constructor(props) {\n super(props);\n this.state = {};\n }", "render (){ //3) El render siempre debe ir a menos que sea un stateless component\r\n return (\r\n <div> \r\n <h2>Listado de Productos</h2> \r\n {Object.keys(this.props.productos).map(key => (\r\n //console.log(key)\r\n <Producto \r\n key={key}\r\n producto={this.props.productos[key]}\r\n /> \r\n ))}\r\n </div>\r\n )\r\n }", "constructor(props) { //Para acceder a las propiedades del componente\n super(props); \n this.state = { liked: false };\n }", "constructor(props) {\n super(props);\n\n this.state = {\n props: props,\n modal: {\n isOpen: false\n }\n };\n }", "constructor(props) {\n super(props);\n this.state = { };\n }", "constructor(props) {\n \tsuper(props);\n\n \tthis.state = { term: '' }; //only class based components have state (not functional components)\n }", "constructor(props) {\n super(props)\n //this.state = propriedade herdada de Compponent, nao pode ser alterada diretamente\n //No react, nao podemos alterar propriedades diretamente, apenas evolui-la\n //predominacao de programacao funcional\n this.state = { value: props.initialValue }\n }", "constructor(props) {\n super(props);\n this.state = {\n error: null,\n isLoaded: false,\n products: []\n };\n }", "constructor(props){\n super(props);\n this.state = {\n loading: false, //sets all necessary attributes, mostly empty to be filled later\n edit: false,\n title: '',\n src: '',\n message: '',\n last: '',\n next: ''\n }\n }", "constructor(props){\n super(props);\n const { city } = props;\n // this.state, es el estado local del colmponente, ayuda a q el componente se renderice\n this.state = {\n city,\n data: null\n }\n console.log('constructor');\n }", "constructor(props) {\n super(props);\n this.state = { ...props };\n }", "constructor(props) {\n super(props);\n this.state= {flag:0};\n }", "constructor(props) {\n super(props)\n \n this.state = {\n someThing:\"ssss\"\n }\n }", "constructor(props){\n super(props); // Passing the props parameter to the constructor\n \n //Setting up the initial state of the component by this.state object because states are immutable .\n this.state = {\n name:\"Rachit\",\n age:28,\n date : new Date()\n };\n }", "constructor(props) {\n super(props);\n\n this.state = ({\n userPermissionModel: \"\",\n userPermissionunmodifiedModel: \"\",\n componentJustMounted: true,\n filterValue: {\n code: \"\",\n description: \"\"\n }\n });\n\n }", "constructor(...args){\n super(...args)\n this.shouldComponentUpdate=PureRenderMixin.shouldComponentUpdate\n this.state={\n userName:''\n }\n }", "constructor(...args){\n super(...args)\n this.shouldComponentUpdate=PureRenderMixin.shouldComponentUpdate\n this.state={\n userName:''\n }\n }", "static getDerivedStateFromProps(props, state) {\n if (props.comp && props.comp.length && !state.dataFilled) {\n return {\n pickedChampions: props.comp,\n dataFilled: true\n };\n }\n }", "constructor(props) {\n super(props)\n\n this.state = {\n name: 'Shagufta-Parent Component'\n }\n }", "constructor(props) {\n super(props);\n // defining the lcoal state\n this.state = {\n result: \"\",\n disres: \"\"\n };\n }", "constructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tcount: 0,\n\t\t\tvalue1: 1,\n\t\t\tvalue2: 1,\n\t\t\tproduct: 1\n\t\t};\n\t}", "constructor(props) {\n super(props);\n this.state = {\n error: false,\n products: [], //all products in the DB\n errorMsg: '',\n deleteModal: null\n }\n }", "constructor(props) {\n super(props)\n this.state = {\n loaded: false\n }\n }", "constructor(props) {\n super(props);\n\n this.state = {\n nodoRaiz: '',\n raiz: '',\n der: '',\n izq: '',\n };\n }", "render() {\r\n return<OriginalComponent {...this.props}/>\r\n }", "constructor(props){\n super(props);\n this.state ={\n products: []\n }\n}", "constructor(props){\n super()\n //state attribute should be called body, value should be props\n this.state = {body: props.body}\n }", "constructor(props) {\n \t//calling parent method with super\n \tsuper(props);\n//functional components don't have state, only class-based components do\n//term is property on which we want to record change\n \tthis.state = { term: ''};\n //the above live can only be in the constructor, so every instance will take a copy of the current state\n }", "constructor(props) {\n super(props);\n this.state = {\n userData: this.props.userData,\n };\n }", "constructor(props) {\n super(props);\n this.state = {\n loaded: false,\n qotd: null,\n };\n }", "constructor(props){\n super(props);\n \n this.state={\n ismodalOpen: false,\n title:'',\n details:'',\n priority:'',\n img:'',\n status:'open',\n validated: false,\n setValidated : false\n }\n }", "constructor(props) {\n //lokalne properties\n console.info(\">> constructor zaciatok\");\n super(props);\n this.state = {\n scanned: false, //KAMERA\n hasCameraPermission: null, //KAMERA\n barcodeData: \"\",\n barcodeType: \"\",\n scannerVisible: false,\n searchedBarcode: \"null\",\n item: \"\",\n item_barcode: \"\",\n item_current: 0,\n item_target: 0,\n item_tobuy: 0,\n tabulka: styles.tabulkaComponent,\n found: false,\n modalVisible: false,\n nameError: false,\n };\n console.info(\">> constructor koniec\");\n }", "constructor (props) {\n super(props);\n this.state = {\n legume : this.props.legume,\n peoples: []\n }\n }", "constructor(props){\r\n super(props);\r\n this.state= {\r\n uname:this.props.uname,\r\n email:this.props.email,\r\n userdiscount:0,\r\n subtotal:this.props.ptotal\r\n }\r\n }", "constructor(props) {\n //Call the constrictor of Super class i.e The Component\n super(props);\n //maintain the state required for this component\n this.state = {\n verified: false\n }\n }", "constructor(props) {\n super(props);\n\n const state = this.state;\n }" ]
[ "0.6774401", "0.67603576", "0.6578185", "0.65611166", "0.6533979", "0.65072185", "0.65048987", "0.6502264", "0.6499764", "0.64822215", "0.64707124", "0.6457622", "0.6457137", "0.64544165", "0.64483273", "0.6421727", "0.6421727", "0.6410014", "0.6403737", "0.63944256", "0.63944256", "0.63944256", "0.63837916", "0.63677776", "0.6346425", "0.6332529", "0.6331198", "0.63308513", "0.6330657", "0.6327477", "0.6326787", "0.6326787", "0.6326787", "0.63254887", "0.6323894", "0.6318687", "0.6317952", "0.6310789", "0.63042134", "0.6299784", "0.62980443", "0.6294411", "0.62935555", "0.62919074", "0.62829816", "0.6280942", "0.62779486", "0.6261722", "0.62613213", "0.62613213", "0.62613213", "0.62613213", "0.62613213", "0.6246377", "0.6246377", "0.6246352", "0.62460726", "0.62397194", "0.6238227", "0.62359095", "0.623069", "0.62301815", "0.62257874", "0.62257874", "0.62257874", "0.62257874", "0.6225085", "0.6224734", "0.6223801", "0.6221769", "0.6218716", "0.621812", "0.6215833", "0.6215193", "0.62103266", "0.62101156", "0.62091786", "0.62041265", "0.61995006", "0.6181329", "0.61806273", "0.61806273", "0.6172164", "0.61703676", "0.6168193", "0.6164994", "0.6160912", "0.6151354", "0.6150827", "0.6145914", "0.61395514", "0.61374617", "0.6130933", "0.61269176", "0.612679", "0.6126496", "0.6123611", "0.61225337", "0.6118946", "0.611455", "0.6110857" ]
0.0
-1
/ PART 1: INTERFACE / Checks if FileSaver.js is compatible. If it isn't, show alert.
function checkBrowser() { try { var isFileSaverSupported = !!new Blob; } catch (e) { window.alert("This browser is not supported!\nPlease, use a recent version of Chrome or Firefox instead."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function file_save_check() {\n\tif (!fs || !schedule_path || !schedule.autosave) {\n\t\t// Show the holy button of justice.\n\t\timg.save.style.opacity = 1;\n\t\timg.save.style.pointerEvents = \"auto\";\n\t} else\n\t\t// The user is no fun. Just auto-save it.\n\t\tfile_save();\n}", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n}", "function browserSupportFileUpload() {\r\n\tvar isCompatible = false;\r\n\tif (window.File && window.FileReader && window.FileList && window.Blob) {\r\n\tisCompatible = true;\r\n\t}\r\n\treturn isCompatible;\r\n}", "function browserSupportFileUpload() {\r\n var isCompatible = false;\r\n if (window.File && window.FileReader && window.FileList && window.Blob) {\r\n isCompatible = true;\r\n }\r\n return isCompatible;\r\n }", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n }", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n}", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n }", "function browserSupportFileUpload() {\r\n var isCompatible = false;\r\n if (window.File && window.FileReader && window.FileList && window.Blob) {\r\n isCompatible = true;\r\n }\r\n return isCompatible;\r\n }", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n }", "function browserSupportFileUpload() {\n var isCompatible = false;\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n isCompatible = true;\n }\n return isCompatible;\n }", "function browserSupportFileUpload() {\r\n\tvar isCompatible = false;\r\n\tif (window.File && window.FileReader\r\n\t\t&& window.FileList && window.Blob) {\r\n\t\tisCompatible = true;\r\n\t}\r\n\treturn isCompatible;\r\n}", "function checkFileAPI() {\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n reader = new FileReader();\n return true;\n } else {\n alert('The File APIs are not fully supported by your browser. Fallback required.');\n return false;\n }\n}", "function checkFileAPI() {\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n reader = new FileReader();\n return true; \n } else {\n alert('The File APIs are not fully supported by your browser. Fallback required.');\n return false;\n }\n}", "function browserSupportFileUpload() {\n\t\tvar isCompatible = false;\n\t\tif (window.File && window.FileReader && window.FileList && window.Blob) {\n\t\t\tisCompatible = true;\n\t\t}\n\t\treturn isCompatible;\n\t}", "function checkFileAPI() {\r\n if (window.File && window.FileReader && window.FileList && window.Blob) {\r\n reader = new FileReader();\r\n return true; \r\n } else {\r\n alert('The File APIs are not fully supported by your browser. Fallback required.');\r\n return false;\r\n }\r\n }", "function download_in_ie(canvas, filename,format) {\n return(navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob(canvas.msToBlob(), filename+format));\n}", "function browserSupportFileUpload() {\n\tvar isCompatible = false;\n\tif (window.File && window.FileReader\n\t\t&& window.FileList && window.Blob) {\n\t\tisCompatible = true;\n\t}\n\treturn isCompatible;\n}", "downloadApp() {\n if (this.saveView.inputDownload.value != Utilitary.currentScene.sceneName && !Scene.rename(this.saveView.inputDownload, this.saveView.rulesName, this.saveView.dynamicName)) {\n }\n else {\n var jsonScene = this.sceneCurrent.saveScene(this.saveView.checkBoxPrecompile.checked);\n var blob = new Blob([jsonScene], {\n type: \"application/json;charset=utf-8;\",\n });\n saveAs(blob, Utilitary.currentScene.sceneName + \".jfaust\");\n }\n }", "function checkBrowser() {\n startWork();\n browser.checked = true;\n\n checkEncodesBase64();\n checkADownloads();\n checkSavesMsBlobs();\n checkCreatesObjectUrls();\n checkExportsSvg(finishWork);\n\n\n function checkEncodesBase64() {\n browser.encodesBase64 = !!root.btoa;\n\n // setup shim for IE9\n if (!browser.encodesBase64) {\n setupBase64Shim();\n }\n }\n\n function checkADownloads() {\n browser.aDownloads = document.createElement('a').download !== undefined;\n }\n\n function checkSavesMsBlobs() {\n browser.savesMsBlobs = !!navigator.msSaveOrOpenBlob;\n }\n\n function checkCreatesObjectUrls() {\n var domUrl = root.URL || root.webkitURL;\n browser.createsObjectUrls = domUrl && domUrl.createObjectURL;\n }\n\n function checkExportsSvg() {\n startWork();\n\n browser.exportsSvg = false;\n\n var iframe = document.body.appendChild(document.createElement('iframe'));\n iframe.style.visibility = 'hidden';\n var doc = iframe.contentWindow.document;\n\n iframe.onload = function () {\n try {\n var svg = doc.querySelector('svg');\n var img = doc.querySelector('img');\n var canvas = doc.querySelector('canvas');\n var context = canvas.getContext('2d');\n canvas.width = img.getAttribute('width') * 1;\n canvas.height = img.getAttribute('height') * 1;\n var sourceImg = new Image();\n sourceImg.width = canvas.width;\n sourceImg.height = canvas.height;\n sourceImg.onload = function () {\n try {\n context.drawImage(sourceImg, 0, 0, img.width, img.height);\n img.src = canvas.toDataURL();\n\n browser.exportsSvg = true; // yay\n } catch (e) {}\n\n svgExportChecked();\n };\n var xml = (new XMLSerializer()).serializeToString(svg);\n sourceImg.src = 'data:image/svg+xml,' + encodeURIComponent(xml);\n } catch (e) {\n svgExportChecked();\n }\n };\n\n doc.open();\n doc.write('<!DOCTYPE html>');\n doc.write('<html><head></head><body>');\n doc.write('<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"2\" height=\"2\" viewBox=\"0 0 1 1\"><circle r=\"1\" fill=\"red\"/></svg>');\n doc.write('<img width=\"2\" height=\"2\">');\n doc.write('<canvas></canvas>');\n doc.write('</body></html>');\n doc.close();\n\n\n function svgExportChecked() {\n document.body.removeChild(iframe);\n\n // load Canvg SVG renderer for browsers that can't safely export SVG\n if (browser.exportsSvg) {\n finishWork();\n } else {\n setupCanvgShim(finishWork);\n }\n }\n }\n\n // base64 shim, for IE9\n function setupBase64Shim() {\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n function InvalidCharacterError(message) {\n this.message = message;\n }\n InvalidCharacterError.prototype = new Error();\n InvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\n // base64 encoder\n // from https://gist.github.com/999166\n root.btoa = function (input) {\n var str = String(input);\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars, output = '';\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError('\"btoa\" failed: The string to be encoded contains characters outside of the Latin1 range.');\n }\n block = block << 8 | charCode;\n }\n return output;\n };\n }\n\n // Canvg shim, for IE9-11 and Safari\n function setupCanvgShim(done) {\n var scripts = [\n 'https://cdnjs.cloudflare.com/ajax/libs/canvg/1.4/rgbcolor.min.js',\n 'https://cdnjs.cloudflare.com/ajax/libs/stackblur-canvas/1.4.1/stackblur.min.js',\n 'https://cdn.jsdelivr.net/npm/canvg/dist/browser/canvg.min.js'\n ];\n var remaining = scripts.length;\n scripts.forEach(function (srcURL) {\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.onload = function () {\n remaining--;\n if (remaining === 0) done();\n };\n script.src = srcURL;\n document.head.appendChild(script);\n });\n }\n}", "function isAPIAvailable() {\n // Check for the various File API support.\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n // Great success! All the File APIs are supported.\n return true;\n } else {\n alert(\"The browser you're using does not currently support\\nthe HTML5 File API. As a result the file loading demo\\nwon't work properly.\");\n return false;\n }\n}", "function downloadFile() {\n let filename = $(\"#fileName\").val();\n // if filename has not been defined set to untitled\n if(filename === ''){\n filename = 'untitled';\n }\n let output = \"\";\n if ($(\"#saveCode\")[0].checked)\n output+= app.editor.getCode();\n if ($(\"#saveLayout\")[0].checked) {\n output+=\"\\nvisualiser_json_layout:\";\n output+= JSON.stringify(app.models.getJSON());\n }\n const blob = new Blob(\n [output],\n {type: 'text/plain;charset=utf-8'});\n require(\"file-saver\").saveAs(blob, filename + '.txt');\n}", "onBeforeSave( info ) {\n //console.dir _.omit( info, 'mk' ), depth: null, colors: true\n if ((info.ext !== 'html') && (info.ext !== 'pdf')) { return info.mk; }\n let safe_eng = info.opts.pdf || 'wkhtmltopdf';\n if (safe_eng === 'phantom') { safe_eng = 'phantomjs'; }\n if (_.has(engines, safe_eng)) {\n this.errHandler = info.opts.errHandler;\n engines[ safe_eng ].call(this, info.mk, info.outputFile, info.opts, this.onError);\n return null; // halt further processing\n }\n }", "function checkToSave() {\n fileName = document.getElementById(\"input-title\").value;\n document.getElementById(\"savestatus\").innerHTML = \"Saving...\";\n if (localStorage.getItem(fileName) == document.getElementById(\"page\").innerHTML) {\n console.log(\"File hasn't changed. Not saving...\");\n } else {\n if (document.activeElement != document.getElementById(\"input-title\")) {\n updateSaveFile();\n } else {\n console.log(\"Didn't save file. (name change in progress)\");\n }\n }\n document.getElementById(\"savestatus\").innerHTML = \"Saved\";\n}", "function APIcompatible(){\n return (window.File && window.FileReader && window.FileList && window.Blob);\n }", "function userDownload(){\n\tvar d = document.getElementById(\"ExportOption\");\n var ExportAs = d.options[d.selectedIndex].value;\n if(ExportAs == 'PNG')\n {\n chart.exportChart({type: 'image/png', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'JPEG')\n {\n chart.exportChart({type: 'image/jpeg', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'PDF')\n {\n chart.exportChart({type: 'application/pdf', filename: titleName}, {subtitle: {text:''}});\n }\n if(ExportAs == 'SVG')\n {\n chart.exportChart({type: 'image/svg+xml', filename: titleName}, {subtitle: {text:''}});\n }\n}", "function discrepencies() {\n fileName = document.getElementById(\"input-title\").value;\n if (document.getElementById(\"page\").innerHTML != localStorage.getItem(fileName)) {\n document.getElementById(\"savestatus\").innerHTML = \"Not Saved\";\n }\n}", "checkBrowser(alert) {\n // Chrome 1+\n let isChrome = !!window.chrome && !!window.chrome.webstore;\n // Opera 8.0+\n let isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;\n // Firefox 1.0+\n let isFirefox = typeof InstallTrigger !== 'undefined';\n\n if (!(isChrome | isOpera | isFirefox)) {\n window.alert('It is suggested to use Chrome, Opera, or Firefox to get the best performance on this web page.');\n }\n }", "function wrong_extension() {\n $('#post_error').text(\"Vybraný soubor není pdf!\");\n}", "function beforeSubmit(){\n //check whether browser fully supports all File API\n if (window.File && window.FileReader && window.FileList && window.Blob){\n\t\t\n\t\tif( !$('#FileInput').val()){ //check empty input filed\t\n\t\t\t$(\"#output\").html(\"Me estas jodiendo. Seleccione un Archivo!\");\n\t\t\treturn false\n\t\t}\n\t\t\n\t\tvar fsize = $('#FileInput')[0].files[0].size; //get file size\n\t\tvar ftype = $('#FileInput')[0].files[0].type; // get file type\n\t\t\n\n\t\t//allow file types \n\t switch(ftype){ \n case 'text/plain':\n case 'application/vnd.ms-excel': \n break;\n default:\n $(\"#output\").html(\"<b>\"+ftype+\"</b> Tipo de archivo no soportado!\");\n\t\t\t\treturn false\n }\n\t\t\n\t\t//Allowed file size is less than 5 MB (1048576)\n\t\tif(fsize>5242880) \n\t\t{\n\t\t\t$(\"#output\").html(\"<b>\"+bytesToSize(fsize) +\"</b> Archivo demasiado grande! <br />El tamaņo del archivo debe ser menor a 5 MB.\");\n\t\t\treturn false\n\t\t}\n\t\t\t\t\n\t\t$('#submit-btn').hide(); //hide submit button\n\t\t$('#loading-img').show(); //hide submit button\n\t\t$(\"#output\").html(\"\"); \n\t}\n\telse\n\t{\n\t\t//Output error to older unsupported browsers that doesn't support HTML5 File API\n\t\t$(\"#output\").html(\"Please upgrade your browser, because your current browser lacks some new features we need!\");\n\t\treturn false;\n\t}\n}", "static save(_toSave, _type = \"text/plain\") {\n for (let filename in _toSave) {\n let content = _toSave[filename];\n let blob = new Blob([content], { type: _type });\n let url = window.URL.createObjectURL(blob);\n //*/ using anchor element for download\n let downloader;\n downloader = document.createElement(\"a\");\n downloader.setAttribute(\"href\", url);\n downloader.setAttribute(\"download\", filename);\n document.body.appendChild(downloader);\n downloader.click();\n document.body.removeChild(downloader);\n window.URL.revokeObjectURL(url);\n }\n return new Promise(_resolve => {\n _resolve(_toSave);\n // function hndSaved(_event: Event): void {\n // FileIoBrowserLocal.removeEventListener(EVENT.FILE_SAVED, hndSaved);\n // _resolve((<CustomEvent>_event).detail);\n // }\n // FileIoBrowserLocal.addEventListener(EVENT.FILE_SAVED, hndSaved);\n // let event: CustomEvent = new CustomEvent(EVENT.FILE_SAVED, { detail: { mapFilenameToContent: _toSave } });\n // FileIoBrowserLocal.targetStatic.dispatchEvent(event);\n });\n }", "function validarExt(){\r\n var pdffFile = document.getElementById('pdffFile');\r\n var archivoRuta = pdffFile.value;\r\n var extPermitidas = /(.pdf)$/i;\r\n\r\nif(!extPermitidas.exec(archivoRuta)){\r\n alert('Asegurate de haber selecconado un PDF');\r\n pdffFile.value='';\r\n return false;\r\n}\r\n\r\nelse{\r\n if(pdffFile.files && pdffFile.files[0]){\r\n var visor = new FileReader();\r\n visor.onload=function(e){\r\n //document.getElementById('visorArchivo').innerHTML= \r\n //'<embed src=\"'+e.target.result+'\" >';\r\n }\r\n visor.readAsDataURL(pdffFile.files[0]);\r\n }\r\n}\r\n}", "function checkBrowser(){\n\tif(document.getElementById && document.attachEvent){\t\n\t\t//modern IE\n\t\tbrowser = 'modIE';\n\t}\n\telse if(document.getElementById){\t\n\t\t//modern, non-IE\n\t\tbrowser = 'gecko';\n\t}\n\telse{\t\t\n\t\t//ask to download new browser\n\t\twindow.location = \"browser.html\";\n\t}\n}", "function main() {\r\n\r\n var exportInfo = new Object();\r\n initExportInfo(exportInfo);\r\n try {\r\n var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.\r\n var compsName = new String(\"none\");\r\n var compsCount = app.activeDocument.layerComps.length;\r\n if ( compsCount < 1 ) {\r\n if ( DialogModes.NO != app.playbackDisplayDialogs ) {\r\n alert ( strAlertNoLayerCompsFound );\r\n }\r\n\t \treturn 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script\r\n } else {\r\n app.activeDocument = app.documents[docName];\r\n docRef = app.activeDocument;\r\n \r\n\r\n app.preferences.maximizeCompatibility = QueryStateType.ALWAYS ;\r\n for ( compsIndex = 0; compsIndex < compsCount; compsIndex++ ) {\r\n var compRef = docRef.layerComps[ compsIndex ];\r\n if (exportInfo.selectionOnly && !compRef.selected) continue; // selected only\r\n compRef.apply();\r\n var duppedDocument = app.activeDocument.duplicate();\r\n var fileNameBody = exportInfo.fileNamePrefix;\r\n fileNameBody += \"_\" + zeroSuppress(compsIndex, 4);\r\n fileNameBody += \"_\" + compRef.name;\r\n if (null != compRef.comment) fileNameBody += \"_\" + compRef.comment;\r\n fileNameBody = fileNameBody.replace(/[:\\/\\\\*\\?\\\"\\<\\>\\|\\\\\\r\\\\\\n]/g, \"_\"); // '/\\:*?\"<>|\\r\\n' -> '_'\r\n if (fileNameBody.length > 120) fileNameBody = fileNameBody.substring(0,120);\r\n saveFile(duppedDocument, fileNameBody, exportInfo);\r\n duppedDocument.close(SaveOptions.DONOTSAVECHANGES);\r\n }\r\n\r\n\r\n\r\n\r\n \r\n if ( DialogModes.ALL == app.playbackDisplayDialogs ) {\r\n alert(strTitle + strAlertWasSuccessful);\r\n }\r\n\r\n app.playbackDisplayDialogs = DialogModes.ALL;\r\n\r\n }\r\n } \r\n catch (e) {\r\n if ( DialogModes.NO != app.playbackDisplayDialogs ) {\r\n alert(e);\r\n }\r\n \treturn 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script\r\n }\r\n\r\n}", "function msgFalhaBaixarArquivo() {\n $scope.showErrorMessage(\"Falha ao fazer o download do arquivo.\");\n }", "function isFileLoadingSupported()\r\n\t{\r\n\t\t// Check for the various File API support.\r\n\t\tif (window.File && window.FileReader && window.FileList && window.Blob) {\r\n\t\t\treturn true;\r\n\t\t} else {\r\n\t\t\talert('The File APIs are not fully supported in this browser.');\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function saveJsonFile()\r\n{\r\n let errorBoxTitle = \"Fehler beim Speichern der Datei\";\r\n\r\n let jsonString = \"\";\r\n try\r\n {\r\n jsonString = jsonEditorHandler.getJsonEditorJsonString();\r\n }\r\n catch (_errorMessage)\r\n {\r\n dialog.showErrorBox(errorBoxTitle, _errorMessage);\r\n }\r\n\r\n if (jsonString)\r\n {\r\n jsonFileSaver.showSaveDialog();\r\n\r\n try\r\n {\r\n jsonFileSaver.saveJsonString(jsonString);\r\n }\r\n catch (_error)\r\n {\r\n dialog.showErrorBox(errorBoxTitle, _error.message);\r\n }\r\n }\r\n else dialog.showErrorBox(errorBoxTitle, \"Keine Datei im Editor geladen\");\r\n}", "function dosavedata ()\n {if (!checksave(folder))\n {savedata(folder); alert('Data saved.'); return true};\n if (confirm('Saving data may overwrite changes made by others. Proceed?'))\n {savedata(folder); return true};\n return false}", "saveFile() {\n lively.warn(\"#TODO implement save\")\n }", "checkSupport_() {\n if (!this.checkedSupport_) {\n this.checkedSupport_ = true;\n\n if (userAgent.IE) {\n // WebGL capture does not work at all in IE\n // the save-svg-as-png library does not work in IE\n // GIT creation is slow to unusable in IE\n var msg = 'Screen capture may not work as expected in Internet Explorer due to browser limitations. To use ' +\n 'this feature, we recommend switching to Chrome or Firefox.';\n AlertManager.getInstance().sendAlert(msg, AlertEventSeverity.WARNING,\n logger);\n }\n }\n }", "function isCorrectVersion() {\r\n\tif (parseInt(version, 10) >= 9) {\r\n\t\treturn true;\r\n\t}\r\n\telse {\r\n\t\talert('This script requires Adobe Photoshop CS2 or higher.', 'Wrong Version', false);\r\n\t\treturn false;\r\n\t}\r\n}", "function save_and_export() {\r\n\r\n}", "function checkDefaultExtension(loader, arg) {\n return loader.defaultJSExtensions && arg.substr(arg.length - 3, 3) != '.js'; \n }", "function checkDefaultExtension(loader, arg) {\n return loader.defaultJSExtensions && arg.substr(arg.length - 3, 3) != '.js'; \n }", "function validaCampoFileInsave(Nombre, ActualLement, espacio) {\n\n var ID = document.getElementById(ActualLement + '_txt_' + Nombre);\n var file = ID.files[0];\n var errorIs2 = false;\n var tipoArch = $('#' + ActualLement + '_txt_' + Nombre).attr('accept');\n var MaxTam = $('#' + ActualLement + '_txt_' + Nombre).attr('maxtam');\n var espacio = espacio !== undefined ? espacio : '_S_solicitud_datos';\n if (!MaxTam) {\n MaxTam = 10;\n }\n if (!tipoArch) {\n tipoArch = '.pdf';\n }\n var FilesAdded = new Array();\n var _G_ID_ = '#' + ActualLement;\n if (tipoArch.toUpperCase().includes('PDF')) {\n var reader = new FileReader(file);\n reader.onload = function (event) {\n var text = reader.result;\n var firstLine = text.split('\\n').shift(); // first line\n if (!(firstLine.toString().toUpperCase().includes('PDF'))) {\n redLabel_Space(Nombre, 'El archivo es inválido o no es PDF', _G_ID_);\n errorIs2 = true;\n }\n }\n reader.readAsText(file, 'UTF-8');\n }\n if (file.size > (MaxTam * 1024 * 1024)) {\n redLabel_Space(Nombre, 'El archivo no debe superar los ' + MaxTam + ' MB', _G_ID_);\n errorIs2 = true;\n }\n if (!ValidateAlphanumeric((file.name).replace('.', ''))) {\n redLabel_Space(Nombre, 'El nombre del archivo no debe contener caracteres especiales', _G_ID_);\n errorIs2 = true;\n }\n $(_G_ID_ + espacio + ' input').each(function (i, item) {\n if (item.type === 'file' && item.value !== '') {\n if (FilesAdded.indexOf(item.value) !== -1) {\n redLabel_Space(item.name, 'El archivo ya se encuentra cargado en otro requisito', _G_ID_);\n errorIs2 = true;\n }\n FilesAdded.push(item.value);\n }\n });\n if (file.size <= (0)) {\n redLabel_Space(Nombre, 'El archivo no es valido', _G_ID_);\n errorIs2 = true;\n }\n\n\n var tipoAA = file.name;\n tipoAA = tipoAA.split('.');\n var tamtipoAA = tipoAA.length;\n tipoAA = tipoAA[tamtipoAA - 1];\n\n\n if (!(tipoAA).toUpperCase().replace('.', '').includes(tipoArch.replace('.', '').toUpperCase())) {\n redLabel_Space(Nombre, 'El archivo debe ser' + tipoArch.toUpperCase(), _G_ID_);\n errorIs2 = true;\n }\n setTimeout(function () {\n if (errorIs2) {\n ShowAlertM(_G_ID_, null, null, true);\n }\n errorIs[Nombre] = errorIs2;\n return errorIs2;\n }, 1000);\n}", "screwIE () {\n let browser = new Browser();\n if (browser.screwIE === true) {\n this.$toast({\n type: 'warning',\n content: `\n <h4>Unsupported Browser</h4>\n <span>This app may not function properly in Internet Explorer! Please use another browser such as Chrome, Edge, or Firefox.</span>`\n });\n }\n }", "function ShowIEAlert(){\nif(is_IE()){\nalert(\"Unsupported Browser!\\nOnomatoPedal will not work in Internet Explorer. Use Microsoft Edge or Google Chrome for the full experience.\\n\\nInternet Explorerでは、このページは正しく動作しません。Microsoft EdgeかGoogle Chromeで再度お試しください。\");\n}\n}", "function isFileReaderSupported(){\r\n if(typeof FileReader !== \"undefined\"){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }", "function check_web_storage_support() {\n if(typeof(Storage) !== \"undefined\") {\n return(true);\n }\n else {\n alert(\"Web storage unsupported!\");\n return(false);\n }\n}", "function saveFunctionality() {\n\n\t$('body').on('keyup', '#fileName', function(event) {\n\t\tif ($('#fileName').val()) {\n\t\t\t$('#saveButton').removeClass('disabled');\n\t\t\t$('#saveButton').attr('download', $('#fileName').val());\n\t\t} else {\n\t\t\t$('#saveButton').addClass('disabled');\n\t\t}\n\t});\n\n\t$('body').on('click', '#saveButton', function(event) {\n\t\tif ($('#fileName').val()) {\n\t\t\t$('#saveImage').popover('hide');\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t$('body').on('keydown', function(event) {\n\t\tif (event.keyCode === ESCAPE_KEY) {\n\t\t\t$('#saveImage').popover('hide');\n\t\t}\n\t});\n\n\t$('body').on('keydown', '#fileName', function(event) {\n\t\tif (event.keyCode === RETURN_KEY) {\n\t\t\t$('a#saveButton')[0].click()\n\t\t}\n\t});\n\n\tvar root = $('<div/>').append($('<div id=\"popoverContainer\"/>').append($('<input type=\"text\" placeholder=\"Filename to save\" id=\"fileName\"></input>'), $('<span>.png</span>'), $('<a class=\"btn btn-small disabled\" id=\"saveButton\" >Save!</a>')));\n\t$('#saveImage').popover({\n\t\thtml : true,\n\t\tcontent : root.html(),\n\t\tplacement : 'right'\n\n\t});\n\n\tfunction errorHandler(e) {\n\t\tvar msg = '';\n\n\t\tswitch (e.code) {\n\t\t\tcase FileError.QUOTA_EXCEEDED_ERR:\n\t\t\t\tmsg = 'QUOTA_EXCEEDED_ERR';\n\t\t\t\tbreak;\n\t\t\tcase FileError.NOT_FOUND_ERR:\n\t\t\t\tmsg = 'NOT_FOUND_ERR';\n\t\t\t\tbreak;\n\t\t\tcase FileError.SECURITY_ERR:\n\t\t\t\tmsg = 'SECURITY_ERR';\n\t\t\t\tbreak;\n\t\t\tcase FileError.INVALID_MODIFICATION_ERR:\n\t\t\t\tmsg = 'INVALID_MODIFICATION_ERR';\n\t\t\t\tbreak;\n\t\t\tcase FileError.INVALID_STATE_ERR:\n\t\t\t\tmsg = 'INVALID_STATE_ERR';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tmsg = 'Unknown Error';\n\t\t\t\tbreak;\n\t\t};\n\n\t}\n\n\tfunction saveImageTodownload(fileEntry) {\n\t\treturn function saveToFS() {\n\t\t\tfileEntry.createWriter(function(fileWriter) {\n\t\t\t\tvar blob = convertToBinaryImage($('#printscreen_img')[0]);\n\t\t\t\tfileWriter.onwriteend = function() {\n\t\t\t\t\t$('#saveButton').attr('href', fileEntry.toURL());\n\t\t\t\t\t$('#fileName').removeAttr('disabled');\n\t\t\t\t\t$('#fileName').focus();\n\t\t\t\t};\n\t\t\t\tfileWriter.write(blob);\n\t\t\t}, errorHandler);\n\t\t}\n\t}\n\n\n\t$('#saveImage').click(function() {\n\t\t$('#fileName').attr('disabled', '');\n\t\twebkitStorageInfo.requestQuota(webkitStorageInfo.TEMPORARY, 30 * 1024 * 1024, function(freeBytes) {\n\t\t\twindow.webkitRequestFileSystem(webkitStorageInfo.TEMPORARY, freeBytes, function(fs) {\n\t\t\t\tfs.root.getFile('test.png', {\n\t\t\t\t\tcreate : false\n\t\t\t\t}, function(fileEntry) {\n\t\t\t\t\tfileEntry.remove(function() {\n\t\t\t\t\t\tfs.root.getFile('test.png', {\n\t\t\t\t\t\t\tcreate : true\n\t\t\t\t\t\t}, function(fileEntry) {\n\t\t\t\t\t\t\tsaveImageTodownload(fileEntry)();\n\t\t\t\t\t\t}, errorHandler);\n\t\t\t\t\t}, function(e) {\n\t\t\t\t\t\tif (e.code === FileError.NOT_FOUND_ERR) {\n\t\t\t\t\t\t\tfs.root.getFile('test.png', {\n\t\t\t\t\t\t\t\tcreate : true\n\t\t\t\t\t\t\t}, function(fileEntry) {\n\t\t\t\t\t\t\t\tsaveImageTodownload(fileEntry)();\n\t\t\t\t\t\t\t}, errorHandler);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn errorHandler(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}, function(e) {\n\t\t\t\t\tif (e.code === FileError.NOT_FOUND_ERR) {\n\t\t\t\t\t\tfs.root.getFile('test.png', {\n\t\t\t\t\t\t\tcreate : true\n\t\t\t\t\t\t}, function(fileEntry) {\n\t\t\t\t\t\t\tsaveImageTodownload(fileEntry)();\n\t\t\t\t\t\t}, errorHandler);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn errorHandler(e);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t}, errorHandler);\n\t\t}, errorHandler);\n\n\t});\n\n}", "function saveDocumentAs() {\r\n\t\tif (checkLocalStorage()) {\r\n\t\t var saveName = prompt(\"Save file as...\");\r\n\t\t if (saveName) {\r\n\t\t\tvar str = myDiagram.model.toJson();\r\n\t\t\tlocalStorage.setItem(saveName, str);\r\n\t\t\tmyDiagram.isModified = false;\r\n\t\t\tvar listbox = document.getElementById(\"mySavedFiles\");\r\n\t\t\t// adds saved floor plan to listbox if it isn't there already \r\n\t\t\tvar exists = false;\r\n\t\t\tfor (var i = 0; i < listbox.options.length; i++) {\r\n\t\t\t if (listbox.options[i].value === saveName) {\r\n\t\t\t\texists = true;\r\n\t\t\t\tbreak;\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t\tif (exists === false) {\r\n\t\t\t var option = document.createElement('option');\r\n\t\t\t option.value = saveName;\r\n\t\t\t option.text = saveName;\r\n\t\t\t listbox.add(option, null);\r\n\t\t\t}\r\n\t\t\tvar currentFile = document.getElementById(\"currentFile\");\r\n\t\t\tcurrentFile.innerHTML = saveName;\r\n\t\t }\r\n\t\t}\r\n\t }", "function openSaveAs() {\n var ediv = $(\"#edit-widget-content\").get(0);\n if ($.data(ediv, \"assetid\")) {\n saveAssetContent(null,null);\n } else {\n if (contentEditCriteria.producesResource) {\n $.perc_browser({on_save:onSave, initial_val:\"\"});\n } else {\n saveAssetContent(contentEditCriteria.contentName,null);\n }\n }\n }", "function Install_Detect()\n{\n var _ReportOK = document.getElementById(\"_ReportOK\");\n if (_ReportOK.Register == undefined) //if ((_ReportOK == null) || (_ReportOK.Register == undefined))\n {\n document.write('<div style=\"width: 100%; background-color: #fff8dc; text-align: center; vertical-align: middle; line-height: 20pt; padding-bottom: 12px; padding-top: 12px;\">');\n document.write('<strong> This site needs to be installed Reports plugin sharp waves In order to ensure their normal operation <br /></strong>');\n \n if( _gr_isIE )\n document.write('<strong><span style=\"color: #ff0000\"> If prompted bar at the top or bottom of the browser , Left-click and run the add tooltip , Click here to install the easiest way </span><br /></strong>');\n \n document.write('<a href=\"' + gr_InstallPath + '/grbsctl5.exe\"><span style=\"color: #ff0000\"><strong> Click here to download the plug-in installation package reports sharp waves <br /></strong></span></a>');\n document.write(' After installing the plug-sharp wave reports ,<a href=\"#\" onclick=\"javascript:document.location.reload();\"> Click here </a> Reload this site ');\n document.write('</div>');\n return false;\n }\n else if ((_ReportOK.Utility.ShouldUpdatePlugin == undefined) || _ReportOK.Utility.ShouldUpdatePlugin(gr_Version) == true) // Check whether you should download a new version of the program \n {\n document.write('<div style=\"width: 100%; background-color: #fff8dc; text-align: center; vertical-align: middle; line-height: 20pt; padding-bottom: 12px; padding-top: 12px;\">');\n document.write('<strong> This site requires an upgrade installation Reports plugin sharp waves In order to ensure their normal operation <br /></strong>');\n document.write('<a href=\"' + gr_InstallPath + '/grbsctl5.exe\"><span style=\"color: #ff0000\"><strong> Click here to download the plug-in installation package reports sharp waves <br /></strong></span></a>');\n document.write(' Must close the page window plug-in installation , Click on the window close button on this page to shut down , After the installation is complete reopen this page <br />');\n document.write(' Such as the installation appears [ Can not open file for writing ...] Prompt , Please close the page window , Then click [ Retry ] Button to continue with the installation ');\n document.write('</div>');\n return false;\n }\n \n return true;\n}", "function checkBrowserSupport() {\n if (!checkBrowser()) {\n showAlert(phrases.BrowserOutdated);\n } else if (!navigator.cookieEnabled) {\n showAlert(phrases.CookiesDisabled);\n }\n}", "function CheckBrowser() {\n\tif ('localStorage' in window && window['localStorage'] !== null) {\n\t\t// we can use localStorage object to store data\n\t\treturn true;\n\t} else {\n\t\t\talert(\"Kindly note that this browser doesn't support for local storage introduced in html5!\");\n\t\t\treturn false;\n\t}\n}", "isAPdf(){\n if( $('#fileupload p.name span').text().includes('.pdf')){\n $(\"#pdf-format-error\").addClass('hidden')\n return true\n } else {\n $(\"#pdf-format-error\").removeClass('hidden')\n $('#fileupload tbody.files').empty()\n return false\n }\n }", "function isCorrectVersion() {\n\tif (parseInt(version, 10) >= 8) {\n\t\treturn true;\n\t}\n\telse {\n\t\talert('This script requires Adobe Photoshop CS or higher.', 'Wrong Version', false);\n\t\treturn false;\n\t}\n}", "function alertBadBrowser(){\n var isIE = /*@cc_on!@*/false || !!document.documentMode;\n var isEdge = !isIE && !!window.StyleMedia;\n\n if(isIE||isEdge){\n alert(\"Your browser may cause display problems. You should obtain a modern webkit browser. While some versions of Microsoft Edge work, it can be buggy. Chrome, Firefox, Safari, and Opera all work consistently. Internet Explorer is not supported.\");\n }\n}", "function initWillDownload() {\n if( !js9Electron.willDownload && js9Electron.savedir ){\n\t// eslint-disable-next-line no-unused-vars\n\tjs9Electron.win.webContents.session.on('will-download', (event, item, webContents) => {\n\t const fname = item.getFilename();\n\t const pname = `${js9Electron.savedir}/${fname||js9Electron.defsave}`;\n\t // Set the save path, making Electron not to prompt a save dialog.\n\t item.setSavePath(pname);\n\t item.on('updated', (event, state) => {\n\t\tif (state === 'interrupted') {\n\t\t // eslint-disable-next-line no-console\n\t\t console.log(`Save interrupted: ${pname}`);\n\t\t} else if (state === 'progressing') {\n\t\t if (item.isPaused()) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`Save paused: ${pname}`);\n\t\t }\n\t\t}\n\t });\n\t item.once('done', (event, state) => {\n\t\tif (state !== 'completed') {\n\t\t // eslint-disable-next-line no-console\n\t\t dialog.showErrorBox(\"Error saving file\",\n\t\t\t\t\t`${pname} [${state}]`);\n\t\t}\n\t });\n\t});\n\t// only need to do once\n\tjs9Electron.willDownload = true;\n }\n}", "function checkForStorage() {\n return typeof(Storage) !== \"undefined\"\n}", "function checkForLocalStorage(){\r\n const warning = document.getElementById('storagewarning');\r\n const storagesafe = document.getElementById('storagesafe');\r\n /*\r\n The following checking code was retrived from the MDN web docs\r\n https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API\r\n */\r\n if (typeof(Storage) !== \"undefined\") {\r\n storagesafe.style.display = 'block'; // LocaL Storage supported\r\n warning.style.display = 'none';\r\n } else {\r\n warning.style.display = 'block'; // Local Storage not supported\r\n storagesafe.style.display = 'none';\r\n }\r\n}", "function thisBrowserIsBad() {\n track('streaming', 'not supported');\n alert(facetogif.str.nope);\n }", "function isFirefox() {\n return typeof InstallTrigger !== 'undefined';\n}", "function supportHTML5() {\n\t\tif (window.File && window.FileList && window.FileReader) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function checkCompatability() {\n\tif (typeof my_ubmVersion !== \"string\") {\n\t\tvar s = \"The bookmarklet does not have a setting! Please make sure yours has one!\";\n\t\talert(s);\n\t\tthrow s;\n\t}\n\tif ([-1, NaN].includes(versionCompare(my_ubmVersion, ubm_clientFormatVersion))) { /*aka is the my_ubmVersion less than ubm_clientFormatVersion*/\n\t\tvar s = \"The client has an older version 'v\" + my_ubmVersion + \"' than is compatable with the bookarklet manager 'v\" + ubm_clientFormatVersion + \"'! Because of this, the script will not load until you update your bookmarklet. Possibly will add the ability to redirect to the main site and then update it for you.\";\n\t\talert(s);\n\t\tthrow s;\n\t}\n\tif (typeof repos !== \"undefined\") {\n\t\tconsole.log(\"Reloading script!\");\n\t}\n\tif (typeof my_settings !== \"object\") {\n\t\tconsole.warn(\"The settings object was not found or is not an object!\");\n\t\tsettings = {};\n\t}\n}", "function ImportSaveCallback(name) {\n try {\n var save = findValue(\"SAVE_\" + name);\n if (save != null) {\n writeRedTemporaryText(\"Loaded save.\");\n return base64ToArray(save); //convert this to array\n }\n } catch (error) {\n writeRedTemporaryText(\"Could not read save: \" + error.message);\n }\n return null;\n}", "openSaveFileDialog(title) {\n return new Promise((resolve) => {\n dialog.showSaveDialog({\n title,\n buttonLabel: \"Save\",\n filters: [\n { name: 'SAV Files', extensions: ['sav'] },\n { name: 'All Files', extensions: ['*'] },\n ],\n }, (file) => {\n resolve(file);\n });\n });\n }", "function userSavesHandler() {\n\tif (!filepath) {\n\t\tdialog.showSaveDialog(savePathChosenHandler);\n\t} else {\n\t\twriteToFile(filepath)\n\t}\n}", "function CheckBrowser() {\n\tif ('localStorage' in window && window['localStorage'] !== null) {\n\t\t// we can use localStorage object to store data\n\t\treturn true;\n\t} else {\n\t\t\treturn false;\n\t}\n}", "function CheckBrowser() {\n\tif ('localStorage' in window && window['localStorage'] !== null) {\n\t\t// we can use localStorage object to store data\n\t\treturn true;\n\t} else {\n\t\t\treturn false;\n\t}\n}", "function validaCampoFileInsavePrev(Nombre, ActualLement, espacio) {\n var ID = document.getElementById(ActualLement + '_txt_' + Nombre);\n var file = ID.files[0];\n var errorIs2 = false;\n var tipoArch = $('#' + ActualLement + '_txt_' + Nombre).attr('accept');\n var MaxTam = $('#' + ActualLement + '_txt_' + Nombre).attr('maxtam');\n var espacio = espacio !== undefined ? espacio : '_S_solicitud_datos';\n if (!MaxTam) {\n MaxTam = 10;\n }\n if (!tipoArch) {\n tipoArch = '.pdf';\n }\n var FilesAdded = new Array();\n var _G_ID_ = '#' + ActualLement;\n if (tipoArch.toUpperCase().includes('PDF')) {\n var reader = new FileReader(file);\n reader.onload = function (event) {\n var text = reader.result;\n var firstLine = text.split('\\n').shift(); // first line\n if (!(firstLine.toString().toUpperCase().includes('PDF'))) {\n redLabel_Space(Nombre, 'El archivo es invalido o no es PDF', _G_ID_);\n errorIs2 = true;\n }\n }\n reader.readAsText(file, 'UTF-8');\n }\n if (file.size > (MaxTam * 1024 * 1024)) {\n redLabel_Space(Nombre, 'El archivo no debe superar los ' + MaxTam + ' MB', _G_ID_);\n errorIs2 = true;\n }\n if (!ValidateAlphanumeric((file.name).replace('.', ''))) {\n redLabel_Space(Nombre, 'El nombre del archivo no debe contener caracteres especiales', _G_ID_);\n errorIs2 = true;\n }\n $(_G_ID_ + espacio + ' input').each(function (i, item) {\n if (item.type === 'file' && item.value !== '') {\n if (FilesAdded.indexOf(item.value) !== -1) {\n redLabel_Space(item.name, 'El archivo ya se encuentra cargado en otro requisito', _G_ID_);\n errorIs2 = true;\n }\n FilesAdded.push(item.value);\n }\n });\n if (file.size <= (0)) {\n redLabel_Space(Nombre, 'El archivo no es valido', _G_ID_);\n errorIs2 = true;\n }\n\n\n var tipoAA = file.name;\n tipoAA = tipoAA.split('.');\n var tamtipoAA = tipoAA.length;\n tipoAA = tipoAA[tamtipoAA - 1];\n\n\n if (!(tipoAA).toUpperCase().replace('.', '').includes(tipoArch.replace('.', '').toUpperCase())) {\n redLabel_Space(Nombre, 'El archivo debe ser' + tipoArch.toUpperCase(), _G_ID_);\n errorIs2 = true;\n }\n setTimeout(function () {\n if (errorIs2) {\n ShowAlertMPrev(_G_ID_, null, null, true);\n }\n errorIs[Nombre] = errorIs2;\n return errorIs2;\n }, 1000);\n}", "function checkBrowserSupported()\n{\n\t// Get the browser details\n\tvar userAgent = navigator.userAgent.toLowerCase();\n var browser = {\n version: (userAgent.match( /.+(?:rv|it|ra|ie)[\\/: ]([\\d.]+)/ ) || [0,'0'])[1],\n webkit: /webkit/.test( userAgent ),\n opera: /opera/.test( userAgent ),\n msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),\n mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )\n };\n\t\n\t// If the browser is webkit opera or mozilla it's probably fine'\n\tif ((browser.webkit === true) || (browser.opera === true) || (browser.mozilla === true))\n\t{\n\t\t// Make sure HTML 5 storage support is available\n\t\tif (checkSupportForHtml5Storage() === false)\n\t\t{\n\t\t\t$('#browserSupportError').html('HTML5 local storage support is not available');\n\t\t\treturn false;\n\t\t}\n\t\telse {\n\t\t\treturn true;\n\t\t}\n\t}\n\telse if ((browser.msie === true) && (browser.version > 8.0))\n\t{\n\t\t// IE 9 onwards is ok\n\t\treturn true;\n\t}\n\telse {\n\t\treturn false;\n\t}\n}", "function check(objId, exten, flag, exten2){\n\nvar extParam2=false;\n if(exten2){\nextParam2=true;\n }else{\nexten2=exten;\n\n }\n\n \n var ext = document.getElementById(objId).value;\n if (ext == \"\") {\n alert(\"Please enter the full path and file name\");\n return false;\n }\n\n /* upload file check starts */\n\tif($.browser.msie)\n {\n \tif (navigator.userAgent.indexOf(\"MSIE 9\") != -1) { \n var objFSO = new ActiveXObject(\"Scripting.FileSystemObject\");\n var sPath = document.getElementById(\"tf1_txtRestoreFile\").value;\n var objFile = objFSO.getFile(sPath);\n var iSize = objFile.size;\n if (iSize > 104857600)\n\t\t\t{\n\t\t\t\talert(\"Invalid Restore file, please upload a correct Restore file\");\n\t\t\t\treturn false;\n\t\t\t} \n \t}\n \telse{\n \t\tif (uploadImageSizeCheck () == false)\n\t\t\t\treturn false;\n \t}\n\n }\n else{\n \tif (uploadImageSizeCheck () == false)\n\t\t\t\treturn false;\n\t}\n/* upload file check ends */\n\tif (flag == 1) {\n\t\t\t\t\t\tvar conf = confirm(\"Preparing to restore saved settings from user provided file. Are you sure want to proceed?\\n WARNING: Current configuration will be erased.\");\n\t\t\t\t\tif (conf == false) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t }\n ext = ext.substring(ext.lastIndexOf('.') + 1, ext.length);\n ext = ext.toLowerCase();\n if (ext.length > 4) {\n alert('please select a .' + exten + ' file');\n return false;\n }\n else \n if (ext != exten2) {\n alert('You selected a .' + ext + ' file; please select a .' + exten2 + ' file instead!');\n return false;\n } \n}", "function SaveAsSVG(document, newname)\r{\r var targetFolder = Folder(MATERIAL_EXPORT_PATH);\r\r if (! targetFolder.exists) {\r // geef een melding en \r throw(\"Onderstaande folder niet gevonden, is de netwerkverbinding gemaakt? \\n\\n\" +\r MATERIAL_EXPORT_PATH);\r }\r\r var exportOptions = new ExportOptionsSVG();\r var exportType = ExportType.SVG;\r\r var targetFile = MakeTempInvisibleFile(targetFolder, newname, \".ai\");\r // alert(targetFile);\r\r exportOptions.embedRasterImages = true;\r exportOptions.compressed = true;\r exportOptions.embedAllFonts = false;\r exportOptions.fontSubsetting = SVGFontSubsetting.GLYPHSUSED;\r exportOptions.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;\r exportOptions.optimezForSVGViewer = true;\r\r document.exportFile( targetFile, exportType, exportOptions );\r document.close( SaveOptions.DONOTSAVECHANGES );\r\r var exportedFile = MakeTempInvisibleFile(targetFolder, newname, \".svgz\");\r // alert(exportedFile);\r if (exportedFile.exists) {\r if (! exportedFile.rename(newname+ \".svgz\")) {\r // bij aanwezig zijn oude file, deze proberen te deleten en vervolgens nogmaal renamen:\r var fl = new File(targetFolder + \"/\" + newname + \".svgz\");\r // alert(fl);\r if (fl.remove()) \r exportedFile.rename(newname+ \".svgz\")\r else\r alert(SCRIPT_NAME + \" is niet goed gelukt, oude file is nog aanwezig en niet te overschrijven!\") \r }\r } \r else\r alert(SCRIPT_NAME + \" is niet goed gelukt!\") \r}", "function checkIfCanUpload() {\n var status = document.getElementById(\"uploadButton\").getAttribute(\"class\");\n if (status == \"disabled\") {\n swal(\"Warning\", 'In order to upload you must render the project at least once.', \"warning\");\n } else {\n uploadFiles();\n }\n}", "function saveFile() {\n if(!loadedfs) {\n dialog.showSaveDialog({ filters: [\n { name: 'txt', extensions: ['txt'] }\n ]}, function(filename) {\n if(filename === undefined) return;\n writeToFile(editor, filename);\n });\n }\n else {\n writeToFile(editor, loadedfs);\n }\n}", "function onSubmitFileSaveForm() {\n return fileSaveForm.form('validate');\n }", "function userHasStorageAccess() {\n // If we're inside a running, editable notebook, anyone can save data.\n return utils.browserSupportsFileAPI();\n //return stylist.utils.browserSupportsFileAPI(); // also works!\n}", "function SP_ContinueAutoSave()\n{\n\tvar userAgentInfo = navigator.userAgent.toLowerCase();\n\t\n\tif(userAgentInfo.indexOf('msie') != -1)\n\tif(typeof mcAutoSaver != 'undefined')\n\t{\n\t\tif(arguments[0] == true)\n\t\t{\n\t\t\tAllowAutoSave = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\tAllowAutoSave = false;\n\t\t}\n\t}\n}", "function checkFileReaderSyncSupport() {\n\n function makeWorker(script) {\n //noinspection JSUnresolvedVariable\n let URL = root.URL || window.webkitURL;\n let Blob = root.Blob;\n let Worker = root.Worker;\n\n if (!URL || !Blob || !Worker || !script) return null;\n\n let blob = new Blob([script]);\n //noinspection JSUnresolvedFunction\n return new Worker(URL.createObjectURL(blob));\n }\n\n return new Promise(function (resolve) {\n let syncDetectionScript = \"onmessage = function(e) { postMessage(!!FileReaderSync); close() };\";\n try {\n let worker = makeWorker(syncDetectionScript);\n if (worker) {\n worker.onmessage = function (e) {\n worker.terminate();\n worker = null;\n resolve(e.data);\n };\n worker.postMessage({});\n }\n else resolve(false);\n } catch (err) {\n resolve(false);\n }\n });\n }", "function saveDocumentAs() {\n if (checkLocalStorage()) {\n var saveName = prompt(\"Save file as...\", getCurrentFileName());\n if (saveName && saveName !== UnsavedFileName) {\n setCurrentFileName(saveName);\n saveDiagramProperties()\n window.localStorage.setItem(saveName, myDiagram.model.toJson());\n myDiagram.isModified = false;\n }\n }\n}", "function CheckBrowser()\r\n\r\n \t{\r\n\t\t\r\n\tif ('localStorage' in window && window['localStorage'] !== null)\r\n\t\r\n {\r\n\r\n// we can use localStorage object to store data ------------------------------------------------------------------>\r\n\t\r\n\treturn true;\r\n\t\r\n\t} \r\n\t\r\n\telse \r\n\t\r\n\t{\r\n\t\t\r\n\treturn false;\r\n\t\r\n\t}\r\n\t}", "saveAs () {\n const filepath = dialog.showSaveDialog(this.win, {\n title: translate(\"dialog-save\"),\n defaultPath: this.filepath || this.defaultPath\n });\n if (filepath) {\n return this.save(filepath);\n }\n return Promise.resolve(false);\n }", "_event_saving() {\n\t\tlet ev = new Event(\"saving\", { \"bubbles\": true, \"cancelable\": true });\n\t\tthis.dispatchEvent(ev);\n\t}", "function fixOldSave(oldVersion){\n}", "function fixOldSave(oldVersion){\n}", "function CheckBrowser() {\r\n if (\"localStorage\" in window && window[\"localStorage\"] !== null) {\r\n // we can use localStorage object to store data\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function exportPDFfunction() {\n viz.showExportPDFDialog();\n}", "function CheckBrowser() {\n if (\"localStorage\" in window && window[\"localStorage\"] !== null) {\n // we can use localStorage object to store data\n return true;\n } else {\n return false;\n }\n}", "function guardar_tabla_datos_a_excel() {\n //checamos que tenga datos la tabla\n if ($(\".dato\").length > 0) {\n tableToExcel(\"tabla_res\", \"Establecimientos\" + $(\"#fecha_inicio\").val() + \"-\" + $(\"#fecha_termino\").val() + \".xlsx\");\n\n }//fin\n else alert(\"no hay datos...\");\n}//fin", "function promptToSaveBlob({ content, name, downloadUrl }) {\n if (downloadUrl) {\n const iframeId = 'oc-fm--filemanager-download-iframe';\n let iframeDOMNode = document.getElementById(iframeId);\n\n if (!iframeDOMNode) {\n iframeDOMNode = document.createElement('iframe');\n iframeDOMNode.style.display = 'none';\n iframeDOMNode.id = iframeId;\n document.body.appendChild(iframeDOMNode);\n }\n\n iframeDOMNode.src = downloadUrl;\n } else {\n const blob = new Blob([content], { type: 'octet/stream' });\n FileSaver.saveAs(blob, name);\n }\n}", "function storageIsSupported(){\n\t// Check browser support\n\tif (typeof(Storage) !== \"undefined\") {\n \treturn true;\n\t}else{\n \treturn false;\n\t};\n}", "function fileSaver(url, name, format) {\n var saveLink = document.createElement('a');\n var canUseSaveLink = ('download' in saveLink);\n var promise = new Promise(function (resolve, reject) {\n var blob;\n var objectUrl;\n\n // IE 10+ (native saveAs)\n if (Lib.isIE()) {\n // At this point we are only dealing with a decoded SVG as\n // a data URL (since IE only supports SVG)\n blob = helpers.createBlob(url, 'svg');\n window.navigator.msSaveBlob(blob, name);\n blob = null;\n return resolve(name);\n }\n if (canUseSaveLink) {\n blob = helpers.createBlob(url, format);\n objectUrl = helpers.createObjectURL(blob);\n saveLink.href = objectUrl;\n saveLink.download = name;\n document.body.appendChild(saveLink);\n saveLink.click();\n document.body.removeChild(saveLink);\n helpers.revokeObjectURL(objectUrl);\n blob = null;\n return resolve(name);\n }\n\n // Older versions of Safari did not allow downloading of blob urls\n if (Lib.isSafari()) {\n var prefix = format === 'svg' ? ',' : ';base64,';\n helpers.octetStream(prefix + encodeURIComponent(url));\n return resolve(name);\n }\n reject(new Error('download error'));\n });\n return promise;\n}", "function SaveFile() {\n return {\n save: saveAsFile\n };\n}", "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 browserOK(exclusive)\n{\n if (exclusive == anymozilla)\n {\n if (typeof InstallTrigger == \"object\")\n return true;\n else\n {\n if(window.confirm(\"This package is intended only for Beonex Communicator, Netscape 6 or Mozilla.\\nWould you like to download \" + installName + \"?\"))\n gotoInstallPage();\n return false;\n }\n }\n else if (exclusive == sameversion)\n {\n var start = navigator.userAgent.indexOf(\"Gecko/\") + 6;\n var build = parseInt(navigator.userAgent.substring(start, start + 8));\n if (typeof InstallTrigger == \"object\"\n && build >= 20001100)\n return true;\n else\n {\n if(window.confirm(\"This package is intended only for Beonex Communicator 0.6, Netscape 6.0 or Mozilla 0.6.\\nWould you like to download \" + installName + \"?\"))\n gotoInstallPage();\n return false;\n }\n }\n else if (exclusive == samevendorrelease)\n {\n if (typeof InstallTrigger == \"object\" && navigator.vendor && navigator.vendor == \"Beonex\" && navigator.vendorSub && navigator.vendorSub.substr(0,3) == \"0.6\")\n return true;\n else\n {\n if(window.confirm(\"This package is intended for Beonex Communicator 0.6 only.\\nWould you like to download \" + installName + \"?\"))\n gotoInstallPage();\n return false;\n }\n }\n else\n {\n alert(\"Fatal error: Bug on Website\");\n return false;\n }\n}", "saveDocument(window, getSavePath) {\n this.getDocumentContents(window, (data) => {\n const contents = JSON.stringify(data);\n const document = this.getDocumentByWindow(window);\n\n const saveFile = (fileName, contents) => {\n fs.writeFile(fileName, contents, (err) => {\n if (err) {\n alert(err.message);\n }\n\n this.setWindowEditStatus(window, false);\n });\n };\n\n if (document.fileName && fs.existsSync(document.fileName)) {\n saveFile(document.fileName, contents);\n } else {\n getSavePath(window, (fileName) => {\n // TODO: Check if fileName exists -- when clicking cancel on save dialog it is undefined\n const basename = path.basename(fileName);\n saveFile(fileName, contents);\n this.setWindowFilename(window, fileName);\n window.setRepresentedFilename(basename);\n window.setTitle(basename);\n });\n }\n });\n }", "function save() {\n\t\t$$invalidate(1, excluded_files = allExcludedFiles());\n\t\tplugin.settings.set({ exluded_filename_components });\n\t}", "function CheckVersion() {\n \n}", "static canSave(){\n\t\tif(this.clearLevelFileLater || this.saving || this.writing || !this.needsSave){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\telse{\n\t\t\treturn this.levelFile != undefined;\n\t\t}\n\t}", "function localStorageSupport() {\r\n return typeof Storage !== 'undefined';\r\n}" ]
[ "0.6255532", "0.57877773", "0.57870805", "0.57688266", "0.5761578", "0.5759723", "0.57472", "0.57296425", "0.57270783", "0.572517", "0.56940734", "0.56857806", "0.56829935", "0.5672152", "0.5658792", "0.5650534", "0.5635586", "0.563379", "0.55685383", "0.5513384", "0.5413848", "0.53167963", "0.53137726", "0.5310372", "0.53059584", "0.5247251", "0.5234697", "0.5195662", "0.51904315", "0.5129567", "0.51285905", "0.51191497", "0.5118797", "0.51071125", "0.5097943", "0.50957817", "0.50874734", "0.5071923", "0.50551766", "0.5055136", "0.50522494", "0.5051939", "0.5051939", "0.5028038", "0.50095594", "0.49942556", "0.49789235", "0.49708465", "0.49556652", "0.49517477", "0.49481574", "0.49421304", "0.49376893", "0.4933554", "0.4910455", "0.4902266", "0.48971373", "0.48927242", "0.48860133", "0.4885078", "0.48802242", "0.48654205", "0.48607448", "0.48459122", "0.484159", "0.4833734", "0.48226398", "0.4814323", "0.4814323", "0.48132324", "0.48120594", "0.48095432", "0.48081374", "0.48075518", "0.47880942", "0.47880432", "0.47852907", "0.4775973", "0.4769171", "0.4756632", "0.4755648", "0.47517627", "0.47496146", "0.47496143", "0.47496143", "0.47462058", "0.47460026", "0.47383833", "0.47303194", "0.47289324", "0.4726996", "0.4724693", "0.4719145", "0.47171795", "0.47142395", "0.47086984", "0.4705495", "0.47035682", "0.47015652", "0.46944636" ]
0.7640485
0
Grabs and sets number of lines from slider
function setL(value) { document.getElementById("valueL").innerHTML = value; lines = parseInt(value); adjustMines(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function setLineWidth() {\r\n\t\tlineWidth = $(this).attr('data-size');\t//choix d'une épaisseur prédéfinie\r\n\t\t$range.val(lineWidth);\t//mise à jour de l'affichage sur la réglette\r\n\t}", "function setNumberLineCharts( i ) {\n config.lines = (config.lines = ( i > 0 ) ? i : 1);\n }", "function update_slider(value) {\n d3.select(\"#barcode\").select(\"line\")\n .attr(\"x1\", x(value)) // we map the slider value to the x axis\n .attr(\"x2\", x(value))\n}", "function updateLineWidth(width) { \n // Clamp the line width\n line_width = Math.min(Math.max(width, min_line_width), max_line_width);\n\n // Update range input values\n document.getElementById('line_width').value = line_width;\n document.getElementById('line_width_context').value = line_width;\n\n // Update previews\n var preview = document.getElementById('line_preview');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n preview = document.getElementById('line_preview_context');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n\n // Update cursor\n var cursor = document.getElementById('cursor');\n cursor.style.width = line_width + \"px\";\n cursor.style.height = line_width + \"px\";\n}", "function changeNumberImg(value) {\n count = count + value;\n showSlide();\n }", "function setLineNum(num)\r\n{\r\n var box1 = document.getElementById('lineBox1');\r\n var box2 = document.getElementById('lineBox2');\r\n if(box1 == null || box2 == null)\r\n return;\r\n if(lastPick == null)\r\n {\r\n box1.value = num;\r\n }\r\n else if(lastPick >= num)\r\n {\r\n box1.value = num;\r\n box2.value = lastPick;\r\n }\r\n else if(lastPick < num)\r\n {\r\n box1.value = lastPick;\r\n box2.value = num;\r\n }\r\n lastPick = num;\r\n addButtonEnable();\r\n}", "function updateLines(){\n showLines.innerHTML = ++lineCounter;\n nextLevel(); \n}", "function createPsizeSliders(){\n\n\tGUIParams.partsKeys.forEach(function(p,i){\n\t\tvar initialValue = parseFloat(GUIParams.PsizeMult[p]); //I don't *think* I need to update this in GUI; it's just the initial value that matters, right?\n\n\t\tvar sliderArgs = {\n\t\t\tstart: [initialValue], \n\t\t\tconnect: [true, false],\n\t\t\ttooltips: false,\n\t\t\tsteps: [0.0001],\n\t\t\trange: { //reset below\n\t\t\t\t'min': [0],\n\t\t\t\t'max': [initialValue]\n\t\t\t},\n\t\t\tformat: wNumb({\n\t\t\t\tdecimals: 4\n\t\t\t})\n\t\t}\n\n\t\tvar slider = document.getElementById(p+'_PSlider');\n\t\tvar text = [document.getElementById(p+'_PMaxT')];\n\t\tvar varToSet = [initialValue, \"PsizeMult\",p];\n\t\tvar varArgs = {'f':'setViewerParamByKey','v':varToSet};\n\n\t\tcreateSlider(slider, text, sliderArgs, varArgs);\n\n\t\t//reformat\n\t\tw = parseInt(d3.select('#'+p+'_PSlider').style('width').slice(0,-2));\n\t\td3.select('#'+p+'_PSlider').select('.noUi-base').style('width',w-10+\"px\");\n\t});\n\n}", "function setUpLineSliders() {\r\n //\r\n // set up vertical slider on line chart\r\n $(\"#vertical-line-slider-range\").slider({\r\n orientation: \"vertical\",\r\n range: true,\r\n disabled: true,\r\n min: aleph.yMain.domain()[0],\r\n max: aleph.yMain.domain()[1],\r\n values: [aleph.yMain.domain()[0], aleph.yMain.domain()[1]],\r\n slide: function (event, ui) {\r\n // document.getElementById(\"line-reset-axes\").disabled = false;\r\n d3.selectAll(\".aleph-reset\").classed(\"aleph-hide\", false);\r\n\r\n d3.selectAll(\".aleph-yAxisTitle\").html(\r\n \"Number of UK Population (between \" +\r\n numberWithCommas(ui.values[0]) +\r\n \" to \" +\r\n numberWithCommas(ui.values[1]) +\r\n \")\"\r\n );\r\n\r\n // update yMain domain\r\n aleph.yMain.domain([ui.values[0], ui.values[1]]);\r\n\r\n // update definition of y-axis domain after slider change ..\r\n d3.selectAll(\".axis.axis--y.mainAxis\").call(d3.axisLeft(aleph.yMain));\r\n d3.selectAll(\".line.mainline\").attr(\"d\", aleph.mainline);\r\n d3.selectAll(\".aleph-Line-Vertex-Marker-Circles\").attr(\r\n \"cy\",\r\n function (d) {\r\n return (\r\n aleph.margin.line[aleph.windowSize].top +\r\n aleph.yMain(d[aleph.lineChartyAxisType])\r\n );\r\n }\r\n );\r\n\r\n d3.selectAll(\".aleph-yAxisTicks\").remove();\r\n\r\n // draw tick grid lines extending from y-axis ticks on axis across scatter graph\r\n var yticks = d3.selectAll(\".axis.axis--y.mainAxis\").selectAll(\".tick\");\r\n yticks\r\n .append(\"svg:line\")\r\n .attr(\"class\", \"aleph-yAxisTicks\")\r\n .attr(\"y0\", 0)\r\n .attr(\"y1\", 0)\r\n .attr(\"x1\", 0)\r\n .attr(\r\n \"x2\",\r\n svgWidth -\r\n aleph.margin.line[aleph.windowSize].left -\r\n aleph.margin.line[aleph.windowSize].right\r\n );\r\n\r\n var topBottom = d3\r\n .selectAll(\".ui-slider-handle.ui-corner-all.ui-state-default.top\")\r\n .style(\"bottom\");\r\n\r\n var bottomBottom = d3\r\n .selectAll(\".ui-slider-handle.ui-corner-all.ui-state-default.bottom\")\r\n .style(\"bottom\");\r\n\r\n d3.selectAll(\".slider-label.slider-label-movable-top\")\r\n .style(\"bottom\", topBottom)\r\n .text(numberWithCommas(ui.values[1]) + \" -\");\r\n\r\n d3.selectAll(\".slider-label.slider-label-movable-bottom\")\r\n .style(\"bottom\", bottomBottom)\r\n .text(numberWithCommas(ui.values[0]) + \" -\");\r\n },\r\n });\r\n\r\n // d3.selectAll(\".slider-label.slider-label-fixed-top\").text(\r\n // numberWithCommas(numberWithCommas(aleph.yMain.domain()[1]))\r\n // );\r\n d3.selectAll(\".slider-label.slider-label-fixed-top\").text(function () {\r\n if (aleph.lineChartyAxisType == \"counts\") {\r\n return numberWithCommas(aleph.yMain.domain()[1]);\r\n } else {\r\n return aleph.yMain.domain()[1].toFixed(1);\r\n }\r\n });\r\n\r\n d3.selectAll(\".slider-label.slider-label-fixed-bottom\").text(\r\n numberWithCommas(numberWithCommas(aleph.yMain.domain()[0]))\r\n );\r\n\r\n //\r\n //\r\n //\r\n //\r\n // set up vertical slider on line chart\r\n $(\"#horizontal-line-slider-range\").slider({\r\n orientation: \"horizontal\",\r\n range: true,\r\n disabled: true,\r\n min: Number(aleph.years[0]),\r\n max: Number(aleph.years[aleph.years.length - 1]),\r\n values: [aleph.years[0], aleph.years[aleph.years.length - 1]],\r\n slide: function (event, ui) {\r\n // document.getElementById(\"line-reset-axes\").disabled = false;\r\n d3.selectAll(\".aleph-reset\").classed(\"aleph-hide\", false);\r\n\r\n // update yMain domain\r\n aleph.xMain.domain([\r\n aleph.parseDate(ui.values[0]),\r\n aleph.parseDate(ui.values[1]),\r\n ]);\r\n\r\n // update definition of y-axis domain after slider change ..\r\n d3.selectAll(\".axis.axis--x.mainAxis\").call(d3.axisBottom(aleph.xMain));\r\n d3.selectAll(\".line.mainline\").attr(\"d\", aleph.mainline);\r\n d3.selectAll(\".aleph-Line-Vertex-Marker-Circles\").attr(\r\n \"cx\",\r\n function (d) {\r\n return (\r\n aleph.margin.line[aleph.windowSize].left +\r\n aleph.xMain(aleph.parseDate(d.year))\r\n );\r\n }\r\n );\r\n\r\n setTimeout(function () {\r\n var rightLeft = d3\r\n .selectAll(\".ui-slider-handle.ui-corner-all.ui-state-default.right\")\r\n .style(\"left\");\r\n\r\n var leftleft = d3\r\n .selectAll(\".ui-slider-handle.ui-corner-all.ui-state-default.left\")\r\n .style(\"left\");\r\n\r\n d3.selectAll(\".slider-label.slider-label-movable-left\")\r\n .style(\"left\", leftleft)\r\n .text(ui.values[0]);\r\n\r\n d3.selectAll(\".slider-label.slider-label-movable-right\")\r\n .style(\"left\", rightLeft)\r\n .text(ui.values[1]);\r\n }, 5);\r\n },\r\n });\r\n\r\n // // call function to append ticks to slider bar.\r\n // setSliderTicks(\"#horizontal-line-slider-range\");\r\n\r\n d3.select(\"#horizontal-line-slider-range\").style(\r\n \"width\",\r\n svgWidth -\r\n aleph.margin.line[aleph.windowSize].left -\r\n aleph.margin.line[aleph.windowSize].right +\r\n \"px\"\r\n );\r\n\r\n d3.selectAll(\".slider-label.slider-label-fixed-left\").text(\r\n aleph.formatDate(aleph.xMain.domain()[0])\r\n );\r\n d3.selectAll(\".slider-label.slider-label-fixed-right\").text(\r\n aleph.formatDate(aleph.xMain.domain()[1])\r\n );\r\n\r\n d3.selectAll(\".line-chart-slider-range-container\").style(\r\n \"width\",\r\n function () {\r\n return aleph.margin.line[aleph.windowSize].left - 90 + \"px\";\r\n }\r\n );\r\n\r\n d3.selectAll(\"#horizontal-line-slider-range\").style(\r\n \"left\",\r\n aleph.margin.line[aleph.windowSize].left + \"px\"\r\n );\r\n\r\n return;\r\n}", "function howManyStickers(numberOfLines) { // Write this function\n return numberOfLines*numberOfLines*6;\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 setNumbers() {\n NUMBERS.CAROUSEL_WIDTH = SELECTORS.$carousel.width();\n NUMBERS.SLIDE_WIDTH = NUMBERS.CAROUSEL_WIDTH - (4 * NUMBERS.SLIDE_GUTTER);\n NUMBERS.SLIDE_COUNT = SELECTORS.$slides.length;\n NUMBERS.WRAPPER_WIDTH = (NUMBERS.SLIDE_WIDTH + NUMBERS.SLIDE_GUTTER) * NUMBERS.SLIDE_COUNT;\n STATE.RESIZE_OFFSET = (NUMBERS.SLIDE_WIDTH * (STATE.CURRENT_SLIDE - 1)) + (NUMBERS.SLIDE_GUTTER * (STATE.CURRENT_SLIDE - 1)) - NUMBERS.SLIDE_GUTTER;\n\n return this;\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 processLineNumbers() {\n if ($(\"#editorDiv\").length > 0) {\n var lineHeight = parseInt($(\"#editorDiv\").css('line-height'));\n var scrollHeight = $(\"#editorDiv\")[0].scrollHeight;\n var numberOfLines = scrollHeight / lineHeight;\n\n for (var i = 1; i < numberOfLines; i++) {\n $('.line-numbers').append('<p>' + i + '</p>');\n //console.log(i);\n }\n\n //set width of line-numbers bar dynamically\n var maxWidth = 0;\n var widestSpan = null;\n var $element;\n $('#lineNumbers p').each(function () {\n $element = $(this);\n if ($element.width() > maxWidth) {\n maxWidth = $element.width();\n widestSpan = $element;\n }\n });\n\n var lineNumberExtraWidthPadding = 10;\n //console.log('widest width line numbers ' + maxWidth);\n $('#lineNumbers').css('width', maxWidth + lineNumberExtraWidthPadding + 'px');\n //$('#editorDiv').css('padding-left', maxWidth + lineNumberExtraWidthPadding + 'px');\n $('.editor-wrapper').css('padding-left', maxWidth + lineNumberExtraWidthPadding + 'px');\n }\n}", "@action\n setStartingCount(ev) {\n const count = Number(ev.currentTarget.value);\n this.startingCount = count;\n }", "function createSliderNum() {\n var group = createDiv('');\n group.position(width + 10, height / 2);\n sliderNum = createSlider(2, 100, 8, 1);\n sliderNum.parent(group);\n var label = createSpan('Number of Balls');\n label.parent(group);\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}", "function drawslider(totalSeg, countSeg){\n var create_progress = Math.round((countSeg * 100)/totalSeg);\n document.getElementById(\"sliderbar\").style.width = create_progress+'%';\n document.getElementById(\"create_progress\").innerHTML = 'Creating summary...' + create_progress+'%';\n }", "function loadSlider() {\n $( \"#slider\" ).slider({\n value:2,\n min: 2,\n max: clusterKeys.length+1,\n step: 1,\n animate: \"fast\",\n slide: function( event, ui ) {\n var k = ui.value;\n $( \"#numClusters\" ).val(k);\n clusterize(k);\n loadCentroids(k);\n }\n});\n $( \"#numClusters\" ).val($( \"#slider\" ).slider( \"value\" ) );\n}", "function setStepSize(value){\n stepSize = parseInt(value);\n }", "function adjustMines() {\n maxMines = (lines*collumns) - 1;\n \n document.getElementById(\"mineSlider\").setAttribute(\"max\", maxMines);\n document.getElementById(\"valueMax\").innerHTML = maxMines;\n \n if (mines > maxMines) {\n document.getElementById(\"valueM\").innerHTML = maxMines;\n mines = parseInt(maxMines);\n }\n}", "function reloadSlider() {\n process.nextTick(() => {\n slider.resize();\n setTotalDots(slider.details().size);\n });\n }", "function change_thickness() {\n thickness = document.getElementById(\"slider\").value;\n ctx.lineWidth = thickness;\n }", "setPanelCount(c) {\n this.panelWidth = this.width / c;\n }", "function setNewSlidesNumbers() {\n if (!slider.options.reverse) {\n nextSlide = increaseNumber(nextSlide);\n currentSlide = decreaseNumber(nextSlide);\n } else {\n nextSlide = decreaseNumber(nextSlide);\n currentSlide = increaseNumber(nextSlide);\n }\n }", "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 updateSliders() {\n lengthLabel.html(\"Length: \" + lengthSlider.value());\n tempLabel.html(\"Temperature: \" + tempSlider.value());\n}", "function goalLinesOpen()\n{\n goalLineDifference = goalLineDifference + 1;\n}", "set rows(value) {\n Helper.UpdateInputAttribute(this, 'rows', value);\n }", "function updateSlider(slideAmount) {\n removegrid(gridSize);\n gridSize = (slideAmount ** 2);\n setGridSize(slideAmount);\n}", "function setIncidentsSlider() {\n var handleA = $(\".incidents-rate-slider.lower-handle\");\n var handleB = $(\".incidents-rate-slider.upper-handle\");\n\n $('.incidents-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(1000);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxIncidents = ui.value\n }\n else {\n handleA.text(ui.value);\n minIncidents = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 1000,\n step: 10,\n values: [0, 1000],\n animate: true\n });\n}", "function updateXTickCount() {\n // console.log(\"data -> \" + JSON.stringify(data));\n // console.log(\"data.length -> \" + data.length);\n // console.log(\"(.77 * window.innerWidth - 280) / 15 -> \" + (.77 * window.innerWidth - 280) / 15);\n // console.log((Math.floor(data.length / ((.77 * window.innerWidth - 280) / 15))) - 1);\n setXTickInterval((Math.floor(data.length / ((.77 * window.innerWidth - 280) / 15))) - 1);\n }", "function sizeScrollbar() {\nvar remainder = scrollContent.width() - scrollPane.width();\nvar proportion = remainder / scrollContent.width();\nvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\nscrollbar.find( \".ui-slider-handle\" ).css({\nwidth: handleSize,\n\"margin-left\": -handleSize / 2\n});\nhandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "function numberLine(data){\n\tline = data.nb;\n\tdocument.getElementById(\"NombreTournage\").innerHTML=line;\n}", "function updateLineSelectors() {\n controller.setButtonColour(LaunchPadMini.buttons.RIGHT_COLUMN[0], LaunchPadMini.constants.COLOURS.GREEN);\n controller.setButtonColour(LaunchPadMini.buttons.RIGHT_COLUMN[1], LaunchPadMini.constants.COLOURS.GREEN);\n\n if (state.activeLines === MIN_LINES) {\n controller.setButtonColour(LaunchPadMini.buttons.RIGHT_COLUMN[0], LaunchPadMini.constants.COLOURS.RED);\n } else if (state.activeLines === MAX_LINES) {\n controller.setButtonColour(LaunchPadMini.buttons.RIGHT_COLUMN[1], LaunchPadMini.constants.COLOURS.RED);\n }\n }", "function setRowsCount() {\n\tvar row_count = parseInt(showPrompt('Set Count Of Rows ?','Set number of rows'));\n\tif(!isNaN(row_count) && row_count > 0 )\n\t\tSheeter().setRows(row_count);\n}", "function resetSlider(bins){\n document.getElementById(\"theSlider\").value = bins;\n }", "function changeSlider(index) {\n sliderItems[currentSlider].classList.remove('active');\n sliderItems[index].classList.add('active');\n\n dots[currentSlider].classList.remove('active');\n dots[index].classList.add('active');\n currentSlider = index;// điều kiện này có thể thay thế cho currentSlider++;\n number.innerHTML = (index + 1).toString().padStart(2, '0');\n\n}", "function updateSliders() {\n select('#length').html(lengthSlider.value())\n select('#temperature').html(tempSlider.value())\n }", "function onUpdateSliderSize()\n\t{\n\t\txslider.width = xslider.hide? 0: (w - (yslider.hide? 0 : t)); \n\t\tyslider.height = yslider.hide? 0 : (h - (xslider.hide? 0 : t)); \t\n\t}", "updateSlide(rangelocked)\n\t{\n\t\tif (MarkerSlider._rangeline_pos === null){\n\t\t\treturn -1;\n\t\t}\n\n\t\tvar offs = MarkerSlider._config.I_slider_offset;\n\n\t\tSliderHandler.i_slider_top_y = MarkerSlider._last_input1_posy - MarkerSlider._rangeline_pos.y;\n\t\tSliderHandler.i_slider_length= MarkerSlider._last_input2_posy - MarkerSlider._last_input1_posy;\n\n\t\tvar top_slider = [-offs, 0 ],\n\t\t\tbot_slider = [-offs, SliderHandler.i_slider_length];\n\n\t\tMarkerSlider._slwin_group.setY(SliderHandler.i_slider_top_y);\n\n\t\tMarkerSlider._slwin_group.line.setPoints([\n\t\t\t-MarkerSlider._style.bevel+ top_slider[0] + offs*2, top_slider[1] + MarkerSlider._style.bevel,\n\t\t\ttop_slider[0], top_slider[1] + MarkerSlider._style.bevel,\n\t\t\tbot_slider[0], bot_slider[1] + MarkerSlider._style.bevel,\n\t\t\t-MarkerSlider._style.bevel + bot_slider[0] + offs*2, bot_slider[1] + MarkerSlider._style.bevel\n\t\t]);\n\n\t\tvar diff = MarkerSlider._last_input2_ind - MarkerSlider._last_input1_ind;\n\n\t\tif (diff > Resize.numVisibleHaplos){\n\t\t\tdiff = \"[\" + diff + \"]\";\n\t\t}\n\t\tif (MarkerData.hasGPData){\n\t\t\tdiff += \" (\" + (\n\t\t\t\t\t\"\"+(MarkerData.gp_array[ MarkerSlider._last_input2_ind ] - MarkerData.gp_array[ MarkerSlider._last_input1_ind ])\n\t\t\t\t\t+\"\").slice(0,5) + \" cM)\"\n\t\t}\n\n\t\tvar strokeWidth = 1;\n\t\tif (rangelocked){\n\t\t\tstrokeWidth = 3;\n\t\t}\n\t\tMarkerSlider._slwin_group.line.setStrokeWidth(strokeWidth);\n\t\tMarkerSlider._sl_input1.line.setStrokeWidth(strokeWidth);\n\t\tMarkerSlider._sl_input2.line.setStrokeWidth(strokeWidth);\n\n\t\tMarkerSlider._slwin_group.message.setText( diff );\n\t\tMarkerSlider._slwin_group.message.setY( (SliderHandler.i_slider_length/2) - HAP_VERT_SPA/2 );\n\t}", "function editCounterWidgets(){\n nbWidgets = $('#ad_images div.form-group').length;\n\n $('#widgets_counter').val(nbWidgets);\n}", "function setLineSize(intLineSize){\r\n\tif (intLineSize == 2){\r\n\t\tintNumberOfColumns = 80; // 24X80\r\n\t\tintNumberOfRows = 24;\r\n\t} else if (intLineSize == 3){\r\n\t\tintNumberOfColumns = 80; // 32X80\r\n\t\tintNumberOfRows = 32;\r\n\t} else if (intLineSize == 4){\r\n\t\tintNumberOfColumns = 80; // 43X80\r\n\t\tintNumberOfRows = 43;\r\n\t} else if (intLineSize == 6){\r\n\t\tintNumberOfColumns = 132; // 27X132\r\n\t\tintNumberOfRows = 27;\r\n\t} else if (intLineSize == 5){\r\n\t\tintNumberOfColumns = 132; // 24X132\r\n\t\tintNumberOfRows = 24;\r\n\t}else if (intLineSize == 17){\r\n\t\tintNumberOfColumns = 160; // 62X160\r\n\t\tintNumberOfRows = 62;\r\n\t}\r\n\tnrtc = intNumberOfRows*intNumberOfColumns;\r\n}", "function dragSlider(values) {\n setProgress(parseInt(values[0]))\n }", "function adjustSliderValue(){\n if(scroll_value[0]>scroll_value[1]){\n scroll_value[1]=[scroll_value[0], scroll_value[0]=scroll_value[1]][0];\n index==0?index=1:index=0;\n }\n refreshUI(true);\n}", "function initStepCounter() {\n currentStep = 0;\n var totSteps = document.getElementById(\"totalSteps\");\n var counter = document.getElementById(\"currentStep\");\n\n counter.innerHTML = currentStep;\n totSteps.innerHTML = changes.length;\n \n\n}", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "function viewport_line(e){\n\tsettings.colors.line=e.srcElement.value;\n\tvp.line=settings.colors.line;\t\n}", "function setLine(tab){\n var tabWidth = $(tab).outerWidth();\n var tabPos = $(tab).position();\n $(\".indicator-line\").css({\n \"width\": tabWidth,\n \"left\": tabPos.left\n });\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 }", "_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 setSliderTicks(){\n\t var $slider = $('#slider');\n\t var max = $slider.slider(\"option\", \"max\"); \n\t if (max > 1) {\n\t \tvar spacing = 100 / (max -1);\n\t } else {\n\t \tvar spacing = 50;\n\t }\n\n\t $slider.find('.ui-slider-tick-mark').remove();\n\t for (var i = 0; i < max ; i++) {\n\t $('<span class=\"ui-slider-tick-mark\"></span>').css('left', (spacing * i) + '%').appendTo($slider); \n\t }\n\t}", "function setTotalPoints(num) {\n totalPoints = num;\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 }", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "function setupSliderWidth() {\n // resets sliderElement\n sliderElement.style.width = '0px';\n\n var totalWidth = 0;\n elements.forEach(function (element, index) {\n slideWidth = element.offsetWidth;\n totalWidth = totalWidth += slideWidth;\n });\n sliderElement.style.width = totalWidth + 'px';\n }", "function sizeScrollbar() {\r\n\t\t\tvar remainder = scrollContent.width() - scrollPane.width();\r\n\t\t\tvar proportion = remainder / scrollContent.width();\r\n\t\t\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\r\n\t\t\tscrollbar.find( \".ui-slider-handle\" ).css({\r\n\t\t\t\twidth: handleSize,\r\n\t\t\t\t\"margin-left\": -handleSize / 2\r\n\t\t\t});\r\n\t\t\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\r\n\t\t}", "function changeSliderSize() {\n\t\t\twrapperA.css({\n\t\t\t\twidth: itemsA.length * (sliderWidth + 2 * sliderMargin) + \"vw\",\n\t\t\t\tmarginLeft: getWrapperMargin() + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsA.css({\n\t\t\t\twidth: sliderWidth + \"vw\",\n\t\t\t\theight: sliderHeight + \"em\",\n\t\t\t\tmargin: \"0 \" + sliderMargin + \"vw\"\n\t\t\t});\n\t\t}", "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location bug\n\n this.llabel.html(numberWithCommas(min))\n this.rlabel.html(numberWithCommas(max))\n }", "_updateLevelLinesBox() {\n\t\tthis.levelLinesBox.changeText('LEVEL: ' + this.level + '\\nLINES: ' + this.lines);\n\t}", "function updateHandles(slider) {\n slider.on('update', () => {\n updateSliderValue(slider)\n })\n}", "function changeDimension() {\n document.querySelector('paper-slider').addEventListener('change', function (event) {\n\n minor = event.target.value < graphDimension\n console.log('minor: ', minor)\n graphDimension = event.target.value;\n console.log(event.target.value);\n });\n}", "update() {\n\t\tthis.slideWidth = this.slides[0].offsetWidth;\n\n\t\tthis.slideWidth = parseInt(this.slideWidth, 10);\n\t\tthis.startPos = 2 * (this.slideWidth + this.gap) + this.gap;\n\t\tthis.scrollRight = this.slider.scrollWidth - this.slider.offsetWidth;\n\t\tthis.endPos = this.scrollRight - this.startPos;\n\t\t\n\n\t}", "function NumberLines(field)\n{\n var short_names;\n if (short_names = document.getElementById(field))\n {\n var new_text = \"\";\n var old_text = short_names.value;\n // remove first number\n old_text = old_text.replace(/^\\s*\\d+\\.[ \\t]*/m, \"\");\n // remove trailing lines\n old_text = old_text.replace(/\\s+$/m, \"\");\n // split by lines (and remove other numbers)\n var lines = old_text.split(/[ \\t]*[\\r\\n]+[ \\t]*\\d*\\.?[ \\t]*/);\n // add new numbers\n for (var i = 0; i < lines.length; ++i)\n {\n if (lines[i])\n {\n new_text += (i+1) + \".\" + lines[i] + \"\\n\";\n }\n }\n short_names.value = new_text;\n }\n}", "function sizeScrollbar() {\n\tvar remainder = scrollContent.width() - scrollPane.width();\n\tif(remainder < 1){\n\t\t//remainder = scrollContent.width();\n\t\tscrollbar.find( \".ui-slider-handle\" ).hide();\n\t}else{\n\t\tscrollbar.find( \".ui-slider-handle\" ).show();\n\t}\n\tvar proportion = remainder / scrollContent.width();\n\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\n\tscrollbar.find( \".ui-slider-handle\" ).css({\n\t\twidth: handleSize,\n\t\t\"margin-left\": -handleSize / 2\n\t});\n\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "increaseComicsNumber(){\n this.limit += 6;\n }", "function createSliders(arr) {\n\n for(i = 0; i < arr.length; i++) {\n arr[i].style.height = '20px';\n arr[i].style.width = '30%';\n noUiSlider.create(arr[i], {\n start: [ 0, ], // Handle start position\n margin: 20, // Handles must be more than '20' apart\n direction: 'ltr', // Put '0' at the bottom of the slider\n orientation: 'horizontal', // Orient the slider vertically\n behaviour: 'tap-drag', // Move handle on tap, bar is draggable\n range: { // Slider can select '0' to '10'\n 'min': 1,\n 'max': 10\n }\n });\n arr[i].firstElementChild.value = 1;\n }\n arr[1].firstElementChild.value = 0.2;\n arr[2].firstElementChild.value = 0.1;\n\n}", "update() {\n const items = this.carouselService.settings.items;\n let start = this.carouselService.current(), end = start + items;\n if (this.carouselService.settings.center) {\n start = items % 2 === 1 ? start - (items - 1) / 2 : start - items / 2;\n end = items % 2 === 1 ? start + items : start + items + 1;\n }\n this.carouselService.slidesData.forEach((slide, i) => {\n slide.heightState = (i >= start && i < end) ? 'full' : 'nulled';\n });\n }", "function sizeScrollbar(){\n\t\tvar remainder = scrollContent.width() - scrollPane.width();\n\t\tvar proportion = remainder / scrollContent.width();\n\t\tvar handleSize = scrollPane.width() - (proportion * scrollPane.width());\n\t\tscrollbar.find('.ui-slider-handle').css({\n\t\t\twidth: handleSize,\n\t\t\t'margin-left': -handleSize/2\n\t\t});\n\t\thandleHelper.width('').width( scrollbar.width() - handleSize);\n\t}", "function setCount() {\n countNum = parseInt(imgWheel.dataset.count);\n if(arguments[0] == \"left\") { //click on the left button\n if (countNum < 14) {\n countNum = countNum + 1;\n } else {\n countNum = 1;\n }\n } else if (arguments[0] == \"right\") { // click on the left button\n if (countNum > 1) {\n countNum = countNum - 1; \n } else {\n countNum = 14;\n }\n }\n imgWheel.dataset.count = countNum; //set new value to the data-count\n console.log(countNum);\n return countNum;\n }", "function setUpPyramidSlider() {\r\n // Setter\r\n\r\n $(\"#pyramid-slider\").slider(\"option\", \"value\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\"option\", \"min\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\r\n \"option\",\r\n \"max\",\r\n Number(aleph.years[aleph.years.length - 1])\r\n );\r\n\r\n return;\r\n} // end function setUpPyramidSlider", "function setupUI()\r\n{\r\n textSize(12)\r\n constraintsSlider = createSlider(1, 4, 1, 0.1)\r\n constraintsSlider.style('width', '300px')\r\n constraintsSlider.position(50, sliderY)\r\n\r\n desiredXSlider = createSlider(100, 600, desiredX, 1)\r\n desiredXSlider.style('width', '300px')\r\n desiredXSlider.position(380, sliderY)\r\n}", "function linesComing() {\n // This will work only when game is not paused or over.\n if (checkGamePause === false) {\n\n containerG.append(\"<div id='line\" + lineCount + \"' class='line'></div>\");\n var lineCreated = $(\"#line\" + lineCount);\n scale =1;\n if(availableHeight<1000)\n {\n scale = 0.7;\n }\n lineCreated.css(\"transform\",\"scale(\"+scale+\")\");\n lineCreated.moveTo(180).speed(lineSpeed).css(\"top\", \"-5px\");\n\n lineCount++;\n }\n }", "_changeSliderSize() {\n\t\t\t\tlet width = this.model.get('width'),\n\t\t\t\t\theight = this.model.get('height');\n\n\t\t\t\tthis.$el.css({width, height});\n\t\t\t}", "function thicknessExperiment(scope){\n\t/** Setting the slider value to the label variable */\t\n\tthickness = scope.thickness_num = scope.thicknessNum;\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}", "update() {\n\t\tthis.slideWidth = this.slides[0].offsetWidth;\n\t\tthis.slideWidth = parseInt(this.slideWidth, 10);\n\t\tthis.scrollRight = this.slider.scrollWidth - this.slider.offsetWidth;\n\t\tlet numberCards = this.slides.length;\n\t\tlet numberCardsDisplay = getCssVariable('--number-cards')\n\t\tlet sliderWidth = numberCardsDisplay * this.slideWidth;\n\t\t// calculate and set carousel width based on 80% +/- whats needed to fit\n\t\tlet width = document.body.clientWidth * 0.8\n\t\tlet ncards = width / this.slideWidth;\n\t\twidth = Math.round(ncards * this.slideWidth);\n\t\twidth = width.toString(10) - this.gap + 'px';\n\t\tthis.slider.scrollLeft = this.gap; // initial scroll left position\n\t\tsetCssVariable('--carousel-width', width);\n\t\t// save currently selected card number\n\t\tlet urlPath = window.location.pathname;\n\t\tthis.selected = urlPath.substring(urlPath.lastIndexOf('/') + 1)\n\t\t\n\t}", "function update_progress(idx){\r\n\t\t$('.step_nb').text(idx +'/'+list_elem_count);\r\n\t}", "function sizeScrollbar() {\n var remainder = $scrollContent.width() - $scrollPane.width();\n var proportion = remainder / $scrollContent.width();\n var handleSize = $scrollPane.width() - (proportion * $scrollPane.width());\n $scrollbar.find(\".ui-slider-handle\").css({\n width: handleSize,\n \"margin-left\": -handleSize / 2\n });\n handleHelper.width(\"\").width($scrollbar.width() - handleSize);\n }", "function scroll_number(){\n\t\t$('.numbers_line li').each(function() {\n\t\t\tvar tut = $(this).children('h2');\n\t\t\tvar tut_val = tut.attr('value');\n\t\t\ttut.animate({ num: tut_val - 0 }, {\n\t\t\t\tduration: 5000,\n\t\t\t\tstep: function (num){\n\t\t\t\t\tthis.innerHTML = (num + 0).toFixed(0)\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "async function slider () {\n headLine.textContent = heroHeadlines[0];\n for (var e = 0; e < x; e--) {\n await stageOne();\n await stageOne1();\n await stageOne2();\n await stageOne3();\n await stageOne4();\n await stageOne5();\n await stageOne6();\n await stageOne7();\n await stageOne8();\n await stageOne9();\n await stageTwo(count, sec);\n await changeHeadline(count, heading);\n await stageOne10();\n await stageOne11();\n await stageOne12();\n await stageOne13();\n await stageOne14();\n await stageOne15();\n await stageOne16();\n await stageOne17();\n await stageOne18();\n await stageThree();\n count++;\n if (count === end) {\n count = 0;\n } else {\n count = count;\n }\n }\n }", "function myFunction() {\n document.getElementById(\"nbOfPoint\").innerHTML = document.getElementById(\"sliderPoi\").value;\n}", "function setLineLength() {\n let speed = [14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 2, 2];\n let zoom = map.getZoom();\n let length = speed[zoom - 1];\n return length;\n}", "function sliderProps() {\n if(g.diagram == \"P-V-diagram\"){\n slider.setAttribute(\"min\",\"275\");\n slider.setAttribute(\"max\",\"750\");\n slider.setAttribute(\"step\",\"5\");\n slider.value = \"500\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Temperature (K)\";\n } else {\n slider.setAttribute(\"min\",\"0.2\");\n slider.setAttribute(\"max\",\"25\");\n slider.setAttribute(\"step\",\"0.2\");\n slider.value = \"9\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Pressure (MPa)\";\n }\n}", "function startListCount() {\n active = 0;\n previous = active - 1;\n next = active + 1;\n\n s_imageElements[active].classList.add(state.slideShow.active);\n s_imageElements[next].classList.add(state.slideShow.next);\n s_markerElements[active].classList.add(state.markers.active);\n\n lastIndex = s_imageElements.length - 1;\n }", "function brushLine(x,y,px,py) {\n var dis = dist(x,y,px,py);\n if (dis > 0) {\n var step = sidebar.sliders[1].val/dis;\n var myx,myy,t = 0;\n for (var i = 0; i <= dis; i+= step/5) {\n t = max(i / dis);\n myx = mouseX + (pmouseX-mouseX) * t;\n myy = mouseY + (pmouseY-mouseY) * t;\n mainBrush.show(myx,myy);\n }\n } else {\n mainBrush.show(x,y);\n }\n}", "function updateHorizontalLabel() {\n // Get access to nodes/widgets we need to get/set values\n var hSlider = registry.byId(\"hslider\");\n var label = dom.byId(\"decValue\");\n // Update label\n label.innerHTML = hSlider.get(\"value\");\n params.defaultBreaks = [ hSlider.value / 60 ];\n if (clickpoint) {\n mapClickHandler(clickpoint);\n }\n }", "getRealCurrentLineNb() {\n return this.currentLineNb + this.offset;\n }", "updateCanvasSize() {\n this.drawLines();\n }", "set_pagecount(n) {\n if (this.pagecount !== n) {\n this.pagecount = n;\n this.draw();\n }\n }", "function startLine() {\n picking_photo = false;\n line_started = true;\n updateLabels();\n}", "function showNextLine(lineNum) {\n gState.currHiddenNum = 0;\n showAnswers(lineNum);\n var numsToDrag = gState.allNumsToDrag[lineNum];\n //choose all cuurently shown nums, and 10 more\n var lineToShow = $('.tblQuests2:lt(' + (lineNum + 1) * 10 + ')').removeClass('tdhidden');\n}", "_updateValue () {\n let sliderWidth = this._sliderElement.offsetWidth;\n\n // Calculate the new value\n let { minValue, maxValue } = this._options;\n let percentage = this._xPosition / sliderWidth;\n let value = minValue + (maxValue - minValue) * percentage;\n this.emit(\"update\", value);\n }", "onResize() {\n var sizes = document.getElementById('demogl').getBoundingClientRect();\n\n this.sliders.forEach(function(slider) {\n slider.max = sizes[slider.getAttribute('data-size')];\n this.onSliderChange({ target: slider });\n }, this);\n }", "function updateSliderWidthAndHeight() {\n slider._width = $slider.width();\n slider._height = $slider.height();\n }", "_calcVisibleLines() {\n this._lines.qtMaxVisible = Math.floor(this._matrixHeight / this._cell.heightMin);\n if (this._lines.qtMaxVisible > 3)\n this._lines.qtMinVisible = 3;\n else\n this._lines.qtMinVisible = 1;\n if (this._lines.qtMaxVisible > this._lines.qtTotal)\n this._lines.qtMaxVisible = this._lines.qtTotal;\n if (this._lines.qtMaxVisible < this._lines.qtVisible && this._lines.qtMaxVisible != 0)\n this._lines.qtVisible = this._lines.qtMaxVisible;\n }", "function initialize() {\n setText(initialSliderValue);\n setImage(initialSliderValue);\n computeHolderMargin(initialSliderValue);\n scaleOrHideLabel(initialSliderValue);\n}", "function setSliders() {\n let colorToChange =\n document.querySelector(\"#colorToChange\").style.backgroundColor;\n // console.log(246, colorToChange, typeof colorToChange);\n colorToChange = colorToChange\n .substring(4, colorToChange.length - 1)\n .split(\", \");\n // console.log(250, colorToChange);\n colorToChange = colorToChange.map((elem) => (elem = parseInt(elem)));\n console.log(252, colorToChange);\n const rangeRed = document.querySelector(\"#rangeRed\");\n const rangeGreen = document.querySelector(\"#rangeGreen\");\n const rangeBlue = document.querySelector(\"#rangeBlue\");\n rangeRed.value = colorToChange[0];\n rangeGreen.value = colorToChange[1];\n rangeBlue.value = colorToChange[2];\n console.log(\n 260,\n \"Sliders were set to:\",\n rangeRed.value,\n rangeGreen.value,\n rangeBlue.value\n );\n}" ]
[ "0.7211066", "0.71712977", "0.6696254", "0.66229796", "0.61967367", "0.6099544", "0.6077078", "0.60576355", "0.60437775", "0.6004449", "0.5996762", "0.59542954", "0.5937302", "0.58901674", "0.5865264", "0.5851411", "0.58456063", "0.5828269", "0.58202004", "0.5789066", "0.5757198", "0.575065", "0.574454", "0.57430243", "0.57389927", "0.5718202", "0.5712667", "0.57103705", "0.57065934", "0.56859916", "0.56800455", "0.56737566", "0.5665713", "0.56576055", "0.5651555", "0.5634251", "0.56300306", "0.5626476", "0.5620706", "0.5617106", "0.56109965", "0.5595967", "0.5588055", "0.558375", "0.5567016", "0.5564871", "0.5556511", "0.5551982", "0.5543162", "0.5540936", "0.5512414", "0.5498402", "0.5496594", "0.5489302", "0.54841834", "0.5479262", "0.5478263", "0.54752386", "0.5471195", "0.5467945", "0.5461859", "0.5459896", "0.54582846", "0.54494125", "0.54488707", "0.5442866", "0.54340434", "0.5416553", "0.5412672", "0.5409887", "0.5403994", "0.54029584", "0.54014176", "0.53997433", "0.53810114", "0.53680617", "0.5360006", "0.535971", "0.53509724", "0.5348961", "0.53486025", "0.5346288", "0.53445137", "0.5340955", "0.5338582", "0.5337132", "0.5332592", "0.53204536", "0.5319324", "0.5317111", "0.5316316", "0.53144324", "0.5309508", "0.53093714", "0.5304378", "0.530408", "0.53030646", "0.5302114", "0.5297765", "0.5294289" ]
0.5972167
11
Grabs and sets number of collumns from slider
function setC(value) { document.getElementById("valueC").innerHTML = value; collumns = parseInt(value); adjustMines(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function changeGridSize(){\n gridContainer.innerHTML = ''; //clear grid Container before adding new divs\n let gridSize = parseInt(slider.value,10);\n for (let i=1; i<=Math.pow(gridSize,2); i++){\n addElement();\n\n };\n gridContainer.style[\"grid-template-columns\"] = \"repeat(\" + gridSize + \", 1fr)\";\n}", "function setColumnCount(wall, columnCount) {\n if (!columnCount) return;\n console.log(`set column count: ${columnCount}`);\n \n var width = wall.innerWidth();\n var gap = parseInt(cbcss(wall, \"column-gap\"));\n var columnWidth = Math.floor((width - gap * (columnCount-1)) / columnCount) - 1;\n setColumnWidth(wall, columnWidth);\n\n return columnWidth;\n}", "setPanelCount(c) {\n this.panelWidth = this.width / c;\n }", "function setGridSize(slideAmount){\n let gridSizeCalc = ((containerSize/slideAmount));// calc info = (gridWidth - (borderSize * 2 * numberColumns))/ numberColumns\n \n makeGrid(gridSizeCalc); \n}", "function updateSlider(slideAmount) {\n removegrid(gridSize);\n gridSize = (slideAmount ** 2);\n setGridSize(slideAmount);\n}", "function setupSliderWidth() {\n // resets sliderElement\n sliderElement.style.width = '0px';\n\n var totalWidth = 0;\n elements.forEach(function (element, index) {\n slideWidth = element.offsetWidth;\n totalWidth = totalWidth += slideWidth;\n });\n sliderElement.style.width = totalWidth + 'px';\n }", "_updateSizeRowsCols() {\n const that = this;\n\n that.$.container.removeAttribute('style');\n\n setTimeout(function () {\n if ((that.horizontalScrollBarVisibility === 'disabled' || that.horizontalScrollBarVisibility === 'hidden') && (that.verticalScrollBarVisibility === 'disabled' || that.verticalScrollBarVisibility === 'hidden')) {\n return;\n }\n\n const rectObject = that.getBoundingClientRect();\n\n that.$.container.style.width = rectObject.width + 'px';\n that.$.container.style.height = rectObject.height + 'px';\n }, 0);\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 setWidth(){\n var width = 500/(columnCounter + 1);\n\n for(var i=0; i<=columnCounter; i++){\n for(var j=0; j<columns[i].length; j++) {\n columns[i][j].style.width = (width - 3) + 'px';\n columns[i][j].style.marginLeft = width * i + 'px';\n }\n }\n }", "function setNumbers() {\n NUMBERS.CAROUSEL_WIDTH = SELECTORS.$carousel.width();\n NUMBERS.SLIDE_WIDTH = NUMBERS.CAROUSEL_WIDTH - (4 * NUMBERS.SLIDE_GUTTER);\n NUMBERS.SLIDE_COUNT = SELECTORS.$slides.length;\n NUMBERS.WRAPPER_WIDTH = (NUMBERS.SLIDE_WIDTH + NUMBERS.SLIDE_GUTTER) * NUMBERS.SLIDE_COUNT;\n STATE.RESIZE_OFFSET = (NUMBERS.SLIDE_WIDTH * (STATE.CURRENT_SLIDE - 1)) + (NUMBERS.SLIDE_GUTTER * (STATE.CURRENT_SLIDE - 1)) - NUMBERS.SLIDE_GUTTER;\n\n return this;\n }", "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 hand(event) {\n let x = parseInt(event.target.value);\n console.log(x);\n setRows(x);\n setCols(x);\n rowRef.current = x;\n setGrid(new Array(x).fill(0).map(() => new Array(x).fill(0)));\n }", "function onColumnsClicked(num) {\n LayoutShowcaseState.columns = num;\n setColumnButtonActive(num);\n renderVisuals();\n}", "function createPsizeSliders(){\n\n\tGUIParams.partsKeys.forEach(function(p,i){\n\t\tvar initialValue = parseFloat(GUIParams.PsizeMult[p]); //I don't *think* I need to update this in GUI; it's just the initial value that matters, right?\n\n\t\tvar sliderArgs = {\n\t\t\tstart: [initialValue], \n\t\t\tconnect: [true, false],\n\t\t\ttooltips: false,\n\t\t\tsteps: [0.0001],\n\t\t\trange: { //reset below\n\t\t\t\t'min': [0],\n\t\t\t\t'max': [initialValue]\n\t\t\t},\n\t\t\tformat: wNumb({\n\t\t\t\tdecimals: 4\n\t\t\t})\n\t\t}\n\n\t\tvar slider = document.getElementById(p+'_PSlider');\n\t\tvar text = [document.getElementById(p+'_PMaxT')];\n\t\tvar varToSet = [initialValue, \"PsizeMult\",p];\n\t\tvar varArgs = {'f':'setViewerParamByKey','v':varToSet};\n\n\t\tcreateSlider(slider, text, sliderArgs, varArgs);\n\n\t\t//reformat\n\t\tw = parseInt(d3.select('#'+p+'_PSlider').style('width').slice(0,-2));\n\t\td3.select('#'+p+'_PSlider').select('.noUi-base').style('width',w-10+\"px\");\n\t});\n\n}", "set collider(value) {}", "function changePixels() {\n let pixels = slider.value;\n\n let gridPixels = container.querySelectorAll('div');\n gridPixels.forEach(cell => cell.remove());\n\n makeRows(pixels, pixels, currColor);\n}", "function adjustMines() {\n maxMines = (lines*collumns) - 1;\n \n document.getElementById(\"mineSlider\").setAttribute(\"max\", maxMines);\n document.getElementById(\"valueMax\").innerHTML = maxMines;\n \n if (mines > maxMines) {\n document.getElementById(\"valueM\").innerHTML = maxMines;\n mines = parseInt(maxMines);\n }\n}", "function createSliderNum() {\n var group = createDiv('');\n group.position(width + 10, height / 2);\n sliderNum = createSlider(2, 100, 8, 1);\n sliderNum.parent(group);\n var label = createSpan('Number of Balls');\n label.parent(group);\n}", "function sizeScrollbar() {\nvar remainder = scrollContent.width() - scrollPane.width();\nvar proportion = remainder / scrollContent.width();\nvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\nscrollbar.find( \".ui-slider-handle\" ).css({\nwidth: handleSize,\n\"margin-left\": -handleSize / 2\n});\nhandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "function build_sliders(){\n var total_rows = Math.ceil(sliders.length/3);\n var slider_count = 0;\n for (var i = 0; i < total_rows; i++){\n var slider_div = document.getElementById(\"drag_container\");\n for (var j = 0; j<3; j++){\n if(slider_count < sliders.length){\n $(sliders[slider_count]['obj']).appendTo($(slider_div));\n $(sliders[slider_count]['obj']).children().children().eq(1).remove(\"div\"); // remove the freaking autogenerated input field....\n slider_count = slider_count+1;\n }\n }\n $(slider_div).appendTo($(\"#drag_container\")).trigger(\"create\");\n }\n}", "function setSliderElementsSize($item,i){\n if($window_width > responsive_breakpoint_set[0]) {\n slider_graphic_coefficient = coefficients_graphic_array[0];\n slider_title_coefficient = coefficients_title_array[0];\n slider_subtitle_coefficient = coefficients_subtitle_array[0];\n slider_text_coefficient = coefficients_text_array[0];\n slider_button_coefficient = coefficients_button_array[0];\n }else if($window_width > responsive_breakpoint_set[1]){\n slider_graphic_coefficient = coefficients_graphic_array[1];\n slider_title_coefficient = coefficients_title_array[1];\n slider_subtitle_coefficient = coefficients_subtitle_array[1];\n slider_text_coefficient = coefficients_text_array[1];\n slider_button_coefficient = coefficients_button_array[1];\n }else if($window_width > responsive_breakpoint_set[2]){\n slider_graphic_coefficient = coefficients_graphic_array[2];\n slider_title_coefficient = coefficients_title_array[2];\n slider_subtitle_coefficient = coefficients_subtitle_array[2];\n slider_text_coefficient = coefficients_text_array[2];\n slider_button_coefficient = coefficients_button_array[2];\n }else if($window_width > responsive_breakpoint_set[3]){\n slider_graphic_coefficient = coefficients_graphic_array[3];\n slider_title_coefficient = coefficients_title_array[3];\n slider_subtitle_coefficient = coefficients_subtitle_array[3];\n slider_text_coefficient = coefficients_text_array[3];\n slider_button_coefficient = coefficients_button_array[3];\n }else if ($window_width > responsive_breakpoint_set[4]) {\n slider_graphic_coefficient = coefficients_graphic_array[4];\n slider_title_coefficient = coefficients_title_array[4];\n slider_subtitle_coefficient = coefficients_subtitle_array[4];\n slider_text_coefficient = coefficients_text_array[4];\n slider_button_coefficient = coefficients_button_array[4];\n }else if ($window_width > responsive_breakpoint_set[5]){\n slider_graphic_coefficient = coefficients_graphic_array[5];\n slider_title_coefficient = coefficients_title_array[5];\n slider_subtitle_coefficient = coefficients_subtitle_array[5];\n slider_text_coefficient = coefficients_text_array[5];\n slider_button_coefficient = coefficients_button_array[5];\n }\n else{\n slider_graphic_coefficient = coefficients_graphic_array[6];\n slider_title_coefficient = coefficients_title_array[6];\n slider_subtitle_coefficient = coefficients_subtitle_array[6];\n slider_text_coefficient = coefficients_text_array[6];\n slider_button_coefficient = coefficients_button_array[6];\n }\n\n // letter-spacing decrease quicker\n var slider_title_coefficient_letter_spacing = slider_title_coefficient;\n var slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient;\n var slider_text_coefficient_letter_spacing = slider_text_coefficient;\n if($window_width <= responsive_breakpoint_set[0]) {\n slider_title_coefficient_letter_spacing = slider_title_coefficient/2;\n slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient/2;\n slider_text_coefficient_letter_spacing = slider_text_coefficient/2;\n }\n\n $item.find('.thumb').css({\"width\": Math.round(window[\"slider_graphic_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_graphic_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n $item.find('.qode_slide-svg-holder svg').css({\"width\": Math.round(window[\"slider_svg_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_svg_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n\n $item.find('.q_slide_title').css({\"font-size\": Math.round(window[\"slider_title_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"line-height\": Math.round(window[\"slider_title_\" + i][1]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"letter-spacing\": Math.round(window[\"slider_title_\" + i][2]*slider_title_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_title').css({\"margin-bottom\": Math.round(window[\"slider_title_\" + i][3]*slider_title_coefficient) + 'px'});\n\n $item.find('.q_slide_subtitle').css({\"font-size\": Math.round(window[\"slider_subtitle_\" + i][0]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"line-height\": Math.round(window[\"slider_subtitle_\" + i][1]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"letter-spacing\": Math.round(window[\"slider_subtitle_\" + i][2]*slider_subtitle_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_subtitle').css({\"margin-bottom\": Math.round(window[\"slider_subtitle_\" + i][3]*slider_subtitle_coefficient) + 'px'});\n\n $item.find('.q_slide_text').css({\"font-size\": Math.round(window[\"slider_text_\" + i][0]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"line-height\": Math.round(window[\"slider_text_\" + i][1]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"letter-spacing\": Math.round(window[\"slider_text_\" + i][2]*slider_text_coefficient_letter_spacing) + 'px'});\n\n $item.find('.qbutton:eq(0)').css({\"font-size\": Math.round(window[\"slider_button1_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"font-size\": Math.round(window[\"slider_button2_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"line-height\": Math.round(window[\"slider_button1_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"line-height\": Math.round(window[\"slider_button2_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"letter-spacing\": Math.round(window[\"slider_button1_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"letter-spacing\": Math.round(window[\"slider_button2_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"height\": Math.round(window[\"slider_button1_\" + i][3]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"height\": Math.round(window[\"slider_button2_\" + i][3]*slider_button_coefficient) + 'px'});\n if(window[\"slider_button1_\" + i][4] != 0) {\n $item.find('.qbutton:eq(0)').css({\"width\": Math.round(window[\"slider_button1_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(0)').css({\"width\": 'auto'});\n }\n if(window[\"slider_button2_\" + i][4] != 0) {\n $item.find('.qbutton:eq(1)').css({\"width\": Math.round(window[\"slider_button2_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(1)').css({\"width\": 'auto'});\n }\n $item.find('.qbutton:eq(0)').css({\"padding-left\": Math.round(window[\"slider_button1_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-left\": Math.round(window[\"slider_button2_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"padding-right\": Math.round(window[\"slider_button1_\" + i][6]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-right\": Math.round(window[\"slider_button2_\" + i][6]*slider_button_coefficient) + 'px'});\n\n $item.find('.separator').css({\"margin-top\": Math.round(window[\"slider_separator_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.separator').css({\"margin-bottom\": Math.round(window[\"slider_separator_\" + i][1]*slider_title_coefficient) + 'px'});\n\n }", "function loadSlider() {\n $( \"#slider\" ).slider({\n value:2,\n min: 2,\n max: clusterKeys.length+1,\n step: 1,\n animate: \"fast\",\n slide: function( event, ui ) {\n var k = ui.value;\n $( \"#numClusters\" ).val(k);\n clusterize(k);\n loadCentroids(k);\n }\n});\n $( \"#numClusters\" ).val($( \"#slider\" ).slider( \"value\" ) );\n}", "function setDimensionsFromNumSquares() {\n boardWidth = numSquaresX * xIncrement;\n headerWidth = boardWidth;\n boardHeight = numSquaresY * yIncrement;\n}", "function setCrepidoSize() {\n $('.crepido').width(function() {\n var boards = $(this).find('.board');\n var width = parseInt(boards.eq(1).width());\n var gutter = parseInt(boards.eq(1).css('marginLeft'));\n return parseInt(boards.length * width) + parseInt((boards.length - 1) * gutter) + 40;\n });\n }", "function initToCounter(){\n\t\"use strict\";\n\t\n\tif($j('.counter.zero').length){\n\t\t$j('.counter.zero').each(function() {\n\t\t\tif(!$j(this).hasClass('executed')){\n\t\t\t\t$j(this).addClass('executed');\n\t\t\t\tif($j(this).parents('.vertical_split_slider').length){\n\t\t\t\t\t$j(this).parent().css('opacity', '1');\n\t\t\t\t\tvar $max = parseFloat($j(this).text());\n\t\t\t\t\t$j(this).countTo({\n\t\t\t\t\t\tfrom: 0,\n\t\t\t\t\t\tto: $max,\n\t\t\t\t\t\tspeed: 1500,\n\t\t\t\t\t\trefreshInterval: 100\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$j(this).appear(function() {\n\t\t\t\t\t\t$j(this).parent().css('opacity', '1');\n\t\t\t\t\t\tvar $max = parseFloat($j(this).text());\n\t\t\t\t\t\t$j(this).countTo({\n\t\t\t\t\t\t\tfrom: 0,\n\t\t\t\t\t\t\tto: $max,\n\t\t\t\t\t\t\tspeed: 1500,\n\t\t\t\t\t\t\trefreshInterval: 100\n\t\t\t\t\t\t});\n\t\t\t\t\t},{accX: 0, accY: -200});\n\t\t\t\t}\n\t\t\t}\t\n\t\t});\n\t}\n}", "function changeSliderSize() {\n\t\t\twrapperA.css({\n\t\t\t\twidth: itemsA.length * (sliderWidth + 2 * sliderMargin) + \"vw\",\n\t\t\t\tmarginLeft: getWrapperMargin() + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsA.css({\n\t\t\t\twidth: sliderWidth + \"vw\",\n\t\t\t\theight: sliderHeight + \"em\",\n\t\t\t\tmargin: \"0 \" + sliderMargin + \"vw\"\n\t\t\t});\n\t\t}", "function responsCol(){\n if(globItemdiv===''){\n globItemdiv = items;\n }\n\n if(expCol===6){\n if($(window).width()>991){\n col = 6;\n }\n else{\n respDevice();\n }\n }\n else if(expCol===5){\n if($(window).width()>991){\n col = 5;\n }\n else{\n respDevice();\n }\n }\n else if(expCol===3){\n if($(window).width()>991){\n col = 3;\n }\n else{\n respDevice();\n }\n }\n else{\n if($(window).width()>991){\n col = 4;\n }\n else{\n respDevice();\n }\n\n }\n function respDevice(){\n if($(window).width()>767){\n col = medCol;\n }\n else if($(window).width()>479){\n col = smCol;\n }\n else if($(window).width()<=480){\n col = tinyCol;\n }\n }\n if(startgroup !=''){\n globThisData = '.dc-pf-'+ startgroup;\n globItemdiv = $this.children(globThisData);\n }\n if(animationtype !='classic'){\n thisDefault(col, globItemdiv, items, globThisData); \n }\n else{\n thisDefault2(col, globItemdiv, items, globThisData); \n }\n $this.dcLightBox({\n portfolio:true,\n section: globThisData\n })\n }", "getSliderWidth() {\n return this.slider.innerWidth() - parseInt(this.slider.slick('slickGetOption', 'centerPadding')) * 2;\n }", "function baseInit(){\r\n elemArr.forEach(function(c,i,arr){\r\n c.style.minWidth = elemWidth + 'px';\r\n\r\n //Add data-index\r\n c.setAttribute(\"data-index\", i+1);\r\n\r\n //Add data-active\r\n if(i < 4){\r\n c.setAttribute(\"data-active\", \"true\");\r\n }\r\n else{\r\n c.setAttribute(\"data-active\", \"false\");\r\n }\r\n\r\n elCount++;\r\n });\r\n //Set Abs Width\r\n sliderAbsWidth = (elemArr.length + 1) * elemWidth;\r\n }", "_changeSliderSize() {\n\t\t\t\tlet width = this.model.get('width'),\n\t\t\t\t\theight = this.model.get('height');\n\n\t\t\t\tthis.$el.css({width, height});\n\t\t\t}", "function updateXTickCount() {\n // console.log(\"data -> \" + JSON.stringify(data));\n // console.log(\"data.length -> \" + data.length);\n // console.log(\"(.77 * window.innerWidth - 280) / 15 -> \" + (.77 * window.innerWidth - 280) / 15);\n // console.log((Math.floor(data.length / ((.77 * window.innerWidth - 280) / 15))) - 1);\n setXTickInterval((Math.floor(data.length / ((.77 * window.innerWidth - 280) / 15))) - 1);\n }", "function SetColRes(px) {\r\n var minpx = 400;\r\n var maxpx = 2000;\r\n\r\n return (1/(maxpx-minpx))*px + 1 - maxpx/(maxpx-minpx);\r\n}", "onLayoutReposition() {\n this.slider.find('.slick-slide').css('max-width', this.getSliderWidth());\n this.slider.find('.images-list__item').css('max-height', this.getSliderHeight());\n }", "changeGameBoardWidth(amount) {\n this.currentGeneration.alive = this.currentGeneration.alive.map(value =>\n value + amount * (Math.ceil(value / this.currentGeneration.width) - 1)\n );\n this.currentGeneration.width += amount;\n }", "function PlayingCols (num){\n this.row = [];\n this.num = num;\n}", "setStyle (){\n // console.log(\"style\")\n let ratio = this.items.length / this.slidesVisible\n this.container.style.width = (ratio * 100)+ \"%\"\n this.items.forEach(item => item.style.width= ((100 / this.slidesVisible )/ ratio) + \"%\")\n }", "function adjustSliderValue(){\n if(scroll_value[0]>scroll_value[1]){\n scroll_value[1]=[scroll_value[0], scroll_value[0]=scroll_value[1]][0];\n index==0?index=1:index=0;\n }\n refreshUI(true);\n}", "function updateWooFlickityCount(e) {\r\n\t\t\tvar slideNumber = e.data.wooFlickity.selectedIndex + 1;\r\n\t\t\te.data.wooFlickityCount.text(slideNumber + '/' + e.data.wooFlickity.slides.length);\r\n\t\t}", "_correctIndexSettings() {\n this.options.slider.startIndex -= 1;\n this.options.thumbnailSlider.startIndex -= 1;\n this.options.slider.startIndex = (this.options.slider.startIndex < 0) ? 0 : this.options.slider.startIndex;\n this.options.thumbnailSlider.startIndex = (this.options.thumbnailSlider.startIndex < 0) ? 0 : this.options.thumbnailSlider.startIndex;\n }", "onResize() {\n var sizes = document.getElementById('demogl').getBoundingClientRect();\n\n this.sliders.forEach(function(slider) {\n slider.max = sizes[slider.getAttribute('data-size')];\n this.onSliderChange({ target: slider });\n }, this);\n }", "function updateSlideWidth() {\n let slideWidth = document.querySelector('.slider-about-1__item')\n .offsetWidth;\n // console.log(slideWidth);\n // document.querySelectorAll('.slider-about-1__item').forEach( el => {\n // \tel.style.width = slideWidth + 'px';\n // \t// console.log(el);\n // });\n document.querySelector('.slider-about-3').style.width =\n slideWidth + 'px';\n sliderAbout3.update();\n sliderAbout1.update();\n // console.log('updatewidth');\n }", "function projectGallary() {\n $('.project-gallery ul').on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {\n let i = (currentSlide ? currentSlide : 0) + 1\n let count = slick.slideCount\n let el = $(this).parents('.project-gallery').find('.counter')\n\n if (i < 10) { i = \"0\" + i }\n if (count < 10) { count = \"0\" + count }\n\n el.text( i + ' | ' + count)\n })\n\n $('.project-gallery ul').slick({\n lazyLoad: 'ondemand',\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n autoplay: true,\n autoplaySpeed: 5000,\n arrows: true,\n dots: false,\n swipeToSlide: true,\n nextArrow: '<button class=\"slick-next\" aria-label=\"Next slide\"><img src=\"/wp-content/themes/vicoma/dist/images/angle-right-white.svg\" alt=\"Arrow right\"></button>',\n prevArrow: '<button class=\"slick-prev\" aria-label=\"Previous slide\"><img src=\"/wp-content/themes/vicoma/dist/images/angle-left-white.svg\" alt=\"Arrow left\"></button>'\n })\n }", "_updateClosetSlots(width) {\n let left_closet_face_x_value = this.faces.get(FaceOrientation.LEFT).X();\n let closetSlotFaces=this.getClosetSlotFaces();\n for(let i=0;i<closetSlotFaces.length;i++){\n if(i==0){\n closetSlotFaces[i].changeXAxis(left_closet_face_x_value+width);\n }else{\n closetSlotFaces[i].changeXAxis(closetSlotFaces[i-1].X()+width);\n }\n }\n }", "function posCalc(){\n var width = document.innerWidth;\n var colLength = width/3;\n }", "function onUpdateSliderSize()\n\t{\n\t\txslider.width = xslider.hide? 0: (w - (yslider.hide? 0 : t)); \n\t\tyslider.height = yslider.hide? 0 : (h - (xslider.hide? 0 : t)); \t\n\t}", "function qodeNumberOfTestimonialsItemsResize(){\n\n\n var testimonialsSlider = $j('.testimonials_carousel, .testimonials_c_carousel');\n\n if(testimonialsSlider.length){\n testimonialsSlider.each(function(){\n var thisSliderHolder = $j(this);\n\n var items = qodeNumberOfTestimonialsItems(thisSliderHolder);\n\n thisSliderHolder.data('flexslider').vars.minItems = items;\n thisSliderHolder.data('flexslider').vars.maxItems = items;\n });\n }\n}", "_resizeHandler() {\n\n\t\tconst bounds= this.getBoundingClientRect();\n\n\t\tthis._dimens.width= bounds.width;\n\t\tthis._dimens.height= bounds.width;\n\n\t\tthis._root.querySelector('.wrapper').style.height= `${this._dimens.height}px`;\n\n\t\tfor(let row of this._grid) {\n\n\t\t\tfor(let col of row) {\n\n\t\t\t\tcol.$elem.style.width= (this._dimens.width/this.rows - 10) + 'px';\n\t\t\t\tcol.$elem.style.height= (this._dimens.height/this.cols - 10) + 'px';\n\t\t\t}\n\t\t}\n\t}", "cols() {\n return this.grid[0].length;\n }", "function _sh_workspace_count_changed( windexer, count ){\n\tplane_height = global.stage.height +\n\t\t( (count - 1) * sliding_height );\n\tfor( let i in subplanes )\n\t\tsubplanes[i].set_size( plane_width, plane_height );\n}", "function initSliderPositions() {\n // console.log('Init Slider Pos runs');\n sliders.forEach(slider => {\n if (slider.name === 'hue') {\n // Get the correct color from the array based on the data atttribute of the current slider\n // which will have the correct number for the index based on which group the slider is in\n const color = colorsArr[slider.getAttribute('data-hue')];\n // Extract the hue from that color and save it\n const hueValue = Math.floor(chroma(color).hsl()[0]);\n // console.log(hueValue);\n // set the current slider's value to the hue\n slider.value = hueValue;\n } else if (slider.name === 'saturation') {\n const color = colorsArr[slider.getAttribute('data-sat')];\n const saturationValue = Math.floor(chroma(color).hsl()[1] * 100) / 100;\n slider.value = saturationValue;\n } else {\n const color = colorsArr[slider.getAttribute('data-bright')];\n const brightnessValue = Math.floor(chroma(color).hsl()[2] * 100) / 100;\n slider.value = brightnessValue;\n }\n });\n}", "function column_sizer(){\n\tvar $ww = $(window).width();\n\tif($ww>=1280){\n\t\t$(\".ui-dashbox\").removeClass(\"columnWidth\").removeClass(\"fullWidth\").removeClass(\"halfWidth\").removeClass(\"threeColWidth\").addClass(\"fourColWidth\"); // 4 columns\n\t}else if($ww<1280 && $ww>=960){\n\t\t$(\".ui-dashbox\").removeClass(\"columnWidth\").removeClass(\"fullWidth\").removeClass(\"halfWidth\").removeClass(\"fourColWidth\").addClass(\"threeColWidth\"); // 3 columns!\n\t}else if($ww<960 && $ww>=640){\n\t\t$(\".ui-dashbox\").removeClass(\"columnWidth\").removeClass(\"fullWidth\").removeClass(\"threeColWidth\").removeClass(\"fourColWidth\").addClass(\"halfWidth\"); // 2 columns!\n\t}else if($ww<640){\n\t\t$(\".ui-dashbox\").removeClass(\"columnWidth\").removeClass(\"halfWidth\").removeClass(\"threeColWidth\").removeClass(\"fourColWidth\").addClass(\"fullWidth\"); // 1 column!\n\t}else{\n\t\t$(\".ui-dashbox\").removeClass(\"fullWidth\").removeClass(\"halfWidth\").removeClass(\"threeColWidth\").removeClass(\"fourColWidth\").addClass(\"columnWidth\"); // default\n\t}\n\t\n}", "function setColumns(cols) {\n\tconsole.log(\"Setting cols... \" + cols);\n\tif(cols === 3) {\n\t\t$('.thumb, .thumbSizer').removeClass('col4 col5');\n\t\t$('.thumb, .thumbSizer').addClass('col3');\n\t} else if(cols === 4) {\n\t\t$('.thumb, .thumbSizer').removeClass('col3 col5');\n\t\t$('.thumb, .thumbSizer').addClass('col4');\n\t} else if(cols === 5) {\n\t\t$('.thumb, .thumbSizer').removeClass('col3 col4');\n\t\t$('.thumb, .thumbSizer').addClass('col5');\n\t}\n\tupdatePositions();\n}", "setPropertyX(maxColsBeforeCanvas, minColsBeforeCanvas, colWidth) {\n return globals.getRandomInt(-maxColsBeforeCanvas, -minColsBeforeCanvas)*colWidth;\n }", "onResize() {\n var sizes = document\n .getElementById('demogl')\n .getBoundingClientRect();\n\n this.sliders.forEach(function(slider) {\n slider.max = sizes[slider.getAttribute('data-size')];\n this.onSliderChange({ target: slider });\n }, this);\n }", "function setWidths(evt) {\n let newColWidth = (resize.colStartWidth + evt.clientX - resize.startX),\n newSibWidth = (resize.sibStartWidth - evt.clientX + resize.startX),\n numToPercentString = (num) => {\n return num.toString() + '%';\n },\n percent = (width) => {\n return (width / resize.rowWidth * 100);\n },\n colWidthPercent = percent(newColWidth),\n sibWidthPercent = percent(newSibWidth);\n\n column.dataset.colWidth = numToPercentString(Math.round(colWidthPercent));\n sibling.dataset.colWidth = numToPercentString(Math.round(sibWidthPercent));\n\n column.style.width = numToPercentString(colWidthPercent);\n sibling.style.width = numToPercentString(sibWidthPercent);\n }", "update() {\n\t\tthis.slideWidth = this.slides[0].offsetWidth;\n\t\tthis.slideWidth = parseInt(this.slideWidth, 10);\n\t\tthis.scrollRight = this.slider.scrollWidth - this.slider.offsetWidth;\n\t\tlet numberCards = this.slides.length;\n\t\tlet numberCardsDisplay = getCssVariable('--number-cards')\n\t\tlet sliderWidth = numberCardsDisplay * this.slideWidth;\n\t\t// calculate and set carousel width based on 80% +/- whats needed to fit\n\t\tlet width = document.body.clientWidth * 0.8\n\t\tlet ncards = width / this.slideWidth;\n\t\twidth = Math.round(ncards * this.slideWidth);\n\t\twidth = width.toString(10) - this.gap + 'px';\n\t\tthis.slider.scrollLeft = this.gap; // initial scroll left position\n\t\tsetCssVariable('--carousel-width', width);\n\t\t// save currently selected card number\n\t\tlet urlPath = window.location.pathname;\n\t\tthis.selected = urlPath.substring(urlPath.lastIndexOf('/') + 1)\n\t\t\n\t}", "function changeMaxRange(value) {\n let maxQuantity = sortedData[0].quantity;\n let minQuantity = sortedData[sortedData.length - 1].quantity;\n heatmap.setData(\n getWeightedPoints(sortedData, minQuantity, maxQuantity, value)\n );\n document.getElementById(\"sliderLabel\").innerHTML = value;\n}", "function setPaneDimensions() {\n pane_width = element.width();\n \n // incase carousel slides have been updated, re-index them\n panes = $(\"ul>li\", element);\n pane_count = panes.length;\n\n panes.each(function() {\n $(this).width(pane_width);\n });\n container.width(pane_width*pane_count);\n }", "_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 set_grid_horizontal() {\n GRID_HOR_VAR = parseInt(grid_horizontal.value);\n main();\n}", "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location bug\n\n this.llabel.html(numberWithCommas(min))\n this.rlabel.html(numberWithCommas(max))\n }", "function setSliders() {\n let colorToChange =\n document.querySelector(\"#colorToChange\").style.backgroundColor;\n // console.log(246, colorToChange, typeof colorToChange);\n colorToChange = colorToChange\n .substring(4, colorToChange.length - 1)\n .split(\", \");\n // console.log(250, colorToChange);\n colorToChange = colorToChange.map((elem) => (elem = parseInt(elem)));\n console.log(252, colorToChange);\n const rangeRed = document.querySelector(\"#rangeRed\");\n const rangeGreen = document.querySelector(\"#rangeGreen\");\n const rangeBlue = document.querySelector(\"#rangeBlue\");\n rangeRed.value = colorToChange[0];\n rangeGreen.value = colorToChange[1];\n rangeBlue.value = colorToChange[2];\n console.log(\n 260,\n \"Sliders were set to:\",\n rangeRed.value,\n rangeGreen.value,\n rangeBlue.value\n );\n}", "setSlidePosition() {\n this.slides.forEach((slide, i) => {\n slide.style.left = this.slideWidth * i + \"px\";\n });\n }", "function setupUI()\r\n{\r\n textSize(12)\r\n constraintsSlider = createSlider(1, 4, 1, 0.1)\r\n constraintsSlider.style('width', '300px')\r\n constraintsSlider.position(50, sliderY)\r\n\r\n desiredXSlider = createSlider(100, 600, desiredX, 1)\r\n desiredXSlider.style('width', '300px')\r\n desiredXSlider.position(380, sliderY)\r\n}", "function changeSlider(index) {\n sliderItems[currentSlider].classList.remove('active');\n sliderItems[index].classList.add('active');\n\n dots[currentSlider].classList.remove('active');\n dots[index].classList.add('active');\n currentSlider = index;// điều kiện này có thể thay thế cho currentSlider++;\n number.innerHTML = (index + 1).toString().padStart(2, '0');\n\n}", "function setPaneDimensions() {\n pane_width = element.width();\n $(options.paneItemsSelector, element).each(function () {\n $(this).width(pane_width);\n });\n container.width(pane_width * pane_count);\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 }", "applyWidth() {\n var columns = this.template.querySelectorAll('.dynamicColumn');\n for (var i = 0; i < columns.length; i++) {\n columns[i].style.width = this.percentage + \"%\";\n //columns[i].style.display = \"inline\";\n columns[i].style.textAlign = \"center\";\n //columns[i].style.border = \"1px solid #4CAF50\";\n }\n }", "setOrders() {\n const {\n panels,\n } = this\n var idx = 0;\n var element = document.querySelector('.masonry-panel');\n\n var style = window.getComputedStyle(element),\n width = style.getPropertyValue('width');\n width = width.replace('px', '');\n width = width/window.innerWidth;\n\n var cols = Math.ceil(1/width) - 1;\n panels.forEach((panel, idx) => {\n panel.style.order = ((idx + 1) % cols === 0) ? cols : (idx + 1) % cols\n })\n console.log(panels[1]);\n }", "function setNumSquaresFromDimensions() {\n while (numSquaresX * xIncrement + xIncrement < boardWidth) {\n numSquaresX++;\n }\n\n while (numSquaresY * yIncrement + yIncrement < boardHeight) {\n numSquaresY++;\n }\n}", "function updateSliderWidthAndHeight() {\n slider._width = $slider.width();\n slider._height = $slider.height();\n }", "function sizeScrollbar() {\r\n\t\t var remainder = scrollContent.width() - scrollPane.width();\r\n\t\t var proportion = scrollPane.width() / scrollContent.width(); //remainder / scrollContent.width();\r\n\t\t var handleSize = jQuery('.slider-lb:eq(0)').width(); //scrollPane.width() * proportion; // - (proportion * scrollPane.width());\r\n\t\t var pos = jQuery(jQuery(jQuery(scrollPane.next('.scroll-bar-container').children(\".scroll-bar-start\")).prev(\".scroll-bar-wrap\").children(\".scroll-bar\").children(\".slider-lb1\"))).position();\r\n\t\t scrollbar.find('.ui-slider-handle').css({\r\n\t\t\twidth: handleSize+100,\r\n\t\t\tleft: pos.left-50\r\n\t\t });\r\n\t\t// var scrollContentWidth = 1200;\r\n\t\t handleHelper.width('').width(scrollbar.width() - handleSize - 150);\r\n\t\t var scrollBarSize = jQuery(\".scroll-bar-container\").width()-100;\r\n\t\t var offsetFactor = Math.round(handleSize / 2) + 14; // for left padding scrollbar\r\n\t\t Group2First = (group1 * scrollBarSize) / (scrollContentWidth)\r\n\t\t Group3First = ((group1 + group2) * scrollBarSize) / (scrollContentWidth)\r\n\t\t Group4First = ((group1 + group2 + group3) * scrollBarSize) / (scrollContentWidth)\r\n\t\t jQuery(\".slider-lb2\").css('left', (Group2First + offsetFactor + 50) + 'px');\r\n\t\t jQuery(\".slider-lb3\").css('left', (Group3First + offsetFactor + 100) + 'px');\r\n\t\t /*trick to handle overlapping labels*/\r\n\t\t var group5Offset = (scrollBarSize - jQuery(\".slider-lb5\").width());\r\n\t\t var group4Offset = Group4First + offsetFactor;\r\n\t\t var fwLength = jQuery(\".slider-lb4\").width();\r\n\t\t if ((group4Offset + fwLength) > group5Offset) group4Offset -= ((group4Offset + fwLength) - group5Offset) + 35;\r\n\t\t if (((group4Offset + fwLength) - group5Offset) < 10) group4Offset -= 30;\r\n\t\t Group4First = group4Offset - offsetFactor;\r\n\t\t jQuery(\".slider-lb4\").css('left', group4Offset+150+'px');\r\n\t\t jQuery(\".slider-lb5\").css('left', group5Offset+50+'px');\r\n\t\t}", "function sizeScrollbar(){\n\t\tvar remainder = scrollContent.width() - scrollPane.width();\n\t\tvar proportion = remainder / scrollContent.width();\n\t\tvar handleSize = scrollPane.width() - (proportion * scrollPane.width());\n\t\tscrollbar.find('.ui-slider-handle').css({\n\t\t\twidth: handleSize,\n\t\t\t'margin-left': -handleSize/2\n\t\t});\n\t\thandleHelper.width('').width( scrollbar.width() - handleSize);\n\t}", "function sizeScrollbar() {\r\n\t\t\tvar remainder = scrollContent.width() - scrollPane.width();\r\n\t\t\tvar proportion = remainder / scrollContent.width();\r\n\t\t\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\r\n\t\t\tscrollbar.find( \".ui-slider-handle\" ).css({\r\n\t\t\t\twidth: handleSize,\r\n\t\t\t\t\"margin-left\": -handleSize / 2\r\n\t\t\t});\r\n\t\t\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\r\n\t\t}", "function gridSize(count) {\n gridContainer.style.gridTemplateColumns = `repeat(${count}, 1fr)`;\n}", "function initGliderBoard() {\n let glider = [[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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 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, 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, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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]];\n return glider;\n}", "function setMaximumGridSize() {\n var maxCols = Math.floor( ($(window).width() - 42) / 40);\n var maxRows = Math.floor( ($(window).height() - 42) / 40);\n $(\"#rows\").prop(\"min\", 1).prop(\"max\", maxRows);\n $(\"#cols\").prop(\"min\", 1).prop(\"max\", maxCols);\n // $(\"#message\").text(\"Maximum rows = \" + maxRows + \" and maximum columns = \" + maxCols);\n}", "initSliderInner() {\n const { onInfiniteLoop, isVertical } = this.props;\n const slidesTotal = !onInfiniteLoop ? this.slides.length : this.slides.length + 2;\n\n if (isVertical) {\n // Set wrapper height to total height of slides combined and stack slides vertically\n this.elem.classList.add('is-vertical');\n this.sliderInner.style.height = `${slidesTotal * 100}%`;\n this.sliderInner.style.top = '-100%';\n } else {\n // Set wrapper width to total width of slides combined and lay slides horizontally\n this.sliderInner.style.width = `${slidesTotal * 100}%`;\n this.sliderInner.style.left = '-100%';\n }\n }", "function countColumns(){\n return GRID[0].length;\n}", "function createSliders(arr) {\n\n for(i = 0; i < arr.length; i++) {\n arr[i].style.height = '20px';\n arr[i].style.width = '30%';\n noUiSlider.create(arr[i], {\n start: [ 0, ], // Handle start position\n margin: 20, // Handles must be more than '20' apart\n direction: 'ltr', // Put '0' at the bottom of the slider\n orientation: 'horizontal', // Orient the slider vertically\n behaviour: 'tap-drag', // Move handle on tap, bar is draggable\n range: { // Slider can select '0' to '10'\n 'min': 1,\n 'max': 10\n }\n });\n arr[i].firstElementChild.value = 1;\n }\n arr[1].firstElementChild.value = 0.2;\n arr[2].firstElementChild.value = 0.1;\n\n}", "function onChange()\n\t{\n\t\t// decide if we need sliders based on new content size. default is they are hidden\n\t\t// we update both h and v sliders even when only content.width is changed as it's possible that both sliders\n\t\t// will hide/show based on the change in content.width alone\n\t\thslider.hide = true; \n\t\tvslider.hide = true; \n\t\tif (content.width > display.width) hslider.hide = false; \n\t\tif (content.height > display.height) vslider.hide = false; \n\t\tif ((content.width > display.width - t) && (content.height > display.height)){ hslider.hide = false; } \n\t\tif ((content.height > display.height - t) && (content.width > display.width)){ vslider.hide = false; } \n\n\t\t// now that we know which slider(v/s) is enabled, update their sizes\n\t\t// we set a rule that sliders will try to fill container.size. e.g. if vslider is hidden, hslider.height = container.height\n\t\t// both h and s sliders to be updated as it's possible that both slides will hide/show based on change in content.width alone\n\t\t//if (!hslider.hide){ hslider.width = w - (vslider.hide? 0 : t); }\n\t\t//if (!vslider.hide){ vslider.height = h - (hslider.hide? 0 : t); }\n\t\thslider.width = hslider.hide? 0: (w - (vslider.hide? 0 : t)); \n\t\tvslider.height = vslider.hide? 0 : (h - (hslider.hide? 0 : t)); \n\n\t\t// set slider's min/max. max value is calculated as the value difference between content size and display size.\n\t\t// the excess size of content will be the scroll size of slider. if content size < display size, max < 0 but slider class will \n\t\t// handle this properly and fix the thumbsize and its position to ensure no undesired behavior occurs\n\t\t// since both h and s sliders might have hide/show from this change, update max for both sliders\n\t\tvslider.min = 0; // min = 0, default.\n\t\thslider.min = 0; // min = 0, default.\n\t\tvslider.max = content.height - display.height + (hslider.hide? 0 : t);\n\t\thslider.max = content.width - display.width + (vslider.hide? 0 : t);\n\n\t\t// we want thumbsize to be based on ratio between content.size and frame.size. slider size is expected to fill frame size\n\t\t// but if both sliders (h and v), slider.size = frame.size - slider.t \n\t\t// since both v and h sliders might have changed their sizes, we update both thumbsize\n\t\tvslider.thumbsize = display.height / content.height * (vslider.height - (hslider.hide? 0 : t));\n\t\thslider.thumbsize = display.width / content.width * (hslider.width - (vslider.hide? 0 : t));\n\n\t\t// let's set min value for thumbsize, 32, because if content.size is too big, thumbsize will be too small to click.\n\t\tif (vslider.thumbsize < 32) vslider.thumbsize = 32;\n\t\tif (hslider.thumbsize < 32) hslider.thumbsize = 32;\n\t}", "update() {\n const items = this.carouselService.settings.items;\n let start = this.carouselService.current(), end = start + items;\n if (this.carouselService.settings.center) {\n start = items % 2 === 1 ? start - (items - 1) / 2 : start - items / 2;\n end = items % 2 === 1 ? start + items : start + items + 1;\n }\n this.carouselService.slidesData.forEach((slide, i) => {\n slide.heightState = (i >= start && i < end) ? 'full' : 'nulled';\n });\n }", "function sizeScrollbar() {\n var remainder = $scrollContent.width() - $scrollPane.width();\n var proportion = remainder / $scrollContent.width();\n var handleSize = $scrollPane.width() - (proportion * $scrollPane.width());\n $scrollbar.find(\".ui-slider-handle\").css({\n width: handleSize,\n \"margin-left\": -handleSize / 2\n });\n handleHelper.width(\"\").width($scrollbar.width() - handleSize);\n }", "get columnsCount() {\n return (this.endColumn - this.startColumn) + 1\n }", "_updateHandles() {\n const positions = this._positions;\n const values = this._mouseActive ? this._activeValues\n : this._values;\n let handleOffset = null;\n\n this._$handles.children().each((i, el) => {\n const $el = $(el);\n\n if (handleOffset === null) {\n handleOffset = Math.floor($el.width() / 2);\n }\n\n const left = (positions[values[i]] - handleOffset);\n\n $el.css('left', `${left}px`);\n });\n\n if (this._numHandles === 2) {\n this._$range.css({\n 'left': positions[values[0]] + 'px',\n 'width': positions[values[1] - values[0]] + 'px',\n });\n }\n }", "updateColumnsLimit() {\n if (window.matchMedia(\"(max-width: 479px)\").matches) {\n this.maxCols = 2;\n } else if (window.matchMedia(\"(max-width: 767px)\").matches) {\n this.maxCols = 3;\n } else if (window.matchMedia(\"(max-width: 969px)\").matches) {\n this.maxCols = 3;\n } else if (window.matchMedia(\"(max-width: 1169px)\").matches) {\n this.maxCols = 4;\n } else if (window.matchMedia(\"(max-width: 1439px)\").matches) {\n this.maxCols = 5;\n } else {\n this.maxCols = 6;\n }\n }", "function recalculateIndex(){\r\n\r\n\t\t\tisDragging = false;\r\n\r\n\t\t\tvar k = 0;\r\n\t\t\twhile($slides.eq(k).position().left*(-1) > $empty.position().left){\r\n\t\t\t\tk++;\r\n\t\t\t}\r\n\r\n\t\t\t_index = k-1 > 0 ? k-1 : k;\r\n\r\n\t\t}", "_setCSSVariables() {\n this.sliderElement.style.setProperty(\n \"--card-width\",\n `${this.cardWidthValue}${this.cardWidthUnits}`\n );\n this.sliderElement.style.setProperty(\n \"--num-visible-cards\",\n this.numVisibleCards\n );\n this.sliderElement.style.setProperty(\n \"--num-total-cards\",\n this.numTotalCards\n );\n this.sliderElement.style.setProperty(\n \"--card-spacing\",\n `${this.cardSpacingValue}${this.cardSpacingUnits}`\n );\n }", "function changeUp() {\n $(\".sliderContent\").hide();\n current += 1;\n if (current === max) {\n current = 1;\n }\n $(\".sliderContent:nth-child(\" + current + \")\").fadeIn(\"slow\");\n }", "function setGridSize(){\n numHorzItems = Math.floor(screenWidth/originalImageSize);\n\n \n var widthOffset = (numHorzItems*originalImageSize) - screenWidth;\n widthOffset = widthOffset/numHorzItems;\n var newwidth = originalImageSize - widthOffset;\n var newHeight = newwidth;\n imageHeight = imageWidth = newwidth;\n\n numVertItems = Math.ceil(screenHeight/newHeight);\n\n numItems = numHorzItems * numVertItems;\n\n if(numItems > 20){\n originalImageSize += 50;\n\n setGridSize();\n }\n else{\n for (var j=0; j<numVertItems; j++)\n {\n for (var i=0; i<numHorzItems; i++)\n {\n var xPos = 0 + (i*newwidth);\n var yPos = 0 + (j*newHeight);\n\n var index = (numHorzItems * j) + i;\n\n indexIsAnimating[index] = false;\n\n $grid = $(\".grid\").append(\"<div class='grid-item' id='image\" + index + \"' style='width:\" + newwidth + \"px; left: \" + xPos + \"px; top: \" + yPos + \"px'></div>\");\n $tiles = $grid.children('.grid-item');\n\n }\n }\n }\n}", "num_players(number)\n {\n for(let col of this.m_columns)\n {\n col.num_players(number);\n }\n }", "handleColumn(e) {\n if(!this.state.running){\n let actualSize = this.state.size;\n \n if(e.target.value < 90){\n actualSize[0] = e.target.value;\n } else {\n actualSize[0] = 25;\n }\n \n this.setState({\n size: actualSize\n });\n \n this.renderBoard();\n }\n }", "getColumnsAmount() { //metodo para calcular a quantidade de coluna disponivel baseado no tamanho do bloco, para saber as dimensoes do celular\n const width = Dimensions.get('window').width\n return Math.floor(width / this.blockSize)\n }", "function sizeScrollbar() {\n\tvar remainder = scrollContent.width() - scrollPane.width();\n\tif(remainder < 1){\n\t\t//remainder = scrollContent.width();\n\t\tscrollbar.find( \".ui-slider-handle\" ).hide();\n\t}else{\n\t\tscrollbar.find( \".ui-slider-handle\" ).show();\n\t}\n\tvar proportion = remainder / scrollContent.width();\n\tvar handleSize = scrollPane.width() - ( proportion * scrollPane.width() );\n\tscrollbar.find( \".ui-slider-handle\" ).css({\n\t\twidth: handleSize,\n\t\t\"margin-left\": -handleSize / 2\n\t});\n\thandleHelper.width( \"\" ).width( scrollbar.width() - handleSize );\n}", "beginColSelect(number)\n {\n this.selectedCols=[];\n this.colsToSelect=number;\n }", "function setPaneDimensions() {\n pane_width = $(window).width();\n\t\t\t\n panes.each(function() {\n $(this).width(pane_width);\n });\n\n container.width(pane_width*pane_count);\n\t\t\t\n\t\t\t\n\t\t\n\n }", "function setPaneDimensions() {\n pane_width = $(window).width();\n\t\t\t\n panes.each(function() {\n $(this).width(pane_width);\n });\n\n container.width(pane_width*pane_count);\n\t\t\t\n\t\t\t\n\t\t\n\n }", "function makeGridAndUpdateTooltip(){\n const val = Number(slider.value);\n makeGrid(val);\n document.querySelector(\"#number\").textContent = val;\n}" ]
[ "0.6257656", "0.6211999", "0.6132718", "0.61283904", "0.6106927", "0.59924054", "0.5921225", "0.5911456", "0.58831394", "0.5853252", "0.581245", "0.5793267", "0.5771251", "0.57558894", "0.5731719", "0.5720783", "0.5717159", "0.5711466", "0.56949794", "0.5630843", "0.5623277", "0.560869", "0.5596338", "0.5589466", "0.5586328", "0.5563048", "0.5556668", "0.55427164", "0.55418396", "0.55411166", "0.55384845", "0.55379957", "0.55349344", "0.551137", "0.5506594", "0.5496454", "0.5493165", "0.5491751", "0.54897577", "0.5473036", "0.5472086", "0.5469216", "0.54623973", "0.5458573", "0.5455006", "0.5453724", "0.5449737", "0.544806", "0.5429727", "0.541452", "0.5413235", "0.5407822", "0.5406755", "0.5406186", "0.54053175", "0.54044664", "0.54022586", "0.5392908", "0.53913933", "0.53854346", "0.5385135", "0.5373401", "0.5371391", "0.5362524", "0.53608", "0.5359969", "0.5358651", "0.53549826", "0.5349188", "0.5347126", "0.5343236", "0.5341176", "0.5334955", "0.53323", "0.532706", "0.53252643", "0.5323564", "0.5318254", "0.5314629", "0.53110737", "0.53081995", "0.5306338", "0.529967", "0.5293608", "0.5291341", "0.52890813", "0.5287147", "0.5286824", "0.52841085", "0.52831167", "0.5271014", "0.5270814", "0.52692056", "0.52676195", "0.52629894", "0.52559876", "0.5255266", "0.5254188", "0.5254188", "0.5253419" ]
0.57347536
14
Grabs and sets number of mines from slider
function setM(value) { document.getElementById("valueM").innerHTML = value; mines = parseInt(value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustMines() {\n maxMines = (lines*collumns) - 1;\n \n document.getElementById(\"mineSlider\").setAttribute(\"max\", maxMines);\n document.getElementById(\"valueMax\").innerHTML = maxMines;\n \n if (mines > maxMines) {\n document.getElementById(\"valueM\").innerHTML = maxMines;\n mines = parseInt(maxMines);\n }\n}", "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function setNumPoints() {\n runcavas.setupSlider(0, thePoints.length, 0.05);\n }", "function increaseMinMax() {\n min -= 10;\n max += 10;\n }", "function createPsizeSliders(){\n\n\tGUIParams.partsKeys.forEach(function(p,i){\n\t\tvar initialValue = parseFloat(GUIParams.PsizeMult[p]); //I don't *think* I need to update this in GUI; it's just the initial value that matters, right?\n\n\t\tvar sliderArgs = {\n\t\t\tstart: [initialValue], \n\t\t\tconnect: [true, false],\n\t\t\ttooltips: false,\n\t\t\tsteps: [0.0001],\n\t\t\trange: { //reset below\n\t\t\t\t'min': [0],\n\t\t\t\t'max': [initialValue]\n\t\t\t},\n\t\t\tformat: wNumb({\n\t\t\t\tdecimals: 4\n\t\t\t})\n\t\t}\n\n\t\tvar slider = document.getElementById(p+'_PSlider');\n\t\tvar text = [document.getElementById(p+'_PMaxT')];\n\t\tvar varToSet = [initialValue, \"PsizeMult\",p];\n\t\tvar varArgs = {'f':'setViewerParamByKey','v':varToSet};\n\n\t\tcreateSlider(slider, text, sliderArgs, varArgs);\n\n\t\t//reformat\n\t\tw = parseInt(d3.select('#'+p+'_PSlider').style('width').slice(0,-2));\n\t\td3.select('#'+p+'_PSlider').select('.noUi-base').style('width',w-10+\"px\");\n\t});\n\n}", "function setIncidentsSlider() {\n var handleA = $(\".incidents-rate-slider.lower-handle\");\n var handleB = $(\".incidents-rate-slider.upper-handle\");\n\n $('.incidents-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(1000);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxIncidents = ui.value\n }\n else {\n handleA.text(ui.value);\n minIncidents = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 1000,\n step: 10,\n values: [0, 1000],\n animate: true\n });\n}", "function onUpdateMin()\n\t{\n\t\t// store current min \n\t\tvar pxmin = xslider.min;\n\t\tvar pymin = yslider.min;\n\n\t\t// store current values\n\t\tvar xcurr = xslider.value;\n\t\tvar ycurr = yslider.value;\n\n\t\t// set new min. slider will internally try to update current value to ensure it's within its range. e.g. if curr = 20, new min = 25, curr = 25\n\t\t// this is why we store original values before we do this. we use original values to calculate new values\n\t\txslider.min = w - (yslider.hide? 0 : t);\n\t\tyslider.min = h - (xslider.hide? 0 : t);\n\n\t\t// calculate the change in min and use it to update current values. e.g. old.min = 20, old.val = 24, new.min = 15, new.val = 19\n\t\t// we always keep the delta between min and value. if value end up >max, slider will handle it.\n\t\txcurr -= (pxmin - xslider.min);\n\t\tycurr -= (pymin - yslider.min);\n\n\t\t// finally, update values\n\t\txslider.value = xcurr;\n\t\tyslider.value = ycurr;\n\t}", "function updateMinMax() {\n min = parseInt(minValueField.value);\n max = parseInt(maxValueField.value);\n}", "function inputMinSliderLeft(){//slider update inputs\n inputMin.value=sliderLeft.value;\n}", "function setMortalitySlider() {\n var handleA = $(\".mortality-rate-slider.lower-handle\");\n var handleB = $(\".mortality-rate-slider.upper-handle\");\n\n $('.mortality-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(250);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxMortality = ui.value\n }\n else {\n handleA.text(ui.value);\n minMortality = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 250,\n step: 5,\n values: [0, 250],\n animate: true\n });\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}", "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location bug\n\n this.llabel.html(numberWithCommas(min))\n this.rlabel.html(numberWithCommas(max))\n }", "function resetSlider(bins){\n document.getElementById(\"theSlider\").value = bins;\n }", "function xrangeset(min,max) {\n // Force the slider thumbs to adjust to the appropriate place\n $(\"#slider-range\").slider(\"option\", \"values\", [min,max]);\n }", "_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 changeMaxRange(value) {\n let maxQuantity = sortedData[0].quantity;\n let minQuantity = sortedData[sortedData.length - 1].quantity;\n heatmap.setData(\n getWeightedPoints(sortedData, minQuantity, maxQuantity, value)\n );\n document.getElementById(\"sliderLabel\").innerHTML = value;\n}", "function 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 invokeRangeSlider(){\n var minRange=0;\n var maxRange=document.getElementById('videoLength').value;\n $('#rangeSliderG').show();\n}", "function adjustSlider(sim) {\n\tif( sim*100 > similarityThresholdMax ) {\n\t\tsimilarityThresholdMax = sim*100; \n\t} else if( sim*100 < similarityThresholdMin ) {\n\t\tsimilarityThresholdMin = sim*100;\n\t}\n}", "function setSliderElementsSize($item,i){\n if($window_width > responsive_breakpoint_set[0]) {\n slider_graphic_coefficient = coefficients_graphic_array[0];\n slider_title_coefficient = coefficients_title_array[0];\n slider_subtitle_coefficient = coefficients_subtitle_array[0];\n slider_text_coefficient = coefficients_text_array[0];\n slider_button_coefficient = coefficients_button_array[0];\n }else if($window_width > responsive_breakpoint_set[1]){\n slider_graphic_coefficient = coefficients_graphic_array[1];\n slider_title_coefficient = coefficients_title_array[1];\n slider_subtitle_coefficient = coefficients_subtitle_array[1];\n slider_text_coefficient = coefficients_text_array[1];\n slider_button_coefficient = coefficients_button_array[1];\n }else if($window_width > responsive_breakpoint_set[2]){\n slider_graphic_coefficient = coefficients_graphic_array[2];\n slider_title_coefficient = coefficients_title_array[2];\n slider_subtitle_coefficient = coefficients_subtitle_array[2];\n slider_text_coefficient = coefficients_text_array[2];\n slider_button_coefficient = coefficients_button_array[2];\n }else if($window_width > responsive_breakpoint_set[3]){\n slider_graphic_coefficient = coefficients_graphic_array[3];\n slider_title_coefficient = coefficients_title_array[3];\n slider_subtitle_coefficient = coefficients_subtitle_array[3];\n slider_text_coefficient = coefficients_text_array[3];\n slider_button_coefficient = coefficients_button_array[3];\n }else if ($window_width > responsive_breakpoint_set[4]) {\n slider_graphic_coefficient = coefficients_graphic_array[4];\n slider_title_coefficient = coefficients_title_array[4];\n slider_subtitle_coefficient = coefficients_subtitle_array[4];\n slider_text_coefficient = coefficients_text_array[4];\n slider_button_coefficient = coefficients_button_array[4];\n }else if ($window_width > responsive_breakpoint_set[5]){\n slider_graphic_coefficient = coefficients_graphic_array[5];\n slider_title_coefficient = coefficients_title_array[5];\n slider_subtitle_coefficient = coefficients_subtitle_array[5];\n slider_text_coefficient = coefficients_text_array[5];\n slider_button_coefficient = coefficients_button_array[5];\n }\n else{\n slider_graphic_coefficient = coefficients_graphic_array[6];\n slider_title_coefficient = coefficients_title_array[6];\n slider_subtitle_coefficient = coefficients_subtitle_array[6];\n slider_text_coefficient = coefficients_text_array[6];\n slider_button_coefficient = coefficients_button_array[6];\n }\n\n // letter-spacing decrease quicker\n var slider_title_coefficient_letter_spacing = slider_title_coefficient;\n var slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient;\n var slider_text_coefficient_letter_spacing = slider_text_coefficient;\n if($window_width <= responsive_breakpoint_set[0]) {\n slider_title_coefficient_letter_spacing = slider_title_coefficient/2;\n slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient/2;\n slider_text_coefficient_letter_spacing = slider_text_coefficient/2;\n }\n\n $item.find('.thumb').css({\"width\": Math.round(window[\"slider_graphic_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_graphic_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n $item.find('.qode_slide-svg-holder svg').css({\"width\": Math.round(window[\"slider_svg_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_svg_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n\n $item.find('.q_slide_title').css({\"font-size\": Math.round(window[\"slider_title_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"line-height\": Math.round(window[\"slider_title_\" + i][1]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"letter-spacing\": Math.round(window[\"slider_title_\" + i][2]*slider_title_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_title').css({\"margin-bottom\": Math.round(window[\"slider_title_\" + i][3]*slider_title_coefficient) + 'px'});\n\n $item.find('.q_slide_subtitle').css({\"font-size\": Math.round(window[\"slider_subtitle_\" + i][0]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"line-height\": Math.round(window[\"slider_subtitle_\" + i][1]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"letter-spacing\": Math.round(window[\"slider_subtitle_\" + i][2]*slider_subtitle_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_subtitle').css({\"margin-bottom\": Math.round(window[\"slider_subtitle_\" + i][3]*slider_subtitle_coefficient) + 'px'});\n\n $item.find('.q_slide_text').css({\"font-size\": Math.round(window[\"slider_text_\" + i][0]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"line-height\": Math.round(window[\"slider_text_\" + i][1]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"letter-spacing\": Math.round(window[\"slider_text_\" + i][2]*slider_text_coefficient_letter_spacing) + 'px'});\n\n $item.find('.qbutton:eq(0)').css({\"font-size\": Math.round(window[\"slider_button1_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"font-size\": Math.round(window[\"slider_button2_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"line-height\": Math.round(window[\"slider_button1_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"line-height\": Math.round(window[\"slider_button2_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"letter-spacing\": Math.round(window[\"slider_button1_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"letter-spacing\": Math.round(window[\"slider_button2_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"height\": Math.round(window[\"slider_button1_\" + i][3]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"height\": Math.round(window[\"slider_button2_\" + i][3]*slider_button_coefficient) + 'px'});\n if(window[\"slider_button1_\" + i][4] != 0) {\n $item.find('.qbutton:eq(0)').css({\"width\": Math.round(window[\"slider_button1_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(0)').css({\"width\": 'auto'});\n }\n if(window[\"slider_button2_\" + i][4] != 0) {\n $item.find('.qbutton:eq(1)').css({\"width\": Math.round(window[\"slider_button2_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(1)').css({\"width\": 'auto'});\n }\n $item.find('.qbutton:eq(0)').css({\"padding-left\": Math.round(window[\"slider_button1_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-left\": Math.round(window[\"slider_button2_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"padding-right\": Math.round(window[\"slider_button1_\" + i][6]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-right\": Math.round(window[\"slider_button2_\" + i][6]*slider_button_coefficient) + 'px'});\n\n $item.find('.separator').css({\"margin-top\": Math.round(window[\"slider_separator_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.separator').css({\"margin-bottom\": Math.round(window[\"slider_separator_\" + i][1]*slider_title_coefficient) + 'px'});\n\n }", "onResize() {\n var sizes = document.getElementById('demogl').getBoundingClientRect();\n\n this.sliders.forEach(function(slider) {\n slider.max = sizes[slider.getAttribute('data-size')];\n this.onSliderChange({ target: slider });\n }, this);\n }", "function quantityControl(){\n const min = document.querySelectorAll('.min');\n const max = document.querySelectorAll('.max');\n min.forEach((inx)=>{\n inx.addEventListener('click',()=>{\n var inputValue = inx.nextElementSibling;\n inputValue.value --;\n disable();\n })\n })\n max.forEach((ma)=>{\n ma.addEventListener('click',()=>{\n var inputValue = ma.previousElementSibling;\n inputValue.value ++;\n disable()\n })\n })\n}", "function qodeNumberOfTestimonialsItemsResize(){\n\n\n var testimonialsSlider = $j('.testimonials_carousel, .testimonials_c_carousel');\n\n if(testimonialsSlider.length){\n testimonialsSlider.each(function(){\n var thisSliderHolder = $j(this);\n\n var items = qodeNumberOfTestimonialsItems(thisSliderHolder);\n\n thisSliderHolder.data('flexslider').vars.minItems = items;\n thisSliderHolder.data('flexslider').vars.maxItems = items;\n });\n }\n}", "function setN1Range() {\n minValue1 = Number(document.getElementById('low1').value);\n maxValue1 = Number(document.getElementById('high1').value);\n}", "function changeSlider() {\n var minInput = document.getElementById(\"min_price\");\n var maxInput = document.getElementById(\"max_price\");\n if(minInput.value < Number(minInput.getAttribute(\"min\"))) {\n console.log(minInput.value, minInput.getAttribute(\"min\"));\n minInput.value = minInput.getAttribute(\"min\");\n }\n else if(minInput.value >= Number(maxInput.getAttribute(\"max\"))) {\n minInput.value = Number(maxInput.getAttribute(\"max\")) - 1;\n }\n else {\n maxInput.setAttribute(\"min\", minInput.value);\n }\n if(maxInput.value > Number(maxInput.getAttribute(\"max\"))) {\n console.log(maxInput.value, maxInput.getAttribute(\"max\"));\n maxInput.value = maxInput.getAttribute(\"max\");\n }\n else if(maxInput.value <= Number(maxInput.getAttribute(\"min\"))) {\n maxInput.value = Number(maxInput.getAttribute(\"min\")) + 1;\n }\n else {\n maxInput.setAttribute(\"min\", minInput.value);\n }\n}", "function loadSlider() {\n $( \"#slider\" ).slider({\n value:2,\n min: 2,\n max: clusterKeys.length+1,\n step: 1,\n animate: \"fast\",\n slide: function( event, ui ) {\n var k = ui.value;\n $( \"#numClusters\" ).val(k);\n clusterize(k);\n loadCentroids(k);\n }\n});\n $( \"#numClusters\" ).val($( \"#slider\" ).slider( \"value\" ) );\n}", "onResize() {\n var sizes = document\n .getElementById('demogl')\n .getBoundingClientRect();\n\n this.sliders.forEach(function(slider) {\n slider.max = sizes[slider.getAttribute('data-size')];\n this.onSliderChange({ target: slider });\n }, this);\n }", "function createSliderNum() {\n var group = createDiv('');\n group.position(width + 10, height / 2);\n sliderNum = createSlider(2, 100, 8, 1);\n sliderNum.parent(group);\n var label = createSpan('Number of Balls');\n label.parent(group);\n}", "function setUpPyramidSlider() {\r\n // Setter\r\n\r\n $(\"#pyramid-slider\").slider(\"option\", \"value\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\"option\", \"min\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\r\n \"option\",\r\n \"max\",\r\n Number(aleph.years[aleph.years.length - 1])\r\n );\r\n\r\n return;\r\n} // end function setUpPyramidSlider", "set minIndex(_val) {\n (typeof _val === \"number\") && this.setAttribute(\"min\", _val);\n }", "function loopPicker(e) {\n var $el = $(e.currentTarget);\n var val = $el.val();\n var min = $el.attr('data-min');\n var max = $el.attr('data-max');\n var actualmin = $el.attr('data-actual-min');\n var actualmax = $el.attr('data-actual-max');\n if (val === max) {\n $el.val(actualmin);\n }\n if (val === min) {\n $el.val(actualmax);\n }\n }", "function setMinMaxResize() {\n opts['resizeMax'] = opts.max.substr(-1) === '%' ? ((win.parseInt(opts['max']) / 100) * opts.containerSize) : win.parseInt(opts['max']);\n opts['resizeMin'] = opts.min.substr(-1) === '%' ? ((win.parseInt(opts['min']) / 100) * opts.containerSize) : win.parseInt(opts['min']);\n\n var diff = parentContainerDiff();\n if (opts['panel-before'].prev().length > 0 && diff > 0) {\n opts.resizeMax += diff;\n opts.resizeMin += diff;\n }\n }", "function changeHandler(){\n\n // shortcut\n const $this = $(this);\n\n // set value in slider\n if( $this.data('type') == 'min' ) {\n $els.sliderCont.slider( 'values', 0, $this.val() );\n } else {\n $els.sliderCont.slider( 'values', 1, $this.val() );\n }\n\n }", "function setL(value) {\n document.getElementById(\"valueL\").innerHTML = value;\n lines = parseInt(value);\n adjustMines();\n}", "function updateThreshold() {\n let sliderValues = utils.getSliderMinMax(\"threshold\", DATA_REAL_MIN, DATA_REAL_MAX);\n if (get(\"cboxthreshold\").checked) {\n get(\"faceSetThreshold\").setAttribute(\"lowerbound\", sliderValues.min);\n get(\"faceSetThreshold\").setAttribute(\"upperbound\", sliderValues.max);\n get(\"triSetThreshold\").setAttribute(\"lowerbound\", sliderValues.min);\n get(\"triSetThreshold\").setAttribute(\"upperbound\", sliderValues.max);\n }\n get(\"faceSetThreshold2\").setAttribute(\"lowerbound\", sliderValues.min);\n get(\"faceSetThreshold2\").setAttribute(\"upperbound\", sliderValues.max);\n}", "function adicionaMinutos() {\n\n\n if(minutos === 5){\n setMinutos(10);\n setSegundos(0);\n }\n\n if(minutos === 10){\n setMinutos(15);\n setSegundos(0);\n }\n\n if(minutos === 10){\n setMinutos(15);\n setSegundos(0);\n }\n\n if(minutos === 15){\n setMinutos(20);\n setSegundos(0);\n }\n\n if(minutos === 20){\n setMinutos(25);\n setSegundos(0);\n }\n\n if(minutos === 25){\n setMinutos(30);\n setSegundos(0);\n }\n\n if(minutos === 30){\n setMinutos(35);\n setSegundos(0);\n }\n\n if(minutos === 35){\n setMinutos(40);\n setSegundos(0);\n }\n\n if(minutos === 40){\n setMinutos(5);\n setSegundos(0);\n }\n}", "function updateSlider()\r\n{\r\n document.getElementById('slider_min').innerHTML = (document.getElementById(\"tb_slider_size_min\").value);\r\n document.getElementById('slider_max').innerHTML = (document.getElementById(\"tb_slider_size_max\").value);\r\n //alert('hello');\r\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 start() {\n if (n == 0) {\n\n se = setInterval(() => {\n if (count > 59) {\n count = 0;\n ++min;\n document.querySelector('.min').innerHTML = min;\n }\n count = count + 1;\n document.getElementById('p').innerHTML = count;\n }, 1000);\n n++;\n }\n\n}", "setInitialZoom() {\n let me = $(this);\n if (parseFloat(me.find(\"svg\").attr(\"width\")) != 0) {\n let initialZoom = $('.cntBody').width() / parseFloat(me.find(\"svg\").attr(\"width\"));\n me.find(\".sliderZoom\").val(initialZoom);\n me.find(\".sliderZoom\").change();\n }\n }", "function setStepSize(value){\n stepSize = parseInt(value);\n }", "_updateValue () {\n let sliderWidth = this._sliderElement.offsetWidth;\n\n // Calculate the new value\n let { minValue, maxValue } = this._options;\n let percentage = this._xPosition / sliderWidth;\n let value = minValue + (maxValue - minValue) * percentage;\n this.emit(\"update\", value);\n }", "_toSliderScale(value) {\n const trackToRange = (this.props.max - this.props.min) / this._trackTotalLength;\n return (value * trackToRange) + this.props.min;\n }", "set minWidth(value) {}", "function startSliderWatch() {\n\t\t$(\".donate-range\").change(function(){\n\t\t\tvar $thisVal = $(this).val();\n\t\t\tupdateSliderValue($thisVal);\n\t\t\tupdateSliderMessage($thisVal);\n\t\t\t$('.donate-slider-amount').removeClass('blank').html('$'+$thisVal);\n\t\t});\n\n\t\tsetTimeout(function(){ updateSliderValue($(\".donate-range\").val()); },50);\n\t}", "function createSliders(arr) {\n\n for(i = 0; i < arr.length; i++) {\n arr[i].style.height = '20px';\n arr[i].style.width = '30%';\n noUiSlider.create(arr[i], {\n start: [ 0, ], // Handle start position\n margin: 20, // Handles must be more than '20' apart\n direction: 'ltr', // Put '0' at the bottom of the slider\n orientation: 'horizontal', // Orient the slider vertically\n behaviour: 'tap-drag', // Move handle on tap, bar is draggable\n range: { // Slider can select '0' to '10'\n 'min': 1,\n 'max': 10\n }\n });\n arr[i].firstElementChild.value = 1;\n }\n arr[1].firstElementChild.value = 0.2;\n arr[2].firstElementChild.value = 0.1;\n\n}", "function sliderProps() {\n if(g.diagram == \"P-V-diagram\"){\n slider.setAttribute(\"min\",\"275\");\n slider.setAttribute(\"max\",\"750\");\n slider.setAttribute(\"step\",\"5\");\n slider.value = \"500\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Temperature (K)\";\n } else {\n slider.setAttribute(\"min\",\"0.2\");\n slider.setAttribute(\"max\",\"25\");\n slider.setAttribute(\"step\",\"0.2\");\n slider.value = \"9\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Pressure (MPa)\";\n }\n}", "function slider_setup(slider_name, number_name, settings) {\n // Make variables for the slider and number input objects\n var slider = document.getElementById(slider_name);\n var number = document.getElementById(number_name);\n \n if (slider_name == 'ilr_preset') { // create non-linear preset slider with pips\n var ilr = Object.keys(preset_tree[INITIAL_CELL_TECH][INITIAL_PACKAGE_TYPE][INITIAL_SYSTEM_TYPE]) // get ILR values\n var percentage_list = []; // percentages where values appear\n var interval_list = []; // interval between pips\n\n for (var i = 0; i < ilr.length - 1; i++) { // ilr.length - 1 to exclude the max value\n if (i == 0) { // special case for min value\n percentage_list.push(\"0.1%\")\n interval_list.push([parseFloat(ilr[0]), ilr[1]-ilr[0]])\n } else {\n var percentage = (ilr[i]-ilr[i-1]) / (ilr[ilr.length - 1] - ilr[0]) * 100\n percentage_list.push(percentage.toString() + \"%\")\n interval_list.push([parseFloat(ilr[i]), ilr[i+1]-ilr[i]])\n }\n } \n\n var ilr_range = {'min': [parseFloat(ilr[0]) - 0.1], 'max': [parseFloat(ilr[ilr.length - 1])]} // min needs to be slightly less than actual value to get all pips to appear\n for (var i = 0; i < percentage_list.length; i++) { // expand the range based on non-linear intervals\n ilr_range[percentage_list[i]] = interval_list[i]\n }\n\n noUiSlider.create(slider, {\n start: [1.1],\n range: ilr_range, \n pips: {mode: 'steps', density: 50, filter: filterPips}\n });\n } else if (slider_name == 'baseline_degradation_rate') {\n noUiSlider.create(slider, {start: settings['start'], step: settings['step'], connect: true, pips: {mode: 'steps', density: 50, filter: pip_baseline_degradation}, range: {'min': settings['min'], 'max': settings['max']}});\n } else if (slider_name == 'baseline_service_life') {\n noUiSlider.create(slider, {start: settings['start'], step: settings['step'], connect: true, pips: {mode: 'steps', density: 50, filter: pip_baseline_year}, range: {'min': settings['min'], 'max': settings['max']}});\n } else if (slider_name == 'proposed_degradation_rate') {\n noUiSlider.create(slider, {start: settings['start'], step: settings['step'], connect: true, pips: {mode: 'steps', density: 50, filter: pip_proposed_degradation}, range: {'min': settings['min'], 'max': settings['max']}});\n } else if (slider_name == 'proposed_service_life') {\n noUiSlider.create(slider, {start: settings['start'], step: settings['step'], connect: true, pips: {mode: 'steps', density: 50, filter: pip_proposed_year}, range: {'min': settings['min'], 'max': settings['max']}});\n } else { // Create all other sliders\n noUiSlider.create(slider, {start: settings['start'], step: settings['step'], connect: true, range: {'min': settings['min'], 'max': settings['max']}});\n }\n\n // Set the number input to equal the slider's starting point\n number.value = parseFloat(slider.noUiSlider.get()).toFixed(settings['digits']);\n\n // When the slider moves, update the number\n slider.noUiSlider.on('slide', function(values) {\n \n $('#lcoe_proposed').tooltip('hide')\n $('#lcoe_baseline').tooltip('hide')\n $('#baseline_service_life_text').tooltip('hide')\n $('#proposed_service_life_text').tooltip('hide')\n\n var val = parseFloat(values[0]).toFixed(settings['digits']);\n number.value = val\n\n if (val >= SERVICE_LIFE_CAP && (slider_name == 'proposed_service_life' || slider_name == 'baseline_service_life')) {\n document.getElementById(slider_name+'_text').setAttribute('data-original-title', 'Service life must be a positive integer no greater than 1000.');\n\n\n $('#'+slider_name+'_text').tooltip('enable')\n $('#'+slider_name+'_text').tooltip('show')\n } else {\n $('#'+slider_name+'_text').tooltip('disable')\n } \n\n key = slider_name.substring(0, 8) // 'baseline' and 'proposed' are both 8 letters\n var degradation_rate = parseFloat($('#'+key+'_degradation_rate_text').val())/100.0\n var year = parseFloat($('#'+key+'_service_life_text').val())\n var max_year = 1 / degradation_rate + 0.5\n \n if (max_year > SERVICE_LIFE_SLIDER_MAX) {\n max_year = SERVICE_LIFE_SLIDER_MAX\n } \n var max_degradation = 1 / (year - 0.5) * 100\n if (max_degradation > DEGRADATION_MAX) {\n max_degradation = DEGRADATION_MAX\n } \n\n // when the degradation or service life slider moves, update the maximum of the other slider\n if (slider_name == 'baseline_degradation_rate') {\n document.getElementById('baseline_service_life').noUiSlider.updateOptions({\n padding: [0, SERVICE_LIFE_SLIDER_MAX-parseInt(max_year)]\n });\n }\n if (slider_name == 'proposed_degradation_rate') {\n document.getElementById('proposed_service_life').noUiSlider.updateOptions({\n padding: [0, SERVICE_LIFE_SLIDER_MAX-parseInt(max_year)]\n });\n }\n if (slider_name == 'baseline_service_life') {\n document.getElementById('baseline_degradation_rate').noUiSlider.updateOptions({\n padding: [0, Math.round((DEGRADATION_MAX - max_degradation)*100)/100 ]\n });\n }\n if (slider_name == 'proposed_service_life') {\n document.getElementById('proposed_degradation_rate').noUiSlider.updateOptions({\n padding: [0, Math.round((DEGRADATION_MAX - max_degradation)*100)/100 ] \n });\n } \n \n\n // if discount rate is linked, move baseline and proposed sliders together\n if (slider_name == 'baseline_discount_rate' && !document.getElementById('baselineLinkImage').src.includes('broken')) {\n update_slider('proposed_discount_rate', number.value, false)\n $('#proposed_discount_rate_text').val(number.value)\n }\n if (slider_name == 'proposed_discount_rate' && !document.getElementById('proposedLinkImage').src.includes('broken')) {\n update_slider('baseline_discount_rate', number.value, false)\n $('#baseline_discount_rate_text').val(number.value)\n }\n\n calculate()\n });\n\n // When the number changes, update the slider\n number.addEventListener('input', function(){\n update_slider(slider_name, this.value, false);\n\n // if discount rate is linked, update baseline and proposed input boxes together\n if (slider_name == 'baseline_discount_rate' && !document.getElementById('baselineLinkImage').src.includes('broken')) {\n $('#proposed_discount_rate_text').val(this.value)\n }\n if (slider_name == 'proposed_discount_rate' && !document.getElementById('proposedLinkImage').src.includes('broken')) {\n $('#baseline_discount_rate_text').val(this.value)\n }\n \n $('#lcoe_proposed').tooltip('hide')\n $('#lcoe_baseline').tooltip('hide')\n calculate()\n });\n}", "function setupUI()\r\n{\r\n textSize(12)\r\n constraintsSlider = createSlider(1, 4, 1, 0.1)\r\n constraintsSlider.style('width', '300px')\r\n constraintsSlider.position(50, sliderY)\r\n\r\n desiredXSlider = createSlider(100, 600, desiredX, 1)\r\n desiredXSlider.style('width', '300px')\r\n desiredXSlider.position(380, sliderY)\r\n}", "set min(value) {\n this.changeAttribute('min', value);\n }", "function ScaleSlider() {\n var parentWidth = jssor_slider2.$Elmt.parentNode.clientWidth;\n if (parentWidth)\n jssor_slider2.$ScaleWidth(Math.min(parentWidth, 600));\n else\n window.setTimeout(ScaleSlider, 30);\n }", "function adjustBubbles() {\n\n // make sure the low value bubble is actually within the slider\n fitToBar(refs.currBub);\n\n if(gap(refs.minBub, refs.currBub) < 5) {\n // the low bubble overlaps the minLimit bubble\n\n // so hide the minLimit bubble\n hide(refs.minBub);\n } else {\n // the low bubble doesn't overlap the minLimit bubble\n\n // single knob slider\n\n // so show the minLimit slider\n show(refs.minBub);\n\n }\n\n if(gap(refs.currBub, refs.maxBub) < 5) {\n // the low bubble overlaps the maxLimit bubble\n\n // so hide the maxLimit bubble\n hide(refs.maxBub);\n } else {\n // the low bubble doesn't overlap the maxLimit bubble\n\n // no overlap\n\n // so show the maxLimit bubble\n show(refs.maxBub);\n }\n }", "function setDeathPercentageSlider() {\n var handleA = $(\".deathPercentage-rate-slider.lower-handle\");\n var handleB = $(\".deathPercentage-rate-slider.upper-handle\");\n\n $('.deathPercentage-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(0.70);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxDeath = ui.value\n }\n else {\n handleA.text(ui.value);\n minDeath = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 0.70,\n step: 0.05,\n values: [0, 0.70],\n animate: true\n });\n}", "function adjustComplex(){\n if (settings[\"sizeValue\"] < 16){\n complexSlider.max = 4;\n } else if (settings[\"sizeValue\"] < 32){\n complexSlider.max = 5;\n } else{\n complexSlider.max = 6;\n }\n complexValue.textContent = complexSlider.value;\n settings[\"complexValue\"] = complexSlider.value;\n }", "function sliderLeftInput(){//input udate slider left\n sliderLeft.value=inputMin.value;\n}", "function setSliders() {\n let colorToChange =\n document.querySelector(\"#colorToChange\").style.backgroundColor;\n // console.log(246, colorToChange, typeof colorToChange);\n colorToChange = colorToChange\n .substring(4, colorToChange.length - 1)\n .split(\", \");\n // console.log(250, colorToChange);\n colorToChange = colorToChange.map((elem) => (elem = parseInt(elem)));\n console.log(252, colorToChange);\n const rangeRed = document.querySelector(\"#rangeRed\");\n const rangeGreen = document.querySelector(\"#rangeGreen\");\n const rangeBlue = document.querySelector(\"#rangeBlue\");\n rangeRed.value = colorToChange[0];\n rangeGreen.value = colorToChange[1];\n rangeBlue.value = colorToChange[2];\n console.log(\n 260,\n \"Sliders were set to:\",\n rangeRed.value,\n rangeGreen.value,\n rangeBlue.value\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 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}", "function ScaleSlider() {\n var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;\n if (parentWidth) jssor_slider1.$ScaleWidth(Math.min(parentWidth, 720));\n else $Jssor$.$Delay(ScaleSlider, 30);\n }", "function resetMinMax() {\n minPermintaan = 1000;\n maxPermintaan = 5000;\n minPersediaan = 100;\n maxPersediaan = 600;\n }", "function passCorrectedValuesToSliderAndGetThem(textBox, isMin){\n newVal = $(textBox).val()\n theSlider = $(textBox).parent().parent().parent().find(\"div > .theSlider\")\n if(newVal){ //make sure the new value exists\n //create the range variables for each of the sliders\n low = (isMin) ? $(theSlider).slider(\"option\", \"min\") : $(theSlider).slider(\"values\", 0)\n high = (isMin) ? $(theSlider).slider(\"values\", 1) : high = $(theSlider).slider(\"option\", \"max\")\n \n //if we are not within range make ourselves within range\n if(newVal < low || high < newVal){\n if(newVal < low) newVal = low\n else newVal = high\n }\n } //set the slider value to its default\n else newVal = $(theSlider).slider(\"option\", (isMin) ? \"min\" : \"max\")\n\n //set the new value of the slider\n $(theSlider).slider(\"values\", (isMin) ? 0 : 1, newVal)\n\n //set the value for the textbox\n return newVal\n }", "function ScaleSlider() {\n var parentWidth = jssor_slider2.$Elmt.parentNode.clientWidth;\n if (parentWidth)\n jssor_slider2.$ScaleWidth(Math.min(parentWidth, 750));\n else\n window.setTimeout(ScaleSlider, 30);\n }", "function ScaleSlider() {\r\n var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;\r\n if (parentWidth)\r\n jssor_slider1.$ScaleWidth(Math.max(Math.min(parentWidth, 2000), 300));\r\n else\r\n window.setTimeout(ScaleSlider, 30);\r\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 ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 820);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function renderMinesCountOnLevel(initNum) {\n var minesCount;\n if (initNum === 4) minesCount = 2;\n else if (initNum === 8) minesCount = 12;\n else minesCount = 30;\n var elMines = document.querySelector('.mines');\n elMines.innerHTML = `${minesCount}${MINE}`\n}", "function onSliderChange() {\n sw = slider.value;\n}", "function changeInsightsSliderSize() {\n\t\t\twrapperI.css({\n\t\t\t\twidth: itemsI.length * sliderInsightsWidth + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\tpaddingI.css({\n\t\t\t\tpadding: \"0 \" + sliderInsightsPadding + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsI.each(function() {\n\t\t\t\tif(parseFloat($(this).css(\"width\")) != 0) {\n\t\t\t\t\t$(this).css({\n\t\t\t\t\t\twidth: sliderInsightsWidth + \"vw\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t$(this).css({\n\t\t\t\t\theight: sliderInsightsHeight + \"em\"\n\t\t\t\t});\n\t\t\t});\n\t\t\t\n\t\t\tcontrolI.css({\n\t\t\t\tmarginLeft: sliderInsightsPadding + \"vw\",\n\t\t\t\twidth: (Math.floor(100/sliderInsightsWidth) * sliderInsightsWidth - 2 * sliderInsightsPadding) + \"vw\"\n\t\t\t});\n\t\t}", "function increaseValueOnWin() {\n if (inputAsNumber() === randomNumber) {\n min = min - 10;\n max = max + 10;\n randomNumber = generateRandomNumber();\n updateMinMaxText();\n }\n }", "function setWidth() {\r\n /*determind the siblings of the box in focus*/\r\n var boxSiblings = $(this).siblings();\r\n /*count the number of siblings a box has*/\r\n var numberOfSiblings = boxSiblings.length;\r\n /*determine the size the box should scale to*/\r\n var lg = newFeatureBoxWidth;\r\n var lgString = lg + \"%\";\r\n /*determine the remaining space int eh row after the box has scaled*/\r\n var rem = (100 - lg) / numberOfSiblings;\r\n var remString = rem + \"%\";\r\n /*determine which box should be scaled*/\r\n var boxFocus = $(this);\r\n\r\n /*disable box scaling on mobile/devices smaller than 769px*/\r\n if ($(window).width() >= 769) {\r\n TweenLite.to(boxFocus, 0.5, {width: lgString});\r\n TweenLite.to(boxSiblings, 0.5, {width: remString});\r\n }\r\n }", "function initSliderPositions() {\n // console.log('Init Slider Pos runs');\n sliders.forEach(slider => {\n if (slider.name === 'hue') {\n // Get the correct color from the array based on the data atttribute of the current slider\n // which will have the correct number for the index based on which group the slider is in\n const color = colorsArr[slider.getAttribute('data-hue')];\n // Extract the hue from that color and save it\n const hueValue = Math.floor(chroma(color).hsl()[0]);\n // console.log(hueValue);\n // set the current slider's value to the hue\n slider.value = hueValue;\n } else if (slider.name === 'saturation') {\n const color = colorsArr[slider.getAttribute('data-sat')];\n const saturationValue = Math.floor(chroma(color).hsl()[1] * 100) / 100;\n slider.value = saturationValue;\n } else {\n const color = colorsArr[slider.getAttribute('data-bright')];\n const brightnessValue = Math.floor(chroma(color).hsl()[2] * 100) / 100;\n slider.value = brightnessValue;\n }\n });\n}", "function setupSliderWidth() {\n // resets sliderElement\n sliderElement.style.width = '0px';\n\n var totalWidth = 0;\n elements.forEach(function (element, index) {\n slideWidth = element.offsetWidth;\n totalWidth = totalWidth += slideWidth;\n });\n sliderElement.style.width = totalWidth + 'px';\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 ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 1900);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\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 penSize(){\n\t$('#btnIncrease').click(function(){\n\t\tradius = radius + 2;\n\t\tif (radius >= maxRadius) {\n\t\t\tradius = maxRadius;\n\t\t}\n\t\t$('#penVal').text(radius);\n\n\t});\n\n\t$('#btnDecrease').click(function(){\n\t\tradius = radius - 2;\n\t\tif (radius <= minRadius) {\n\t\t\tradius = minRadius;\n\t\t}\n\t\t$('#penVal').text(radius);\n\n\t});\n}", "function updateSlider(slideAmount) {\n removegrid(gridSize);\n gridSize = (slideAmount ** 2);\n setGridSize(slideAmount);\n}", "function increaseIntensity(){\n\t\t//Check that it will still be in the range after increase\n\t\tif(intensityInRange(currentIntensity + currentStepSize)){\n\t\t\tcurrentIntensity += currentStepSize;\n\t\t\t\n\t\t\t//Set the variable to keep track that we have not hit the limit such that we update the step size\n\t\t\tlimitHit = false;\n\t\t}\n\t\t//Else just set it to the minimum intensity allowed\n\t\telse{\n\t\t\t\n\t\t\t//Only update the step size if we have not hit the lower or upper limit\n\t\t\tif(!limitHit){\n\t\t\t\tcurrentStepSize = upperIntensityLimit - currentIntensity;\n\t\t\t\tconsole.log(\"upperIntensityLimit reached. currentStepSize: \" + currentStepSize);\n\t\t\t}\n\t\t\t\n\t\t\tcurrentIntensity = upperIntensityLimit;\n\t\t\t\n\t\t\t//Set the variable to keep track that we have hit the limit such that we do not update the step size\n\t\t\tlimitHit = true;\n\t\t}\n\t}", "function setProgressDimensionRange(fieldset) {\n // Only for units and lessons:\n // 0 == none of its sub-entities has been completed\n // 1 == some, but not all, of its sub-entities have been completed\n // 2 if all its sub-entities have been completed.\n function updateRange(value) {\n highDiv.find('input').val(value);\n lowDiv.find('input').val(value);\n // Toogle all other buttons (but just the buttons on this fielset.\n fieldset.find('input[type=radio]').prop('checked', false);\n fieldset.find('#progress-button-' + value).prop('checked', true);\n }\n var highDiv = fieldset.find('.dim-range-high').parent();\n var lowDiv = fieldset.find('.dim-range-low').parent();\n highDiv.hide();\n lowDiv.hide();\n createRadioElements(fieldset, progressDimRadioLabels, updateRange);\n highValue = parseInt(highDiv.find('input').val());\n if (highValue == parseInt(lowDiv.find('input').val()) &&\n highValue < progressDimRadioLabels.length) {\n fieldset.find('#progress-button-' + highValue).click();\n }\n}", "function ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 600);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 600);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function changeSliderSize() {\n\t\t\twrapperA.css({\n\t\t\t\twidth: itemsA.length * (sliderWidth + 2 * sliderMargin) + \"vw\",\n\t\t\t\tmarginLeft: getWrapperMargin() + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsA.css({\n\t\t\t\twidth: sliderWidth + \"vw\",\n\t\t\t\theight: sliderHeight + \"em\",\n\t\t\t\tmargin: \"0 \" + sliderMargin + \"vw\"\n\t\t\t});\n\t\t}", "function updateMinN(min) {\n reset();\n if (min < 1 || min > 100 || Math.round(min) != min) {\n alert(\"Minimum value of n must be an integer between 1 and 100\");\n document.getElementById(\"minInput\").value = minN;\n } else {\n minN = min;\n }\n}", "function setC(value) {\n document.getElementById(\"valueC\").innerHTML = value;\n collumns = parseInt(value);\n adjustMines();\n}", "function ScaleSlider() {\r\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\r\n if (refSize) {\r\n refSize = Math.min(refSize, 1400);\r\n jssor_1_slider.$ScaleWidth(refSize);\r\n }\r\n else {\r\n window.setTimeout(ScaleSlider, 30);\r\n }\r\n }", "set _min(value) {\n Helper.UpdateInputAttribute(this, \"min\", value);\n }", "function ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 980);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function setMin (response) {\n curMin1 = 9999;\n for(var i = 0; i < 8; i++) {\n var tempMin1 = response.list[i].main.temp_min;\n //console.log(tempMin1);\n\n if (tempMin1 < curMin1) {\n curMin1 = Math.round(response.list[i].main.temp_min);\n }\n else if (curMin1 > curTemp) {\n curMin1 = Math.round(curTemp);\n }\n }\n}", "function sliderResizeToTallest() {\n var max = 0;\n\n $('.sp-slide').each(function(){\n var slideHeight = $(this).height();\n if( slideHeight > max )\n max = slideHeight;\n });\n\n $('#slider').css({'height' : max});\n }", "function setSliderTicks(){\n\t var $slider = $('#slider');\n\t var max = $slider.slider(\"option\", \"max\"); \n\t if (max > 1) {\n\t \tvar spacing = 100 / (max -1);\n\t } else {\n\t \tvar spacing = 50;\n\t }\n\n\t $slider.find('.ui-slider-tick-mark').remove();\n\t for (var i = 0; i < max ; i++) {\n\t $('<span class=\"ui-slider-tick-mark\"></span>').css('left', (spacing * i) + '%').appendTo($slider); \n\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}", "initPriceSlider(min, max, step) {\n\t\tlet minVal, maxVal;\n\n\t\tif (this.filters.price.length) {\n\t\t\tminVal = this.filters.price[0];\n\t\t\tmaxVal = this.filters.price[1];\n\t\t} else {\n\t\t\tminVal = max * 0.05;\n\t\t\tmaxVal = max * 0.4;\n\t\t}\n\n\t\t$('.price-range__slider').slider({\n\t\t\trange: true,\n\t\t\tvalues: [minVal, maxVal],\n\t\t\tmin: min,\n\t\t\tmax: max,\n\t\t\tstep: step,\n\t\t\tslide: () => {\n\t\t\t\tthis.showPriceRangeValues();\n\t\t\t},\n\t\t\tchange: () => {\n\t\t\t\tthis.showPriceRangeValues();\n\t\t\t\tthis.filters.price = this.getPriceRange();\n\t\t\t\tthis.setCookies('price', this.filters.price.join('_'));\n\t\t\t\t$('#oops').addClass('template');\n\t\t\t\tthis.postFilters(this.filters);\n\t\t\t}\n\t\t});\n\t\tthis.showPriceRangeValues();\n\t}", "_changeSliderSize() {\n\t\t\t\tlet width = this.model.get('width'),\n\t\t\t\t\theight = this.model.get('height');\n\n\t\t\t\tthis.$el.css({width, height});\n\t\t\t}", "function slider_option(id, decimals, pxv, pcv, emv) {\n\n var thisContent = $(\"#\" + id + \"-group\").parent(\".yp-this-content\");\n\n // Set Maximum and minimum values for custom prefixs.\n $(\"#\" + id + \"-group\").data(\"px-range\", pxv);\n $(\"#\" + id + \"-group\").data(\"pc-range\", pcv);\n $(\"#\" + id + \"-group\").data(\"em-range\", emv);\n\n // Default PX\n var range = $(\"#\" + id + \"-group\").data(\"px-range\").split(\",\");\n\n // Update PX.\n if ($(\"#\" + id + \"-group .yp-after-prefix\").val() == 'px') {\n range = $(\"#\" + id + \"-group\").data(\"px-range\").split(\",\");\n }\n\n // Update %.\n if ($(\"#\" + id + \"-group .yp-after-prefix\").val() == '%') {\n range = $(\"#\" + id + \"-group\").data(\"pc-range\").split(\",\");\n }\n\n // Update EM.\n if ($(\"#\" + id + \"-group .yp-after-prefix\").val() == 'em') {\n range = $(\"#\" + id + \"-group\").data(\"em-range\").split(\",\");\n }\n\n // Update s.\n if ($(\"#\" + id + \"-group .yp-after-prefix\").val() == 's') {\n range = $(\"#\" + id + \"-group\").data(\"em-range\").split(\",\");\n }\n\n // Setup slider.\n $('#yp-' + id).wqNoUiSlider({\n\n start: [0],\n\n range: {\n 'min': parseInt(range[0]),\n 'max': parseInt(range[1])\n },\n\n format: wNumb({\n mark: '.',\n decimals: decimals\n })\n\n }, true).on('change', function () {\n\n $(\".fake-layer\").remove();\n\n var lock = thisContent.find(\".lock-btn.active\").length;\n var lockedIdArray = [];\n\n if (lock) {\n\n thisContent.find(\".yp-option-group\").each(function () {\n lockedIdArray.push($(this).attr(\"data-css\"));\n });\n\n var val = $(this).val();\n\n for (var y = 0; y < lockedIdArray.length; y++) {\n $('#yp-' + lockedIdArray[y]).val(val);\n $('#' + lockedIdArray[y] + '-after').trigger(\"keyup\");\n slide_action($(\"#yp-\" + lockedIdArray[y]), lockedIdArray[y], true, false);\n }\n\n option_change();\n\n } else {\n slide_action($(this), id, true, true);\n }\n\n }).on('slide', function () {\n\n // Be sure its hidden.\n hide_frame_ui(200);\n\n var lock = thisContent.find(\".lock-btn.active\").length;\n var lockedIdArray = [];\n\n if (lock) {\n thisContent.find(\".yp-option-group\").each(function () {\n lockedIdArray.push($(this).attr(\"data-css\"));\n });\n }\n\n // Get val\n var val = $(this).val();\n var prefix = $('#' + id + \"-after\").val();\n var y;\n\n val = Number((parseFloat(val)).toFixed(2));\n var left = $(\"#\" + id + \"-group\").find(\".wqNoUi-origin\").css(\"left\");\n\n // Update the input.\n if (lock === 0) {\n $('#' + id + '-value').val(val);\n } else {\n for (y = 0; y < lockedIdArray.length; y++) {\n $('#' + lockedIdArray[y] + '-value').val(val);\n $('#' + lockedIdArray[y] + '-after').val(prefix);\n $('#' + lockedIdArray[y] + '-group').find(\".wqNoUi-origin\").css(\"left\", left);\n }\n }\n\n // some rules not support live css, so we check some rules.\n if (id != 'background-parallax-speed' && id != 'background-parallax-x') {\n\n prefix = $(this).parent().find(\"#\" + id + \"-after\").val();\n\n // Standard.\n if (lock === 0) {\n delete_live_css(id, false);\n insert_live_css(id, val + prefix, false);\n } else {\n for (y = 0; y < lockedIdArray.length; y++) {\n delete_live_css(lockedIdArray[y], false);\n insert_live_css(lockedIdArray[y], val + prefix, false);\n }\n }\n\n\n } else { // for make it as live, inserting css to data.\n slide_action($(this), id, true, true);\n }\n\n if ($(\".fake-layer\").length === 0) {\n $(\"body\").append(\"<div class='fake-layer'></div>\");\n }\n\n });\n\n }", "set min(value) {\n Helper.UpdateInputAttribute(this, 'min', value);\n }", "showMineCount() {\n // get/store number of surrounding mines\n this.surrMines = this.allNeighbours.reduce(\n (total, n) => (n.hasMine ? ++total : total),\n 0\n );\n // if greater than 0, show the number, otherwise leave blank\n if (this.surrMines > 0) {\n this.uiBox.textContent = this.surrMines;\n this.uiBox.classList.add(\"num\");\n this.uiBox.style.color = getComputedStyle(root).getPropertyValue(\n `--boxColor-${this.surrMines}`\n );\n }\n }", "function ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 1920);\n jssor_1_slider.$ScaleWidth(refSize);\n }else{\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function ScaleSlider() {\n var refSize = jssor_1_slider.$Elmt.parentNode.clientWidth;\n if (refSize) {\n refSize = Math.min(refSize, 600);\n jssor_1_slider.$ScaleWidth(refSize);\n }\n else {\n window.setTimeout(ScaleSlider, 30);\n }\n }", "function onSliderChange () {\n // show spinner\n document.getElementById('loader').style.display = 'block'\n\n // get slider values\n data.inputs = {\n 'Count':document.getElementById('count').valueAsNumber,\n 'Radius':document.getElementById('radius').valueAsNumber,\n 'Length':document.getElementById('length').valueAsNumber\n }\n compute()\n}", "function changeMaxAndMin(minRange, maxRange) {\n var minStorage = document.querySelector('#post-min-range');\n var maxStorage = document.querySelector('#post-max-range');\n if (minRange > 10) {\n minRange = minRange - 10;\n minStorage.innerText = minRange;\n maxRange = maxRange + 10;\n maxStorage.innerText = maxRange;\n } else {\n minStorage.innerText = minRange;\n maxRange = maxRange + 10;\n maxStorage.innerText = maxRange;\n }\n}" ]
[ "0.77145463", "0.6774809", "0.67229176", "0.64684594", "0.6364416", "0.6331966", "0.6316435", "0.6271405", "0.62451714", "0.6229473", "0.6142502", "0.6108918", "0.6108454", "0.6106363", "0.60675997", "0.6048922", "0.60485196", "0.6005878", "0.5990862", "0.59832495", "0.5947708", "0.5923673", "0.5923318", "0.5915074", "0.59016144", "0.588825", "0.5884135", "0.5884036", "0.5881899", "0.58624434", "0.58601403", "0.58536434", "0.58454525", "0.5831358", "0.5819341", "0.58182895", "0.580576", "0.57969433", "0.578117", "0.57789975", "0.5774311", "0.57719177", "0.5770403", "0.57460636", "0.57458174", "0.57405174", "0.5738348", "0.5738109", "0.57368356", "0.5734661", "0.57311255", "0.57307607", "0.5728897", "0.57164466", "0.5714619", "0.5711305", "0.57024026", "0.56966513", "0.56930196", "0.56926566", "0.5687133", "0.5680269", "0.5675854", "0.5667326", "0.56665", "0.5664513", "0.5663506", "0.5660288", "0.566014", "0.5659708", "0.56544787", "0.5647279", "0.564715", "0.56465626", "0.56456476", "0.56399715", "0.56382555", "0.56367105", "0.5617599", "0.5617498", "0.5617498", "0.56174093", "0.5614729", "0.56136984", "0.5613645", "0.56123734", "0.5609059", "0.5607559", "0.56053823", "0.5600735", "0.560032", "0.55951184", "0.5594768", "0.5589772", "0.5589121", "0.55888104", "0.5586213", "0.5581194", "0.5575075", "0.5574823" ]
0.6116944
11
Adjusts number of mines (max and current) according to lines and collumns
function adjustMines() { maxMines = (lines*collumns) - 1; document.getElementById("mineSlider").setAttribute("max", maxMines); document.getElementById("valueMax").innerHTML = maxMines; if (mines > maxMines) { document.getElementById("valueM").innerHTML = maxMines; mines = parseInt(maxMines); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function increaseMinMax() {\n min -= 10;\n max += 10;\n }", "function createMinMaxRangeLines(lines){\n // console.log(\"Entering createMinMaxRangelines function with lines\")\n //console.log(lines.length)\n //\n //console.log(\"\\n\\n Value 0,0:\")\n //console.dir(lines)\n //console.log(lines[0][0].length)\n\n for(var i=0; i<lines.length; i++)\n {\n rangeLines[i] = [];\n }\n //console.log(\"length ranglines = \", rangeLines.length)\n\n\n // each entry in rangeLines has all the converted data for that organ\n for(var i=0; i<lines[0].length; i++)\n {\n for(var j=0; j<rangeLines.length; j++)\n {\n //console.log(i,j)\n //console.dir(lines[j][i])\n rangeLines[j].push(convert(lines[j][i]));\n }\n }\n\n // initialize maxLine and minLine to initial low and high values\n // previously was error with max and min changing simultaneously\n for(var i=0; i<lines.length; i++)\n {\n maxLine[i] = [];\n minLine[i] = [];\n for(var k=0; k<lines[0][0].length; k++)\n {\n maxLine[i].push([rangeLines[i][0][k][0], -1]);\n minLine[i].push([rangeLines[i][0][k][0], 2]);\n }\n }\n\n // loop through all data files and determine max and min values out of all data files for each organ\n for(var i=0; i<lines.length; i++)\n {\n for(var j=0; j<lines[0].length; j++)\n {\n for(var k=0; k<lines[0][0].length; k++)\n {\n if(parseFloat(rangeLines[i][j][k][1]) > parseFloat(maxLine[i][k][1]))\n {\n maxLine[i][k][0] = rangeLines[i][j][k][0];\n maxLine[i][k][1] = rangeLines[i][j][k][1];\n }\n if(parseFloat(rangeLines[i][j][k][1]) < parseFloat(minLine[i][k][1]))\n {\n minLine[i][k][0] = rangeLines[i][j][k][0];\n minLine[i][k][1] = rangeLines[i][j][k][1];\n }\n }\n }\n }\n\n}", "limits() {\n var keys = Object.keys(this.data);\n var min = parseInt(this.data[keys[0]]); // ignoring case of empty list for conciseness\n var max = parseInt(this.data[keys[0]]);\n var i;\n for (i = 1; i < keys.length; i++) {\n var value = parseInt(this.data[keys[i]]);\n if (value < min) min = value;\n if (value > max) max = value;\n }\n this.yMin =min - Math.round(min/4);\n if(this.yMin <= 0)\n this.yMin=0;\n this.yMax = max + Math.round(max/4);\n\n }", "function setMinMaxResize() {\n opts['resizeMax'] = opts.max.substr(-1) === '%' ? ((win.parseInt(opts['max']) / 100) * opts.containerSize) : win.parseInt(opts['max']);\n opts['resizeMin'] = opts.min.substr(-1) === '%' ? ((win.parseInt(opts['min']) / 100) * opts.containerSize) : win.parseInt(opts['min']);\n\n var diff = parentContainerDiff();\n if (opts['panel-before'].prev().length > 0 && diff > 0) {\n opts.resizeMax += diff;\n opts.resizeMin += diff;\n }\n }", "function updateMinMax() {\n min = parseInt(minValueField.value);\n max = parseInt(maxValueField.value);\n}", "drawMinMaxes(ctx, ymin, ymax)\n{\n var barData = new Array();\n\n var minValue = 1000000000.0;\n var maxValue = -1000000000.0;\n var minIndex = -1;\n var maxIndex = -1;\n var minLine = -1;\n var maxLine = -1;\n\n for ( var jndx=0; jndx<this.plotData.length; jndx++ )\n {\n barData = this.plotData[jndx];\n\n for ( var indx=0; indx<barData.length; indx++ )\n {\n if ( barData[indx] > maxValue )\n {\n maxValue = barData[indx];\n maxIndex = indx;\n maxLine = jndx;\n }\n if ( barData[indx] < minValue )\n {\n minValue = barData[indx];\n minIndex = indx;\n minLine = jndx;\n }\n }\n }\n\n if ( this.labelMax == true && maxIndex != -1 )\n {\n barData = this.plotData[maxLine];\n\n if ( this.DEBUG == true )\n alert(\"Max Line: \" + maxLine + \", Index: \" + maxIndex +\n \", Value: \" + barData[maxIndex]);\n\n var x = this.xScale*maxIndex + this.xOrg + this.xScale/2.0;\n var y = this.yOrg - (barData[maxIndex]-ymin)*this.yScale - this.xLabelsFontSize;\n\n var max_val = barData[maxIndex];\n ctx.lineWidth = 1;\n ctx.strokeStyle = this.BLACK;\n ctx.drawTextCenter(this.xLabelsFont, this.xLabelsFontSize, x, y, max_val + \"\");\n }\n\n if ( this.labelMin == true && minIndex != -1 )\n {\n barData = this.plotData[minLine];\n\n if ( this.DEBUG == true )\n alert(\"Min Line: \" + minLine + \", Index: \" + minIndex +\n \", Value: \" + barData[minIndex]);\n\n var x = this.xScale*minIndex + this.xOrg + this.xScale/2.0;\n var y = this.yOrg - (barData[minIndex]-ymin)*this.yScale - this.xLabelsFontSize;\n\n var min_val = barData[minIndex];\n ctx.lineWidth = 1;\n ctx.strokeStyle = this.BLACK;\n ctx.drawTextCenter(this.xLabelsFont, this.xLabelsFontSize, x, y, min_val + \"\");\n }\n}", "_determineMinMax() {\n\n if (!this.tabListEl || !this.tabListScrollEl) {\n return;\n }\n\n this.maxX = 0;\n this.minX = this.tabListScrollEl.clientWidth - this.tabListEl.clientWidth - this.maxX;\n }", "function updateMinMax(min, max, coord) {\n if( min[0] < coord[0] ) min[0] = coord[0];\n if( min[1] > coord[1] ) min[1] = coord[1];\n\n if( max[0] > coord[0] ) max[0] = coord[0];\n if( max[1] < coord[1] ) max[1] = coord[1];\n}", "_calcVisibleLines() {\n this._lines.qtMaxVisible = Math.floor(this._matrixHeight / this._cell.heightMin);\n if (this._lines.qtMaxVisible > 3)\n this._lines.qtMinVisible = 3;\n else\n this._lines.qtMinVisible = 1;\n if (this._lines.qtMaxVisible > this._lines.qtTotal)\n this._lines.qtMaxVisible = this._lines.qtTotal;\n if (this._lines.qtMaxVisible < this._lines.qtVisible && this._lines.qtMaxVisible != 0)\n this._lines.qtVisible = this._lines.qtMaxVisible;\n }", "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location bug\n\n this.llabel.html(numberWithCommas(min))\n this.rlabel.html(numberWithCommas(max))\n }", "function onUpdateMin()\n\t{\n\t\t// store current min \n\t\tvar pxmin = xslider.min;\n\t\tvar pymin = yslider.min;\n\n\t\t// store current values\n\t\tvar xcurr = xslider.value;\n\t\tvar ycurr = yslider.value;\n\n\t\t// set new min. slider will internally try to update current value to ensure it's within its range. e.g. if curr = 20, new min = 25, curr = 25\n\t\t// this is why we store original values before we do this. we use original values to calculate new values\n\t\txslider.min = w - (yslider.hide? 0 : t);\n\t\tyslider.min = h - (xslider.hide? 0 : t);\n\n\t\t// calculate the change in min and use it to update current values. e.g. old.min = 20, old.val = 24, new.min = 15, new.val = 19\n\t\t// we always keep the delta between min and value. if value end up >max, slider will handle it.\n\t\txcurr -= (pxmin - xslider.min);\n\t\tycurr -= (pymin - yslider.min);\n\n\t\t// finally, update values\n\t\txslider.value = xcurr;\n\t\tyslider.value = ycurr;\n\t}", "function setMinesNegsCount(rowIdx, colIdx) {\n var minesCount = 0;\n\n for (var i = rowIdx - 1; i <= rowIdx + 1; i++) {\n if (i < 0 || i > gLevel.SIZE - 1) //if the is on the range\n continue;\n for (var j = colIdx - 1; j <= colIdx + 1; j++) {\n if ((j < 0 || j > gLevel.SIZE - 1) || (i === rowIdx && j === colIdx))//if its the cell itself or out of the board\n continue;\n if (gBoard[i][j].cellContent === gMINE) {\n minesCount++;\n continue;\n }\n }\n }\n return minesCount;\n}", "insertUpdateLimits(){\n let node = this;\n let changed = true;\n while(node.parent && changed){\n changed = false;\n if(node.parent.minimumLow > this.minimumLow){\n node.parent.minimumLow = this.minimumLow;\n changed = true;\n }\n if(node.parent.maximumLow < this.maximumLow){\n node.parent.maximumLow = this.maximumLow;\n changed = true;\n }\n if(node.parent.minimumHigh > this.minimumHigh){\n node.parent.minimumHigh = this.minimumHigh;\n changed = true;\n }\n if(node.parent.maximumHigh < this.maximumHigh){\n node.parent.maximumHigh = this.maximumHigh;\n changed = true;\n }\n node = node.parent;\n }\n }", "calcMaxLength () {\n let maxima = [0.0, 0.0, 0.0]\n let minima = [0.0, 0.0, 0.0]\n let spans = [0.0, 0.0, 0.0]\n\n function comp (v, i) {\n if (i === 0) return v.x\n if (i === 1) return v.y\n if (i === 2) return v.z\n }\n\n let atom = this.getAtomProxy()\n for (let iDim = 0; iDim < 3; iDim++) {\n for (let iAtom = 0; iAtom < this.getAtomCount(); iAtom += 1) {\n let pos = atom.load(iAtom).pos\n if (minima[iDim] > comp(pos, iDim)) {\n minima[iDim] = comp(pos, iDim)\n }\n if (maxima[iDim] < comp(pos, iDim)) {\n maxima[iDim] = comp(pos, iDim)\n }\n }\n spans[iDim] = maxima[iDim] - minima[iDim]\n }\n this.maxLength = Math.max(spans[0], spans[1], spans[2])\n }", "function getMinMax() {\n var minPt = pts[0];\n var maxPt = pts[0];\n for (var i=1; i<pts.length; i++) {\n minPt = minPt.$min( pts[i] );\n }\n for (i=1; i<pts.length; i++) {\n maxPt = maxPt.$max( pts[i] );\n }\n nextRect.set( minPt).to( maxPt );\n}", "_maxLineHack() {\n var display = this.cm.display, curOp = this.cm.curOp;\n const CLEARANCE = 3; /* space added to the right, in characters */\n display.maxLineChanged = false;\n if (curOp) {\n curOp.updateMaxLine = false;\n curOp.adjustWidthTo = (display.maxLine.text.length + CLEARANCE) *\n this.cm.defaultCharWidth();\n // Force the size using the actual character count.\n // May result in too much horizontal scrolling, but that is\n // better than the alternative.\n }\n }", "set_lines(list_of_lines) {\n this.lines = list_of_lines;\n this.lines.sort((line1, line2) => {//Ordena las lineas según su punto más a la izquierda\n let min1 = (line1.a.x < line2.a.x) ? line1.a.x : line2.a.x;//Encuentro el minimo entre los puntos a \n let min2 = (line1.b.x < line2.b.x) ? line1.b.x : line2.b.x;//El mínimo entre los puntos b\n let min = (min1 < min2) ? min1 : min2;//Encuentro el mínimo de mínimos\n return ((min === line1.a.x) || (min === line1.b.x) ? -1 : 1);//Pregunto si el mínimo es el x de la\n //Linea 1, si es así, va primero regreso -1, si no, entonces el mínimo pertenece a la linea 2 y regreso 1\n \n });//Ordeno según el eje X\n this.original = [...this.lines];//Creo una copia de las lineas\n }", "addIntervalUpdateLimits(){\n let node = this.parent;\n let changed = true;\n while(node && changed){\n changed = false;\n if(node.minimumHigh > this.minimumHigh){\n node.minimumHigh = this.minimumHigh;\n changed = true;\n }\n if(node.maximumHigh < this.maximumHigh){\n node.maximumHigh = this.maximumHigh;\n changed = true;\n }\n node = node.parent;\n }\n }", "function adjustByMinSize(viewport,rects,minSize) {\n var smallerCount = 0, // no. of rect which is less then the minSize\n min; // The min rectangle\n \n if (minSize === undefined)\n minSize = {width : 0 , height : 0};\n \n for (var i = 0 ; i < rects.length ;i++) {\n if (rects[i].width < minSize.width ||\n rects[i].height < minSize.height) {\n smallerCount++;\n min = rects[i];\n }\n }\n \n if (smallerCount == 1) { \n\n // Ignore 0 or 2.\n // If the count is 2, it has no way to adjust.\n var dw = minSize.width - min.width,\n dh = minSize.height - min.height;\n if (dw < 0)\n dw = 0;\n if (dh < 0)\n dh = 0;\n \n for (var i = 0 ; i < rects.length ;i++) {\n if (rects[i].width < minSize.width ||\n rects[i].height < minSize.height) {\n \n rects[i].width += dw;\n rects[i].height += dh;\n \n if (i === 1) { // It is on the right / bottom\n rects[i].left -= dw;\n rects[i].top -= dh;\n }\n \n } else {\n rects[i].width -= dw;\n rects[i].height -= dh; \n \n if (i === 1) { // It is on the right / bottom\n rects[i].left += dw;\n rects[i].top += dh;\n }\n }\n }\n }\n\n }", "function _calcMaxMin() {\n\t var i,j,k;\n\t\t\n\t\t_vMaxValuesAttr = d3.range (_vIndexMapAttr.length);\n\t\t_vMinValuesAttr = d3.range (_vIndexMapAttr.length);\n\t\t\n\t\tfor (i=0; i< _vMaxValuesAttr.length; i++) {\n\t\t\t_vMaxValuesAttr[i] = Number.MIN_VALUE;\n\t\t\t_vMinValuesAttr[i] = Number.MAX_VALUE;\n\t\t}\n\n\t\tfor (i=0; i< _data.matrix.length; i++)\t\n\t\t\tfor ( j=0; j< _data.matrix[i].length; j++)\n\t\t\t\tif (_data.matrix[i][j].exist) {\n\t\t\t\t\tfor (k=0; k< _vIndexMapAttr.length; k++) {\n\t\t\t\t\t\tif (_data.matrix[i][j].values[_vIndexMapAttr[k]] > _vMaxValuesAttr[k])\n\t\t\t\t\t\t\t_vMaxValuesAttr[k] = _data.matrix[i][j].values[_vIndexMapAttr[k]];\n\t\t\t\t\t\tif (_data.matrix[i][j].values[_vIndexMapAttr[k]] < _vMinValuesAttr[k])\n\t\t\t\t\t\t\t_vMinValuesAttr[k] = _data.matrix[i][j].values[_vIndexMapAttr[k]];\t\t\t\t\t\t\t\n\t\t\t\t\t}\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t_maxValueAttr = d3.max(_vMaxValuesAttr);\n\t\t_minValueAttr = d3.min(_vMinValuesAttr);\n\t}", "function respondToResizeMap() {\n var customRow = rowInput.value;\n\n // update the map size var.\n document.getElementById(\"range\").innerHTML=customRow;\n\n canvasWidth = INIT_CANVAS_WIDTH;//INIT_CANVAS_WIDTH IS 512\n\n //the maximun map size is 16 and th minumun map size is 4\n if ((customRow <= 16) && (customRow >= 4)) {\n if ((canvasWidth % customRow) !== 0) {\n while ((canvasWidth % customRow) !== 0) {\n canvasWidth += 1;\n }\n }\n } else {\n swal(\"Please enter a number between 4 and 16 \");\n return false;\n }\n canvasWidth +=1;//plus 1 to draw the right most and bottom line\n //canvasHeight +=1;\n canvas.width = canvasWidth;\n canvas.height = canvasWidth;\n\n cellLength = (canvasWidth-1) / customRow;\n canvas2D.clearRect(0, 0, canvasWidth, canvasHeight);\n resetEditor();\n\n}", "function set_limits(){\n\t\t\t//max and min container movements\n\t\t\tvar max_move = $wrap.offset().top + $wrap.height() - $sidebar.height();\n\t\t\tvar min_move = $wrap.offset().top;\n\t\t\t//save them\n\t\t\t$sidebar.attr(\"data-min\", min_move).attr(\"data-max\",max_move);\n\t\t\t//window thresholds so the movement isn't called when its not needed!\n\t\t\t//you may wish to adjust the freshhold offset\n\t\t\twindow_min = min_move - threshold_offset;\n\t\t\twindow_max = max_move + threshold_offset;\n\t\t}", "resize(newCols, newRows) {\n // store reference to null cell with default attrs\n const nullCell = this.getNullCell(DEFAULT_ATTR_DATA);\n // Increase max length if needed before adjustments to allow space to fill\n // as required.\n const newMaxLength = this._getCorrectBufferLength(newRows);\n if (newMaxLength > this.lines.maxLength) {\n this.lines.maxLength = newMaxLength;\n }\n // The following adjustments should only happen if the buffer has been\n // initialized/filled.\n if (this.lines.length > 0) {\n // Deal with columns increasing (reducing needs to happen after reflow)\n if (this._cols < newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n this.lines.get(i).resize(newCols, nullCell);\n }\n }\n // Resize rows in both directions as needed\n let addToY = 0;\n if (this._rows < newRows) {\n for (let y = this._rows; y < newRows; y++) {\n if (this.lines.length < newRows + this.ybase) {\n if (this._optionsService.options.windowsMode) {\n // Just add the new missing rows on Windows as conpty reprints the screen with it's\n // view of the world. Once a line enters scrollback for conpty it remains there\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n else {\n if (this.ybase > 0 && this.lines.length <= this.ybase + this.y + addToY + 1) {\n // There is room above the buffer and there are no empty elements below the line,\n // scroll up\n this.ybase--;\n addToY++;\n if (this.ydisp > 0) {\n // Viewport is at the top of the buffer, must increase downwards\n this.ydisp--;\n }\n }\n else {\n // Add a blank line if there is no buffer left at the top to scroll to, or if there\n // are blank lines after the cursor\n this.lines.push(new BufferLine(newCols, nullCell));\n }\n }\n }\n }\n }\n else { // (this._rows >= newRows)\n for (let y = this._rows; y > newRows; y--) {\n if (this.lines.length > newRows + this.ybase) {\n if (this.lines.length > this.ybase + this.y + 1) {\n // The line is a blank line below the cursor, remove it\n this.lines.pop();\n }\n else {\n // The line is the cursor, scroll down\n this.ybase++;\n this.ydisp++;\n }\n }\n }\n }\n // Reduce max length if needed after adjustments, this is done after as it\n // would otherwise cut data from the bottom of the buffer.\n if (newMaxLength < this.lines.maxLength) {\n // Trim from the top of the buffer and adjust ybase and ydisp.\n const amountToTrim = this.lines.length - newMaxLength;\n if (amountToTrim > 0) {\n this.lines.trimStart(amountToTrim);\n this.ybase = Math.max(this.ybase - amountToTrim, 0);\n this.ydisp = Math.max(this.ydisp - amountToTrim, 0);\n this.savedY = Math.max(this.savedY - amountToTrim, 0);\n }\n this.lines.maxLength = newMaxLength;\n }\n // Make sure that the cursor stays on screen\n this.x = Math.min(this.x, newCols - 1);\n this.y = Math.min(this.y, newRows - 1);\n if (addToY) {\n this.y += addToY;\n }\n this.savedX = Math.min(this.savedX, newCols - 1);\n this.scrollTop = 0;\n }\n this.scrollBottom = newRows - 1;\n if (this._isReflowEnabled) {\n this._reflow(newCols, newRows);\n // Trim the end of the line off if cols shrunk\n if (this._cols > newCols) {\n for (let i = 0; i < this.lines.length; i++) {\n this.lines.get(i).resize(newCols, nullCell);\n }\n }\n }\n this._cols = newCols;\n this._rows = newRows;\n }", "function setCountersOfNearbyMines() {\n for (var i = 0; i < gLevel.SIZE; i++) {\n for (var j = 0; j < gLevel.SIZE; j++) {\n if (gBoard[i][j].cellContent === gEmpty) {\n gBoard[i][j].cellContent = setMinesNegsCount(i, j);\n }\n }\n }\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 setL(value) {\n document.getElementById(\"valueL\").innerHTML = value;\n lines = parseInt(value);\n adjustMines();\n}", "set minimumWidth(value) { }", "function resetMinMax() {\n minPermintaan = 1000;\n maxPermintaan = 5000;\n minPersediaan = 100;\n maxPersediaan = 600;\n }", "function defineBorders() {//finds minimum and maximum x,y, and z in the measArray\n\t\t\tminXYZ=[];\n\t maxXYZ=[];\n\t\tfor (i = 3; i < 6; i++){//3 and 6 because of input positions of values\n\t all=[];\n\t for (j = 0; j < measArray.length; j++) {\n\t \tall[j]=measArray[j][i];\n\t }\n\t minXYZ[i-3]=all.sort(function(a, b){return a - b})[0];\n\t maxXYZ[i-3]=all.sort(function(a, b){return a - b})[all.length-1];\n\t }\n\t return 1;\n\t}", "function setC(value) {\n document.getElementById(\"valueC\").innerHTML = value;\n collumns = parseInt(value);\n adjustMines();\n}", "set minMaxWidth(value) {\n let style = this.node.style;\n if (value) {\n style.minWidth = style.maxWidth = value + \"px\";\n } else {\n style.removeProperty(\"min-width\");\n style.removeProperty(\"max-width\");\n }\n }", "_minOrMaxChanged() {\n // var min, max;\n //check that min is less than max\n if(this.min === this.max) {\n this.set('_minMaxValid', 0);\n console.warn(\"Improper configuration: min and max are the same. Increasing max by step size.\");\n this.set('max', this.min + this.step);\n return;\n }\n\n if(this.min > this.max) {\n this.set('_minMaxValid', 0);\n console.warn(\"Improper configuration: min and max are reversed. Swapping them.\");\n var temp = this.min;\n this.set('min', this.max);\n this.set('max', temp);\n return;\n }\n this.setAttribute('aria-valuemin', this.min);\n this.setAttribute('aria-valuemax', this.max);\n\n // validation passes: trigger set domain\n // apparently, it is possible to run this before polymer property defaults can be applied, so check that _minMaxValid is defined\n this.set('_minMaxValid', (this._minMaxValid || 0) + 1);\n }", "function checkMinMaxValues(that){\n //make the values move\n if(that._prvt.currentMax === that._prvt.currentMin){\n //make the items hidden\n that._prvt.maxLabel.hide();\n that._prvt.handleMin.hide();\n }else{\n that._prvt.maxLabel.show();\n that._prvt.handleMin.show();\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "_assignScoreLinesLevel(numLinesCleared) {\n\t\t/* Update the score and the number of lines. */\n\t\tthis.score += (this.level + 1) * POINTS_LEVEL_ZERO[numLinesCleared];\n\t\tthis.lines += numLinesCleared;\n\n\t\t/* Update the level if necessary. */\n\t\tif (this.lines >= (this.initialLevel + 1) * 10) {\n\t\t\tthis.level = Math.floor(this.lines / 10);\n\t\t}\n\n\t\t/* Update the boxes if necessary. */\n\t\tthis._updateLevelLinesBox();\n\t\tthis._updateScoreBox();\n\t}", "calcValueColMinMax() {\n let noNan = this.fillData.reduce((acc, cur) => {\n if (!isNaN(cur)) {\n acc.push(cur)\n }\n return acc\n }, [])\n // if the panehas a filter min and max set, scan datamin and max should be equal\n if (!isNaN(this.paneOb.valFilterMin)) {\n this.scanDatamin = this.paneOb.valFilterMin\n } else {\n /** These values are the min of the entire fillData provided to the canvas. This is used in linearly interpolating the color of the fill for a region if it has data. This is the minimum value */\n this.scanDatamin = Math.min(...noNan).toFixed(3)\n }\n if (!isNaN(this.paneOb.valFilterMax)) {\n this.scanDatamax = this.paneOb.valFilterMax\n\n } else {\n /** This is the maximum value of the fillData for the canvas. */\n this.scanDatamax = Math.max(...noNan).toFixed(3)\n }\n // this normalizes the value from the scan data into the range 0 to 1 for color interpolation\n /** color interpolators for fill */\n this.colInterpolator = interpolator()\n this.colInterpolator.setup(this.scanDatamin, 0, this.scanDatamax, 1)\n // calculate the min and maxes of the scan data for each scan\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (height < 2) { height = textHeight(display); }\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }", "_setMinHeight() {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }", "edges() {\r\n if (this.pos.x > width) {\r\n this.pos.x = 0;\r\n this.updatePrev();\r\n }\r\n if (this.pos.x < 0) {\r\n this.pos.x = width;\r\n this.updatePrev();\r\n }\r\n if (this.pos.y > height) {\r\n this.pos.y = 0;\r\n this.updatePrev();\r\n }\r\n if (this.pos.y < 0) {\r\n this.pos.y = height;\r\n this.updatePrev();\r\n }\r\n\r\n }", "resizeColumnAtStart(table, dragValue, selectedCells) {\n let newIndent = table.leftIndent;\n let rightColumnCollection = this.getColumnCells(table, this.resizerPosition, false);\n let offset = 0;\n let selectedRow = selectedCells[0].ownerRow;\n let rowFormat = selectedRow.rowFormat;\n if (rowFormat.beforeWidth > 0) {\n let newGridBefore = rowFormat.beforeWidth + dragValue;\n if (newGridBefore > 0) {\n this.updateGridBefore(selectedRow, dragValue);\n }\n else {\n let leastGridBefore = this.getLeastGridBefore(table, selectedRow);\n if (newGridBefore < leastGridBefore && offset !== newGridBefore) {\n newIndent = table.leftIndent + newGridBefore;\n table.tableFormat.leftIndent = newIndent >= -1440 ? (newIndent <= 1440 ? newIndent : 1440) : -1440;\n for (let i = 0; i < table.childWidgets.length; i++) {\n let tableRow = table.childWidgets[i];\n if (selectedRow !== tableRow) {\n this.updateGridBefore(tableRow, -newGridBefore);\n }\n }\n }\n }\n }\n else {\n if (dragValue < 0) {\n newIndent = table.leftIndent + dragValue;\n table.tableFormat.leftIndent = newIndent >= -1440 ? (newIndent <= 1440 ? newIndent : 1440) : -1440;\n this.updateWidthForCells(table, selectedCells, dragValue);\n }\n else {\n let leastGridBefore = this.getLeastGridBefore(table, selectedRow);\n let currentTableIndent = table.tableFormat.leftIndent;\n if (currentTableIndent === 0) {\n for (let i = 0; i < table.childWidgets.length; i++) {\n let tableRow = table.childWidgets[i];\n if (selectedCells.indexOf(tableRow.childWidgets[0]) !== -1) {\n this.updateGridBefore(tableRow, dragValue);\n this.increaseOrDecreaseWidth(tableRow.childWidgets[0], dragValue, false);\n }\n }\n }\n else {\n let difference = leastGridBefore - dragValue;\n if (difference > 0) {\n newIndent = table.leftIndent + dragValue;\n table.tableFormat.leftIndent = newIndent >= -1440 ? (newIndent <= 1440 ? newIndent : 1440) : -1440;\n this.updateWidthForCells(table, selectedCells, dragValue);\n }\n else {\n newIndent = table.leftIndent + leastGridBefore;\n table.tableFormat.leftIndent = newIndent >= -1440 ? (newIndent <= 1440 ? newIndent : 1440) : -1440;\n for (let i = 0; i < table.childWidgets.length; i++) {\n let tableRow = table.childWidgets[i];\n if (selectedCells.indexOf(tableRow.childWidgets[0]) !== -1) {\n this.increaseOrDecreaseWidth(tableRow.childWidgets[0], dragValue, false);\n this.updateGridBefore(tableRow, dragValue - leastGridBefore);\n }\n else {\n this.updateGridBefore(tableRow, -leastGridBefore);\n }\n }\n }\n }\n }\n }\n table.tableFormat.allowAutoFit = false;\n this.updateGridValue(table, true, dragValue);\n }", "function scale(){\n\t\t\tif(win.width() > min && win.width() < max){\n\t\t\t\t\teq = ((win.width() / min) / inc) + bas;\n\t\t\t\t\t$(tag).css({\n\t\t\t\t\t\t'font-size' : eq+'px',\n\t\t\t\t\t\t'line-height' : eq * 1.5+'px',\n\t\t\t\t\t\t'letter-spacing' : (max / max) + ((win.width() / max) /100),\n\t\t\t\t\t\t'margin-bottom' : eq / 2+'px'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t }", "function setMinesNegsCount(board, size) {\r\n //Go through every cell in board\r\n for (var i = 0; i < size; i++) {\r\n for (var j = 0; j < size; j++) {\r\n var currI = i;\r\n var currJ = j;\r\n var minesCount = minesNegsCount(board, size, currI, currJ);\r\n board[i][j].minesAroundCount = minesCount;\r\n }\r\n }\r\n}", "immediateUpdateLimits(){\n // Since nodes are in ascending order of length left-to-right,\n // computing the extreme low interval bounds is straightforward.\n this.minimumLow = this.left ? this.left.minimumLow : this.low;\n this.maximumLow = this.right ? this.right.maximumLow : this.low;\n // Maximum interval bounds are effectively:\n // max|min(high bound for this, for left child, for right child)\n this.minimumHigh = this.intervals[this.intervals.length - 1].high;\n this.maximumHigh = this.high; // Should always equal intervals[0].high\n if(this.left){\n if(this.left.minimumHigh < this.minimumHigh){\n this.minimumHigh = this.left.minimumHigh;\n }\n if(this.left.maximumHigh > this.maximumHigh){\n this.maximumHigh = this.left.maximumHigh;\n }\n }\n if(this.right){\n if(this.right.minimumHigh < this.minimumHigh){\n this.minimumHigh = this.right.minimumHigh;\n }\n if(this.right.maximumHigh > this.maximumHigh){\n this.maximumHigh = this.right.maximumHigh;\n }\n }\n }", "function updateLineWidth(width) { \n // Clamp the line width\n line_width = Math.min(Math.max(width, min_line_width), max_line_width);\n\n // Update range input values\n document.getElementById('line_width').value = line_width;\n document.getElementById('line_width_context').value = line_width;\n\n // Update previews\n var preview = document.getElementById('line_preview');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n preview = document.getElementById('line_preview_context');\n preview.style.width = line_width + \"px\";\n preview.style.height = line_width + \"px\";\n preview.style.marginLeft = (50 - (line_width / 2)) + \"px\";\n preview.style.marginTop = (25 - (line_width / 2)) + \"px\";\n\n // Update cursor\n var cursor = document.getElementById('cursor');\n cursor.style.width = line_width + \"px\";\n cursor.style.height = line_width + \"px\";\n}", "function resizeArea(curObj, min, max, limit, limitcnt){\n\t\n\tupdateCharter(curObj,limit,300);\n\t\n\ttextarea = curObj;\n\tif (navigator.userAgent.indexOf(\"SV1\") > 0){ } \n\telse if(navigator.userAgent.indexOf(\"MSIE 7\")>0) { }\n\telse { max = 300; }\n\n\tif (navigator.userAgent.indexOf(\"Chrome/2\") > 0){\n\t\tscrollheight = curObj.scrollHeight - 4;\n\t} \n\telse { scrollheight = curObj.scrollHeight; }\n\n\tif(scrollheight<=min) {\n\t\ttextarea.style.height = min + 'px';\n\t\ttextarea.style.overflowY = \"hidden\";\n\t}else if(scrollheight>max){\n\t\ttextarea.style.height = max + 'px';\n\t\ttextarea.style.overflowY = \"auto\";\n\t}else{\n\t\ttextarea.style.height = scrollheight + 'px';\n\t\ttextarea.style.overflowY = \"hidden\";\n\t}\n}", "setUp(x,max)\n {\n this.x+=x;\n this.y=10;\n for(var i=0;i<4;i++)\n {\n for(var j=0;j<4;j++)\n {\n if(this.mats[i][j]!==0)\n {\n this.mats[i][j]=x+(i*25)+(max*(j*10));\n }\n }\n }\n }", "function generateMin() {\n if (getInputData() > 0 && getInputData() < 5) {\n removeBoardPaint();\n generateHeightDivs(5);\n generateWidthDivs(5);\n addWhiteToBoard();\n window.alert('mínimo: 5 | máximo: 50')\n }\n}", "function updateHeightsInViewport(cm) {\n\t\t var display = cm.display;\n\t\t var prevBottom = display.lineDiv.offsetTop;\n\t\t var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n\t\t var oldHeight = display.lineDiv.getBoundingClientRect().top;\n\t\t var mustScroll = 0;\n\t\t for (var i = 0; i < display.view.length; i++) {\n\t\t var cur = display.view[i], wrapping = cm.options.lineWrapping;\n\t\t var height = (void 0), width = 0;\n\t\t if (cur.hidden) { continue }\n\t\t oldHeight += cur.line.height;\n\t\t if (ie && ie_version < 8) {\n\t\t var bot = cur.node.offsetTop + cur.node.offsetHeight;\n\t\t height = bot - prevBottom;\n\t\t prevBottom = bot;\n\t\t } else {\n\t\t var box = cur.node.getBoundingClientRect();\n\t\t height = box.bottom - box.top;\n\t\t // Check that lines don't extend past the right of the current\n\t\t // editor width\n\t\t if (!wrapping && cur.text.firstChild)\n\t\t { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n\t\t }\n\t\t var diff = cur.line.height - height;\n\t\t if (diff > .005 || diff < -.005) {\n\t\t if (oldHeight < viewTop) { mustScroll -= diff; }\n\t\t updateLineHeight(cur.line, height);\n\t\t updateWidgetHeight(cur.line);\n\t\t if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n\t\t { updateWidgetHeight(cur.rest[j]); } }\n\t\t }\n\t\t if (width > cm.display.sizerWidth) {\n\t\t var chWidth = Math.ceil(width / charWidth(cm.display));\n\t\t if (chWidth > cm.display.maxLineLength) {\n\t\t cm.display.maxLineLength = chWidth;\n\t\t cm.display.maxLine = cur.line;\n\t\t cm.display.maxLineChanged = true;\n\t\t }\n\t\t }\n\t\t }\n\t\t if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n\t\t }", "function fix_extrema(slot) {\n if (slot.maximum !== undefined) {\n slot.max = slot.maximum;\n delete slot.maximum;\n }\n if (slot.minimum !== undefined) {\n slot.min = slot.minimum;\n delete slot.minimum;\n }\n }", "update({target} = {}) {\n let pivot; // unless otherwise acted on\n \n if (target === a) {\n\t\tif (a.valueAsNumber >= Number(a.max)) {\n\t pivot = Math.min(max - 1, Number(a.max) + 1);\n }\n }\n \n if (target === b) {\n\t\tif (b.valueAsNumber <= Number(b.min)) {\n \tpivot = Math.max(min, Number(b.min) - 2);\n }\n }\n \n if (pivot != null) {\n \ta.max = pivot;\n\t b.min = pivot + 1;\n }\n \n a.style.flexGrow = stepsIn(a);\n b.style.flexGrow = stepsIn(b);\n \n // Print selected range\n o.innerText = `${a.value} - ${b.value}`;\n}", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }", "function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i],\n wrapping = cm.options.lineWrapping;\n var height = void 0,\n width = 0;\n\n if (cur.hidden) {\n continue;\n }\n\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top; // Check that lines don't extend past the right of the current\n // editor width\n\n if (!wrapping && cur.text.firstChild) {\n width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1;\n }\n }\n\n var diff = cur.line.height - height;\n\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n\n if (cur.rest) {\n for (var j = 0; j < cur.rest.length; j++) {\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n } // Read and store the height of line widgets associated with the", "setPropertyX(maxColsBeforeCanvas, minColsBeforeCanvas, colWidth) {\n return globals.getRandomInt(-maxColsBeforeCanvas, -minColsBeforeCanvas)*colWidth;\n }", "function initialGridSet(firstLine) {\n\n let x = firstLine.split(\" \")[0] * 1;\n let y = firstLine.split(\" \")[1] * 1;\n\n if (x <= 50 && y <= 50) {\n initialGrid.x = x;\n initialGrid.y = y;\n } else {\n console.log(\"Grid size bigger than allowed\");\n }\n}", "function changeMaxAndMin(minRange, maxRange) {\n var minStorage = document.querySelector('#post-min-range');\n var maxStorage = document.querySelector('#post-max-range');\n if (minRange > 10) {\n minRange = minRange - 10;\n minStorage.innerText = minRange;\n maxRange = maxRange + 10;\n maxStorage.innerText = maxRange;\n } else {\n minStorage.innerText = minRange;\n maxRange = maxRange + 10;\n maxStorage.innerText = maxRange;\n }\n}", "function xMinMax() {\n xMin = d3.min(csvData, function(d) {\n return parseFloat(d[curX]) * 0.85;\n });\n xMax = d3.max(csvData, function(d) {\n return parseFloat(d[curX]) * 1.15;\n }); \n }", "get minRows() { return this._minRows; }", "function yMinMax() {\n // min will grab the smallest datum from the selected column.\n yMin = d3.min(theData, function(d) {\n return parseFloat(d[curY]) * 0.90;\n });\n\n // .max will grab the largest datum from the selected column.\n yMax = d3.max(theData, function(d) {\n return parseFloat(d[curY]) * 1.10;\n });\n }", "handleConstraints() {\n if (this.x < 0) {\n this.x = 0;\n }\n if (this.x > width - 1) {\n this.x = width - this.size;\n }\n if (this.y < 0) {\n this.y = 0;\n }\n if (this.y > height - 1) {\n this.y = height - this.size;\n }\n\n\n }", "function roundMinMax(factor) {\n factor = parseFloat(factor);\n var minNum = parseFloat(min.value);\n var maxNum = parseFloat(max.value);\n\n var minMod = min.value % factor;\n var maxMod = max.value % factor;\n var minVal = minMod < factor / 2 ? minNum - minMod : minNum + (factor - minMod);\n var maxVal = maxMod < factor / 2 ? maxNum - maxMod : maxNum + (factor - maxMod);\n\n min.value = minVal.toFixed(2);\n max.value = maxVal.toFixed(2);\n min.step = factor;\n max.step = factor;\n adjustLabel(max_input, max);\n adjustLabel(min_input, min);\n }", "set minWidth(value) {}", "min(cols=this.displayColumns) {\n if (!this.state.data || this.state.data.length === 0) { return 0; }\n\n const minObs = obs => {\n const vals = _.values(obs).filter(actualNumber);\n return Math.min(...vals);\n };\n\n const pickFields = cols.map(c => c.accessor);\n const allMins = this.getDataPackets()\n .map(obs => _.pick(obs, pickFields))\n .map(obs => minObs(obs));\n\n return Math.min(...allMins);\n }", "function measureMinMax(columns) {\n\tvar result = { min: 0, max: 0 };\n\n\tvar maxStar = { min: 0, max: 0 };\n\tvar starCount = 0;\n\n\tfor (var i = 0, l = columns.length; i < l; i++) {\n\t\tvar c = columns[i];\n\n\t\tif (isStarColumn(c)) {\n\t\t\tmaxStar.min = Math.max(maxStar.min, c._minWidth);\n\t\t\tmaxStar.max = Math.max(maxStar.max, c._maxWidth);\n\t\t\tstarCount++;\n\t\t} else if (isAutoColumn(c)) {\n\t\t\tresult.min += c._minWidth;\n\t\t\tresult.max += c._maxWidth;\n\t\t} else {\n\t\t\tresult.min += ((c.width !== undefined && c.width) || c._minWidth);\n\t\t\tresult.max += ((c.width !== undefined && c.width) || c._maxWidth);\n\t\t}\n\t}\n\n\tif (starCount) {\n\t\tresult.min += starCount * maxStar.min;\n\t\tresult.max += starCount * maxStar.max;\n\t}\n\n\treturn result;\n}", "function handleMazeSize() {\n \"use strict\";\n var r = document.getElementById(\"height\"),\n c = document.getElementById(\"width\");\n NUM_COLS = parseInt(c.value, 10) || NUM_COLS;\n if (NUM_COLS % 2 !== 1) {\n // Don't want an even number...\n NUM_COLS += 1;\n }\n // Update the width input box..\n c.value = NUM_COLS;\n NUM_ROWS = parseInt(r.value, 10) || NUM_ROWS;\n if (NUM_ROWS % 2 !== 1) {\n NUM_ROWS += 1;\n }\n // Update the height input box..\n r.value = NUM_ROWS;\n}", "function findMaxLine(cm) {\n\t\t var d = cm.display, doc = cm.doc;\n\t\t d.maxLine = getLine(doc, doc.first);\n\t\t d.maxLineLength = lineLength(d.maxLine);\n\t\t d.maxLineChanged = true;\n\t\t doc.iter(function(line) {\n\t\t var len = lineLength(line);\n\t\t if (len > d.maxLineLength) {\n\t\t d.maxLineLength = len;\n\t\t d.maxLine = line;\n\t\t }\n\t\t });\n\t\t }", "function findMaxLine(cm) {\n\t\t var d = cm.display, doc = cm.doc;\n\t\t d.maxLine = getLine(doc, doc.first);\n\t\t d.maxLineLength = lineLength(d.maxLine);\n\t\t d.maxLineChanged = true;\n\t\t doc.iter(function (line) {\n\t\t var len = lineLength(line);\n\t\t if (len > d.maxLineLength) {\n\t\t d.maxLineLength = len;\n\t\t d.maxLine = line;\n\t\t }\n\t\t });\n\t\t }", "_updateMaxRings() {\n this._vRings.forEach((ring) => {\n if (ring.typeAttr === \"V\")\n ring.maxValue = max$1(this.model.data.nodes.dataNodes, function (d) { return d.values[ring.indexAttr]; });\n else\n ring.maxValue = 0; // Copy here what was done in the addAttribute()\n });\n }", "function measureMinMax(columns) {\n\tvar result = {min: 0, max: 0};\n\n\tvar maxStar = {min: 0, max: 0};\n\tvar starCount = 0;\n\n\tfor (var i = 0, l = columns.length; i < l; i++) {\n\t\tvar c = columns[i];\n\n\t\tif (isStarColumn(c)) {\n\t\t\tmaxStar.min = Math.max(maxStar.min, c._minWidth);\n\t\t\tmaxStar.max = Math.max(maxStar.max, c._maxWidth);\n\t\t\tstarCount++;\n\t\t} else if (isAutoColumn(c)) {\n\t\t\tresult.min += c._minWidth;\n\t\t\tresult.max += c._maxWidth;\n\t\t} else {\n\t\t\tresult.min += ((c.width !== undefined && c.width) || c._minWidth);\n\t\t\tresult.max += ((c.width !== undefined && c.width) || c._maxWidth);\n\t\t}\n\t}\n\n\tif (starCount) {\n\t\tresult.min += starCount * maxStar.min;\n\t\tresult.max += starCount * maxStar.max;\n\t}\n\n\treturn result;\n}", "ensureLineGaps(current, mayMeasure) {\n let wrapping = this.heightOracle.lineWrapping;\n let margin = wrapping ? 10000 /* MarginWrap */ : 2000 /* Margin */, halfMargin = margin >> 1, doubleMargin = margin << 1;\n // The non-wrapping logic won't work at all in predominantly right-to-left text.\n if (this.defaultTextDirection != exports.Direction.LTR && !wrapping)\n return [];\n let gaps = [];\n let addGap = (from, to, line, structure) => {\n if (to - from < halfMargin)\n return;\n let sel = this.state.selection.main, avoid = [sel.from];\n if (!sel.empty)\n avoid.push(sel.to);\n for (let pos of avoid) {\n if (pos > from && pos < to) {\n addGap(from, pos - 10 /* SelectionMargin */, line, structure);\n addGap(pos + 10 /* SelectionMargin */, to, line, structure);\n return;\n }\n }\n let gap = find(current, gap => gap.from >= line.from && gap.to <= line.to &&\n Math.abs(gap.from - from) < halfMargin && Math.abs(gap.to - to) < halfMargin &&\n !avoid.some(pos => gap.from < pos && gap.to > pos));\n if (!gap) {\n // When scrolling down, snap gap ends to line starts to avoid shifts in wrapping\n if (to < line.to && mayMeasure && wrapping &&\n mayMeasure.visibleRanges.some(r => r.from <= to && r.to >= to)) {\n let lineStart = mayMeasure.moveToLineBoundary(state.EditorSelection.cursor(to), false, true).head;\n if (lineStart > from)\n to = lineStart;\n }\n gap = new LineGap(from, to, this.gapSize(line, from, to, structure));\n }\n gaps.push(gap);\n };\n for (let line of this.viewportLines) {\n if (line.length < doubleMargin)\n continue;\n let structure = lineStructure(line.from, line.to, this.stateDeco);\n if (structure.total < doubleMargin)\n continue;\n let target = this.scrollTarget ? this.scrollTarget.range.head : null;\n let viewFrom, viewTo;\n if (wrapping) {\n let marginHeight = (margin / this.heightOracle.lineLength) * this.heightOracle.lineHeight;\n let top, bot;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.visibleBottom - this.visibleTop) / 2 + marginHeight) / line.height;\n top = targetFrac - spaceFrac;\n bot = targetFrac + spaceFrac;\n }\n else {\n top = (this.visibleTop - line.top - marginHeight) / line.height;\n bot = (this.visibleBottom - line.top + marginHeight) / line.height;\n }\n viewFrom = findPosition(structure, top);\n viewTo = findPosition(structure, bot);\n }\n else {\n let totalWidth = structure.total * this.heightOracle.charWidth;\n let marginWidth = margin * this.heightOracle.charWidth;\n let left, right;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + marginWidth) / totalWidth;\n left = targetFrac - spaceFrac;\n right = targetFrac + spaceFrac;\n }\n else {\n left = (this.pixelViewport.left - marginWidth) / totalWidth;\n right = (this.pixelViewport.right + marginWidth) / totalWidth;\n }\n viewFrom = findPosition(structure, left);\n viewTo = findPosition(structure, right);\n }\n if (viewFrom > line.from)\n addGap(line.from, viewFrom, line, structure);\n if (viewTo < line.to)\n addGap(viewTo, line.to, line, structure);\n }\n return gaps;\n }", "function increaseDifficulty() {\n setGridInvisible();\n if (!isGreatestDimension()) {\n if (row < col) {\n setGrid(row+1, col);\n } else {\n setGrid(row, col+1);\n }\n }\n resetGrid(\"increase\");\n}", "rescale(min, max) {\n if(min === 0){\n min = min + \"\";\n }\n if(max === 0){\n max = max + \"\";\n }\n this.x.domain([min || 30, max || 80]);\n\n this.xAxisElement\n .transition().duration(1500).ease(easeSinInOut) // https://github.com/mbostock/d3/wiki/Transitions#wiki-d3_ease\n .call(this.xAxis);\n\n for (let k in this.data) {\n // Add the valueline path.\n this.lineSvg.select(\".MECU\"+k)\n .transition().duration(1500).ease(easeSinInOut)\n .attr(\"d\", this.valueline(this.data[k].r));\n }\n }", "function normalizeValues() {\r\n\t\t// each row\r\n\t\tfor (var y=0; y<height; y++) {\r\n\t\t\t// each column\r\n\t\t\tfor (var x=0; x<width; x++) {\r\n\t\t\t\t// Adjust the value based on how far it is from the minimum as a percentage of the range.\r\n\t\t\t\theatMap[x][y] = ((heatMap[x][y]-min)/(max-min));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function xMinMax() {\n // min will grab the smallest datum from the selected column.\n xMin = d3.min(theData, function(d) {\n return parseFloat(d[curX]) * 0.90;\n });\n\n // .max will grab the largest datum from the selected column.\n xMax = d3.max(theData, function(d) {\n return parseFloat(d[curX]) * 1.10;\n });\n }", "function draw_min_data(min_data) {\n}", "function setMinesNegsCount(board) {\r\n for (var i = 0; i < board.length; i++) {\r\n for (var j = 0; j < board.length; j++) {\r\n TypeCell(board, { i, j });\r\n }\r\n }\r\n}", "function updatePositions(init) {\n var lx = $scope.lowerCost - $lower.width() / 2;\n var ux = $scope.upperCost - $upper.width() / 2;\n $lower.css('left', lx + 'px');\n $upper.css('left', ux + 'px');\n\n $range.css('left', lx + 'px').width(ux - lx);\n\n var maxWidth = $slider.width();\n\n $scope.min = scale[parseInt($scope.lowerCost / maxWidth * scale.length)];\n $scope.max = scale[parseInt($scope.upperCost / maxWidth * scale.length)];\n if (!$scope.max)\n $scope.max = $scope.MAX_VALUE;\n\n if (!$scope.$$phase && !init)\n $scope.$apply();\n }", "createLineupAdjustWidth (elem, name, spec, fixed) {\n let rankWidth = 0;\n let total = 0;\n let count = 0;\n let c1, c2;\n /* The final width value of 30 is to leave room for a scroll bar. */\n let width = $(elem)[0].getBoundingClientRect().width - fixed * 2 - 30;\n let col = spec.dataspec.layout.primary;\n for (c1 = 0; c1 < col.length; c1 += 1) {\n if (col[c1].children) {\n for (c2 = 0; c2 < col[c1].children.length; c2 += 1) {\n count += 1;\n total += this.lineupGetColumnWidth(name, col[c1].children[c2], fixed);\n }\n } else {\n if (col[c1].type === 'rank') { /* LineUp wants this to be 50 */\n rankWidth = this.lineupRankWidth + fixed;\n continue;\n }\n count += 1;\n total += this.lineupGetColumnWidth(name, col[c1], fixed);\n }\n }\n let avail = width - count * fixed - rankWidth;\n avail -= count + (rankWidth ? 1 : 0); // I'm not sure why this is necessary\n let scale = avail / total;\n for (c1 = 0; c1 < col.length; c1 += 1) {\n if (col[c1].children) {\n for (c2 = 0; c2 < col[c1].children.length; c2 += 1) {\n col[c1].children[c2].width = fixed + col[c1].children[c2].widthBasis * scale;\n }\n } else {\n col[c1].width = fixed + col[c1].widthBasis * scale;\n if (col[c1].type === 'rank') { /* LineUp wants this to be fixed */\n col[c1].width = this.lineupRankWidth + fixed;\n }\n }\n }\n return scale;\n }", "function updateWidth(idNum, hrs, min) {\n var newWidth = (hrs * 100) + (min/15*25);\n var newX = $(\"#rect_\" + idNum).get(0).x.animVal.value + newWidth;\n\n $(\"#rt_rect_\" + idNum).attr(\"x\", newX);\n $(\"#handoff_btn_\" + idNum).attr(\"x\", newX-18);\n $(\"#collab_btn_\" + idNum).attr(\"x\", newX-38);\n\n var indexOfJSON = getEventJSONIndex(idNum);\n for (i = 1; i <= flashTeamsJSON[\"events\"][indexOfJSON].members.length; i++) {\n $(\"#event_\" + idNum + \"_eventMemLine_\" + i).attr(\"width\", newWidth-8);\n }\n\n $(\"#rect_\" + idNum).attr(\"width\", newWidth);\n updateTime(idNum);\n}", "function newSize(){\n\t\tvar input = prompt(\"Enter the number of rows (1-64)\");\n\t\tvar exit = false;\n\t\tdo {\n\t\t\tif((input < 1) || (input > 64)){\n\t\t\t\tinput = prompt(\"Please, enter a valid value or 'exit'\");\t\t\t\n\t\t\t}\n\t\t\telse if(input==\"exit\"){\n\t\t\t\treturn; //exit without change the old values\n\t\t\t}\t\n\t\t\telse{\n\t\t\t\texit = true;\n\t\t\t}\t\t\t\n\t\t}while (!exit)\n\t\tdefaultPixelsQuantity = parseInt(input);// just in case of no integer values\t\n\t\tfillYellowed(defaultPixelsQuantity); //draw new area\n}", "constructor(minV, maxV, minA, maxA) {\n this.minV = minV;\n this.maxV = maxV;\n this.minA = minA;\n this.maxA = maxA;\n\n var size = 0.1;\n this.partNegative = (minV < 0) ? size : 0;\n this.partZero = this.partNegative + size;\n\n this.bounds = new Rectangle();\n\n this.steering_rate = 2.5;\n }", "static _projectVertsForMinMax(axis, verts)\n {\n // note that we project the first point to both min and max\n let min = SAT._vectorDotProduct(axis, verts[0]);\n let max = min;\n\n // now we loop over the remiaing vers, updating min/max as required\n for (let j = 1; j < verts.length; j++)\n {\n let temp = SAT._vectorDotProduct(axis, verts[j]);\n if (temp < min) min = temp;\n if (temp > max) max = temp;\n }\n\n return {min: min, max: max};\n }", "function maybeUpdateLineNumberWidth(cm) {\n\t\t if (!cm.options.lineNumbers) { return false }\n\t\t var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n\t\t if (last.length != display.lineNumChars) {\n\t\t var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n\t\t \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n\t\t var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n\t\t display.lineGutter.style.width = \"\";\n\t\t display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n\t\t display.lineNumWidth = display.lineNumInnerWidth + padding;\n\t\t display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n\t\t display.lineGutter.style.width = display.lineNumWidth + \"px\";\n\t\t updateGutterSpace(cm.display);\n\t\t return true\n\t\t }\n\t\t return false\n\t\t }", "update()\n\t{\n\t\tsuper.update();\n\t\t\n\t\tfor(var i = 0; i < this.mines.length; i++) {\n\t\t\tthis.mines[i].position.y = (this.mines[i].position.y + 0.2) % 32;\n\t\t}\n\t}", "clampX() {\n const min = 0, max = config.width - this.w;\n if (this.x <= min) {\n this.x = min;\n this.moveSpeed = -this.moveSpeed;\n } else if (this.x >= max) {\n this.x = max;\n this.moveSpeed = -this.moveSpeed;\n }\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }", "function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }" ]
[ "0.6695079", "0.66375417", "0.6620301", "0.6238601", "0.6237543", "0.616682", "0.61139566", "0.6091268", "0.6032945", "0.59048116", "0.5900105", "0.5896101", "0.589425", "0.5871503", "0.58661646", "0.5858506", "0.58562315", "0.58234906", "0.5817086", "0.581665", "0.57899624", "0.5728829", "0.5694199", "0.56908876", "0.5683035", "0.5650621", "0.56382227", "0.5578301", "0.5550524", "0.55437636", "0.55384874", "0.5528331", "0.5515201", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.5508593", "0.54904497", "0.5427167", "0.54171365", "0.54037124", "0.54007435", "0.5399752", "0.5399669", "0.5396107", "0.5393743", "0.53698796", "0.5360773", "0.53603566", "0.5352421", "0.534789", "0.5346042", "0.5320274", "0.5312842", "0.5312842", "0.53061414", "0.5297287", "0.52945256", "0.5282794", "0.5282732", "0.52761376", "0.527611", "0.52672786", "0.5258696", "0.5252667", "0.52521247", "0.5251988", "0.5251986", "0.5243319", "0.5238674", "0.5229908", "0.5227957", "0.5219164", "0.52182394", "0.5216516", "0.5212215", "0.52118087", "0.5209468", "0.520513", "0.52043533", "0.52025086", "0.5201939", "0.5200311", "0.5199066", "0.51942444", "0.51817805", "0.5179956", "0.51772743", "0.51760656", "0.51760656", "0.51760656", "0.51760656" ]
0.7379214
0
Function called by button press at the end of the page
function generate() { // Last time validation, in case user ends up messing with vars adjustMines(); generateBoard(); generateJSON(); board = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endEarlyButton() {\n endEarlyDetails();\n}", "function handleFinalPage() {\r\n $(`main`).on(`click`, `#restart`, function () {\r\n store.quizStarted = false;\r\n store.questionNumber = 0;\r\n store.score = 0;\r\n render();\r\n });\r\n}", "function ExitPage() {\n\t\talert('Are you sure you want navigate away from this App?');\n\t\tgetit()\n\t}", "function pageUnload()\n{\n\t//storing of open input text is now performed in presnav.js in the goNext() function\n\tparent.booContentLoaded = false; // This is to tell the program that this page is being unloaded from the browser.\n}", "function exit() {\r\n page_reset();\r\n}", "function endQuiz() {\n quizPage.hidden = true;\n finalPage.hidden = false;\n quizTimer.hidden = true;\n}", "function endQuiz() {\n\n // clear page\n clearPage();\n\n // replace start button\n $(\"#start-button\").append(\"<button>Click here to try again!</button>\");\n\n // show user how they did\n quizQuestion.append(\"<div>Correct Guesses: \" + correctGuesses + \"</div>\");\n quizQuestion.append(\"<div>Incorrect Guesses: \" + (questions.length - correctGuesses) + \"</div>\");\n\n }", "function endCT(){\n // HERE ADD YOUR CODE\n \n return false;\n }", "onClick() {\n this.wizard.goToNextStep(this.preFinalize, this.postFinalize);\n }", "finish(){\n model.stat.timer.stop();\n alert(model.algorithm.getCurrStep().description+' '+model.algorithm.getCurrStep().help);\n\t\tdocument.getElementById('nextBtn').disabled=true;\n\t\tdocument.getElementById('autoRunBtn').disabled=true;\n }", "function handleEndQuiz() {\n $('main').on('click', '.js-end-button', (event) => {\n store.score = 0;\n store.questionNumber = 0;\n store.quizStarted = false;\n renderQuizScreen();\n });\n}", "function done() {\n // User is done, remove buttons on the screen\n readNextInput = false;\n layout.RemoveChild(startButton);\n layout.RemoveChild(doneButton);\n text.SetText(\"Cool!\");\n console.log(\"Done.\");\n}", "onClick() {\n this.wizard.goToPreviousStep(this.preFinalize, this.postFinalize);\n }", "function endGame() {\n $('.home').css({ 'margin-top': '0px' });\n disappear('.instructions');\n hide('.view-button');\n disappear('.follow-circle');\n disappear('.instructions');\n state = \"view\";\n }", "function end () {\n //the page goes white\n $('body').css({\n backgroundColor: 'white',\n });\n $('#canvas').css({\n visibility: 'hidden',\n });\n\n //the final package downloads\n window.open('https://whogotnibs.github.io/dart450/assignment02/downloads/package03.zip', '_blank');\n\n //the game functions stop running\n end = true;\n\n //the music stops\n Gibber.clear();\n}", "function postCloseInjury() {\n removeForms();\n $('html, body').animate({\n scrollTop: 0\n }, 400);\n $(\"#queryResetButton\").click();\n}", "BunnyAtExit() {\n if (this.UpdatePoppedEggCount()) {\n this.Complete();\n } else {\n ui.AlarmEggCount();\n ui.Tip(\"You haven't got all the eggs yet - go back in\");\n }\n }", "function endGame() {\n resetMainContainer();\n loadTemplate(\"result\", displayResults);\n}", "function onFinish() {\n\t\tclbk();\n\t}", "function finish () {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n $(\"#wins\").text(\"Correct: \" + wins);\n $(\"#losses\").text(\"Incorrect: \" + losses);\n restart();\n }", "_onFinish () {\n clearInterval(this.timer)\n const minutes = this.shadowRoot.querySelector('#minutes').textContent\n const seconds = this.shadowRoot.querySelector('#seconds').textContent\n // Presents attempts and time on finish page.\n const counter = this.shadowRoot.querySelector('.attempts')\n const countedAttempts = this.attemptsCount\n this.attemptsCount = 0\n counter.textContent = countedAttempts\n const timeEl = this.shadowRoot.querySelector('.time')\n timeEl.textContent = `${minutes}:${seconds}`\n this._gameBoard.classList.add('hidden')\n this._tracker.classList.add('hidden')\n this._finishPage.classList.remove('hidden')\n }", "function goBack() {\n\t\ttogglePage();\n\t\tdisposeThrownShurikens();\n\t\tupdateThrownShurikenCount();\n\t\tcleanBelt();\n\t}", "function pageAfterAnimation(pageData) {\n // todo\n\n }", "function gameExit() {\n endPage();\n userScore();\n}", "function endingScreen(STORE, questionNumber, totalQuestions, score) {\r\n $('.results').on('click', '.restartButton', function (event) {\r\n let questionNumberDisp = 1;\r\n\r\n updateAnswerList(STORE, questionNumber, totalQuestions, questionNumberDisp, score);\r\n\r\n $('.results').css('display', 'none');\r\n $('.quizQuestions').css('display', 'block'); \r\n });\r\n\r\n return questionNumber;\r\n}", "function endWizardPlanes () {\n\t\t\t$('.wizardPlanes-pasos:not(.pasoFinal)').slideUp();\n\t\t\t$('.wizardPlanes-pasos.wizard-pasoFinal').slideDown();\n\t\t\t$('header h3.ta-center').html('El plan más conveniente para ti es');\n\t\t\t$('header h4').remove();\n\t\t\t$('html, body').animate({scrollTop: $('header h3').offset().top}, 500);\n\t\t}", "function onUnload() {\r\n \tcontrols.log('onUnload');\r\n stop();\r\n }", "function endScreen() {\n // set variable for final score\n var finalScore = score + internalScore;\n\n // change reset variable to prevent reset. game is done...\n resetWhere = 6;\n console.log('spelet är slut');\n var gameArea = document.getElementById('gameArea');\n gameArea.innerHTML = '<h1>Resultat</h1>';\n gameArea.innerHTML += '<p>Du fick totalt ' + finalScore + ' poäng av 25 möjliga</p>';\n gameArea.innerHTML += '<h3>Hur pass bra resultat fick du?</h3>';\n gameArea.innerHTML += '<ul class=\"list-group\"><li class=\"list-group-item\">Under 8 poäng: Njaaaa....</li><li class=\"list-group-item\">8 - 16 poäng: Nu börjar det likna något.</li><li class=\"list-group-item\">16 - 22 poäng: Sådär ja!</li><li class=\"list-group-item\">22 - 25 poäng: Heter du Einstein i efternamn?</li></ul>';\n gameArea.innerHTML += '<button type=\"button\" id=\"moveOn\" class=\"btn btn-default\">Prova igen</button>';\n\n document.getElementById('moveOn').addEventListener('click', function() {\n window.location.reload();\n });\n\n }", "function end() {\n stopTime();\n promptText.innerText = \"Test Complete\";\n pegDisplay.classList.add(\"gone\");\n homeButton.classList.remove(\"gone\");\n resultsButton.classList.remove(\"gone\");\n}", "function end(){\n alert('Game over \\nYou reached level '+counter);\n bord.hidden = true;\n cumputerTurn = true;\n buttonDisplay = 0;\n userClicked = false;\n randomData=[];\n userCounter = 0;\n counter = 1;\n gameStart.hidden = false;\n bord.hidden = true;\n start = false;\n}", "function after_loop()\n {\n disable_buttons(); //Disable control buttons.\n display_output($result); //Display output based on the result; Error or Accept\n }", "function endgame() {\n $(\"flee-btn\").classList.add(\"hidden\");\n $(\"endgame\").classList.add(\"hidden\");\n $(\"their-card\").classList.add(\"hidden\");\n $(\"pokedex-view\").classList.remove(\"hidden\");\n qs(\"#my-card .buffs\").classList.add(\"hidden\");\n qs(\"#my-card .health-bar\").style.width = \"100%\";\n qs(\"#my-card .hp\").innerHTML = pokeHP + \"HP\";\n $(\"results-container\").classList.add(\"hidden\");\n $(\"p1-turn-results\").classList.add(\"hidden\");\n $(\"title\").innerHTML = \"Your Pokedex\";\n $(\"start-btn\").classList.remove(\"hidden\");\n }", "onClick() {\n this.wizard.goToStep(this.destinationStep, this.preFinalize, this.postFinalize);\n }", "function endReached() {\n stopDriving();\n updateProgressBar(0);\n showInstruction(\"You have reached your destination\");\n document.getElementById(\"step\" + selectedStep).style.backgroundColor = \"white\";\n selectedStep = null;\n }", "function endQuiz(){\n $(stage).append(\n '<div class=\"questionText\">You have finished the quiz!<br><br>Total questions:'\n +num+'<br>Correct answers: '+score+'</div>'\n );\n }", "function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }", "function end() {\n focusInput();\n updateInput = true;\n move(); up();\n }", "function endQuiz(){\r\n\t\t\tvar endQuestions = \"End of Quiz!\";\r\n\t\t\tdocument.getElementById(\"pager\").innerHTML = endQuestions;\r\n\t\t\t$('#explanation').empty();\r\n\t\t\t$('#question').empty();\r\n\t\t\t$('#choice-block').empty();\r\n\t\t\t$('#submitbutton').remove();\r\n\t\t\t$('.rsform-block-submit').addClass('show');\r\n\t\t\t$('#question').text(\"You got \" + score + \" out of \" + quiz.length + \" correct.\");\r\n\t\t\t$(document.createElement('h4')).addClass('score').text(Math.round(score/quiz.length * 100) + '%').insertAfter('#question');\t\t\t\r\n\t\t}", "function finalScore() {\n $('.start-container').html(finalPage());\n $('.restartButton').on('click', function (event) {\n event.preventDefault();\n STORE.score = 0;\n $('.score').html('0 / 7');\n STORE.questionNumber = 0;\n $('.questionNumber').html('0 / 7');\n startPage();\n });\n\n}", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "function onBack() {\n resetPageState();\n }", "function finished() {\n hide(questionBlock);\n hide(stopMusic);\n hide(outcome);\n reveal(scoreBtn);\n reveal(finish);\n finalScore.textContent = score;\n jeopardy.pause();\n}", "function loadEnd() {\n quizPage.style.display = \"none\";\n endPage.style.display = \"block\";\n clearInterval(timeInterval);\n}", "function endQuiz() {\n\t\t//fix button state\n\t\tvar button = buttonControl;\n\t\tbutton.value=\"Score\";\n\t\tbutton.disabled=false;\n\t\tbuttonUndo.setAttribute(\"disabled\",\"true\");\n\t\tbuttonUndo.setAttribute(\"display\",\"none\");\n\n\t\t//lock all term widgets\n\t\tvar terms = document.getElementsByClassName(\"termWidget\");\n\t\tfor (var i = 0; i < terms.length; i++) {\n\t\t\tterms[i].draggable = false;\n\t\t}\n\n\t\t//end timer\n\t\tclearInterval(timerInterval);\n\t}", "function endPage() {\n next.classList.add(\"hide\");\n quizMain.classList.add(\"hide\");\n endSection.classList.remove(\"hide\");\n start.classList.remove(\"hide\");\n start.innerHTML = \"Restart\";\n score.innerHTML = \"You got \" + scoreNum + \" questions correct\";\n clearInterval(timeInterval);\n}", "function highScoresEndGame() {\n saveHighScores();\n originalContent.hidden = true;\n\n displayHighScoresOutput();\n clearHighScoresClass.hidden = false;\n\n highScoresPage.hidden = false;\n}", "function endScreen() {\n clearScreen();\n var allDone = $(\"<h2>\").text(\"All done, here's how you did!\");\n var correct = $(\"<h3>\").text(\"Correct Answers: \" + correctNumber);\n var incorrect = $(\"<h3>\").text(\"Incorrect Answers: \" + incorrectNumber);\n var unanswered = $(\"<h3>\").text(\"Unanswered: \" + unansweredNumber);\n var resetBtn = $(\"<button>\").text(\"Play Again!\");\n allDone.attr({ id: \"all-done\", class: \"animated fadeInUp\" });\n correct.attr({ id: \"correct-number\", class: \"animated fadeInUp\" });\n incorrect.attr({ id: \"incorrect-number\", class: \"animated fadeInUp\" });\n unanswered.attr({ id: \"unanswered-number\", class: \"animated fadeInUp\" });\n resetBtn.attr({\n id: \"reset-btn\",\n class: \"btn btn-light animated fadeInUp\"\n });\n $(\"#question-section\").append(allDone);\n $(\"#answers-section\").append(correct, incorrect, unanswered);\n $(\"#btn-section\").append(resetBtn);\n }", "function cleanup() {\r\n tablet.removeButton(button);\r\n tablet.webEventReceived.disconnect(onWebEventReceived)\r\n }", "handleDoneButtonClicked_() {\n this.handleEmitMetrics_(FeedbackAppPostSubmitAction.kClickDoneButton);\n window.close();\n }", "function end(){\n\toverlay_on();\n\tsetTimeout(\"location.href = '/auth/ranking?'+score_sum;\",1000);\n}", "function navigateToScoreOverview(){\n ApplicationEnded=true;\n gotoScoreOverview();\n}", "onFocusExit() { }", "function handleEnd(){\n if ((tracksBtn.value === 'playing') && !unpause){\n tracksBtn.value = 'paused';\n tracksBtn.innerHTML = 'Play';\n if(gl){\n endVisualizations();\n }\n }\n}", "click() {\n\t\t\t\tapp.quit();\n\t\t\t}", "finishedPage() {\n return (\n <div>\n <h3>Congratulations!</h3>\n <p>You finished the evaluation!</p>\n <p>You can safely exit this tab.</p>\n <Button onClick={() => goTo(\"/myEvaluations\")}>Take Me Home</Button>\n </div>\n );\n }", "function surveyEnd() {\n viewResultsButton.textContent = 'View Results';\n picSection.appendChild(viewResultsButton);\n picSection.removeEventListener('click', handleUserClick);\n for (var i = 0; i < catalogArray.length; i++) {\n tallyClickFinal.push(catalogArray[i].tallyClicked);\n tallyViewFinal.push(catalogArray[i].tallyDisplayed);\n };\n}", "function pageUnload()\n{\n\tparent.booContentLoaded = false; // This is to tell the program that this page is being unloaded from the browser.\n}", "completeBuyOut(){\n this.summaryCheckoutButton.waitForDisplayed();\n this.summaryCheckoutButton.click();\n\n LoginPage.loginAsNormalUser();\n \n this.addressCheckoutButton.waitForDisplayed();\n this.addressCheckoutButton.click();\n\n this.termnsAndConditionsButton.waitForDisplayed();\n this.termnsAndConditionsButton.click();\n\n this.shippingCheckoutButton.click();\n\n this.payByCheckButton.click();\n\n this.confirmOrderButton.click();\n }", "end(event) {\n\n }", "function onFinish() {\n console.log('finished playing');\n window.location = 'http://www.theplanaproj.com/';\n }", "function goNext() {\n \t$('.chat__input__text').off('click', $scope.activeConversation.question.action);\n \t$('.chat__input__icon').off('click', $scope.activeConversation.question.action);\n \tupdateNext();\n }", "function onEnd() {\n\t\t\tif ( ++counter === total ) {\n\t\t\t\tif ( clbk ) {\n\t\t\t\t\tclbk();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "finish() {\n document.querySelector(\".game-page\").style.display = \"none\";\n document.querySelector(\".scores-page\").style.display = \"block\";\n localStorage.setItem(\n \"game\" + Date.now(),\n this.player.name + \",\" + this.player.score\n );\n this.reset();\n mylib.createHighscoresTable();\n }", "function finalScreen() {\n\tgameHTML =\n\t\t\"<p class='text-center timer-p'>Time Left: <span class='timer'>\" +\n\t\tcounter + \"</span></p>\" +\n\t\t\"<p class='text-center'>Meow it's time for your results!\" + \"</p>\" +\n\t\t\"<p class='summary-right'>Correct: \" + correctTally + \"</p>\" +\n\t\t\"<p>Incorrect: \" + incorrectTally + \"</p>\" + \"<p>Skipped: \" +\n\t\tunansweredTally + \"</p>\" +\n\t\t\"<p class='text-center reset-button-container'><a class='btn btn-default btn-lg btn-block reset-button' href='#' role='button'>Reset The Quiz!</a></p>\";\n\t$( \".mainArea\" )\n\t\t.html( gameHTML );\n\tendMusic.play(); //#sorrynotsorry\n}", "function cleanup() {\r\n tablet.removeButton(button);\r\n\t}", "function endOfGame() {\n\tcreatesMensg();\n\tstopTime();\n\tshowModal();\n}", "exit() {\n this.quotes = [];\n this.numQuotes = 1;\n this.pickColor();\n this.showQuotes = false;\n }", "function pageUnload()\n{\n\tparent.booContentLoaded = false; // This is to tell the program that this page is being unloaded from the browser.\n}", "function cmdCallEnd() {\n let html = `<div class=\"text-center p-2 mb-3\">\n <span>Obrigado!<br> Este bate-papo foi encerrado.</span>\n </div>\n <div class=\"py-3\">\n <button class=\"btn btn-warning btn-block\" id=\"j_btn_new_call\">\n <i class=\"fa fa-bullhorn\"></i> Novo Atendimento\n </button>\n </div>`\n print_msg.innerHTML = html\n sessionStorage.setItem(\"chatbox_content\", \"call_end\")\n document.getElementById('j_btn_new_call').onclick = () => createToken(formCreateCall)\n }", "function lastPage() {\n \n if (page > 1) {\n page -= 1;\n getURL();\n\n }\n else {\n console.log(\"Already on page 1\");\n\n }\n updateButton();\n \n}", "function scriptEnding() {\n for (i = 0; i < NUMBER_OF_BUTTONS; i++) {\n Overlays.deleteOverlay(buttons[i]);\n Overlays.deleteOverlay(labels[i]);\n }\n Overlays.deleteOverlay(speedometer);\n}", "function resultsPageHandler() {\n $('main').on('click', '#restart-button', function() {\n console.log('restart button clicked');\n event.preventDefault();\n currentPage = 'startPage';\n STORE.questionNumber = 0;\n STORE.score = 0;\n render();\n \n });\n}", "function finalPage() {\n\n //Hide the questionPage\n $(\"#questionPage\").hide();\n\n //Display the final message\n $(\"#message\").text(\"All done, here's how you did!\");\n\n //display correctCounter\n $(\"#message\").append($(\"<p>\").text(\"Correct Answers: \" + correctCounter));\n $(\"#message\").append($(\"<p>\").text(\"Incorrect Answers: \" + incorrectCounter));\n $(\"#message\").append($(\"<p>\").text(\"Unanswered: \" + unansweredCounter));\n\n //display finalGif\n $(\"#message\").append(\"<br>\");\n $(\"#message\").append($(\"<img>\").attr(\"src\", \"assets/images/finalGif.gif\"));\n\n //ask user to start over\n $(\"#message\").append(\"<br>\");\n $(\"#message\").append($(\"<h2>\").text(\"Start Over?\"));\n\n //display startButton\n $(\"#start\").show();\n}", "end() {\n this.endZoomInMode();\n this.endHandMode();\n }", "function doAfterPageLoadActions() {\n\t//TODO: Override this\n}", "function GameEnd(){\n\t\t\tif(poker._cash == 0 && poker._bet == 0)\n\t\t\t\talert(\"Thanks for playing better luck next time.\\nRefresh the browser to start a new game.\");\n\t}", "function exitPopup(){\n\t\t//console.log(\"You have clicked the exit button\");\n\t\tpopwrap.classList.add(\"no-read\");\n\t\tlocalStorage.visits = 1; //After the popup has been closed once, the visit is logged and it should not appear again.\n\t}", "function scriptEnding() {\n // re-enabled the standard application for touch events\n Controller.releaseJoystick(THRUST_CONTROLLER);\n Controller.releaseJoystick(VIEW_CONTROLLER);\n}", "function quizEnd() {\n\n //display quiz stats and creates restart button\n $(\"#quiz\").html('<h3 id=\"question\">Behold your statistics:</h3>' + '<p>' + correct + '</p>' + '<p>' + incorrect + '</p>' + '<button type=\"button\" class=\"btn btn-default btn-lg btn-block\" id=\"restart\">Click to be reborn</button>');\n\n //if all correct/incorrect\n if (correct === 5) {\n $(\"#quiz\").append(\"<h1>Your knowledge may be vast, but it cannot save you.</h1>\");\n }\n else if (incorrect === 5) {\n $(\"#quiz\").append(\"<h1>This disappointment shall prepare you well for eternity.</h1>\");\n }\n //click handler to start quiz over\n $(\"#restart\").click(startQuiz);\n }", "function end() {\n result.innerHTML = \"you got a score of \" + score;\n saveInitials.style.visibility = \"visible\";\n clock.innerHTML = \"\";\n form1.style.visibility = \"hidden\";\n clearTimer();\n}", "function finish(){\n\n // sound-effect\n playIncorrect()\n // Disable buttons, because we don't need them.\n elements.correctButton.disabled = true\n elements.incorrectButton.disabled = true\n window.setTimeout(displayGameOver,1500)\n}", "function onExitAlertOkClick() {\n app.exit();\n }", "function endQuiz()\n\t\t\t{\n\t\t\t\t$(\".middle\").hide();\n\t\t\t\t$(\".instruction\").show();\n\t\t\t\t$(\".instruction\").children().hide();\n\t\t\t\t\n\t\t\t\tvar marks = Math.floor(( myScore / 85 ) * 100);\n\t\t\t\tvar finalText = \"<p id='p1'>Thank you for taking the Quiz</p>\";\n\t\t\t\tvar finalScore = \"<p id='p2'>Your final score is \"+myScore+\" out of 100</p>\";\n\t\t\t\t$(\".instruction\").append(finalText);\n\t\t\t\t$(\".instruction\").append(finalScore);\n\t\t\t}", "function Clearup(){\n\t\tEventLogout();\n }", "function endQuiz() {\n //calculate final score\n score = Math.max((timer * 10).toFixed(), 0);\n timer = 0;\n $timer.text(\"Timer: \" + timer.toFixed(1));\n //stop the timer\n clearInterval(interval);\n //write the end message, buttons, and scores\n setEndDOM();\n }", "function onUnload() {\r\n log('onUnload');\r\n stop();\r\n }", "function Clearup(){\n EventLogout();\n }", "function endOfGame() {\n\t\t$('.timeRemaining').html('<div class=\"text-center\"> Sports Trivia Over </div>'); //changing time stamp to Game Over\t\t\n\t\t$('.questionInfo').empty(); //emptying info about question\n\t\t$('#answerImage').attr('src',\"\"); //taking out image from final score\n\t\t$('.questionsRemaining').html('<div class=\"text-center\"> Sports Trivia Over </div>'); //changing questions # counter to Game over\n\n\t\t//gmae scores\n\t\t$('.questionShowBox').append('<div class=\"text-center score\">You answered ' + correctAnswers + ' questions correctly.</div>');\n\t\t$('.questionShowBox').append('<div class=\"text-center score\">You answered ' + wrongAnswers + ' questions incorrectly.</div>');\n\t\t$('.questionShowBox').append('<div class=\"text-center score\">You did not answer ' + unanswered + ' questions.</div>');\n\n\t\t// adding reset button and its click fucntions\n\t\t$('.questionShowBox').append('<div><button class=\"startGame\"> Play Again</button></div>');\n\t\t$('.startGame').click(function(){\n\t\t\tRestartGame();\n\t\t});\n\t}", "function back_from_complete() {\n\tif(action == 'delivered' || action == 'tendered_to_carrier' ||\n\t\t\t\taction == 'recovered_from_carrier') {\n\t\tshow('page-image-doc');\n\t} else {\n\t\tif(action == 'pick-up') {\n\t\t\tshow('page-signature');\n\t\t} else {\n\t\t\tshow('page-album');\n\t\t}\n\t}\n}", "function end(){\n //window.alert(\"clicked the x\");\n var el = document.getElementById(\"not\");\n el.style.display = 'none';\n }", "function endScreen() {\n leaderboardScreen.style.display = 'none';\n homeScreen.style.display = 'none';\n endQuiz.style.display = 'flex';\n quizPrompts.style.display = 'none';\n timer.style.visibility = 'hidden';\n\n yourScore()\n}", "function onEnd() {\n\n // reset the offsets\n stickyOffsetLow = 0;\n stickyOffsetHigh = 0;\n\n if(pointer) {\n // if we have a pointer reference\n\n // update all the elements in the DOM\n setPointers();\n adjustBubbles();\n\n // the pointer is no longer active\n pointer.removeClass('active');\n }\n\n // reset the references\n pointer = null;\n ref = null;\n dragRange = false;\n }", "function adbpEndSlateClick() {\n\ttry {\n\t\ttrackMetrics({ \n\t\t\ttype: \"endslate-click\", \n\t\t\tdata: {}\n\t\t}); \n\t} catch(e){}\n}", "function Clearup() {\n //TO DO:\n EventLogout();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n }", "function endGame() {\n // Overlay\n // Show score\n // Show table \n // Give user chance to restart\n // TODO: add high score to renderGUI\n\n uploadScore(score);\n score = 0;\n}", "function finishGame() {\n $('#startGame').removeClass('hidden');\n $('#startButton').addClass('btn-danger');\n $('#answers').addClass('hidden');\n $('#titleDiv').addClass('hidden');\n $('#imageDiv').addClass('hidden');\n $('#answers').addClass('hidden');\n $('#startButton').text('Play again?');\n $('#startButton').attr('onclick', 'location.reload()');\n}", "function onClosed() {\n // save lastTab that the user was on\n dynamicData.state.activeTabName = currentTab;\n MyAvatar.hasScriptedBlendshapes = false;\n addRemoveFlowDebugSpheres(false);\n deleteMirror();\n }", "endGame() {\n this.state = \"endOfGame\";\n\n var resetButton = $(\"<button>Reset</button>\");\n\n resetButton.on(\"click\", function() {\n // Empty all game zones of any remaining content\n $(\"#characterSelect\").empty();\n $(\"#opponentSelect\").empty();\n $(\"#battleZone\").empty();\n $(\"#combatLog\").empty();\n\n // Recreate character cards and set game to character selection\n game.setupCharCards();\n game.state = \"charSelect\";\n\n // Remove reset button\n $(this).remove();\n\n });\n\n resetButton.insertAfter($(\"#atkBtn\"));\n }", "function clearPage() {\n quizQuestion.empty();\n timeRem.empty();\n quizAnswers.empty();\n }" ]
[ "0.74576116", "0.6984215", "0.6777922", "0.6712419", "0.66500884", "0.66295224", "0.65920985", "0.6582092", "0.65505075", "0.6525036", "0.65183365", "0.6516215", "0.64776665", "0.6453434", "0.6441214", "0.6437451", "0.6409301", "0.64030117", "0.6390213", "0.63438606", "0.6327864", "0.63274556", "0.6325937", "0.63091063", "0.628463", "0.6280333", "0.6263161", "0.6245361", "0.6238092", "0.62352425", "0.62341803", "0.6231113", "0.62154263", "0.6213019", "0.6204501", "0.6203254", "0.6203254", "0.6180178", "0.61763674", "0.61726385", "0.6164137", "0.6156932", "0.61533904", "0.61223483", "0.6121669", "0.6115117", "0.6110672", "0.6105812", "0.60989815", "0.6089108", "0.6088863", "0.6078533", "0.6070738", "0.607031", "0.60701716", "0.606906", "0.60642105", "0.6055137", "0.6054739", "0.6048499", "0.60438555", "0.6038746", "0.6035035", "0.60348773", "0.60324854", "0.6028806", "0.60260016", "0.6025246", "0.6021996", "0.6021202", "0.6018703", "0.601645", "0.60136765", "0.6009497", "0.60074115", "0.600156", "0.60015476", "0.5998878", "0.5992196", "0.5992096", "0.5988641", "0.5982588", "0.5977781", "0.59756386", "0.59741586", "0.59729815", "0.59696406", "0.59683293", "0.59641916", "0.59594643", "0.59581465", "0.59548855", "0.5949868", "0.59470606", "0.59470606", "0.59470606", "0.5947009", "0.59463805", "0.5940356", "0.593594", "0.59348494" ]
0.0
-1
Resets sliders to given values
function reset(l, c, m) { document.getElementById("lineSlider").value = l; setL(l); document.getElementById("collumnSlider").value = c; setC(c); document.getElementById("mineSlider").value = m; setM(m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetSlider(bins){\n document.getElementById(\"theSlider\").value = bins;\n }", "function resetSlider() {\r\n slider.value = 0;\r\n}", "function resetGraph(){\n d3.select(\"#handle-one\").style(\"left\",\"0%\");\n d3.select(\"#handle-two\").style(\"left\",\"100%\");\n d3.select(\".d3-slider-range\").style(\"left\",\"0%\").style(\"right\",\"0%\");\n}", "function initSliders() {\r\n\t$(\".slider\").slider({ value: 50 });\r\n\t$(\".slider\").slider('disable');\r\n}", "function resetValue() {\n var remainder = $scrollPane.width() - $scrollContent.width();\n var leftVal = $scrollContent.css(\"margin-left\") === \"auto\" ? 0 : parseInt($scrollContent.css(\"margin-left\"));\n var percentage = Math.round(leftVal / remainder * 100);\n $scrollbar.slider(\"value\", percentage);\n }", "function resetValues() {\n curr_time.textContent = \"00:00\";\n tot_duration.textContent = \"00:00\";\n seek_slider.value = 0;\n}", "function resetValues() {\r\n curr_time.textContent = \"00:00\";\r\n total_duration.textContent = \"00:00\";\r\n seek_slider.value = 0;\r\n\r\n}", "function resetValue() {\nvar remainder = scrollPane.width() - scrollContent.width();\nvar leftVal = scrollContent.css( \"margin-left\" ) === \"auto\" ? 0 :\nparseInt( scrollContent.css( \"margin-left\" ) );\nvar percentage = Math.round( leftVal / remainder * 100 );\nscrollbar.slider( \"value\", percentage );\n}", "function initialValues() {\n document.querySelector(\"#rangeRed\").value = 0;\n document.querySelector(\"#rangeGreen\").value = 0;\n document.querySelector(\"#rangeBlue\").value = 0;\n document.querySelector(\"#rangeHue\").value = 0;\n document.querySelector(\"#rangeSaturation\").value = 0;\n document.querySelector(\"#rangeLightness\").value = 0;\n}", "function resetInputs() {\n const sliders = document.querySelectorAll(\".sliders input\");\n\n sliders.forEach((slider) => {\n if (slider.name === \"hue\") {\n const hueColor = initialColors[slider.getAttribute(\"data-hue\")];\n const hueValue = chroma(hueColor).hsl()[0];\n slider.value = Math.floor(hueValue);\n } else if (slider.name === \"brightness\") {\n const brightnessColor =\n initialColors[slider.getAttribute(\"data-brightness\")];\n const brightnessValue = chroma(brightnessColor).hsl()[2];\n slider.value = Math.floor(brightnessValue * 100) / 100;\n } else if (slider.name === \"saturation\") {\n const saturationColor =\n initialColors[slider.getAttribute(\"data-saturation\")];\n const saturationValue = chroma(saturationColor).hsl()[1];\n slider.value = Math.floor(saturationValue * 100) / 100;\n }\n });\n}", "function resetValue(){\n\tvar remainder = scrollPane.width() - scrollContent.width();\n\tvar leftVal = scrollContent.css('margin-left') == 'auto' ? 0 : parseInt(scrollContent.css('margin-left'));\n\tvar percentage = Math.round(leftVal / remainder * 100);\n\tscrollbar.slider(\"value\", percentage);\n}", "_resetOptions() {\n\t\tfor ( let slider of this.controlOptions.control.sliders ) {\n\t\t\tlet options = this.getSliderConfig( slider );\n\t\t\tthis.sliders[slider.name].$slider.slider( 'option', options );\n\t\t}\n\t}", "function resetValue() {\r\n\t\t var remainder = scrollPane.width() - scrollContentWidth;\r\n\t\t var leftVal = scrollContent.css('left') == 'auto' ? 0 : parseInt(scrollContent.css('left'));\r\n\t\t var percentage = Math.round(leftVal / remainder * 100);\r\n\t\t scrollbar.slider(\"value\", percentage);\r\n\t\t}", "function resetValues(){\r\n document.getElementById(\"localOnly\").checked = DEFAULT_VALUES.local_only;\r\n document.getElementById(\"spf_slider\").value = DEFAULT_VALUES.spf_value;\r\n document.getElementById(\"tz_slider\").value = DEFAULT_VALUES.tz_value;\r\n document.getElementById(\"bl_slider\").value = DEFAULT_VALUES.bl_value;\r\n document.getElementById(\"origin_slider\").value = DEFAULT_VALUES.origin_value;\r\n document.getElementById(\"api_slider\").value = DEFAULT_VALUES.api_value;\r\n document.getElementById(\"needed_score_slider\").value = DEFAULT_VALUES.needed_score;\r\n}", "function resetValue() {\n\tvar remainder = scrollPane.width() - scrollContent.width();\n\tvar leftVal = scrollContent.css( \"margin-left\" ) === \"auto\" ? 0 :\n\t\tparseInt( scrollContent.css( \"margin-left\" ) );\n\tvar percentage = Math.round( leftVal / remainder * 100 );\n\tscrollbar.slider( \"value\", percentage );\n}", "function resetValue() {\r\n\t\t\tvar remainder = scrollPane.width() - scrollContent.width();\r\n\t\t\tvar leftVal = scrollContent.css( \"margin-left\" ) === \"auto\" ? 0 :\r\n\t\t\t\tparseInt( scrollContent.css( \"margin-left\" ) );\r\n\t\t\tvar percentage = Math.round( leftVal / remainder * 100 );\r\n\t\t\tscrollbar.slider( \"value\", percentage );\r\n\t\t}", "function setSliderHandle(i, value, parent, varArgs, resetEnd, type, varVals=null, varLims=null) {\n\t//resetEnd : 0=don't reset; 1=reset if value > max; 2=reset always\n //console.log(i, value, parent, varArgs, resetEnd, type)\n\n\t//reset the slider limits\n\tvar min = parent.noUiSlider.options.range.min[0];\n\tvar max = parent.noUiSlider.options.range.max[0];\n\tif (typeof parseFloat(min) === \"number\" && typeof parseFloat(max) === \"number\" && !isNaN(min) && !isNaN(max)){\n\t\tvar minReset = min;\n\t\tvar maxReset = max;\n\t\tif ((i == 0 && type == \"double\") && resetEnd[0] == 2 || (resetEnd[0] == 1 && value < min)) minReset = parseFloat(value);\n\t\tif ((i == 1 || type == \"single\") && resetEnd[1] == 2 || (resetEnd[1] == 1 && value > max)) maxReset = parseFloat(value);\n\n\t\tmaxReset = Math.max(minReset + 0.0001*Math.abs(minReset), maxReset); //in case user makes a mistake\n\t\tparent.noUiSlider.updateOptions({\n\t\t\trange: {\n\t\t\t\t'min': [minReset],\n\t\t\t\t'max': [maxReset]\n\t\t\t}\n\t\t});\n\n\t\tif (varVals) varVals[i] = parseFloat(value);\t\n\t\tif (varLims) varLims[i] = parseFloat(value);\n\n\t\t//reset the slider value\n\t\tvar r = parent.noUiSlider.get()\n\t\tif (Array.isArray(r)) r[i] = value; else r = value; //this could also be type 'double' vs. 'single'\n\t\tparent.noUiSlider.set(r);\n\n\n\t\t//update the attached variables (already taken care of when we change the slider value)\n\t\tupdateUIValues(parseFloat(value), varArgs, i, type);\n\t}\n\n}", "_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 setPriceValues() {\r\n\t\tlet priceStartValue;\r\n\t\tlet priceEndValue;\r\n\t\tif (priceStart.value != '') {\r\n\t\t\tpriceStartValue = priceStart.value;\r\n\t\t}\r\n\t\tif (priceEnd.value != '') {\r\n\t\t\tpriceEndValue = priceEnd.value;\r\n\t\t}\r\n\t\tpriceSlider.noUiSlider.set([priceStartValue, priceEndValue]);\r\n\t}", "function resetClicked(){\n filters.rating = undefined\n filters.genres = undefined\n filters.language = undefined\n filters.runtime = undefined\n filters.year = undefined\n\n // reset the sliders and option boxes\n const runtimeRange = getRuntimeRange()\n const yearRange = getYearRange()\n\n // move the slider back to start\n runtimeSliderPointer.set([runtimeRange.low, runtimeRange.high])\n ratingSliderPointer.set([0, 10])\n yearSliderPointer.set([yearRange.low, yearRange.high])\n\n // re-call the create functions, which will delete the old one and replace it as a new selector\n createGenreSelector()\n createLanguageSelector()\n\n applyFilters()\n\n}", "function refreshSlider () {\n $(\".sliders\").slider('value', 50);\n $(\".sliders\").val(50);\n $(\".slidervals\").val(50);\n $(\".ui-slider-handle\").text(\"\");\n $(\".sliders\").css({\"background\":\"\"});\n $(\".sliders\" + \" .ui-slider-handle\").css({\n \"background\":\"#FAFAFA\",\n \"border-color\": \"#CCCCCC\" });\n}", "function setPriceValues() {\n\t\tlet priceStartValue;\n\t\tlet priceEndValue;\n\t\tif (priceStart.value != '') {\n\t\t\tpriceStartValue = priceStart.value;\n\t\t}\n\t\tif (priceEnd.value != '') {\n\t\t\tpriceEndValue = priceEnd.value;\n\t\t}\n\t\tpriceSlider.noUiSlider.set([priceStartValue, priceEndValue]);\n\t}", "function initializeSliders(slrRedBody,slrGreenBody,slrBlueBody,slrRedHeader,slrGreenHeader,slrBlueHeader) {\n slrRedBody.value = sliderRedBody;\n slrGreenBody.value = sliderGreenBody;\n slrBlueBody.value = sliderBlueBody;\n slrRedHeader.value = sliderRedHeader;\n slrGreenHeader.value = sliderGreenHeader;\n slrBlueHeader.value = sliderBlueHeader;\n}", "function setSliderValue(newValue) {\n curSlider.val(newValue).slider(\"refresh\");\n }", "function resetSlider(){\n $('.slide').removeClass('current-slide');\n currentSlide = $('#slide1');\n currentSlide.addClass('current-slide');\n num = 1;\n }", "function updateSliders() {\n select('#length').html(lengthSlider.value())\n select('#temperature').html(tempSlider.value())\n }", "restart()\n\t{\n\t\tthis.world.make_empty();\n\t\tthis.time = 0;\n\t\t\n\t\t// -- Initialize values here.\n\t\t\n\t\t// Parameters that control the animation.\n\t\tthis.value;\n\t\t\n\t\t\n\t\t// -- Slider 1 : \n\t\tvar slider_h = 20;\n\t\tvar slider;\n\t\tslider = new gui_Slider(room_w/24, room_h/4 + room_h/8, slider_h, room_h/8, slider_h);\n\t\tslider.setPer(1, 0);\n\t\tslider.world = this;\n\t\tslider.action = function(x, y)\n\t\t{\n\t\t\tvar min = 0;\n\t\t\tvar max = 1;\n\t\t\tthis.value = min + (max - min)*x;\n\t\t}\n\t\tthis.world.push(slider);\n\t\t\n\t\t\t\t\n\t}", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "function Reset(){\n let slideAmount = document.getElementById(\"slide\").value;\n updateSlider(slideAmount);\n opacityTaggle(\"false\");\n randnomColorCalcVar = false;\n}", "function reset() {\n\n // Match the slider to the material selected.\n if (MATERIALS[controls.material.value] !== controls.k.value) {\n if (controls.material.value === OTHER_MATERIAL) {\n for (material in MATERIALS) {\n if (MATERIALS[material] === controls.k.value) {\n controls.material.select(material);\n break;\n }\n }\n } else {\n controls.material.select(OTHER_MATERIAL)\n }\n }\n \n // Calculate the transfer of heat between both objects.\n heatTransfer = ((controls.k.value * controls.barArea.value) * (controls.t1.value - controls.t2.value)) / controls.barLength.value;\n labels.heatTransfer.set(heatTransfer);\n\n // Calculate the block's colors.\n if (controls.t1.value === controls.t2.value) {\n t1Color = [0,0,0];\n t2Color = [0,0,0];\n } else {\n t1Color = controls.t1.value > controls.t2.value ? [255,0,0] : [0,0,255];\n t2Color = controls.t1.value < controls.t2.value ? [255,0,0] : [0,0,255];\n }\n\n // Set the sliders' color.\n controls.t1.setColor(shadeColor(t1Color, 40));\n controls.t2.setColor(shadeColor(t2Color, 40));\n\n // Bar dimensions.\n barLength = controls.barLength.value;\n barWidth = Math.sqrt(controls.barArea.value);\n\n // Dimensions of the arrow.\n arrowBodyW = heatTransfer / 100;\n\n}", "function ResetAverageNightlyRateSlider(min,max,posMin,posMax,minRange,maxRange){\n $('#slider_minPrice').html('min: <span class=\"bold\">'+minPrice+'</span>');\n $('#slider_maxPrice').html('max: <span class=\"bold\">'+maxPrice+'</span>');\n $(\"#average_nigthlyRate\").val(minRange + ' - ' + maxRange);\n $(\"#info_average_nigthlyRate\").html(minRange + ' - ' + maxRange);\n\n $(\"#slider_average_nigthlyRate\").slider( \"destroy\" );\n $(\"#slider_average_nigthlyRate\").slider({\n range: true,\n min: min,\n max: max,\n values: [minRange, maxRange],\n slide: function(event, ui) {\n $(\"#average_nigthlyRate\").val(ui.values[0] + ' - ' + ui.values[1]);\n $(\"#info_average_nigthlyRate\").html(ui.values[0] + ' - ' + ui.values[1]);\n }\n });\n\n $( \"#slider_average_nigthlyRate\").slider({\n stop: function(event, ui) {\n $('#average_nightly_rate').next('a.remove-small').show();\n sendFilterRequest($(this));\n }\n });\n\n /*\n\n $(\"#slider_average_nigthlyRate\").slider2( \"destroy\" );\n $(\"#slider_average_nigthlyRate\").slider2({\n range: true,\n min: min,\n max: max,\n posMin: posMin,\n posMax: posMax,\n values: [minRange, maxRange],\n slide: function(event, ui) {\n $(\"#average_nigthlyRate\").val(ui.values[0] + ' - ' + ui.values[1]);\n $(\"#info_average_nigthlyRate\").html(ui.values[0] + ' - ' + ui.values[1]);\n }\n });\n\n $( \"#slider_average_nigthlyRate\").slider2({\n stop: function(event, ui) {\n $('#average_nightly_rate').next('a.remove-small').show();\n sendFilterRequest($(this));\n }\n });\n\n */\n}", "function updateSliders() {\n lengthLabel.html(\"Length: \" + lengthSlider.value());\n tempLabel.html(\"Temperature: \" + tempSlider.value());\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 setSliders() {\n let colorToChange =\n document.querySelector(\"#colorToChange\").style.backgroundColor;\n // console.log(246, colorToChange, typeof colorToChange);\n colorToChange = colorToChange\n .substring(4, colorToChange.length - 1)\n .split(\", \");\n // console.log(250, colorToChange);\n colorToChange = colorToChange.map((elem) => (elem = parseInt(elem)));\n console.log(252, colorToChange);\n const rangeRed = document.querySelector(\"#rangeRed\");\n const rangeGreen = document.querySelector(\"#rangeGreen\");\n const rangeBlue = document.querySelector(\"#rangeBlue\");\n rangeRed.value = colorToChange[0];\n rangeGreen.value = colorToChange[1];\n rangeBlue.value = colorToChange[2];\n console.log(\n 260,\n \"Sliders were set to:\",\n rangeRed.value,\n rangeGreen.value,\n rangeBlue.value\n );\n}", "reset_extents(min, max) {\n const ds = this.jdiv.find('#time-slider')\n const vals = ds.dragslider('values')\n ds.dragslider('option', 'min', min)\n ds.dragslider('option', 'max', max)\n ds.dragslider('values', vals) // Restore values after setting min/max to fix slider location bug\n\n this.llabel.html(numberWithCommas(min))\n this.rlabel.html(numberWithCommas(max))\n }", "updateSlider_() {\n if (!this.sliderInput_) {\n return;\n }\n this.sliderInput_.setAttribute('value', this.getValue());\n }", "function setDeathPercentageSlider() {\n var handleA = $(\".deathPercentage-rate-slider.lower-handle\");\n var handleB = $(\".deathPercentage-rate-slider.upper-handle\");\n\n $('.deathPercentage-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(0.70);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxDeath = ui.value\n }\n else {\n handleA.text(ui.value);\n minDeath = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 0.70,\n step: 0.05,\n values: [0, 0.70],\n animate: true\n });\n}", "function adjustSliderValue(){\n if(scroll_value[0]>scroll_value[1]){\n scroll_value[1]=[scroll_value[0], scroll_value[0]=scroll_value[1]][0];\n index==0?index=1:index=0;\n }\n refreshUI(true);\n}", "function setSliderValues(){\n warpValue.innerHTML = \"Warp Speed:\" + warpSlider.value;\n warpSlider.oninput = function() {\n warpValue.innerHTML = \"Warp Speed:\" + this.value;\n }\n\n stretchValue.innerHTML = \"Warp Stretch Length:\" + stretchSlider.value;\n stretchSlider.oninput = function() {\n stretchValue.innerHTML = \"Warp Stretch Length:\" + this.value;\n }\n\n sizeValue.innerHTML = \"Base Size:\" + sizeSlider.value;\n sizeSlider.oninput = function() {\n sizeValue.innerHTML = \"Base Size:\" + this.value;\n }\n \n baseSpeedValue.innerHTML = \"Base Speed:\" + baseSpeedSlider.value;\n baseSpeedSlider.oninput = function() {\n baseSpeedValue.innerHTML = \"Base Speed:\" + this.value;\n }\n\n amountValue.innerHTML = \"Amount:\" + amountSlider.value*100;\n amountSlider.oninput = function() {\n amountValue.innerHTML = \"Amount:\" + this.value*100;\n loadImages();\n }\n}", "reset(...values) {\n this.inputs.forEach( (input, i) => this[\"v\" + (i+1)] = (values[i] || 0) );\n this.displayTime();\n this.displayLap();\n if(this.hours) this.hours = false;\n }", "function updateMortalitySlider(valA, valB){\n $('.mortality-slider').slider(\"values\", 0, valA)\n $(\".mortality-rate-slider.lower-handle\").text(valA)\n $('.mortality-slider').slider(\"values\", 1, valB)\n $(\".mortality-rate-slider.upper-handle\").text(valB)\n}", "function reset(){\n for(let i = 0; i < sliderImages.length; i++){\n sliderImages[i].style.display = 'none';\n }\n }", "function updateDeathPrecentSlider(valA, valB){\n $('.deathPercentage-slider').slider(\"values\", 0, valA)\n $(\".deathPercentage-rate-slider.lower-handle\").text(valA)\n $('.deathPercentage-slider').slider(\"values\", 1, valB)\n $(\".deathPercentage-rate-slider.upper-handle\").text(valB)\n}", "function initialize() {\n setText(initialSliderValue);\n setImage(initialSliderValue);\n computeHolderMargin(initialSliderValue);\n scaleOrHideLabel(initialSliderValue);\n}", "set value(value) {\n if (this.slider) {\n this.slider.setValue(value);\n }\n else {\n this.initialOptions.value = value;\n }\n }", "function reset() {\n for (let i = 0; i < sliderImages.length; i++) {\n sliderImages[i].style.display = \"none\";\n }\n}", "function reset() {\n for (let i = 0; i < sliderImages.length; i++) {\n sliderImages[i].style.display = 'none';\n }\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}", "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}", "function init() {\n setMortalitySlider()\n setIncidentsSlider()\n setDeathPercentageSlider()\n setYearSlider()\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 }", "function setRangeSliders(filter_id, rangeSliders) {\n\tvar style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"button\";\n\n\tif (!rangeSliders) {\n\t\treturn false;\n\t}\n\n\t// Loop all range sliders\n\t[].concat(_toConsumableArray(rangeSliders)).forEach(function (slider, e) {\n\t\tvar target = slider.querySelector(\".alm-range-slider--target\");\n\t\tvar label = slider.querySelector(\".alm-range-slider--label\");\n\t\tvar resetBtn = slider.querySelector(\".alm-range-slider--reset\");\n\t\tvar input = slider.parentNode.querySelector(\"input\");\n\n\t\tvar min = slider.dataset.min ? parseInt(slider.dataset.min) : 0;\n\t\tvar max = slider.dataset.max ? parseInt(slider.dataset.max) : 100;\n\t\tvar start = slider.dataset.start ? parseInt(slider.dataset.start) : min;\n\t\tvar start_reset = slider.dataset.startReset ? parseInt(slider.dataset.startReset) : start;\n\t\tvar end = slider.dataset.end ? parseInt(slider.dataset.end) : max;\n\t\tvar end_reset = slider.dataset.endReset ? parseInt(slider.dataset.endReset) : end;\n\t\tvar steps = slider.dataset.steps ? parseInt(slider.dataset.steps) : 1;\n\t\tvar display_label = slider.dataset.label ? slider.dataset.label : \"{start} - {end}\";\n\t\tvar orientation = slider.dataset.orientation ? slider.dataset.orientation : \"horizontal\";\n\t\tvar decimals = slider.dataset.decimals ? slider.dataset.decimals : \"true\";\n\t\tdecimals = decimals === \"true\" ? true : false;\n\n\t\t// Range Slider Options\n\t\tvar options = {\n\t\t\tstart: [start, end],\n\t\t\tstep: steps,\n\t\t\tconnect: true,\n\t\t\tbehaviour: \"tap\",\n\t\t\torientation: orientation,\n\t\t\trange: {\n\t\t\t\tmin: min,\n\t\t\t\tmax: max\n\t\t\t}\n\t\t};\n\n\t\t// Custom config options\n\t\tvar opt_var = filter_id !== \"\" ? \"alm_nouislider_opts_\" + filter_id : \"alm_nouislider_opts\"; // Dynamic Variable Name\n\t\tvar alm_nouislider_opts = window[opt_var]; // Get window variable\n\t\tif (alm_nouislider_opts) {\n\t\t\tObject.keys(alm_nouislider_opts).forEach(function (key) {\n\t\t\t\t// Loop object\tto create key:prop\n\t\t\t\toptions[key] = alm_nouislider_opts[key];\n\t\t\t});\n\t\t}\n\n\t\t// Initiate noUiSlider\n\t\t_nouislider2.default.create(target, options);\n\n\t\t// Update\n\t\ttarget.noUiSlider.on(\"update\", function () {\n\t\t\tvar value = this.get();\n\t\t\tlabel.innerHTML = parseRangeValue(value, min, max, display_label, decimals);\n\t\t});\n\n\t\t// End\n\t\ttarget.noUiSlider.on(\"end\", function () {\n\t\t\tvar value = this.get();\n\n\t\t\t// If style is change, submit the form on change\n\t\t\tif (style === \"change\") {\n\t\t\t\tvar ev = document.createEvent(\"Event\");\n\t\t\t\tev.initEvent(\"keyup\", true, false);\n\t\t\t\tev.which = ev.keyCode = 13;\n\t\t\t\tinput.dispatchEvent(ev);\n\t\t\t}\n\n\t\t\tif (resetBtn) {\n\t\t\t\ttoggleResetBtn(resetBtn, value, start_reset, end_reset);\n\t\t\t}\n\t\t});\n\n\t\t// Change\n\t\ttarget.noUiSlider.on(\"change\", function () {\n\t\t\tonChange(this, label, input, resetBtn, min, max, start_reset, end_reset, display_label, decimals, style);\n\t\t});\n\n\t\t// Set\n\t\ttarget.noUiSlider.on(\"set\", function () {\n\t\t\tonChange(this, label, input, resetBtn, min, max, start_reset, end_reset, display_label, decimals, style);\n\t\t});\n\n\t\t// Reset Range Slider\n\t\tif (resetBtn) {\n\t\t\tresetBtn.addEventListener(\"click\", function () {\n\t\t\t\ttarget.noUiSlider.set([start_reset, end_reset]);\n\t\t\t});\n\t\t\t// Run on init\n\t\t\ttoggleResetBtn(resetBtn, target.noUiSlider.get(), start_reset, end_reset);\n\t\t}\n\t});\n}", "function setUpPyramidSlider() {\r\n // Setter\r\n\r\n $(\"#pyramid-slider\").slider(\"option\", \"value\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\"option\", \"min\", Number(aleph.years[0]));\r\n $(\"#pyramid-slider\").slider(\r\n \"option\",\r\n \"max\",\r\n Number(aleph.years[aleph.years.length - 1])\r\n );\r\n\r\n return;\r\n} // end function setUpPyramidSlider", "function reset() {\r\n // Clear all images\r\n for (let i = 0; i < sliderImages.length; i++) {\r\n sliderImages[i].style.display = \"none\"; // taking display and setting to none\r\n }\r\n}", "function reset(){\n for(let i = 0 ; i<sliderImages.length ; i++){\n sliderImages[i].style.display = \"none\"\n }\n}", "function restoreDefaults(){\r\n\tvar amountString = \"\";\r\n\tvar sliderString = \"\";\r\n\tfor (var i=0;i<inputs.length;i++){\r\n\t\tamountString = \"#amount\"+i;\r\n\t\tsliderString = \"#slider\"+i;\r\n\t\t$(amountString).val(getInputDefault(i));\r\n\t\t$(sliderString).slider('value',getInputDefault(i));\r\n\t}\r\n}", "function inputMinSliderLeft(){//slider update inputs\n inputMin.value=sliderLeft.value;\n}", "resetRange() {\n this._initAxisTags(true);\n this.draw();\n }", "function resetSlide() {\n gsap.to(\".reset\", { duration: 1, x: \"100%\" });\n}", "function reset() {\n for (var i = 0; i < sliderImages.length; i++) {\n sliderImages[i].style.display = \"none\";\n }\n}", "function resetTime() {\n maxTimeInMs = Math.round(timeMax/1000);\n timeSlider.attr('max', maxTimeInMs);\n timeSlider.attr('value', maxTimeInMs);\n $(\"#timeRange\").val(maxTimeInMs)\n updateTimeLabel(formatToMinuteSecond(timeMax));\n //timeSlider.attr(\"visibility\", \"hidden\");\n}", "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 updateSlider() {\n\n // Empty input field\n if (volumeNumber.value === \"\") {\n volumeSlider.value = 0;\n volumeImage.src = \"./assets/media/icons/volume-level-0.svg\";\n\n // Input Field Range 1 to 100\n } else {\n if (volumeNumber.value == 0) {\n volumeImage.src = \"./assets/media/icons/volume-level-0.svg\";\n } else if (1 <= volumeNumber.value && volumeNumber.value <= 33) {\n volumeImage.src = \"./assets/media/icons/volume-level-1.svg\";\n } else if (34 <= volumeNumber.value && volumeNumber.value <= 66) {\n volumeImage.src = \"./assets/media/icons/volume-level-2.svg\";\n } else if (67 <= volumeNumber.value && volumeNumber.value <= 100) {\n volumeImage.src = \"./assets/media/icons/volume-level-3.svg\";\n } else {\n volumeNumber.value = 100;\n }\n volumeSlider.value = volumeNumber.value;\n }\n}", "function set_sliders(subject)\n{\n $(\".angst-nslider\").slider(\n {\n\t range: \"min\",\n\t min: 0,\n\t max: 100,\n\t value: 60,\n\t slide: function(event, ui)\n\t {\n\t var id = this.id.split(\"-\")[1];\n $(\"#angst-\" + id + \"-text\").val(ui.value/10);\n update_result(subject);\n }\n });\n \n // Set the starting value for the text inputs\n $(\".angst-ntext\").val(6.0);\n \n // Sync the text inputs with the sliders\n $(\".angst-ntext\").keyup(\n function (event)\n {\n var slider_id = this.id.split(\"-\")[1];\n var value = $(\"#angst-\" + slider_id + \"-text\").val();\n $(\"#angst-\" + slider_id + \"-slider\").slider(\"value\", value * 10);\n update_result(subject);\n });\n}", "function reset() {\n for (var i = 0; i < sliderImages.length; i++) {\n sliderImages[i].style.display = 'none'; // Clear all images.\n dots[i].classList.remove(\"active\"); // Clear class active (CSS)\n } \n}", "function initSliderPositions() {\n // console.log('Init Slider Pos runs');\n sliders.forEach(slider => {\n if (slider.name === 'hue') {\n // Get the correct color from the array based on the data atttribute of the current slider\n // which will have the correct number for the index based on which group the slider is in\n const color = colorsArr[slider.getAttribute('data-hue')];\n // Extract the hue from that color and save it\n const hueValue = Math.floor(chroma(color).hsl()[0]);\n // console.log(hueValue);\n // set the current slider's value to the hue\n slider.value = hueValue;\n } else if (slider.name === 'saturation') {\n const color = colorsArr[slider.getAttribute('data-sat')];\n const saturationValue = Math.floor(chroma(color).hsl()[1] * 100) / 100;\n slider.value = saturationValue;\n } else {\n const color = colorsArr[slider.getAttribute('data-bright')];\n const brightnessValue = Math.floor(chroma(color).hsl()[2] * 100) / 100;\n slider.value = brightnessValue;\n }\n });\n}", "function updateSliders() {\n\n fillToggle.addEventListener('change', function(){\n\n fillnode = (fillnode === \"transparent\") ? \"#bbb\" : \"transparent\";\n d3.selectAll(\"#node-text\").style(\"fill\", fillnode);\n console.log(fillnode);\n });\n\n edgeToggle.addEventListener('change', function(){\n\n hoverlink = !hoverlink;\n });\n\n nodeSlider.noUiSlider.on('update', updateNode);\n\n nodeIn.addEventListener('change', function(){\n nodeSlider.noUiSlider.set(this.value);\n });\n\n edgeSlider.noUiSlider.on('update', updateEdge);\n\n edgeIn.addEventListener('change', function(){\n edgeSlider.noUiSlider.set(this.value);\n });\n\n tensionSlider.noUiSlider.on('update', updateTension);\n\n tensionIn.addEventListener('change', function(){\n tensionSlider.noUiSlider.set(this.value);\n });\n\n weightSlider.noUiSlider.on('update', updateWeight);\n\n weightMinInput.addEventListener('change', function(){\n weightSlider.noUiSlider.set([this.value, weightMax]);\n });\n\n weightMaxInput.addEventListener('change', function(){\n weightSlider.noUiSlider.set([weightMin, this.value]);\n });\n\n inSlider.noUiSlider.on('update', updateIn);\n\n inIn.addEventListener('change', function(){\n inSlider.noUiSlider.set(this.value);\n });\n\n outSlider.noUiSlider.on('update', updateOut);\n\n outIn.addEventListener('change', function(){\n outSlider.noUiSlider.set(this.value);\n });\n}", "function updateRange(value) {\n highDiv.find('input').val(value);\n lowDiv.find('input').val(value);\n // Toogle all other buttons (but just the buttons on this fielset.\n fieldset.find('input[type=radio]').prop('checked', false);\n fieldset.find('#progress-button-' + value).prop('checked', true);\n }", "function setIncidentsSlider() {\n var handleA = $(\".incidents-rate-slider.lower-handle\");\n var handleB = $(\".incidents-rate-slider.upper-handle\");\n\n $('.incidents-slider').slider({\n create: function (e, ui) {\n handleA.text(0);\n handleB.text(1000);\n },\n slide: function (e, ui) {\n if (ui.values[0] == ui.values[1])\n return false;\n if ($(ui.handle).hasClass(\"upper-handle\")) {\n handleB.text(ui.value);\n maxIncidents = ui.value\n }\n else {\n handleA.text(ui.value);\n minIncidents = ui.value\n }\n },\n orientation: 'horizontal',\n range: true,\n min: 0,\n max: 1000,\n step: 10,\n values: [0, 1000],\n animate: true\n });\n}", "function setUpSliders(){\n prevYear.addEventListener(\"click\",function() {\n yearHolder.textContent--; \n eraseForYears(); \n }, false);\n nextYear.addEventListener(\"click\",function() {\n yearHolder.textContent++;\n eraseForYears();\n }, false);\n prevMonth.addEventListener(\"click\",function () {\n if (currentDate.getMonth()!==0) {\n monthHolder.textContent = monthNames[currentDate.getMonth()-1]; \n currentDate.setMonth(currentDate.getMonth()-1);\n }else{\n monthHolder.textContent = monthNames[11];\n currentDate.setMonth(11);\n yearHolder.textContent--;\n currentDate.setFullYear(yearHolder.textContent);\n }\n eraseForMonths(); \n },false); \n\n nextMonth.addEventListener(\"click\",function () {\n if (currentDate.getMonth()!==11) {\n monthHolder.textContent = monthNames[currentDate.getMonth()+1]; \n currentDate.setMonth(currentDate.getMonth()+1);\n }else{\n monthHolder.textContent = monthNames[0];\n currentDate.setMonth(0);\n yearHolder.textContent++;\n currentDate.setFullYear(yearHolder.textContent);\n }\n eraseForMonths();\n },false); \n\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 resetMinMax() {\n minPermintaan = 1000;\n maxPermintaan = 5000;\n minPersediaan = 100;\n maxPersediaan = 600;\n }", "function reverse_resetSlider(){\n currentSlide = $('#slide'+slideCount);\n currentSlide.addClass('current-slide');\n\n $('#slide1').removeClass('current-slide');\n num = slideCount;\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}", "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 }", "function reloadSlider(slider){\n slider.reloadSlider();\n}", "function createPsizeSliders(){\n\n\tGUIParams.partsKeys.forEach(function(p,i){\n\t\tvar initialValue = parseFloat(GUIParams.PsizeMult[p]); //I don't *think* I need to update this in GUI; it's just the initial value that matters, right?\n\n\t\tvar sliderArgs = {\n\t\t\tstart: [initialValue], \n\t\t\tconnect: [true, false],\n\t\t\ttooltips: false,\n\t\t\tsteps: [0.0001],\n\t\t\trange: { //reset below\n\t\t\t\t'min': [0],\n\t\t\t\t'max': [initialValue]\n\t\t\t},\n\t\t\tformat: wNumb({\n\t\t\t\tdecimals: 4\n\t\t\t})\n\t\t}\n\n\t\tvar slider = document.getElementById(p+'_PSlider');\n\t\tvar text = [document.getElementById(p+'_PMaxT')];\n\t\tvar varToSet = [initialValue, \"PsizeMult\",p];\n\t\tvar varArgs = {'f':'setViewerParamByKey','v':varToSet};\n\n\t\tcreateSlider(slider, text, sliderArgs, varArgs);\n\n\t\t//reformat\n\t\tw = parseInt(d3.select('#'+p+'_PSlider').style('width').slice(0,-2));\n\t\td3.select('#'+p+'_PSlider').select('.noUi-base').style('width',w-10+\"px\");\n\t});\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 xrangeset(min,max) {\n // Force the slider thumbs to adjust to the appropriate place\n $(\"#slider-range\").slider(\"option\", \"values\", [min,max]);\n }", "function setValue(args, set) {\n\n /*jshint validthis: true */\n\n // If the value is to be set to a number, which is valid\n // when using a one-handle slider, wrap it in an array.\n if (!$.isArray(args)) {\n args = [args];\n }\n\n // Setting is handled properly for each slider in the data set.\n return this.each(function () {\n\n var b = $(this).data('base'), to, i,\n\t\t\t\t\thandles = Array.prototype.slice.call(b.data('handles'), 0),\n\t\t\t\t\tsettings = b.data('options');\n\n // If there are multiple handles to be set run the setting\n // mechanism twice for the first handle, to make sure it\n // can be bounced of the second one properly.\n if (handles.length > 1) {\n handles[2] = handles[0];\n }\n\n // The RTL settings is implemented by reversing the front-end,\n // internal mechanisms are the same.\n if (settings['direction']) {\n args.reverse();\n }\n\n for (i = 0; i < handles.length; i++) {\n\n // Calculate a new position for the handle.\n to = args[i % 2];\n\n // The set request might want to ignore this handle.\n // Test for 'undefined' too, as a two-handle slider\n // can still be set with an integer.\n if (to === null || to === undefined) {\n continue;\n }\n\n // Add support for the comma (,) as a decimal symbol.\n // Replace it by a period so it is handled properly by\n // parseFloat. Omitting this would result in a removal\n // of decimals. This way, the developer can also\n // input a comma separated string.\n if ($.type(to) === 'string') {\n to = to.replace(',', '.');\n }\n\n // Calculate the new handle position\n to = toPercentage(settings['range'], parseFloat(to));\n\n // Invert the value if this is an right-to-left slider.\n if (settings['direction']) {\n to = 100 - to;\n }\n\n // If the value of the input doesn't match the slider,\n // reset it. Sometimes the input is changed to a value the\n // slider has rejected. This can occur when using 'select'\n // or 'input[type=\"number\"]' elements. In this case, set\n // the value back to the input.\n if (setHandle(handles[i], to) !== true) {\n handles[i].data('store').val(true);\n }\n\n // Optionally trigger the 'set' event.\n if (set === true) {\n call(settings['set'], $(this));\n }\n }\n });\n }", "function resetDefaults() {\n controls.timeSlider.value = 500;\n app.setTimeScale(controls.timeSlider.value / 1000);\n if (!controls.threePlanetCheckbox.checked) {\n controls.planet1.x.value = EARTH.x;\n controls.planet1.y.value = EARTH.y;\n controls.planet1.z.value = EARTH.z;\n controls.planet1.vx.value = EARTH.vx;\n controls.planet1.vy.value = EARTH.vy;\n controls.planet1.vz.value = EARTH.vz;\n controls.planet1.mass.value = EARTH.mass;\n\n controls.planet2.x.value = MOON.x;\n controls.planet2.y.value = MOON.y;\n controls.planet2.z.value = MOON.z;\n controls.planet2.vx.value = MOON.vx;\n controls.planet2.vy.value = MOON.vy;\n controls.planet2.vz.value = MOON.vz;\n controls.planet2.mass.value = MOON.mass;\n } else {\n controls.planet1.x.value = THREE_BODY_345[0].x;\n controls.planet1.y.value = THREE_BODY_345[0].y;\n controls.planet1.z.value = THREE_BODY_345[0].z;\n controls.planet1.vx.value = THREE_BODY_345[0].vx;\n controls.planet1.vy.value = THREE_BODY_345[0].vy;\n controls.planet1.vz.value = THREE_BODY_345[0].vz;\n controls.planet1.mass.value = THREE_BODY_345[0].mass;\n\n controls.planet2.x.value = THREE_BODY_345[1].x;\n controls.planet2.y.value = THREE_BODY_345[1].y;\n controls.planet2.z.value = THREE_BODY_345[1].z;\n controls.planet2.vx.value = THREE_BODY_345[1].vx;\n controls.planet2.vy.value = THREE_BODY_345[1].vy;\n controls.planet2.vz.value = THREE_BODY_345[1].vz;\n controls.planet2.mass.value = THREE_BODY_345[1].mass;\n\n controls.planet3.x.value = THREE_BODY_345[2].x;\n controls.planet3.y.value = THREE_BODY_345[2].y;\n controls.planet3.z.value = THREE_BODY_345[2].z;\n controls.planet3.vx.value = THREE_BODY_345[2].vx;\n controls.planet3.vy.value = THREE_BODY_345[2].vy;\n controls.planet3.vz.value = THREE_BODY_345[2].vz;\n controls.planet3.mass.value = THREE_BODY_345[2].mass;\n }\n}", "function sliderReset(event) {\n var $this = $(this);\n // Clean active items.\n $this\n .find('.fp-root')\n .animate({\n 'left': 0\n }, 250)\n .find('.fp-item')\n .trigger('clean')\n .end()\n .end()\n .trigger('reflowed');\n \n }", "function updateValues() {\n alignmentSliderVal = document.getElementById(\"alignment-slider\").value;\n cohesionSliderVal = document.getElementById(\"cohesion-slider\").value;\n separationSliderVal = document.getElementById(\"separation-slider\").value;\n changeAudioSpeed();\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 updateSliderHandles(args){\n i = args[0]\n value = args[1]\n key = args[2]\n resetEnd = args[3]\n type = args[4]\n \n var this_parent = document.getElementById(key)\n\n setSliderHandle(i,value,this_parent,null,resetEnd,type);\n}", "function resetValue() {\n\t\t\t}", "function dragSlider(values) {\n setProgress(parseInt(values[0]))\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}", "function reset() {\n\n // Plot distribution 1.\n g1.clear();\n for (var i = XMIN; i <= XMAX; i += STEP) {\n var y1 = (1/(controls.s1.value*Math.sqrt(2*Math.PI)))*Math.exp(-0.5*Math.pow(((i-controls.u1.value)/controls.s1.value),2));\n g1.addPoint(i, y1);\n }\n\n // Plot distribution 2.\n g2.clear();\n for (var i = XMIN; i <= XMAX; i += STEP) {\n var y2 = (1/(controls.s2.value*Math.sqrt(2*Math.PI)))*Math.exp(-0.5*Math.pow(((i-controls.u2.value)/controls.s2.value),2));\n g2.addPoint(i, y2);\n }\n\n}", "function onSliderChange() {\n sw = slider.value;\n}", "_correctIndexSettings() {\n this.options.slider.startIndex -= 1;\n this.options.thumbnailSlider.startIndex -= 1;\n this.options.slider.startIndex = (this.options.slider.startIndex < 0) ? 0 : this.options.slider.startIndex;\n this.options.thumbnailSlider.startIndex = (this.options.thumbnailSlider.startIndex < 0) ? 0 : this.options.thumbnailSlider.startIndex;\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 setValue(val, vertical) {\n document.getElementById(\"slider\").value = 3;\n showValue(val, vertical);\n}", "function resetOptions(){\n\t \t \n\t\t g_options = jQuery.extend({}, g_temp.originalOptions);\n\t\t \n\t\t g_selectedItemIndex = -1;\n\t\t g_selectedItem = null;\n\t\t g_objSlider = undefined;\n\t\t g_objThumbs = undefined;\n\t\t g_objSlider = undefined; \n\t}", "function adjustSettings() {\n d3.select('.main-svg').remove();\n d3.select('.tooltip').remove();\n var range = slider.noUiSlider.get();\n g_settings.follower_slider.min = range[0];\n g_settings.follower_slider.max = range[1];\n g_settings.sort = $('.sort-box')[0].checked;\n drawGraph();\n}", "function restInputs() {\r\n const allSliders = document.querySelectorAll('input[type=\"range\"]');\r\n allSliders.forEach((slider) => {\r\n // console.log(slider.name);\r\n if (slider.name === 'hue') {\r\n const hueColor = initialColors[slider.getAttribute('data-hue')];\r\n //get the hue value from the current color with hsl() that return an array with the hue, brightness and sat values of a color\r\n const hueValue = chroma(hueColor).hsl()[0];\r\n slider.value = Math.floor(hueValue);\r\n } else if (slider.name === 'brightness') {\r\n const brightnessColor = initialColors[slider.getAttribute('data-bright')];\r\n const brightnessValue = chroma(brightnessColor).hsl()[2];\r\n slider.value = brightnessValue.toFixed(2);\r\n } else if (slider.name === 'saturation') {\r\n //get the data-set with different techinique\r\n const satColor = initialColors[slider.dataset.sat];\r\n const satValue = chroma(satColor).hsl()[1];\r\n slider.value = satValue.toFixed(2);\r\n }\r\n });\r\n}", "function setSliderValues (slider, sliderMax, sliderValue, tooltiptext) {\n //reset the max value of the slider\n slider.data('slider').max = sliderMax;\n slider.slider('setValue', sliderValue);\n $(\".tooltip-inner\").html(tooltiptext);\n }", "_update() {\n const _this = this;\n\n _this._updateEls();\n \n for (let i = 0; i < this.o.numSliders; ++i) {\n let sliderPos = _this._calcSliderPos(i);\n\n this.svgEls.sliders[i].setAttribute(\"x\", sliderPos.x);\n this.svgEls.sliders[i].setAttribute(\"y\", sliderPos.y);\n this.svgEls.sliders[i].setAttribute(\"width\", _this._calcSliderWidth());\n this.svgEls.sliders[i].setAttribute(\"height\", _this._calcSliderHeight(i));\n this.svgEls.sliders[i].setAttribute(\"fill\", this.o.sliderColors[i % this.o.sliderColors.length]);\n\n this.svgEls.sliderPanels[i].setAttribute(\"x\", sliderPos.x);\n this.svgEls.sliderPanels[i].setAttribute(\"y\", 0);\n this.svgEls.sliderPanels[i].setAttribute(\"width\", _this._calcSliderWidth());\n this.svgEls.sliderPanels[i].setAttribute(\"height\", _this._getHeight());\n this.svgEls.sliderPanels[i].setAttribute(\"fill\", \"transparent\");\n }\n\n // set background panel color\n this.svgEls.panel.setAttribute(\"x\", 0);\n this.svgEls.panel.setAttribute(\"y\", 0);\n this.svgEls.panel.setAttribute(\"width\", _this._getWidth());\n this.svgEls.panel.setAttribute(\"height\", _this._getHeight());\n this.svgEls.panel.setAttribute(\"fill\", this.o.backgroundColor);\n }", "function updateSlider(slideAmount) {\n removegrid(gridSize);\n gridSize = (slideAmount ** 2);\n setGridSize(slideAmount);\n}" ]
[ "0.7601607", "0.7571234", "0.69490063", "0.68924135", "0.6855094", "0.683257", "0.6808523", "0.6806798", "0.68061703", "0.6789691", "0.6769028", "0.6762554", "0.67313516", "0.6697319", "0.666806", "0.666462", "0.6632596", "0.6629029", "0.66231334", "0.6618713", "0.6607569", "0.65982175", "0.659766", "0.6589263", "0.65163857", "0.6507469", "0.64924777", "0.6486311", "0.6455327", "0.6442444", "0.640299", "0.6393699", "0.63597953", "0.63452643", "0.6333022", "0.62485623", "0.62209326", "0.6194781", "0.61856747", "0.6179077", "0.6165399", "0.6162169", "0.61615866", "0.6158646", "0.61540973", "0.6150505", "0.61391056", "0.61207724", "0.6115452", "0.6114835", "0.6113031", "0.60980517", "0.60818475", "0.60675335", "0.6049494", "0.603912", "0.60375684", "0.6029177", "0.60194546", "0.6011847", "0.600996", "0.6006355", "0.5996212", "0.59949917", "0.59693015", "0.59248376", "0.5924197", "0.59020215", "0.5901117", "0.5901033", "0.5899289", "0.58816326", "0.5878514", "0.587832", "0.5875805", "0.58742034", "0.5870755", "0.5870437", "0.58675516", "0.58656996", "0.58631957", "0.58630455", "0.5857447", "0.5853298", "0.58482486", "0.5844658", "0.5823021", "0.58109874", "0.5809041", "0.57978725", "0.57782125", "0.57726", "0.57706505", "0.57642525", "0.5745578", "0.5726319", "0.5720146", "0.57165205", "0.57150716", "0.570898" ]
0.7158393
2
/ PART 2: BOARD GENERATION / Generate a Minesweeper array and place it in a board
function generateBoard() { var array = [], // 1-d array, with LxC, which will be ported to the main board at the end i, max = lines*collumns; // Put all mines in the beginning for (i = 0; i < max; i++) { if (i < mines) { array[i] = 1; } else { array[i] = 0; } } fisherYates(array); // Randomizes mine position makeBoard(array); // Passes 1-d array to 2-d board }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function boardGenerator() {\n for (var i = 0; i < boardSize; i++) {\n for (var j = 0; j < boardSize; j++) {\n board.cells.push({\n row: i,\n col: j,\n isMine: randomMines(),\n hidden: true,\n });\n }\n }\n}", "function makeBoard() {\n //Make an empty array for board propert cells\n board.cells = [];\n for (let rowNum = 0; rowNum < gridSize; rowNum++) {\n for (let colNum = 0; colNum < gridSize; colNum++) {\n board.cells.push({\n row: rowNum,\n col: colNum,\n isMine: Math.round(Math.random() >= 0.7),\n isMarked: false,\n hidden: true,\n });\n }\n }\n}", "generateBoard() {\n for (let i = 0; i < this.rows; i++) {\n let row = [];\n for (let i = 0; i < this.cols; i++) row.push(new Tile(0, false));\n this.tiles.push(row);\n }\n this.setMines();\n }", "function buildBoard() {\n\t// DONE: Create the Matrix 10 * 12\n\tvar board = [];\n\tfor(var i = 0; i< ROWS; i++) {\n\t\tboard[i] = [];\n\t\tfor(var j = 0; j< COLS; j++) {\n\t\t\t// DONE: Put FLOOR everywhere and WALL at edges\n\t\t\tvar cell = {type: FLOOR, gameElement: null};\n\t\t\tif(i === 0 || j === 0 || i === ROWS - 1 || j === COLS -1 ) {\n\t\t\t\tcell.type = WALL;\n\t\t\t}\n\t\t\tboard[i][j] = cell;\n\t\t}\n\t}\n\t\n\t// DONE: Place the gamer\n\tboard[gGamerPos.i][gGamerPos.j].gameElement = GAMER;\n\t\n\tfor (var i = 0; i < gWindowsPos.length; i++) {\n\t\tvar currWindow = gWindowsPos[i].pos;\n\t\tboard[currWindow.i][currWindow.j].type = FLOOR;\n\t}\n\n\t// console.log(board);\n\treturn board;\n}", "function createBoard(size) {\r\n var board = [];\r\n\r\n for (var i = 0; i < size; i++) {\r\n board[i] = [];\r\n for (var j = 0; j < size; j++) {\r\n var cell = {\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: false,\r\n isMarked: false\r\n };\r\n board[i][j] = cell;\r\n }\r\n }\r\n return board;\r\n}", "function makeBoard() {\n\t// TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n\t//loop over HEIGHT (6) times to signify the 6 rows\n\tfor (let i = 0; i < HEIGHT; i++) {\n\t\t//create an empty array\n\t\tlet arr = [];\n\t\t//push the empty array into the empty \"board\" array\n\t\tboard.push(arr);\n\t\t//loop over WIDTH times (7) to create the length of each row\n\t\tfor (let i = 0; i < WIDTH; i++) {\n\t\t\t//push \"null\" into each \"arr\" array\n\t\t\tarr.push(null);\n\t\t}\n\t}\n}", "function generateBoard(cells) {\n var i, j;\n var tempBoard = [];\n var shipArr = [];\n var boardSettings = [{\n shipLength: 4,\n qty: 1\n },\n {\n shipLength: 3,\n qty: 2\n }, {\n shipLength: 2,\n qty: 3\n }, {\n shipLength: 1,\n qty: 4\n }\n ]\n\n //initializing an empty 2d array\n for (i = 0; i < cells; ++i) {\n tempBoard.push([]);\n for (j = 0; j < cells; ++j) {\n tempBoard[i].push(\"\");\n }\n }\n for (i = 0; i < boardSettings.length; ++i) {\n // for each shipType\n for (j = 0; j < boardSettings[i].qty; ++j) {\n //for each ship\n var newShip = placeShip(boardSettings[i].shipLength, tempBoard, cells);\n shipArr.push(newShip);\n }\n }\n return shipArr;\n}", "function buildBoard() {\r\n var boardLength = gCurrLevel.boardSize\r\n var board = [];\r\n for (var i = 0; i < boardLength; i++) {\r\n board[i] = [];\r\n for (var j = 0; j < boardLength; j++) {\r\n var cell = {\r\n type: EMPTY,\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: false,\r\n isMarked: false,\r\n isCanClick: true\r\n }\r\n board[i][j] = cell;\r\n }\r\n }\r\n return board;\r\n}", "function makeBoard() {\n // set \"board\" to empty HEIGHT x WIDTH matrix array\n board = [...Array(height)].map(arr => [...Array(width)].map(e => ''));\n}", "function makeBoard() {\n \n // loops through starting at Y grid position 0-0,pushing to the board array each coordinate for x at y, 6X7\n for (let y = 0; y < HEIGHT; y++) {\n board.push(Array.from({length: WIDTH}));\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 generate() {\n\tfor (var i = 0; i < rows * columns; i++) {\n\t\t// Loop through every spot in our 2D array and check spots neighbors\n\t\tx = floor(random(columns));\n\t\ty = floor(random(rows));\n\t\t// pick a random orthogonal neighbor and set state to match\n\t\tvar n = floor(random(4));\n\t\tif (n == 0) board[x][y] = board[x][bounded(y-1, 0, rows-1)];\n\t\telse if (n == 1) board[x][y] = board[x][bounded(y+1, 0, rows-1)];\n\t\telse if (n == 2) board[x][y] = board[bounded(x-1, 0, columns-1)][y];\n\t\telse board[x][y] = board[bounded(x+1, 0, columns-1)][y];\n\n\t\tif ((board[x][y] == 1)) fill(0);\n\t\telse fill(255);\n\t\trect(x*w, y*w, w-1, w-1);\n\t}\n}", "function makeBoard() {\n\t// TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n\tfor (let y = 0; y < HEIGHT; y++) {\n\t\tboard.push(Array.from({ length: WIDTH }));\n\t}\n}", "makeBoard() {\r\n const a = new Array(this.m).fill(null).map(()=>new Array(this.n).fill(null));\r\n for (let numS in this.placing) {\r\n let [di, dj] = this.placing[numS].dir;\r\n let [i, j] = this.placing[numS].place;\r\n for (let c of numS) {\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 return a;\r\n }", "function buildBoard() {\r\n var board = [];\r\n for (var i = 0; i < gCurrlevel.size; i++) {\r\n board[i] = [];\r\n for (var j = 0; j < gCurrlevel.size; j++) {\r\n var cell = {\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: false,\r\n isFlag: false,\r\n isMarked: false,\r\n type: EMPTY,\r\n location: { i, j }\r\n\r\n }\r\n board[i][j] = cell;\r\n }\r\n }\r\n\r\n return board;\r\n}", "function makeBoard(/*columnCount, rowCount*/) {\n // Set \"board\" to empty HEIGHT x WIDTH matrix array\n //This array is used for the logic.\n\n board = [...Array(WIDTH)].map(e => Array(HEIGHT)); \n board.every((row) => row.fill(undefined));\n\n\n/* const map = [];\nfor(let x=0; x<columnCount; x++){\n map[x] = []; //set up inner array\n for(let y = 0; y< rowCount; y++){\n addCell(map, x, y);\n }\n}\nreturn map; */\n\n\n}", "function populateBoard() {\n let newArr = Array(64).fill(null);\n let len = 64;\n let i = 0;\n for (i = 0; i < len; ++i){\n // White\n if(i == 0 || i == 7){\n newArr[i] = 'white/rook' // Position Rook\n }\n if(i == 1 || i == 6){\n newArr[i] = 'white/knight' // Position Knight(Horse; to avoid confusion)\n }\n if(i == 2 || i == 5){\n newArr[i] = 'white/bishop' // Position Bishop\n }\n if(8 <= i && i <= 15){\n newArr[i] = 'white/pawn' // Position Pawn\n }\n if(i == 4){\n newArr[i] = 'white/queen' // Position Queen\n }\n if(i == 3){\n newArr[i] = 'white/king' // Position King\n }\n\n // Black\n if(i == 56 || i == 63){\n newArr[i] = 'black/rook' // Position Rook\n }\n if(i == 57 || i == 62){\n newArr[i] = 'black/knight' // Position Knight(Horse; to avoid confusion)\n }\n if(i == 58 || i == 61){\n newArr[i] = 'black/bishop' // Position Bishop\n }\n if(48 <= i && i <= 55){\n newArr[i] = 'black/pawn' // Position Pawn\n }\n if(i == 59){\n newArr[i] = 'black/queen' // Position Queen\n }\n if(i == 60){\n newArr[i] = 'black/king' // Position King\n }\n }\n return newArr;\n}", "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n const arr = [];\n for (let i = 0; i < WIDTH; i++) {\n arr[i] = null;\n }\n for (let i = 0; i < HEIGHT; i++) {\n board[i] = [...arr];\n }\n}", "function _makeGrid () {\n let board = [];\n for (let i = 0; i < 8; i++) {\n let row = [];\n for (let j = 0; j < 8; j++) {\n row.push(null);\n }\n board.push(row);\n }\n let whites = [[3, 3], [4, 4]];\n let blacks = [[4, 3], [3, 4]];\n whites.forEach(coordinates => {\n let piece = new Piece(\"white\");\n board[coordinates[0]][coordinates[1]] = piece;\n });\n blacks.forEach(coordinates => {\n let piece = new Piece(\"black\");\n board[coordinates[0]][coordinates[1]] = piece;\n });\n return board;\n}", "function makeBoard() {\n\tfor (let h = 0; h < HEIGHT; h++) {\n\t\t//outer loop will allow us to build 7 rows (WIDTH) for every iteration through the column (HEIGHT)\n\t\tlet rowArray = []; //initialize an interal array\n\t\tfor (let w = 0; w < WIDTH; w++) {\n\t\t\trowArray[w] = 0; //increment the array each time through the loop\n\t\t}\n\t\tboard.push(rowArray); //finish by pushing the newly made array into the board array\n\t}\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 makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n for (let i = 1; i <= HEIGHT; i++) {\n board.push(Array.from({ length: WIDTH }));\n }\n}", "function buildBoard(){\n\t \t\tvar mineCount = 0;\n\t \t\tfor (var i = 0; i < ROWS; i+=1) {\n\t\t\t\tfor (var j = 0; j < COLS; j+=1) {\n\t\t\t\t\tvar x_shift = Math.floor(0.5*start) + i*stepW;\n\t\t\t\t\tvar y_shift = Math.floor(0.5*start) + j*stepH;\n\t\t\t\t\tvar circleCol = randomColorGenerator(x_shift,y_shift);\n\t\t\t\t\tvar invertedCol = getInvertedColors(circleCol);\n\t\t\t\t\tvar myCircle = new Path.Circle(new Point(x_shift+circleSize,y_shift+circleSize),circleSize).fillColor = circleCol;\n\t\t\t\t\t//initialise space object\n\n\n\t\t\t\t\tvar spaceObj = {\n\t\t\t\t\t\t\t\t\tindex: n, \n\t\t\t\t\t\t\t\t\tcolor: circleCol,\n\t\t\t\t\t\t\t\t\toutline: invertedCol,\n\t\t\t\t\t\t\t\t\tcircleRef: myCircle,\n\t\t\t\t\t\t\t\t\tpos_x: 0, pos_y: 0, \n\t\t\t\t\t\t\t\t\tholdsMine: 0, \n\t\t\t\t\t\t\t\t\tadjacentNeighbours: 0, \n\t\t\t\t\t\t\t\t\tclicked: false,\n\t\t\t\t\t\t\t\t\tflagged: false,\n\t\t\t\t\t\t\t\t\tneighbourIndexList: []\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\tspaceObj.pos_x = x_shift+circleSize;\n\t\t\t\t\tspaceObj.pos_y = y_shift+circleSize;\n\t\t\t\t\tspaceObj.holdsMine = assignMine();\n\n\t\t\t\t\tif(spaceObj.holdsMine){\n\t\t\t\t\t\tmineCount++;\n\t\t\t\t\t}\n\n\t\t\t\t\tspaces.push(spaceObj);\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tplayerStats.totalMines = mineCount;\n\t\t\tplayerStats.flags = mineCount;\n\t \t}", "function createMatrix() {\n var board = [];\n for (var i = 0; i < gLevel.SIZE; i++) {\n board[i] = [];\n for (var j = 0; j < gLevel.SIZE; j++) {\n var cell = {\n minesAroundCount: 0,\n isShown: false,\n isMine: false,\n isMarked: false,\n }\n board[i][j] = cell;\n }\n }\n return board;\n}", "function createBoardArr(){\n for(var i = tileAmt; i >= 1; i--){\n for(var j = 1; j <= tileAmt; j++){\n const tmpObj = new Object;\n tmpObj.val = \"tile\";\n tmpObj.empty = true;\n tmpObj.x = i;\n tmpObj.y = String.fromCharCode(64+j);\n tmpObj.tileLocation = tmpObj.x + tmpObj.y;\n if(i % 2 == 0){\n if(j % 2 == 0){ tmpObj.color = \"dark\";}\n else{ tmpObj.color = \"light\";}\n }else{\n if(j % 2 !== 0){ tmpObj.color = \"dark\";}\n else{ tmpObj.color = \"light\";}\n }\n if(tmpObj.color == \"dark\"){tmpObj.legalPlay = true;}\n else{tmpObj.legalPlay = false;}\n boardArr.push(tmpObj);\n }\n }\n}", "function buildTestBoard() {\n var size = 4;\n var bombsCount = 2;\n var board = [];\n //create empty board:\n for (var i = 0; i < size; i++) {\n var row = [];\n for (var j = 0; j < size; j++) {\n row.push({\n val: '', //can be empty, number, or '*' (stands for bomb)\n // negsCount: 0, //not sure if this is needed - to use only if value is not enough\n isShown: false,\n isMarkedBomb: false,\n isExplodedBomb: false\n });\n }\n board.push(row);\n }\n // fill in 2 bombs:\n board[1][1].val = '*';\n board[2][3].val = '*';\n gBombs.push({ i: 1, j: 1 });\n gBombs.push({ i: 2, j: 3 });\n fillNegsCount(board);\n printBoardToConsole(board);\n return board;\n}", "makeBoard() {\n // Creates and returns an 2D Array\n // [\n // [0, 0, 0],\n // [0, 0, 0],\n // [0, 0, 0],\n // [0, 0, 0],\n // ]\n let rows = new Array(this.height);\n for (let i = 0; i < rows.length; i++) {\n rows[i] = new Array(this.width);\n }\n for (let x = 0; x < rows.length; x++) {\n for (let e = 0; e < rows[x].length; e++) {\n rows[x][e] = 0;\n }\n }\n\n return rows;\n }", "function createBoard() {\n var board = [];\n for (var i = 0; i < gCurrLevel.size; i++) {\n board.push([])\n for (var j = 0; j < gCurrLevel.size; j++) {\n board[i][j] = {\n minesAroundCount: 0,\n isShown: false,\n isMine: false,\n isMarked: false,\n emptyNeighborsCount: null\n };\n }\n }\n return board;\n}", "function generate(){\n\t//loop through every spot in our 2D array and check spots neighbors\n\tfor (let x = 1; x < columns - 1; x++){\n\t\tfor (let y = 1; y < rows - 1; y++){\n\t\t\t//Add up all the states in a 3x3 surronding grid\n\t\t\tlet neighbors = 0;\n\t\t\tfor (let i = -1; i <= 1; i++){\n\t\t\t\tfor (let j = -1; j <= 1; j++) {\n\t\t\t\t\tneighbors += board[x + i][y + j]; \n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A little trick to subtract the currrent cell's state since\n\t\t\t//we added it in the above loop\n\t\t\tneighbors -= board[x][y];\n\t\t\t//Rules of Life\n\t\t\tif ((board[x][y] == 1) && (neighbors < 2)) next[x][y] = 0; //Loneliness\n\t\t\telse if ((board[x][y] == 1) && (neighbors > 3)) next[x][y] = 0; //Overpopulation\n\t\t\telse if ((board[x][y] == 0) && (neighbors == 3)) next[x][y] = 1; //Reproductin\n\t\t\telse next[x][y] = board[x][y]; //Stasis\n\t\t}\n\t}\n\n\t//swap!\n\tlet temp = board;\n\tboard = next;\n\tnext = temp;\n}", "function CreateGame(y, x, nBombs){\n\tif(BoardState != undefined){\n\t\treturn;\n\t}\n\tvar div = document.getElementById(\"minesweeper\");\n\tvar minesweeper = document.createElement(\"TABLE\");\n\twidth = 0;\n\theight = 0;\n\tfor (var i = x - 1; i >= 0; i--) {\n\t\tvar row = document.createElement(\"TR\");\n\t\tfor (var f = y - 1; f >= 0; f--) {\n\t\t\tvar col = document.createElement(\"TD\");\n\t\t\tcol.innerHTML = '<img src=\"images/HiddenSquare.png\" class=\"square\" height=30 width=30 onclick=\"buttonclick(this);\" xVal=\"' + width + '\" yVal= \"' + height + '\" id=\"' + width.toString() + 'h' + height.toString() + 'w\">';\n\t\t\trow.appendChild(col);\n\t\t\twidth++;\n\t\t}\n\t\tminesweeper.appendChild(row);\n\t\theight++;\n\t\twidth = 0;\n\t};\n\tdocument.getElementById(\"minesweeper\").appendChild(minesweeper);\n\tvar flag = document.createElement(\"BUTTON\");\n\tflag.setAttribute(\"onclick\",\"changeFlag();\");\n\tflag.innerHTML = \"Togge Flag\";\n\tdocument.getElementById(\"minesweeper\").appendChild(flag);\n\n\tBoardState = Board(new WyJS.Integer(y), new WyJS.Integer(x));\n\tinitialiseBoard(nBombs);\n}", "createEmptyBoard(rows, cols) {\n\n let theBoard = [];\n\n for (let i = 0; i < rows; i++) {\n\n theBoard.push([]);\n\n for (let j = 0; j < cols; j++) {\n\n theBoard[i][j] = {\n row: i,\n col: j,\n mine: false,\n mineCount: 0,\n revealed: false,\n flag: false\n };\n\n }\n }\n\n return theBoard;\n }", "function buildBoard() {\n let board = [];\n let boardSize = gLevel.curr.SIZE;\n\n for (let i = 0; i < boardSize; i++) {\n board[i] = [];\n for (let j = 0; j < boardSize; j++) {\n board[i][j] = {\n minesAroundCount: null,\n isShown: false,\n isMine: false,\n isMarked: false,\n }\n }\n }\n return board;\n}", "populateBoard() {\n for (let col = 0; col < this.board.getSize(); col++) {\n for (let row = 0; row < this.board.getSize(); row++) {\n // Check the empty candy position (hole), fill with new candy\n if (this.board.getCandyAt(row, col) == null) {\n this.board.addRandomCandy(row, col);\n }\n }\n }\n }", "function makeBoard () {\n // Done TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n //Setting 'board' to empty height x width creates a 2d array\n //that has a height of 6 rows by a width of 7 columns\n //set variable y (columns) to zero; y iterates thru columns until false\n for (let y = 0; y < HEIGHT; y++) {\n //calling board[y] = empty array;\n board[y] = [];\n for (let x = 0; x < WIDTH; x++) {\n //creates an empty/undefined array\n board[y][x] = null;\n }\n }\n}", "populateBoard() {\n // add a bubble at every row, col\n for (let row = 0; row < this.rows; row++) {\n for (let col = 0; col < this.cols; col++) {\n let pos = this.getBubbleLocAt(row, col);\n this.pieces[row][col] = this.drawBubbleAt(pos.x, pos.y, row, col);\n }\n }\n this.pieces.forEach(row => {\n row.forEach(bubble => {\n bubble.getNeighbors();\n });\n });\n }", "function createBoard() {\n let render = (arr)=>{\n for(let i=0;i<ncols;i++){\n arr.push(Math.random()>chance ? false:true)\n }\n }\n let initialBoard =[];\n let solvable = false;\n for(let i=0;i<nrows;i++){\n let arr = []\n render(arr)\n initialBoard.push([...arr])\n }\n while(solvable === false){\n let even = initialBoard.map((row)=>{\n let n = row.reduce((acc,bool)=>{\n return bool ? acc+1:acc\n },0)\n return n\n })\n even.forEach((num,index)=>{\n if(num%2!==0){\n initialBoard[index]=[]\n render(initialBoard[index])\n }\n })\n if(!even.some(num=>num%2!==0)){\n break\n }\n }\n \n // console.log({Board: initialBoard})\n\n return initialBoard;\n }", "function makeBoard() {\n\tfor (let row = 0; row < HEIGHT; row++) {\n\t\tlet c = [];\n\t\tboard.push(c);\n\t\tfor (let col = 0; col < WIDTH; col++) {\n\t\t\tc.push(null);\n\t\t}\n\t}\n}", "function _makeGrid () {\n\tgrid = new Array(8)\n\tfor(let i = 0; i <= grid.length - 1; i++){\n\t\tgrid[i] = new Array(8);\n\t}\n\tgrid[3][4] = new Piece('black');\n\tgrid[4][3] = new Piece('black');\n\tgrid[3][3] = new Piece('white');\n\tgrid[4][4] = new Piece('white');\n\treturn grid;\n}", "function initializeWalls() {\n walls_board = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, WALL, WALL, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n}", "function makeBoard() {\n\t// TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n\tfor (let i = 0; i < HEIGHT; i++) {\n\t\tboard.push([]);\n\t\tfor (let j = 0; j < WIDTH; j++) {\n\t\t\tboard[i].push(null);\n\t\t}\n\t}\n}", "function initializeBoard() {\r\n\tvar tempArray = [];\r\n\r\n\tfor (var x = 0; x < 8; x++) {\r\n\t\ttempArray[x] = [];\r\n\r\n\t\tfor (var y = 0; y < 8; y++) {\r\n\t\t\t//adding black pieces\r\n\t\t\t//pawns\r\n\t\t\tif (x == 1) {\r\n\t\t\t\tblackPieces[y+8].x = x;\r\n\t\t\t\tblackPieces[y+8].y = y;\r\n\t\t\t\ttempArray[x][y] = blackPieces[y+8];\r\n\t\t\t}\r\n\t\t\t//other pieces\r\n\t\t\tif (x == 0) {\r\n\t\t\t\tblackPieces[y].x = x;\r\n\t\t\t\tblackPieces[y].y = y;\r\n\t\t\t\ttempArray[x][y] = blackPieces[y];\r\n\r\n\t\t\t\t//stores the black king\r\n\t\t\t\tif (blackPieces[y].name.substr(0, 4) == 'king') {\r\n\t\t\t\t\tblackKing = blackPieces[y];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//adding white pieces\r\n\t\t\t//pawns\r\n\t\t\tif (x == 6) {\r\n\t\t\t\twhitePieces[y+8].x = x;\r\n\t\t\t\twhitePieces[y+8].y = y;\r\n\t\t\t\ttempArray[x][y] = whitePieces[y+8];\r\n\t\t\t}\r\n\t\t\t//other\r\n\t\t\tif (x == 7) {\r\n\t\t\t\twhitePieces[y].x = x;\r\n\t\t\t\twhitePieces[y].y = y;\r\n\t\t\t\ttempArray[x][y] = whitePieces[y];\r\n\r\n\t\t\t\t//stores the black king\r\n\t\t\t\tif (whitePieces[y].name.substr(0, 4) == 'king') {\r\n\t\t\t\t\twhiteKing = whitePieces[y];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn tempArray;\r\n}", "function buildBoard() {\n var size = gLevel.size\n var board = [];\n for (var i = 0; i < size; i++) {\n var row = [];\n for (let j = 0; j < size; j++) {\n var cell = {\n minesAroundCount: 0,\n isShown: false,\n isMine: false,\n isUsedLife: false,\n isMarked: false,\n }\n row.push(cell)\n }\n board.push(row)\n }\n return board;\n}", "function buildBoard(Rows, Cols) {\n var board = [];\n for (var i = 0; i < Rows; i++) {\n board[i] = [];\n for (var j = 0; j < Cols; j++) {\n board[i][j] = {\n isBomb: false,\n coord: {i, j},\n numOfBombsAround: 0,\n isShown: false,\n isFlaged: false,\n textContent: '',\n };\n }\n }\n return board;\n}", "function getBoard(){\n var size = 8;\n var board = new Array(size);\n for (var i = 0; i < size; i++) {\n board[i] = new Array(size);\n for (var j = 0; j < size; j++)\n board[i][j] = '*';\n }\n createShips(board, size);\n board = flatten(board);\n return board;\n }", "function makeBoard() { // creates in-memory board to track board movements\n for(let y = 0; y < HEIGHT; y++){\n board.push([])\n for(let x = 0; x < WIDTH; x++){\n board[y].push(null)\n }\n }\n}", "function generate() {\n let x_,y_, neighbors;\n // Loop through every spot in our 2D array and check spots neighbors\n for (var x = 0; x < columns; x++) {\n for (var y = 0; y < rows; y++) {\n // Add up all the states in a 3x3 surrounding grid\n neighbors = 0;\n for (var i = -1; i <= 1; i++) {\n for (var j = -1; j <= 1; j++) {\n x_ = (x+i)%columns !== -1 ? (x+i)%columns : columns-1;\n y_ = (y+j)%rows !== -1 ? (y+j)%rows : rows-1;\n neighbors += board[x_][y_];\n }\n }\n\n // A little trick to subtract the current cell's state since\n // we added it in the above loop\n neighbors -= board[x%columns][y%rows];\n // Rules of Life\n if ((board[x][y] == 1) && (neighbors < 2)) next[x][y] = 0; // Loneliness\n else if ((board[x][y] == 1) && (neighbors > 3)) next[x][y] = 0; // Overpopulation\n else if ((board[x][y] == 0) && (neighbors == 3)) next[x][y] = 1; // Reproduction\n else next[x][y] = board[x][y]; // Stasis\n }\n }\n\n // Swap!\n var temp = board;\n board = next;\n next = temp;\n}", "function createBoard() {\r\n for(let i=0;i<width*width;i++)\r\n {\r\n square = document.createElement('div')\r\n square.innerHTML = 0\r\n gridDisplay.appendChild(square)\r\n squares.push(square)\r\n }\r\n generate()\r\n generate()\r\n\r\n\r\n }", "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n //2d array to generate the BOARD H x W\n for (let i = 0; i < HEIGHT; i++) {\n let rows = [];\n for (let j = 0; j < WIDTH; j++) {\n rows.push(undefined);\n }\n BOARD.push(rows);\n } \n console.log(BOARD);\n}", "generateBoard(){\n const { n } = this;\n this.board = Array.from(Array(n)).map(() => Array(n).fill(0));\n }", "function createBoard() {\n for (let i=0; i < width*width; i++) {\n square = document.createElement('div')\n square.innerHTML = 0\n gridDisplay.appendChild(square)\n squares.push(square)\n }\n generate()\n generate()\n }", "function create2DBoard(cols, rows) {\n board.cells = [];\n for(var i = 0; i < cols; i++) {\n for(var j = 0; j < rows; j++) {\n var index = i * rows + j;\n board.cells[index] = [];\n board.cells[index].col = i;\n board.cells[index].row = j;\n board.cells[index].hidden = true;\n if(Math.random() < 0.3) {\n board.cells[index].isMine = true;\n } else {\n board.cells[index].isMine = false;\n } \n } \n }\n return board; \n}", "function makeBoard() {\r\n for (let y = 0; y < HEIGHT; y++) {\r\n board.push(Array.from({ length: WIDTH }));\r\n }\r\n}", "function fillBoard() {\n var x, y, type;\n jewels = [];\n\n for (x = 0; x < cols; x++) {\n jewels[x] = [];\n for (y = 0; y < rows; ++y) {\n type = randomJewel();\n\n // Ensure that no chains are created on the initial board fill\n while ((type === getJewel(x - 1, y) && type === getJewel(x - 2, y)) ||\n (type === getJewel(x, y - 1) && type === getJewel(x, y - 2))) {\n type = randomJewel();\n }\n\n jewels[x][y] = type;\n }\n }\n\n // Recursively fill if the generated board has no moves\n if (!hasMoves()) {\n fillBoard();\n }\n }", "createBoard() \n\t{\n\t\tlet board = [];\n\t\t\n\t\t// MY SOLUTION\n\t\t// while( board.length < 5 )\n\t\t// {\n\t\t// \tconst line = new Array(5);\n\t\t// \tfor( let i = 0; i < line.length; i++ )\n\t\t// \t{\n\t\t// \t\tconst num = this.props.chanceLightStartsOn * (Math.random() * 2);\n\t\t// \t\tconst random = Math.floor( num );\n\t\t// \t\tline[i] = random === 1 ? true : false;\n\t\t// \t}\n\t\t\t\n\t\t// \tboard.push(line);\n\t\t// }\n\n\t\tfor ( let x = 0; x < this.props.numRows; x++ )\n\t\t{\n\t\t\tlet row = [];\n\t\t\tfor ( let y = 0; y < this.props.numColumns; y++ )\n\t\t\t{\n\t\t\t\trow.push(Math.random() < this.props.chanceLightStartsOn)\n\t\t\t}\n\t\t\tboard.push(row);\n\t\t}\n\n\t\treturn board\n\t}", "function createBoard() {\n var board = [\n []\n ];\n\n for (let row = 0; row < 7; row++) {\n let tempArr = [];\n for (let col = 0; col < 7; col++) {\n tempArr[col] = \"_\";\n }\n board[row] = tempArr;\n }\n return board;\n}", "function MakeBoard(board){\n for(var i = 0; i < 3; i++){\n board.push([\"*\", \"*\", \"*\"]);\n }\n return board\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 }", "makeBoard() {\n return new Array(this.height)\n .fill()\n .map(() => new Array(this.width).fill(0));\n }", "makeBoard() {\n let board = [];\n for(let row = 0; row < this.height; row++ ){\n let newRow = [];\n for(let column = 0; column <this.width; column++){\n newRow.push(0);\n }\n board.push(newRow);\n }\n return board;\n }", "function _makeGrid () {\n let grid = new Array(8);\n for (let i = 0; i < grid.length; i++) {\n grid[i] = new Array(8)\n }\n grid[3][4] = new Piece(\"black\");\n grid[4][3] = new Piece(\"black\");\n grid[3][3] = new Piece(\"white\");\n grid[4][4] = new Piece(\"white\");\n return grid;\n}", "function makeBoard() {\n for (let y = 0; y < HEIGHT; y++) {\n board.push(Array.from({ length: WIDTH }));\n }\n makeHtmlBoard();\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 makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n for(i = 0; i < HEIGHT; i++) {\n board.push(new Array(WIDTH).fill(null));\n }\n}", "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n for (let i =0; i < HEIGHT; i++) {\n board[i] = new Array(WIDTH).fill(null);\n }\n}", "function makeBoard() {\n\tfor (let y = 0; y < HEIGHT; y++) {\n\t\tconst row = [];\n\t\tfor (let x = 0; x < WIDTH; x++) {\n\t\t\trow.push(null);\n\t\t}\n\t\tboard.push(row);\n\t}\n}", "function makeBoard() {\n board = [];\n if (WIDTH===0 || HEIGHT===0){\n console.log(\"Invalid dimension provided resetting dimensions to 1\");\n WIDTH = 1;\n HEIGHT = 1;\n }\n for (let x = 0; x < WIDTH; x++){\n board.push([]);\n for (let y = 0; y<HEIGHT; y++){\n board[x].push('E');\n }\n }\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 makeBoard() {\n // set \"board\" to empty HEIGHT x WIDTH matrix array\n for(let i = 0; i < HEIGHT; i++){\n board[i] = [];\n for(let j = 0; j < WIDTH; j++)\n board[i][j] = null;\n }\n}", "function setup() {\n createCanvas(w * 20 + 1, w * 20 + 1); // forms the width and height of the board\n // need to + 1 to draw the right and bottom borders\n\n // calculates number of rows and columns and then round down to nearest whole number\n cols = floor(width/w);\n rows = floor(height/w);\n grid = make2DArray(cols, rows);\n for (var i = 0; i < cols; i++) { // for every column\n for (var j = 0; j < rows; j++) { // for every row\n grid[i][j] = new Cell(i, j, w); // initialise every spot to be a new cell\n }\n }\n \n \n // Options to pick totalMines spots to plant the mines\n var options = []; // new array\n // go thr every spot...\n for (var i = 0; i < cols; i++) {\n for (var j = 0; j < rows; j++) {\n options.push([i, j]); // and adds each spot into option list\n }\n }\n \n\n for (var n = 0; n < totalMines; n ++) { // as long as number of planted mines haven't hit target\n var index = floor(random(options.length));\n // Option has a column and row in it\n var choice = options[index];\n var i = choice[0];\n var j = choice[1];\n // Deletes that spot so it's no longer an option\n options.splice(index, 1);\n grid[i][j].mine = true; // sets the spot as a mine\n }\n for (var i = 0; i < cols; i++) {\n for (var j = 0; j < rows; j++) {\n grid[i][j].countMines();\n }\n }\n\n}", "function resetBoard() {\n board = [];\n $(__BOARD__).children().remove();\n let nbTilesBuilt = 0;\n let arrayTmp = [];\n board.push(arrayTmp);\n let index1D = 0;\n let index2D = -1;\n while(nbTilesBuilt < nbTiles) {\n if(index2D !== 0 && index2D % (nbColumns - 1) === 0) {\n arrayTmp = [];\n board.push(arrayTmp);\n index1D++;\n index2D = 0;\n } else {\n index2D++;\n }\n arrayTmp.push(__BLACK_TILE_CLASS__);\n $(__BOARD__).append(\"<div data-index-1d='\" + index1D + \"' data-index-2d='\" + index2D + \"' class='\" + __BLACK_TILE_CLASS__ +\n \"' style='width:\"+ sizeTile +\"px; height:\"+ sizeTile +\"px;'></div>\");\n nbTilesBuilt++;\n }\n}", "function createBoard() {\n for (let i = 0; i < numSquaresY; i++) {\n board[i] = [];\n for (let j = 0; j < numSquaresX; j++) {\n board[i][j] = new Square(i, j, j * xIncrement, i * yIncrement + headerHeight);\n }\n }\n}", "function boardCreate() {\n let board = [\n [' ', ' ', ' '],\n [' ', ' ', ' '],\n [' ', ' ', ' '],\n ];\n\n return board;\n}", "function create_game_board() {\n var arr = [];\n for (var i = 0; i < 12; i++) {\n arr[i] = [];\n for (var j = 0; j < 12; j++) {\n var arr2 = [];\n arr[i].push(arr2);\n }\n }\n\n for (var i = 0; i < 12; i++) {\n for (var j = 0; j < 12; j++) {\n arr[i][j] = true;\n }\n }\n return arr;\n}", "creatArr(board) {\n //initialize all grids with 0\n for (let i = 0; i < this.boardSize; i++) {\n board[i] = 0;\n }\n //generate two tiles\n this.newTile(board);\n this.newTile(board);\n return board;\n }", "makeBoard() {\n this.board.length = 0;\n for (let y = 0; y < this.HEIGHT; y++) {\n this.board.push(Array.from({ length: this.WIDTH }));\n }\n }", "function createBoard(rows, columns) {\n for (let i = 0; i < rows; i++) {\n board.push([]);\n for (let j = 0; j < columns; j++) {\n if (i === 0 || i === rows - 1 || j === 0 || j === columns - 1) {\n board[i][j] = [\n { type: 'wall', visual: '#', position: { row: i, column: j } },\n ];\n } else {\n board[i][j] = [\n { type: 'grass', visual: '.', position: { row: i, column: j } },\n ];\n }\n }\n }\n}", "function makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n while (board.length < HEIGHT){\n let row = [];\n for (let i = 1; i <= WIDTH; i++){\n row.push(null);\n }\n board.push(row);\n }\n}", "buildGameBoard() {\n // creating 2d array to act as game board\n this.board = [];\n for(var i = 0; i < this.num_rows; i++) {\n this.board[i] = [];\n for(var j = 0; j < this.num_cols; j++) {\n this.board[i][j] = \"*\";\n }\n }\n\n // populating game board\n var mine_placed;\n for(var i = 0; i < this.mine_count; i++) {\n mine_placed = false;\n do {\n var row = Math.floor(Math.random() * this.num_rows);\n var col = Math.floor(Math.random() * this.num_cols);\n if(this.board[row][col] == \"*\"){\n mine_placed = true;\n this.board[row][col] = \"M\";\n }\n } while (!mine_placed);\n }\n\n // generating adjacency counts\n var cur_mines;\n for (var i = 0; i < this.num_rows; i++) {\n for (var j = 0; j < this.num_cols; j++) {\n // if cell is a mine, don't need to generate count for it (duh)\n if (this.board[i][j] != \"M\") {\n cur_mines = 0;\n // go through all adjacent cells.\n for (var k = i-1; k <= i+1; k++) {\n for (var l = j-1; l <= j+1; l++) {\n // check is adjecent cell is within bounds\n if (k >= 0 && l >= 0 && k < this.num_rows && l < this.num_cols) {\n if (this.board[k][l] == \"M\") {\n cur_mines++;\n }\n }\n }\n }\n\n this.board[i][j] = cur_mines;\n }\n }\n }\n }", "makeBoard() {\n this.board = [];\n for (let y = 0; y < this.height; y++) {\n this.board.push(Array.from({ length: this.width }));\n }\n }", "function initBoard(){\n // prepare/add array space for initial 1x5 (row)\n for(i=0;i<5;i++){\n board.push([]);\n // adds \"O\" in each array to make 5x5 (col)\n for(j=0; j<5; j++){\n board[i].push('O');\n } \n }\n console.log();\n console.log(` Welcome to Battleship!`);\n console.log(`We have placed our hidden Battleship in a sea of arrays!`);\n console.log(` Take your guess with a range between 0-4`);\n console.log(` Try and sink us before we sink you! hahaha!`);\n console.log(` You get to have ${turn} turns to guess!`);\n console.log();\n console.log(`Le Sea of Arrays`);\n printBoard();\n console.log();\n}", "makeBoard() {\n // Initialize the board to be an empty array\n this.board = [];\n // For loop to create the board's empty elements using the values of height and width\n for (let y = 0; y < this.height; y++) {\n this.board.push(Array.from({ length: this.width }));\n }\n }", "function _makeGrid () {\n\n let grid=[];\n\n for (let i = 0; i<8;i++){\n let rows = [];\n for( let j=0; j<8; j++){\n rows.push(undefined);\n }\n grid.push(rows);\n }\n\n grid[3][4] = new Piece(\"black\");\n grid[4][3] = new Piece(\"black\");\n grid[3][3] = new Piece(\"white\"); \n grid[4][4] = new Piece(\"white\"); \n\n return grid;\n}", "makeBoard() {\n let rows = this.height;\n let columns = this.width;\n let largerArr = [];\n for(let i = 0; i<rows;i++){\n largerArr.push([]);\n for(let z = 0; z<columns; z++){\n largerArr[i][z] = Math.round(Math.random());\n }\n }\n return largerArr;\n }", "function makeBoard() {\n // DONE - TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n\n board = []\n\n for (let y = 0; y < HEIGHT; y++) {\n let row = []\n for (let x = 0; x < WIDTH; x++) {\n row.push(null)\n }\n board.push(row)\n }\n\n}", "function buildSweeperGrid() {\n\n var gameArea = document.getElementById('game');\n gameArea.innerHTML = \"\";\n\n console.log('---------------[ GENERATING GRID ]---------------');\n\n for (var i = 0; i < Math.sqrt(game.gridSize); i++) {\n var row = document.createElement('div');\n row.classList.add('row');\n row.classList.add('flex');\n console.log('ROW ' + i + \":\");\n for (var j = 0; j < Math.sqrt(game.gridSize); j++) {\n var cell = document.createElement('div');\n cell.id = `cell-${j}-${i}`;\n cell.setAttribute('row', i);\n cell.setAttribute('cell', j);\n cell.classList.add('w-16');\n cell.classList.add('h-16');\n\n\n cell.classList.add('cell');\n cell.classList.add('border');\n cell.classList.add('border-black');\n cell.classList.add('m-0');\n row.appendChild(cell);\n\n console.log(' - Cell ' + j);\n }\n gameArea.appendChild(row);\n }\n console.log('---------------[ GENERATED GRID ]---------------');\n\n}", "function makeModelBoard() {\n for (var i = 0; i < rowCol; i++) {\n for (var j = 0; j < rowCol; j++) {\n board[i].push(0);\n }\n }\n}", "function createBoard() {\r\n // We'll use a for loop to iterate through all the elemtents of the layout array:\r\n for (let i = 0; i < layout.length; i++) {\r\n // For each element we create a square:\r\n const square = document.createElement('div')\r\n // Append the square to our grid:\r\n grid.appendChild(square)\r\n // And push the square to our squares array:\r\n squares.push(square)\r\n\r\n // Now we color each square depending on its number, by adding the corresponding class:\r\n if (layout[i] === 0) {\r\n squares[i].classList.add('pac-dot')\r\n } else if (layout[i] === 1) {\r\n squares[i].classList.add('wall')\r\n } else if (layout[i] === 2) {\r\n squares[i].classList.add('ghost-lair')\r\n } else if (layout[i] === 3) {\r\n squares[i].classList.add('power-pellet')\r\n }\r\n }\r\n}", "_initialiseBoard(level) {\n let rows = level.rows, cols = level.cols;\n \n let board = GenerateGridOfSizeXYWithDefault(\n rows, \n cols, \n {...options.board.defaultCell});\n\n let i = 0, x = -1, y = -1;\n\n while (i < level.mines) {\n x = Math.floor(Math.random() * rows);\n y = Math.floor(Math.random() * cols);\n\n if (!board[x][y].isMine === true) {\n board[x][y] = {...board[x][y], isMine: true};\n board = this._incrementSurroundingCells(x, y, rows, cols, board);\n i++;\n }\n }\n\n return board;\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}", "_createBoard() {\n let map = this.map = this._createHexagonMap();\n\n for (let q in map) {\n for (let r in map[q]) {\n this._createSprite(map[q][r]);\n }\n }\n }", "function setupBoard() {\n var i = 0;\n while (i < rows) {\n boardTable[i] = [columns];\n boardNextTable[i] = [columns];\n i++;\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}", "function buildBoard(size) {\n\tboard = [];\n\tfor (var i = 0; i <= size; i++) {\n\t\tarr = [];\n\t\tfor (var j = 0; j <= i; j++) {\n\t\t\tvar peg = new Peg()\n\t\t\tpeg.setCord([i, j])\n\t\t\tarr.push(peg);\n\t\t}\n\t\tboard.push(arr)\n\t}\n\treturn board;\n}", "function minesweeper (inputGrid) {\n const outputGrid = [];\n for (let row = 0; row < inputGrid.length; row++) {\n\n let rowArray = [];\n for (let col = 0; col < inputGrid[0].length; col++) {\n\n if (inputGrid[row][col] === 1) {\n rowArray.push(9);\n } else {\n let total = 0;\n let neighboringCoordinates = getNeighboringCoordinates(row,col);\n neighboringCoordinates.forEach(cord => {\n total += inputGrid[cord[0]][cord[1]];\n });\n rowArray.push(total);\n }\n\n }\n outputGrid.push(rowArray);\n }\n return outputGrid;\n}", "function wallMaker() {\n\tvar height = mapArrays.length;\n // Because it's a square we only need to check the length of one line.\n var width = mapArrays[0].length;\n var bottomRowY = mapArrays.length-1;\n var lastColumnX = mapArrays[0].length - 1;\n // A little callback function created inside wallMaker so that we don't have to repeat the same 3 commands.\n function waller(wallThis) {\n wallThis.canMove = false;\n wallThis.description = \"A wall\";\n \twallThis.terrainType = \"wall\";\n wallThis.symbol = \"^\";\n wallThis.color = \"wall\";\n // Or whatever symbol we want to set it to.\n }\n // Walls the top row.\n for(var idx = 0; idx < width; idx++) {\n \tvar toWall = mapArrays[0][idx];\n waller(toWall);\n }\n // Walls the bottom row.\n for(var idx = 0; idx < width; idx++) {\n \tvar toWall = mapArrays[bottomRowY][idx];\n waller(toWall);\n }\n // Walls the sides. Ignores the top and bottom rows since they're already done.\n for(var idx = 1; idx < height-1; idx++) {\n \tvar toWall1 = mapArrays[idx][0];\n var toWall2 = mapArrays[idx][lastColumnX];\n waller(toWall1);\n waller(toWall2);\n }\n}", "function genBoard(size) {\n const board = [];\n for (let x = 0; x < size; x += 1) {\n const row = [];\n for (let y = 0; y < size; y += 1) {\n row.push(0);\n }\n board.push(row);\n }\n return board;\n}", "function makePuzzle() {\n fillBox(0, 0);\n fillBox(3, 3);\n fillBox(6, 6);\n fillRemaining(0, 3);\n const mappedArray = [];\n let i = 0;\n let j = 0;\n while (i < 9) {\n while (j < 9) {\n mappedArray.push(puzzleArray[i][j]);\n j++\n }\n j = 0;\n i++;\n }\n return mappedArray;\n}", "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 makeBoard() {\n // TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n // push the amount of rows (arrays) into the larger array\n for(let y = 0; y < HEIGHT; y++) {\n board.push([])\n // push null amount of columns as in width\n for(let x = 0; x < WIDTH; x++) {\n board[y].push(null)\n }\n }\n return board;\n}", "function createBoard() {\n for (let i = 0; i < width * width; i++) {\n //every time it loops we want to create a div\n //using .createElement\n const square = document.createElement('div');\n //we want to make the divs draggable. so we just use the\n //setAttribute function and set draggable to true\n square.setAttribute('draggable', true);\n //we also want to use setAttribute to give each square a unique ID\n square.setAttribute('id', i);\n //set a random number based on the candy colors length and a whole number\n let randomColor = Math.floor(Math.random() * candyColors.length);\n //set that color background for the square at this index\n square.style.backgroundImage = candyColors[randomColor];\n //next we add that div to the grid with appendChild\n grid.appendChild(square);\n //we also want to store these squares into an array\n squares.push(square);\n }\n }" ]
[ "0.7574005", "0.7389867", "0.7277623", "0.71575075", "0.7149459", "0.71318465", "0.7103886", "0.7102805", "0.709265", "0.7091244", "0.70705867", "0.70338184", "0.7013336", "0.7012744", "0.7009111", "0.69877744", "0.6975426", "0.6965226", "0.696433", "0.69549036", "0.6931066", "0.6922477", "0.69203746", "0.68996495", "0.68992496", "0.68906003", "0.68894285", "0.6886972", "0.68860745", "0.68807137", "0.6876904", "0.6873596", "0.6871277", "0.6860845", "0.6860442", "0.68598944", "0.6855983", "0.6851847", "0.6851735", "0.68313426", "0.6831236", "0.68250823", "0.68208355", "0.6819381", "0.6818385", "0.6811226", "0.67992115", "0.678016", "0.67678684", "0.67630625", "0.6756709", "0.6749974", "0.67496306", "0.67485297", "0.67470694", "0.67445266", "0.6744201", "0.6738597", "0.67380357", "0.6737802", "0.67341626", "0.6732627", "0.67304873", "0.67296636", "0.67228264", "0.6719905", "0.671843", "0.671296", "0.6708661", "0.6704182", "0.6694371", "0.6688887", "0.6685209", "0.6679925", "0.66788685", "0.6659468", "0.6647309", "0.66459", "0.664559", "0.6636258", "0.66360104", "0.6617036", "0.66167605", "0.6614592", "0.6614378", "0.66088426", "0.6590399", "0.6590294", "0.65875643", "0.6577699", "0.6576592", "0.6571085", "0.65704906", "0.6569813", "0.65464354", "0.654503", "0.6538491", "0.6534902", "0.6525099", "0.6516181" ]
0.7624286
0
Shuffle array, so it's like pulling out of a "hat" Credit:
function fisherYates (myArray) { var i = myArray.length, j, tempi, tempj; if (i === 0) { return; } while (--i) { j = Math.floor(Math.random() * (i + 1)); tempi = myArray[i]; tempj = myArray[j]; myArray[i] = tempj; myArray[j] = tempi; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shuffle (array) {\r\n var i = 0\r\n , j = 0\r\n , temp = null\r\n\r\n for (i = array.length - 1; i > 0; i -= 1) {\r\n j = Math.floor(Math.random() * (i + 1))\r\n temp = array[i]\r\n array[i] = array[j]\r\n array[j] = temp\r\n }\r\n }", "function shuffle(arr){\n\t\t\t\t\t\t for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);\n\t\t\t\t\t\t return arr;\n\t\t\t\t\t\t}", "function shuffleMe(array) {\n\n\t\tvar currentIndex = array.length,\n\t\t\ttemporaryValue, randomIndex;\n\n\t\twhile (0 !== currentIndex) {\n\n\t\t\trandomIndex = Math.floor(Math.random() * currentIndex);\n\t\t\tcurrentIndex -= 1;\n\n\t\t\ttemporaryValue = array[currentIndex];\n\t\t\tarray[currentIndex] = array[randomIndex];\n\t\t\tarray[randomIndex] = temporaryValue;\n\t\t}\n\n\t\treturn array;\n\t}", "shuffle(a) {\r\n let j, x, i\r\n for (i = a.length - 1; i > 0; i--) {\r\n j = Math.floor(Math.random() * (i + 1))\r\n x = a[i]\r\n a[i] = a[j]\r\n a[j] = x\r\n }\r\n\r\n return a\r\n }", "function shuffle(array) {\n//randomizes the order of the figures in the array\n let currentIndex = array.length, randomIndex;\n while (0 !== currentIndex) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex--;\n [array[currentIndex], array[randomIndex]] = [\n array[randomIndex], array[currentIndex]];\n }\n return array;\n}", "function shuffleArray(array) {\n //used in generteHand() to shuffle the deck before drawing the hand\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "static shuffle(array) {\n var currentIndex = array.length, temporaryValue, randomIndex;\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n return array;\n }", "function shuffle(array) {\n for(var counter=array.length-1; counter > 0; counter--) {\n var index = Math.floor(Math.random() * counter);\n var temp = array[counter];\n array[counter] = array[index];\n array[index] = temp;\n }\n return array;\n }", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * i);\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n }", "function shuffle(a) {\n let x;\n let y;\n for (let i = a.length - 1; i > 0; i--) {\n x = Math.floor(Math.random() * (i + 1));\n y = a[i];\n a[i] = a[x];\n a[x] = y;\n }\n shuffleDeck = a;\n}", "function shuffle(array) {\n var j, x, i;\n for (i = array.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = array[i];\n array[i] = array[j];\n array[j] = x;\n }\n return array;\n}", "shuffle()\n\t{\n\t\tlet temp;\n\t\tlet arraySpot;\n\t\tlet arraySpot2;\n\t\tfor (let x = 0; x < 1000000; x++)\n\t\t{\n\t\t\tarraySpot = Math.floor(Math.random() * this.numCards);\n\t\t\tarraySpot2 = Math.floor(Math.random() * this.numCards);\n\n\t\t\ttemp = this.cards[arraySpot];\n\t\t\tthis.cards[arraySpot] = this.cards[arraySpot2];\n\t\t\tthis.cards[arraySpot2] = temp;\n\t\t}\n\t}", "function shuffle(array) {\n\tfor (let i = array.length - 1; i > 0; i--) {\n\t let j = Math.floor(Math.random() * (i + 1));\n\t [array[i], array[j]] = [array[j], array[i]];\n\t}\n}", "shuffleCards(a) {\n for(let i=a.length-1;i>0;i--){\n const j = Math.floor(Math.random() * (i + 1));\n [a[i], a[j]] = [a[j], a[i]];\n }\n }", "function shuffle(a) {\n\t\t\t\tvar j, x, i;\n\t\t\t\tfor (i = a.length; i; i -= 1) {\n\t\t\t\t\tj = Math.floor(Math.random() * i);\n\t\t\t\t\tx = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[j];\n\t\t\t\t\ta[j] = x;\n\t\t\t\t}\n\t\t\t}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n }", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n \n }\n }", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n }", "function shuffleDeck(array) {\r\n for (var i = array.length - 1; i>0; i--) {\r\n var j = Math.floor(Math.random() * (i+1));\r\n var temp = array[i];\r\n array[i] = array[j];\r\n array[j] = temp;\r\n }\r\n return array;\r\n }", "shuffle(a) {\n let j, x, i;\n for (let i = a.length; i; i--) {\n let j = Math.floor(Math.random() * i);\n [a[i - 1], a[j]] = [a[j], a[i - 1]];\n }\n return a;\n }", "function shuffle(a){\n var j, x, i;\n for (let i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(ary) {\n var i = ary.length;\n\n while(i > 0) {\n var j = Random.integerWithinRange(0, --i);\n var tmp = ary[i];\n ary[i] = ary[j];\n ary[j] = tmp;\n }\n\n return ary;\n }", "function shuffle(array) {\r\n for (let i = array.length - 1; i > 0; i--) {\r\n const j = Math.floor(Math.random() * (i + 1));\r\n [array[i], array[j]] = [array[j], array[i]];\r\n }\r\n return array;\r\n}", "function shuffle(array) { \n for (let i = 0; i < 3; i++) {\n tempArr.push(array.splice(Math.floor(Math.random() * array.length), 1));\n } \n }", "function shuffle(array){\n\t\t\t\t\t\t\t\t \tvar currentIndex = array.length;\n\t\t\t\t\t\t\t\t \tvar temporaryValue;\n\t\t\t\t\t\t\t\t \t//var randIndex;\n\n\t\t\t\t\t\t\t\t \twhile (currentIndex > 0){\n\t\t\t\t\t\t\t\t \t\trandomIndex = Math.floor(Math.random() * currentIndex);\n\t\t\t\t\t\t\t\t \t\tcurrentIndex --;\n\n\t\t\t\t\t\t\t\t \t\ttemporaryValue = array[currentIndex];\n\t\t\t\t\t\t\t\t \t\tarray[currentIndex] = array[randomIndex];\n\t\t\t\t\t\t\t\t \t\tarray[randomIndex] = temporaryValue;\n\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t \t\treturn array;\n}", "function shuffleTRIALS(array) {\n for (var i = array.length - 1; i > 1; i--) {\n var j = 1 + Math.floor(Math.random() * (i));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(array) {\n\t\n var cardsArrayLength = array.length, cardHolder, index;\n\n while (cardsArrayLength) {\n\n index = Math.floor(Math.random() * cardsArrayLength--);\n\n cardHolder = array[cardsArrayLength];\n array[cardsArrayLength] = array[index];\n array[index] = cardHolder;\n }\n\n return array;\n\n}", "function shuffle(array) {\n var i, j, t;\n for (i = array.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i\n t = array[i]; array[i] = array[j]; array[j] = t;\n }\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "function shuffle(array) {\r\n for (let i = array.length - 1; i > 0; i--) {\r\n let j = Math.floor(Math.random() * (i + 1));\r\n [array[i], array[j]] = [array[j], array[i]];\r\n }\r\n}", "function shuffleArray(array) {\r\n\t for (let i = array.length - 1; i > 0; i--) {\r\n\t let j = Math.floor(Math.random() * (i + 1));\r\n\t let temp = array[i];\r\n\t array[i] = array[j];\r\n\t array[j] = temp;\r\n\t }\r\n }", "shuffle() {\n // TODO\n }", "function shuffle (array) {\r\n var i = 0\r\n , j = 0\r\n , temp = null\r\n\r\n for (i = array.length - 1; i > 0; i -= 1) {\r\n j = Math.floor(Math.random() * (i + 1))\r\n temp = array[i]\r\n array[i] = array[j]\r\n array[j] = temp\r\n }\r\n}", "function shuffle(array) { \n for (let i=array.length-1; i>0; i--) {\n let j = Math.floor(Math.random() * (i+1));\n [array[i], array[j]] = [array[j], array[i]]; // destructing to swap 2 elements\n }\n return array;\n}", "function shuffle (arr) {\n var arrCopy = arr.slice();\n shuffleInplace(arrCopy);\n return arrCopy;\n }", "shuffleArray(array) {\n for(var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "function shuffle(a) {\n for (let i = a.length; i; i--) {\n let j = Math.floor(Math.random() * i);\n [a[i - 1], a[j]] = [a[j], a[i - 1]];\n }\n }", "shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1)); // случайный индекс от 0 до i\n\n [array[i], array[j]] = [array[j], array[i]];\n }\n }", "function ShuffleArray(array) {\r\n for (var i = 0 ; i < array.length ; i++) {\r\n var j = Math.floor(Math.random() * (i + 1));\r\n var temp = array[i];\r\n array[i] = array[j];\r\n array[j] = temp;\r\n }\r\n return array;\r\n }", "function shuffle(arr) {\r\n\tfor (let i = arr.length - 1; i > 0; i--) {\r\n\t\tlet j = Math.floor(Math.random() * (i + 1));\r\n\t\t// Use of array destructuring \r\n\t\t[ arr[i], arr[j] ] = [ arr[j], arr[i] ];\r\n\t}\r\n\treturn arr;\r\n}", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "shuffle(a, rng) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(rng() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "function shuffle(_array) {\n // geht über das _array über und wechselt den Eintrag an Position i mit einem anderen zufälligen Eintrag im array\n for (let i = 0; i < _array.length; i++) {\n // der Eintrag an Position i wird zwischen gespeichert\n let tmp = _array[i];\n // randomIndex = random Position im _array, wird mit dem Wert an der Stelle i vertauscht ||Beispiel: Math.random() = 0,99; _array.length = 8 --> 0,99 * 8 = 7,92 --> Math.floor() (abrunden) --> 7 \n let randomIndex = Math.floor(Math.random() * _array.length);\n // Beispiel || warum wird das gemacht? Um die urls zu mischen\n // tmp bleibt immer 4\n // _array[i]: 4, _array[randomIndex]: 9\n // = _array[i]: 9, _array[randomIndex]: 9\n // _array[randomIndex]: 4, _array[i]: 9\n _array[i] = _array[randomIndex];\n _array[randomIndex] = tmp;\n }\n }", "function shuffle(a) {\n\tfor (let i = a.length; i; i--) {\n\t\tlet j = Math.floor(Math.random() * i);\n\t\t[a[i - 1], a[j]] = [a[j], a[i - 1]];\n\t}\n}", "function shuffle(a) {\n\tfor (let i = a.length; i; i--) {\n\t\tlet j = Math.floor(Math.random() * i);\n\t\t[a[i - 1], a[j]] = [a[j], a[i - 1]];\n\t}\n}", "function shuffle(a) {\n\tfor (let i = a.length; i; i--) {\n\t\tlet j = Math.floor(Math.random() * i);\n\t\t[a[i - 1], a[j]] = [a[j], a[i - 1]];\n\t}\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n}", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(srandom() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(array) {\n\n\tlet currIndex = array.length;\n\tlet tempVal, randomIndex;\n\n\twhile (currIndex !== 0) {\n\n\t\trandomIndex = Math.floor(Math.random() * currIndex);\n\t\tcurrIndex -= 1;\n\n\t\ttempVal = array[currIndex];\n\t\tarray[currIndex] = array[randomIndex];\n\t\tarray[randomIndex] = tempVal;\n\t}\n\n\treturn array;\n}", "Shuffle(theArray) {\n for (var i = theArray.length - 1; i > 0; i--) { // i counts down from the end of the array\n var j = Math.floor(Math.random() * (i + 1)); // j is a random number between 0 and the current value of i\n var temp = theArray[i]; // store the value at [i] in a temp variable\n theArray[i] = theArray[j]; // put the value at [j] (our random number) into [i]\n theArray[j] = temp; // put the value in temp (originally at [i]) into [j]\n }\n }", "function shuffle(a) {\n var j, x, i;\n for (i = a.length; i; i--) {\n j = ~~(Math.random() * i);\n x = a[i - 1];\n a[i - 1] = a[j];\n a[j] = x;\n }\n}", "function shuffle(arr) {\n var j, x, i;\n for (i = arr.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = arr[i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i)\n const temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n}", "function shuffleDeck(array) {\n\n var i, j, temp;\n for (i = array.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(array) {\n var i = 0 , j = 0 , temp = null;\n\n for (i = array.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1));\n temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "function shuffleArray( array ) { // eslint-disable-line no-inner-declarations\n for ( let i = array.length - 1; i > 0; i-- ) {\n const j = Math.floor( Math.random() * ( i + 1 ) );\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n }", "function shuffleArray(a) {\n\tvar j, x, i;\n\tfor(i = a.length; i; i--) {\n\t\tj = Math.floor(Math.random() * i);\n\t\tx = a[i - 1];\n\t\ta[i - 1] = a[j];\n\t\ta[j] = x;\n\t}\n}", "function shuffle(array) {\n\t\tvar random = array.length,\n\t\t\ttemp,\n\t\t\tindexs;\n\t\twhile (random) {\n\t\t\tindex = Math.floor(Math.random() * random--);\n\t\t\ttemp = array[random];\n\t\t\tarray[random] = array[index];\n\t\t\tarray[index] = temp;\n\t\t}\n\t\treturn array;\n\t}", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}", "function shuffle (array) {\n \n var currentIndex = array.length;\n var temporaryValue;\n var randomIndex;\n \n while (0 !== currentIndex) {\n \n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n \n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n \n }\n \n return array;\n \n}", "shuffleArray(array) {\n\t\tfor (var i = array.length - 1; i > 0; i--) {\n\t\t\tvar j = Math.floor(Math.random() * (i + 1));\n\t\t\tvar temp = array[i];\n\t\t\tarray[i] = array[j];\n\t\t\tarray[j] = temp;\n\t\t}\n\t}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n let temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(array) {\n\tfor (var i = array.length-1; i > 0; i--) {\n\t\tvar rand = Math.floor(Math.random() * (i + 1));\n\t\tvar temp = array[i];\n\t\tarray[i] = array[rand];\n\t\tarray[rand] = temp;\n\t}\n\treturn array;\n}", "function shuffle(array) {\n var currentIndex = array.length, temporaryValue, randomIndex;\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n return array;\n }", "static shuffleArray (array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n\n return array;\n }", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "function shuffleArray(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n }", "randomShuffle() {\n const shuffled = [];\n const unshuffled = this.cards.slice();\n\n while (unshuffled.length > 0) {\n const randomCard = Math.floor(Math.random() * unshuffled.length);\n shuffled.push(unshuffled.splice(randomCard, 1)[0]);\n }\n\n this.cards = shuffled;\n }", "function shuffle( arr )\n{\n var pos, tmp;\n\t\n for( var i = 0; i < arr.length; i++ )\n {\n pos = Math.round( Math.random() * ( arr.length - 1 ) );\n tmp = arr[pos];\n arr[pos] = arr[i];\n arr[i] = tmp;\n }\n return arr;\n}", "function shuffle(array) {\n let result = array.map(el => el);\n let counter = result.length;\n\n while (counter > 0) {\n let index = Math.floor(Math.random() * counter);\n counter--;\n\n let temp = result[counter];\n result[counter] = result[index];\n result[index] = temp;\n }\n\n return result;\n}", "function shuffle(array){\n let len = array.length - 1;\n for(let i = len; i > 0; i--) {\n const j = Math.floor(Math.random() * i)\n const temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n return array;\n}", "function shuffle(array) {\n var currentIndex = array.length, temporaryValue, randomIndex;\n\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n\n return array;\n }", "function shuffle(input) {\r\n let array = [...input];\r\n\r\n let count = array.length;\r\n let randomnumber;\r\n let temp;\r\n while (count) {\r\n randomnumber = Math.random() * count-- | 0;\r\n temp = array[count];\r\n array[count] = array[randomnumber];\r\n array[randomnumber] = temp;\r\n }\r\n\r\n return array;\r\n }", "function shuffle(arr) {\n var j, x, i;\n for (i = arr.length; i; i--) {\n j = Math.floor(Math.random() * i);\n x = arr[i - 1];\n arr[i - 1] = arr[j];\n arr[j] = x;\n }\n}", "function shuffle(array) {\n var currentIndex = array.length, temporaryValue, randomIndex;\n\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n console.log(\"shuffled\");\n return array;\n }", "function shuffle(array) {\n var currentIndex = array.length,\n temporaryValue, randomIndex;\n\n while (currentIndex !== 0) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n return array;\n}", "shuffle(arr) {\n let c = arr.length;\n while (c > 0) {\n let index = Math.floor(Math.random() * c);\n c--;\n let temp = arr[c];\n arr[c] = arr[index];\n arr[index] = temp;\n }\n }", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n}", "function shuffle(a) {\n for (let i = a.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [a[i], a[j]] = [a[j], a[i]];\n }\n }", "function shuffle(array) {\r\n array.sort(() => Math.random() - 0.5);\r\n }", "function shuffle(array) {\n\tarray.sort(function() { return 0.5 - Math.random() });\n}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(array) {\n for (var i = array.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n return array;\n}", "function shuffle(a){for(var c,d,b=a.length;b;)d=Math.floor(Math.random()*b--),c=a[b],a[b]=a[d],a[d]=c;return a}", "shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n }", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n}", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n}", "function shuffle(a) {\n var j, x, i;\n for (i = a.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * (i + 1));\n x = a[i];\n a[i] = a[j];\n a[j] = x;\n }\n return a;\n}" ]
[ "0.7850486", "0.7824968", "0.78068966", "0.77906704", "0.77783275", "0.7754589", "0.7752481", "0.77511865", "0.7737907", "0.77328783", "0.77244127", "0.7723962", "0.77229434", "0.77190626", "0.77164876", "0.77100706", "0.7707687", "0.7700004", "0.76967853", "0.7683549", "0.7676585", "0.76762086", "0.7668944", "0.76676714", "0.7662835", "0.76625085", "0.7658318", "0.7655266", "0.7654729", "0.7651451", "0.7647302", "0.7645986", "0.7639513", "0.76392466", "0.7636379", "0.7628936", "0.7626768", "0.76266867", "0.762658", "0.7625134", "0.76198375", "0.76175654", "0.7616781", "0.7615747", "0.7613681", "0.7613235", "0.7613235", "0.7613235", "0.7611806", "0.7611806", "0.7611806", "0.76111376", "0.7610933", "0.7610032", "0.7608135", "0.76063716", "0.76028883", "0.76001656", "0.7598057", "0.7598057", "0.75979763", "0.75974345", "0.75963473", "0.7591008", "0.7589152", "0.75876504", "0.75875974", "0.75821704", "0.7582", "0.7581522", "0.7581522", "0.75812835", "0.7580876", "0.7579221", "0.757773", "0.7573936", "0.75739264", "0.75739264", "0.7572098", "0.757199", "0.7571185", "0.7571018", "0.75704134", "0.7567567", "0.75608075", "0.7560675", "0.7556521", "0.7552103", "0.75512946", "0.75512946", "0.7549389", "0.7547479", "0.75466174", "0.7546343", "0.7546343", "0.7546343", "0.7544848", "0.75428045", "0.7542798", "0.7541223", "0.7541223" ]
0.0
-1
Add array's data to the board Here I use a (lines+2)x(collumns+2) board with valid entries [1..lines][1..collumns]. This makes it easier to use tilebased functions without corner verifications.
function makeBoard(myArray) { var l, c, count; // Empty board board = []; for (l = 0; l < lines+2; l++) { board[l] = []; for (c = 0; c < collumns+2; c++) { board[l][c] = 0; } } // Place mines in board (only valid positions) count = 0; for (l = 1; l <= lines; l++) { for (c = 1; c <= collumns; c++) { if (myArray[count] === 1) { // Places bomb (-1) in given position, and increases count on neighboring cells board[l][c] = -1; increaseTile(l-1, c-1); increaseTile(l-1, c ); increaseTile(l-1, c+1); increaseTile(l, c-1); increaseTile(l, c+1); increaseTile(l+1, c-1); increaseTile(l+1, c ); increaseTile(l+1, c+1); } count++; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayBuild(){\n\t/*\n\t * evtl moechte man in einer spaeteren Version manuell ein Array definieren, welches eine groessere Map\n\t * beherbergen kann als das canvas, deswegen gibt es diese beiden Variablen, welche in erster Version\n\t * lediglich mit der Dimension des Standard Arrays belegt werden.\n\t */\n\tvar arrayColumns;\n\tvar arrayRows;\n\n\n\t// In diesem Block finden die Berechnungen statt, welche die Dimension des Spielfeldes berechnen sollen.\n\t// In der ersten Version des SPiels soll sich das Spielfeld aus der Größe des Canvas ableiten.\n\t// In spaeteren Versionen soll das Spielfeld auch groesser gewählt werden können.\n\t{\n\t\t// Die Dimension des Arrays leitet sich aus der Anzahl der Hexatiles in einer Zeile und der Anzahl der Hexatiles in\n\t\t// einer Spalte ab.\n\t\tarrayDimensionLine = cellsInLine + (Math.round(cellsInColumn / 2) - 1);\n\t\tarrayDimensionColumn = arrayDimensionLine;\n\t\t// Bei dieser Berechnungsart ist die Matrix quadratisch und deswegen gibt es genausoviele Spalten wie Zeilen\n\t\tarrayRows = arrayDimensionLine;\n\t\tarrayColumns = arrayDimensionColumn;\n\t}\n\n\t// An dieser Stelle wird das Spielfeld als ein Array mit der berechneten Größe definiert\n\tgameField = new Array(arrayRows);\n\t// Die Anzahl der existierenden Minen zurücksetzen\n\texsistingMines = 0;\n\t// Dann wird jedes Feld des Arrays durchlaufen\n\tfor(var i = 0; i < arrayRows; i++ ){\n\t\t// und ebenfalls als Array der berechneten Größe definiert\n\t\tgameField[i] = new Array(arrayColumns);\n\t\t// Anschließend werden also alle Spalten der eben erzeugten Zeile durchlaufen \n\t\tfor(var j = 0; j < arrayColumns; j++){\n\t\t\t// Und geprüft, ob die entsprechenden Zelle mit einem Hexatile versehen werden muss.\n\t\t\tif(hexatileOnMap(i,j)) {\n\t\t\t\t// Wenn ja, dann wird ein Hexatile an der entsprechenden Zelle erzeugt und mit \n\t\t\t\t// Koordinaten versehen, welche sich von den Original Koordinaten unterscheiden,\n\t\t\t\t// jedoch notwendig sind, damit dich die hexatiles resourcenschonend selbst \n\t\t\t\t// zeichnen und verwalten können.\n\t\t\t\tgameField[i][j] = new Hexatile(i - (cellsInLine - 1),j);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t{// Die Mienen erzeugen\n\t\t// berechnen, wieviele Mienen erzeugt werden müssen\n\t\tminesToGo = ((cellsInLine * cellsInColumn) * difficulty) / 100;\n\t\t\n\t\t// solange noch Mienen erzeugt werden müssen..\n\t\twhile (minesToGo > 0) {\n\t\t\t// ...zufällig eine Zeile ermitteln,...\n\t\t\tline = Math.round(Math.random() * (arrayRows));\n\t\t\t// ...zufällig eine Spalte ermitteln...\n\t\t\tcolumn = Math.round(Math.random() * (arrayColumns));\n\t\t\t\n\t\t\t// ...und prüfen, ob die so ermittelte Zelle auf dem Spielfeld liegt und noch keine Miene ist.\n\t\t\tif (hexatileOnMap(line, column) && !gameField[line][column].isMine) {\n\t\t\t\t// Die Zelle zu einer Miene machen\n\t\t\t\tgameField[line][column].isMine = true;\n\t\t\t\t// Die Anzahl der zu produzierenden Mienen herunterzählen\n\t\t\t\tminesToGo--;\n\t\t\t\t// Die Anzahl der exsistierenden Mienen hochzählen\n\t\t\t\texsistingMines++;\n\t\t\t}\n\t\t}\n\t}\n\n}", "function drawBoard() {\nvar table = document.createElement(\"table\");\nfor (var i = 0; i < arr.length; i++) { \n var row = document.createElement('tr'); \n for (var j = 0; j < arr[i].length; j++) { \n var col = document.createElement('td'); \n if (j % 2 && i % 2) { //identify gem cells\n arr[0].push(col); //HELP --> need to push into array while retaining table structure\n col.innerHTML = gemChar;\n col.className = \"gem\";\n }\n else if (j % 2 || i%2) { //identify alarm cells\n col.className = \"alarm\";\n arr.push(col);\n }\n row.appendChild(col);\n }\n table.appendChild(row);\n}\ndocument.body.appendChild(table);\n\n//display in this div\nlet divContainer = document.getElementById(\"game\");\ndivContainer.innerHTML = \"\";\ndivContainer.appendChild(table);\n}", "function makeBoard() {\n \n // loops through starting at Y grid position 0-0,pushing to the board array each coordinate for x at y, 6X7\n for (let y = 0; y < HEIGHT; y++) {\n board.push(Array.from({length: WIDTH}));\n }\n}", "function populateArrayWithValues() {\n for (let i = 0; i < gameSize; i++) {\n let line = [gameSize];\n for (let j = 0; j < gameSize; j++) {\n line[j] = new Cell(i, j, \"\");\n }\n gameField[i] = line;\n }\n}", "function attachDataToCells(array) {\n let categoryIndex = 0;\n let clueIndex = 0;\n for (let i = 0; i <= 29; i++) {\n $(`#${i}`).data(array[categoryIndex].clues[clueIndex]);\n categoryIndex++;\n if (categoryIndex >= 6) {\n categoryIndex = 0;\n clueIndex++;\n }\n // if (clueIndex >= 10) {\n // clueIndex = 9;\n // }\n }\n}", "function buildArrays() {\n var xPos = 124;\n var yPos = 153;\n\n rowOne.push(new Point(59, 153));\n rowOne.push(new Point(76, 153));\n\n\n rowTwo.push(new Point(59, 199));\n rowTwo.push(new Point(76, 199));\n\n\n rowThree.push(new Point(59, 248));\n rowThree.push(new Point(76, 248));\n\n\n for (var i = 1; i <= 35; i++) {\n rowOne.push(new Point(xPos, yPos));\n rowTwo.push(new Point(xPos, yPos + 46));\n rowThree.push(new Point(xPos, yPos + 46 + 49));\n xPos += 16.45;\n if (i % 5 == 0) {\n xPos += 24;\n }\n\n }\n\n rowOne.push(new Point(886, 158.5));\n rowOne.push(new Point(942, 208.5));\n rowOne.push(new Point(965.5, 284));\n rowOne.push(new Point(948.5, 359));\n rowOne.push(new Point(896.5, 417.5));\n\n rowTwo.push(new Point(868.5, 209));\n rowTwo.push(new Point(905, 240.5));\n rowTwo.push(new Point(916.5, 284.5));\n rowTwo.push(new Point(907, 327.5));\n rowTwo.push(new Point(879, 366));\n\n rowThree.push(new Point(854, 257));\n rowThree.push(new Point(866, 270));\n rowThree.push(new Point(869.5, 287));\n rowThree.push(new Point(867.5, 305));\n rowThree.push(new Point(860, 319.5));\n\n\n xPos -= 35;\n yPos = 429;\n\n for (var n = 1; n <= 35; n++) {\n rowOne.push(new Point(xPos, yPos));\n rowTwo.push(new Point(xPos, yPos - 46));\n rowThree.push(new Point(xPos, yPos - 46 - 47));\n xPos -= 16.8;\n if (n % 5 == 0) {\n xPos -= 9.9;\n }\n\n }\n\n rowOne.push(new Point(169.5, 441.5));\n rowOne.push(new Point(159.5, 457.5));\n rowOne.push(new Point(155.5, 474));\n rowOne.push(new Point(158.5, 492));\n rowOne.push(new Point(170.5, 506.5));\n\n rowTwo.push(new Point(156.5, 384));\n rowTwo.push(new Point(121, 419));\n rowTwo.push(new Point(104, 471));\n rowTwo.push(new Point(117.5, 521.5));\n rowTwo.push(new Point(156.5, 555));\n\n rowThree.push(new Point(142.5, 338));\n rowThree.push(new Point(77.5, 393.5));\n rowThree.push(new Point(58.5, 469.5));\n rowThree.push(new Point(79, 548));\n rowThree.push(new Point(139, 605));\n\n xPos += 24;\n yPos = 517.5;\n\n for (var m = 1; m <= 40; m++) {\n rowOne.push(new Point(xPos, yPos));\n rowTwo.push(new Point(xPos, yPos + 46));\n rowThree.push(new Point(xPos, yPos + 46 + 49));\n xPos += 16.5;\n if (m % 5 == 0) {\n xPos += 10.8;\n }\n\n }\n\n rowOne.push(new Point(970.5, 561.5));\n\n rowTwo.push(new Point(970.5, 561.5));\n\n rowThree.push(new Point(970.5, 561.5));\n}", "function drawGrid(array) {\n const numCols = array[0].length;\n const numRows = array.length;\n for (let row = 0; row < numRows; row++) {\n for (let col = 0; col < numCols; col++) {\n const tile = array[row][col];\n const element = cells[row][col];\n\n // ** can you figure our how to get rid of this switch? Maybe another enumeration, of the tile CSS classes? **\n switch (tile) {\n case worldTile.FLOOR:\n element.classList.add(\"floor\")\n break;\n\n case worldTile.WALL:\n element.classList.add(\"wall\");\n break;\n\n case worldTile.LOCKED:\n element.classList.add(\"locked\");\n break;\n\n case worldTile.END:\n element.classList.add(\"end\");\n break;\n\n case worldTile.GROUND:\n element.classList.add(\"ground\");\n break;\n }\n }\n }\n}", "function AddToArray(array, data, maxLenght)\n{\n\n array.push(data);\n\n if(array.length > maxLenght)\n {\n for(var i = 1; i < array.length - 1; i++)\n {\n for(var j = 0; j < array[i].length; j++)\n {\n array[i][j] = array[i + 1][j]\n }\n }\n array.pop()\n }\n}", "function main() {\n var board = [];\n for (i = 0; i < 9; i++) {\n var line = [];\n for (j = 1; j <= 9; j++) {\n line.push(0);\n }\n board.push(line);\n }\n currentGrid = board;\n draw();\n}", "function createBoardArr(){\n for(var i = tileAmt; i >= 1; i--){\n for(var j = 1; j <= tileAmt; j++){\n const tmpObj = new Object;\n tmpObj.val = \"tile\";\n tmpObj.empty = true;\n tmpObj.x = i;\n tmpObj.y = String.fromCharCode(64+j);\n tmpObj.tileLocation = tmpObj.x + tmpObj.y;\n if(i % 2 == 0){\n if(j % 2 == 0){ tmpObj.color = \"dark\";}\n else{ tmpObj.color = \"light\";}\n }else{\n if(j % 2 !== 0){ tmpObj.color = \"dark\";}\n else{ tmpObj.color = \"light\";}\n }\n if(tmpObj.color == \"dark\"){tmpObj.legalPlay = true;}\n else{tmpObj.legalPlay = false;}\n boardArr.push(tmpObj);\n }\n }\n}", "function makeBoard() {\n let tempArray = []\n for(let i = 0; i < WIDTH; i++){\n tempArray.push(null)\n }\n for(let i = 0; i < HEIGHT; i++){\n board.push([...tempArray])\n }\n //console.log(board) //DEBUG\n}", "drawBoard(){\n for(var i = 0; i<this.numColumns; i++){\n this.boardData.push([]);\n\n for(var j = 0; j<this.numRows; j++){\n\n this.boardData[i].push(new Hex(this, this.initOffset.x + i*this.hexWidth,this.initOffset.y +j*this.vertOffset, ((j%2) * this.hexWidth/2), {row: j, col: i}, this.hexScale, this.game));\n this.boardData[i][j].draw();\n\n }\n }\n console.log(this.identifierDict);\n\n }", "generateBoard() {\n for (let i = 0; i < this.rows; i++) {\n let row = [];\n for (let i = 0; i < this.cols; i++) row.push(new Tile(0, false));\n this.tiles.push(row);\n }\n this.setMines();\n }", "makeBoard() {\n // Creates and returns an 2D Array\n // [\n // [0, 0, 0],\n // [0, 0, 0],\n // [0, 0, 0],\n // [0, 0, 0],\n // ]\n let rows = new Array(this.height);\n for (let i = 0; i < rows.length; i++) {\n rows[i] = new Array(this.width);\n }\n for (let x = 0; x < rows.length; x++) {\n for (let e = 0; e < rows[x].length; e++) {\n rows[x][e] = 0;\n }\n }\n\n return rows;\n }", "function initBoard(){\n // prepare/add array space for initial 1x5 (row)\n for(i=0;i<5;i++){\n board.push([]);\n // adds \"O\" in each array to make 5x5 (col)\n for(j=0; j<5; j++){\n board[i].push('O');\n } \n }\n console.log();\n console.log(` Welcome to Battleship!`);\n console.log(`We have placed our hidden Battleship in a sea of arrays!`);\n console.log(` Take your guess with a range between 0-4`);\n console.log(` Try and sink us before we sink you! hahaha!`);\n console.log(` You get to have ${turn} turns to guess!`);\n console.log();\n console.log(`Le Sea of Arrays`);\n printBoard();\n console.log();\n}", "update() {\r\n\t\tthis.matrix.forEach((row, y) => row.forEach((tile, x) => {\r\n\t\t\tif (tile && !tile.isEmpty) {\r\n\t\t\t\tlet temp = tile.top;\r\n\t\t\t\ttile.contents.shift();\r\n\t\t\t\tthis.insert(temp);\r\n\t\t\t}\r\n\t\t}));\r\n\t}", "initBoardData(height, width, coord, walls, water, goals) {\n let data = [];\n\n for (let i = 0; i < height; i++) {\n data.push([]);\n for (let j = 0; j < width; j++) {\n data[i][j] = {\n x: i,\n y: j,\n color: '',\n isWall: false,\n isPlayer: false,\n isGoal: false,\n };\n }\n }\n data = this.plantWater(data, water);\n data = this.plantWalls(data, walls);\n data = this.plantGoals(data, goals);\n data = this.plantPlayer(data, coord);\n return data;\n }", "createBoard() \n\t{\n\t\tlet board = [];\n\t\t\n\t\t// MY SOLUTION\n\t\t// while( board.length < 5 )\n\t\t// {\n\t\t// \tconst line = new Array(5);\n\t\t// \tfor( let i = 0; i < line.length; i++ )\n\t\t// \t{\n\t\t// \t\tconst num = this.props.chanceLightStartsOn * (Math.random() * 2);\n\t\t// \t\tconst random = Math.floor( num );\n\t\t// \t\tline[i] = random === 1 ? true : false;\n\t\t// \t}\n\t\t\t\n\t\t// \tboard.push(line);\n\t\t// }\n\n\t\tfor ( let x = 0; x < this.props.numRows; x++ )\n\t\t{\n\t\t\tlet row = [];\n\t\t\tfor ( let y = 0; y < this.props.numColumns; y++ )\n\t\t\t{\n\t\t\t\trow.push(Math.random() < this.props.chanceLightStartsOn)\n\t\t\t}\n\t\t\tboard.push(row);\n\t\t}\n\n\t\treturn board\n\t}", "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 }", "makeBoard() {\n this.board.length = 0;\n for (let y = 0; y < this.HEIGHT; y++) {\n this.board.push(Array.from({ length: this.WIDTH }));\n }\n }", "function drawBoard(){\n for (var i = 0; i < gameboard.length; i++){\n for (var j = 0; j < gameboard.length; j++){\n var xCoord = 15 + i * 32;\n var yCoord = 25 + j * 32;\n gameboard[i][j].xCoord = xCoord;\n gameboard[i][j].yCoord = yCoord;\n tile.beginPath();\n tile.fillStyle = '#000000';\n tile.font = '24px monospace';\n tile.fillText(gameboard[i][j].letter, xCoord, yCoord);\n tile.closePath();\n }\n }\n}", "function makeBoard() {\n\tfor (let h = 0; h < HEIGHT; h++) {\n\t\t//outer loop will allow us to build 7 rows (WIDTH) for every iteration through the column (HEIGHT)\n\t\tlet rowArray = []; //initialize an interal array\n\t\tfor (let w = 0; w < WIDTH; w++) {\n\t\t\trowArray[w] = 0; //increment the array each time through the loop\n\t\t}\n\t\tboard.push(rowArray); //finish by pushing the newly made array into the board array\n\t}\n}", "function MakeBoard(board){\n for(var i = 0; i < 3; i++){\n board.push([\"*\", \"*\", \"*\"]);\n }\n return board\n}", "creatArr(board) {\n //initialize all grids with 0\n for (let i = 0; i < this.boardSize; i++) {\n board[i] = 0;\n }\n //generate two tiles\n this.newTile(board);\n this.newTile(board);\n return board;\n }", "function makeBoard(/*columnCount, rowCount*/) {\n // Set \"board\" to empty HEIGHT x WIDTH matrix array\n //This array is used for the logic.\n\n board = [...Array(WIDTH)].map(e => Array(HEIGHT)); \n board.every((row) => row.fill(undefined));\n\n\n/* const map = [];\nfor(let x=0; x<columnCount; x++){\n map[x] = []; //set up inner array\n for(let y = 0; y< rowCount; y++){\n addCell(map, x, y);\n }\n}\nreturn map; */\n\n\n}", "makeBoard() {\r\n const a = new Array(this.m).fill(null).map(()=>new Array(this.n).fill(null));\r\n for (let numS in this.placing) {\r\n let [di, dj] = this.placing[numS].dir;\r\n let [i, j] = this.placing[numS].place;\r\n for (let c of numS) {\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 return a;\r\n }", "function makeBoard() {\n for (let y = 0; y < HEIGHT; y++) {\n board.push(Array.from({ length: WIDTH }));\n }\n makeHtmlBoard();\n}", "function makeBoard() {\n let row = []\n for (let col = 0; col < WIDTH; col ++) { // make a row array based on number of columns (WIDTH)\n row.push(undefined)\n }\n for (let y = 0; y < HEIGHT; y ++) { // combine row arrays into board. make copy of row using spread operator\n rowCopy = [...row] //need this line, otherwise all the rows will be referencing the same row\n board.push(rowCopy)\n }\n return board\n}", "function makeBoard() {\r\n for (let y = 0; y < HEIGHT; y++) {\r\n board.push(Array.from({ length: WIDTH }));\r\n }\r\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 createBoard(rows, columns) {\n for (let i = 0; i < rows; i++) {\n board.push([]);\n for (let j = 0; j < columns; j++) {\n if (i === 0 || i === rows - 1 || j === 0 || j === columns - 1) {\n board[i][j] = [\n { type: 'wall', visual: '#', position: { row: i, column: j } },\n ];\n } else {\n board[i][j] = [\n { type: 'grass', visual: '.', position: { row: i, column: j } },\n ];\n }\n }\n }\n}", "function drawBoard(array_name, numRows, numCol, xOrigin, yOrigin) {\n for (var j = 0; j < numRows; j++) {\n\n var yCorner = yOrigin + j * segmentHeight;\n\n for (var i = 0; i < numCol; i++) {\n\n var xCorner = xOrigin + i * segmentWidth;\n rect(xCorner, yCorner, segmentWidth, segmentHeight);\n }\n\n strokeWeight(1);\n textSize(25);\n textAlign(CENTER, CENTER);\n stroke('black');\n //Display the array values on canvas\n text(array_name[j], xOrigin + segmentWidth / 0.7, yCorner + segmentHeight / 2);\n //Display the array index value on canvas\n text(j, xOrigin + segmentWidth / 2, yCorner + segmentHeight / 2);\n\n }\n}", "addValidNeighbor(arr, row, col) {\n if (row >= 0 && row < this.boardSize && col >= 0 && col < this.boardSize &&\n this.board[row][col] === -1) {\n arr.push({\n row,\n col\n });\n }\n }", "function makeBoard() {\n\t// TODO: set \"board\" to empty HEIGHT x WIDTH matrix array\n\t//loop over HEIGHT (6) times to signify the 6 rows\n\tfor (let i = 0; i < HEIGHT; i++) {\n\t\t//create an empty array\n\t\tlet arr = [];\n\t\t//push the empty array into the empty \"board\" array\n\t\tboard.push(arr);\n\t\t//loop over WIDTH times (7) to create the length of each row\n\t\tfor (let i = 0; i < WIDTH; i++) {\n\t\t\t//push \"null\" into each \"arr\" array\n\t\t\tarr.push(null);\n\t\t}\n\t}\n}", "function placeShip(array,x,y,shipLength,axis){\n if (axis === 1){\n for(i=0; i<shipLength; i++){\n array[x+i][y] = 2\n }\n } \n if (axis === -1){\n for(i=0; i<shipLength; i++){\n array[x][y+i] = 2\n }\n }\n}", "function wallMaker() {\n\tvar height = mapArrays.length;\n // Because it's a square we only need to check the length of one line.\n var width = mapArrays[0].length;\n var bottomRowY = mapArrays.length-1;\n var lastColumnX = mapArrays[0].length - 1;\n // A little callback function created inside wallMaker so that we don't have to repeat the same 3 commands.\n function waller(wallThis) {\n wallThis.canMove = false;\n wallThis.description = \"A wall\";\n \twallThis.terrainType = \"wall\";\n wallThis.symbol = \"^\";\n wallThis.color = \"wall\";\n // Or whatever symbol we want to set it to.\n }\n // Walls the top row.\n for(var idx = 0; idx < width; idx++) {\n \tvar toWall = mapArrays[0][idx];\n waller(toWall);\n }\n // Walls the bottom row.\n for(var idx = 0; idx < width; idx++) {\n \tvar toWall = mapArrays[bottomRowY][idx];\n waller(toWall);\n }\n // Walls the sides. Ignores the top and bottom rows since they're already done.\n for(var idx = 1; idx < height-1; idx++) {\n \tvar toWall1 = mapArrays[idx][0];\n var toWall2 = mapArrays[idx][lastColumnX];\n waller(toWall1);\n waller(toWall2);\n }\n}", "function draw(new_array, array_size) {\n // Getting the div in the body to draw the array\n var table_container = document.getElementById(\"table_container\");\n // Clearing the div for the new generation\n table_container.innerHTML = \"\";\n\n // For each row loop the below (array_size / ARRAY_COLUMN_WIDTH = how many rows)\n for (var i = 0; i < array_size / ARRAY_COLUMN_WIDTH; i++) {\n // Create one div for a row\n var row = document.createElement(\"div\");\n // Set attribute for this div\n row.setAttribute(\"class\", \"row\");\n // For each column loop the below\n for (var k = 0; k < ARRAY_COLUMN_WIDTH; k++) {\n // Create one div for a column\n var col = document.createElement(\"div\");\n // Set attribute for this div\n col.setAttribute(\"class\", \"col-sm with-number\");\n // Create another div to put the array value in it\n var value_p = document.createElement(\"div\");\n // Setting attributes\n value_p.setAttribute(\"class\", \"value\");\n // Putting the value as a text\n var text = document.createTextNode(new_array[k + i * ARRAY_COLUMN_WIDTH]); //\"value: \"+\n // Appending the value text in the value div\n value_p.appendChild(text);\n // I am doing this for better visualization\n if (k + i * ARRAY_COLUMN_WIDTH < array_size) {\n // Setting attributes for my easiness in each cell\n col.setAttribute(\"cell_id\", (k + i * ARRAY_COLUMN_WIDTH).toString());\n col.setAttribute(\"cell_value\", (new_array[k + i * ARRAY_COLUMN_WIDTH]).toString());\n // Creating a divider\n var hr = document.createElement(\"hr\");\n // Creating another div for the array index\n var index_p = document.createElement(\"div\");\n // Setting attributes\n index_p.setAttribute(\"class\", \"index\");\n // Putting the index as a text\n var index = document.createTextNode((k + i * ARRAY_COLUMN_WIDTH).toString()); //\"index: \"+\n // Appending the index text in the index div\n index_p.appendChild(index);\n // Appending the index div at parent div which is the column (cell)\n col.appendChild(index_p);\n // After the array index append the divider\n col.appendChild(hr);\n // Then append the array value\n col.appendChild(value_p);\n // Append the cell in the row div\n row.appendChild(col);\n // Finally append the row div at the table div\n table_container.appendChild(row);\n } else {\n //if a cell doesn't have values run this code for good visualization in the page \n col.setAttribute(\"class\", \"col-sm\");\n col.appendChild(document.createTextNode(\"\"));\n row.appendChild(col);\n table_container.appendChild(row);\n }\n }\n }\n}", "function drawBoard() {\n\n // \"board\" variable refers to the div that we have in html file(We take this by using document(html) + getElementById)\n var htmlBoard = document.getElementById(\"board\");\n // Board is empty\n htmlBoard.innerHTML = \"\";\n // Instead of 10 we take the length of the map\n // Because we have to dimensional array, we have to create one more loop\n // The firs loop is for x and the second one is for y\n //! Here it takes the length of the map\n for (let y = 0; y < map.length; y++) {\n //! Here it takes the length of the y direction\n for (let x = 0; x < map[y].length; x++) {\n // We want to check the value of the map\n // ! \"===\" - checks if they are the same value as well as type\n if (map[y][x] === 1) {\n // add a div\n // += - add to it\n // remember to use single quotes because double quotes does not work withing double qoutes\n htmlBoard.innerHTML += \"<div class='wall tile'></div>\"\n }\n if (map[y][x] === 2) {\n // add a div\n // += - add to it\n // remember to use single quotes because double quotes does not work withing double qoutes\n htmlBoard.innerHTML += \"<div class='background tile'></div>\"\n }\n if (map[y][x] === 3) {\n // add a div\n // += - add to it\n // remember to use single quotes because double quotes does not work withing double qoutes\n htmlBoard.innerHTML += \"<div class='dot tile'></div>\"\n }\n if (map[y][x] === 4) {\n // add a div\n // += - add to it\n // remember to use single quotes because double quotes does not work withing double qoutes\n htmlBoard.innerHTML += \"<div class='hacman tile'></div>\"\n }\n }\n // What is does it will separate the div so they will be equal (after the row is done)\n htmlBoard.innerHTML += \"<br>\"\n }\n var wScore = document.getElementById(\"score\");\n wScore.innerText = \"The Score is \" + score;\n}", "addBoundary(boardArray) {\n\t\treturn (\n\t\t\tbracketArray(\n\t\t\t\tboardArray.map((row, rowIndex) => \n\t\t\t\t\tbracketArray(row, leftRowLabel(rowIndex), rightRowLabel(rowIndex))\n\t\t\t\t),\n\t\t\t\tcolLabels(0),\n\t\t\t\tcolLabels(config.rows + 1)\n\t\t\t)\n\t\t)\n\t}", "function addGrid(strtLat, strtLang, width, height){\n for(var i = 0; i < .0005 * width; i += .0005){\n\tfor(var j = 0; j < .001 * height; j += .001){\n\n\t var\ttile = {\n\t\tlat: strtLat + i,\n\t\tlang: strtLang + j,\n\t\tstatus: -1,\n\t\tspecies: []};\n\t tileArray.tiles.push(tile);\n\t}}\n}", "initGame() {\n this.board = [];\n for(let x = 0; x < 9; ++x) {\n let col = [];\n for(let y = 0; y < 9; ++y){\n let row = [];\n for(let z = 0; z < 3; ++z){\n row.push(null);\n }\n col.push(row);\n }\n this.board.push(col);\n }\n }", "function tileSetter(array, xIndex, yIndex) {\n sameType = array[xIndex][yIndex].type;\n\n let left = +(array[xIndex - 1][yIndex].type === sameType),\n right = +(array[xIndex + 1][yIndex].type === sameType),\n up = +(array[xIndex][yIndex - 1].type === sameType),\n down = +(array[xIndex][yIndex + 1].type === sameType);\n\n\n let binary = \"\" + left + up + right + down;\n array[xIndex][yIndex].tile = parseInt(binary, 2) + 17;\n\n}", "board() {\n console.log(`Problem : ${this.string}\\n`);\n\n for (let i = 0; i < 9; i++) {\n this.unsolved[i].splice(3, 0, \"|\");\n this.unsolved[i].splice(7, 0, \"|\");\n this.unsolved[i] = this.unsolved[i].join(\" \");\n\n this.solved[i].splice(3, 0, \"|\");\n this.solved[i].splice(7, 0, \"|\");\n this.solved[i] = this.solved[i].join(\" \");\n }\n\n let line = [];\n for (let j = 0; j < 21; j++) {\n line.push(\"-\");\n }\n\n line = line.join(\"\");\n\n for (let k = 0; k < 16; k += 4) {\n this.unsolved.splice(k, 0, line);\n this.solved.splice(k, 0, line);\n }\n\n console.log(\"Init Board :\");\n console.log(this.unsolved.join(\"\\n\"));\n console.log(\"\\n\");\n console.log(\"Solve :\");\n console.log(this.solved.join(\"\\n\"));\n }", "makeBoard() {\n this.board = [];\n for (let y = 0; y < this.height; y++) {\n this.board.push(Array.from({ length: this.width }));\n }\n }", "function addtile(mtype,ofs,len,x,y,alfa){\n\tvar idxs = [], rollback = points.length + 0, maskrollbacks = {};\n\n\tfor(var i=0; i<tileangles[mtype].length; i++){\n\t\t\n\t\t// Angle mask\n\t\tvar angle = tileangles[mtype][ (i+ofs) % tileangles[mtype].length ];\n\t\tvar thisangle = tileangles[mtype][ (i+ofs+tileangles[mtype].length-1) % tileangles[mtype].length ];\n\t\t\n\t\tvar beta = alfa/36;\n\t\tvar mask = []; for(var j=0; j<10; j++){ mask[j]=0; } for(var j=0; j<thisangle; j++){ mask[ (j+beta+10) % 10 ]=1; }\n\t\t\n\t\t// Adding point\n\t\tvar pidx = addpoint(len, [x, y], mask );\n\t\tif(pidx>-1){\n\t\t\tmaskrollbacks[pidx] = mask;\n\t\t\tidxs.push( pidx );\n\t\t}else{\n\t\t\tfor(var k in maskrollbacks){ removemask(k,maskrollbacks[k]); /*removepointdistance(k);*/ }\n\t\t\tvar rem = (points.length-rollback);\n\t\t\tif(rem>0){ points.splice( rollback, rem ); }\n\t\t\treturn -1;\n\t\t}\n\t\t\n\t\t// Vector movement\n\t\tx += Math.cos( alfa *Math.PI/180 ) * len;\n\t\ty += Math.sin( alfa *Math.PI/180 ) * len;\n\t\talfa += ( 180 - angle * 36 );\n\t\t\n\t}// End of points loop\n\t\n\tvar newidxs = []; for(var i=rollback;i<points.length;i++){ newidxs.push(i); }\n\t\n\tif(testtilepoints(newidxs,len)){\n\t\ttiles.push({ type: mtype, pointindexes: idxs, offset: ofs, sidelength: len, rotation: alfa, masks: maskrollbacks });\n\t\treturn tiles.length-1;\n\t}else{\n\t\tfor(var k in maskrollbacks){ removemask(k,maskrollbacks[k]); /*removepointdistance(k);*/ }\n\t\tvar rem = (points.length-rollback);\n\t\tif(rem>0){ points.splice( rollback, rem ); }\n\t\treturn -1;\n\t}\n\t\n}// End of addtile()", "fillAt(row, col, piece) {\r\n this.board[row][col] = piece;\r\n }", "function pushData(arr)\r\n{\r\n\tfor (var i = 0; i < rows.length; i++)\r\n\t{\r\n var cells = rows[i].split(\",\");\r\n console.log(\"cells \",cells);\r\n if (cells.length > 1) {\r\n arr.push(trimOut(cells[0]));\r\n arr.push(trimOut(cells[2]));\r\n }\r\n }\r\n\tconsole.log(\"pushdata call \");\r\n main(document.getElementById('graphContainer'));\r\n}", "function fillrowuntil(rownum, colnum){\n \ttn = {};\n \tbeforelength = two_dim_arr[rownum].length;\n \tconsole.info( typeof two_dim_arr[rownum][beforelength-1] == 'object' ? two_dim_arr[rownum][beforelength-1].colnum + two_dim_arr[rownum][beforelength-1].colspan : 0+1);\n \t\n \tvar pointer = ( typeof two_dim_arr[rownum][beforelength-1] == 'object' ? two_dim_arr[rownum][beforelength-1].colnum + two_dim_arr[rownum][beforelength-1].colspan : 0+1);\n \tfor(pointer; pointer <= colnum; pointer ++){\n \t\ttn.raw = '|';\n\t\t\t\ttn.text = ' ' + '\\n';\n\t\t\t\ttn.l = ' ';\n\t\t\t\ttn.r = ' ';\n\t\t\t\ttn.colnum = pointer;\n\t\t\t\ttn.rownum = rownum;\n\t\t\t\ttn.colspan = 1;\n\t\t\t\ttn.rowspan = 1;\n\t\t\t\ttn.height = 1;\n\t\t\t\ttn.h_align = 'default';\n\t\t\t\ttn.v_align = 'default';\n\t\t\t\t\n\t\t\t\ttwo_dim_arr[rownum].push(tn);\n\t\t\t\tconsole.warn('this row was extended to be able to put the content somewhere');\n if(debug){\n console.log(two_dim_arr[rownum]);\n }\n\t\t\t}\n }", "function initializeWalls() {\n walls_board = [\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0, 0, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, WALL, WALL, 0],\n [0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, WALL, WALL, 0, 0, 0],\n [0, 0, 0, 0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n [0, 0, WALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, WALL, WALL, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n ];\n}", "formatBoard() {\n\t\treturn map2DArray(this.props.boardState.boardArray, boardCellData)\n\t}", "function remake_cells(){\n cells = new Array() ;\n for(var i=0 ; i<nRows ; i++){\n cells.push(new Array()) ;\n for(var j=0 ; j<nCols ; j++){\n cells[i].push([0,0,0]) ;\n }\n }\n}", "function addTiles(co,jk,jj,dp,dn,dq,dk,dj,dl,dh,dg,di){xc_eg(co,\"jn\",\"jn\",{\"width\":jk,\"height\":jj,\"jn\":[dp||\"\",dn||\"\",dq||\"\",dk||\"\",dj||\"\",dl||\"\",dh||\"\",dg||\"\",di||\"\"],\"ca\":0,\"bs\":0,\"id\":\"\"},0)}", "AddTileToCell(tileID, board, sideSwitcher){\r\n\t\t\r\n\t\t\tlet tile = board.FindTileById(tileID);\r\n\t\t\tlet nextOneUpCoords = tile.GetNextOneUpCoords();\r\n\t\t\tlet nextOneUpTile = board.FindTileByCoordinates(nextOneUpCoords.col, nextOneUpCoords.row);\r\n\t\t\tlet victoryCheck = new VictoryCheck();\r\n\t\t\t\r\n\t\t\tlet allCol = board.GetAllTilesInColumn(tile.col);\r\n\t\t\tlet allRow = board.GetAllTilesInRow(tile.row);\r\n\t\t\t\r\n\t\t\tlet allLeftDiags = board.GetLeftDiagonals(tile.col, tile.row);\r\n\t\t\t\r\n\t\t\tconsole.log(allLeftDiags);\r\n\t\t\t\r\n\t\t\tlet allRightDiags;\r\n\t\t\t\r\n\t\t\tfor(let a = allCol.length-1; a > -1; a--){\r\n\t\t\t\t\r\n\t\t\t\tif(allCol[a].occupationCode == 0){\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(sideSwitcher.currentTurn == 1){\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).childNodes[0].classList = \"\";\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).childNodes[0].classList.add(\"redCounter\");\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).setAttribute(\"data-occupationcode\", sideSwitcher.currentTurn);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tallCol[a].ChangeOccupationCode(sideSwitcher.currentTurn);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(sideSwitcher.currentTurn == 2){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).childNodes[0].classList = \"\";\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).childNodes[0].classList.add(\"blueCounter\");\r\n\t\t\t\t\t\tdocument.getElementById(allCol[a].tileID).setAttribute(\"data-occupationcode\", sideSwitcher.currentTurn);\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tallCol[a].ChangeOccupationCode(sideSwitcher.currentTurn);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tboard.UpdateTile(allCol[a]);\r\n\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t} \t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t\t//\tCheck for vertical win \r\n\t\t\tvictoryCheck.CheckVictory(allRow, sideSwitcher.currentTurn);\r\n\t\t\t\r\n\t\t\t//\tCheck for a horizontal win \r\n\t\t\tvictoryCheck.CheckVictory(allCol, sideSwitcher.currentTurn);\r\n\t\t\t\r\n\r\n\t\t\tsideSwitcher.ChangeTurn();\r\n\t\r\n\t\t\r\n\t\t}", "makeBoard() {\n let board = [];\n for(let row = 0; row < this.height; row++ ){\n let newRow = [];\n for(let column = 0; column <this.width; column++){\n newRow.push(0);\n }\n board.push(newRow);\n }\n return board;\n }", "function create_game_board() {\n var arr = [];\n for (var i = 0; i < 12; i++) {\n arr[i] = [];\n for (var j = 0; j < 12; j++) {\n var arr2 = [];\n arr[i].push(arr2);\n }\n }\n\n for (var i = 0; i < 12; i++) {\n for (var j = 0; j < 12; j++) {\n arr[i][j] = true;\n }\n }\n return arr;\n}", "function connectArray(size) {\n uniqueId = 0;\n\n //Making 2-D Array\n for (let i = 0; i < size; i++) {\n data[i] = new Array(2);\n }\n\n //Initializing 2-D Array\n for (let i = 0; i < size; i++) {\n for (let j = 0; j < size; j++) {\n //console.log(wall.indexOf(uniqueId))\n if(wall.indexOf(uniqueId)==-1){\n data[i][j] = new Spot(i, j, false, uniqueId++);\n }else{\n data[i][j] = new Spot(i, j, true, uniqueId++);\n }\n }\n }\n\n for (let i = 0; i < size; i++) {\n for (let j = 0; j < size; j++) {\n data[i][j].connectFrom(data);\n }\n }\n //console.log(data);\n }", "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}", "renderBoard() {\n const renderedBoard = [];\n for(let i = 0; i < this.props.totalRows; i++) {\n const renderedRow = [];\n for(let j = 0; j < this.props.totalColumns; j++) {\n const coordinates = `${i}-${j}`\n renderedRow.push(<td key={j}><Cell key={coordinates} isLit={this.state.Board[i][j]} click={this.toggleState} text={coordinates}/></td>);\n }\n renderedBoard.push(<tr key={i}>{renderedRow}</tr>);\n }\n return renderedBoard;\n }", "setupGameBoard()\n {\n this.gameBoard.innerHTML = \"\";\n let newStyle = \"grid-template-columns: repeat(\" + this.xSize + \", 1fr); grid-template-rows: repeat(\" + this.ySize + \", 1fr);\";\n this.gameBoard.setAttribute(\"style\", newStyle);\n\n for (let row = 0; row < this.ySize; row++)\n {\n for (let col = 0; col < this.xSize; col++)\n {\n let newTile = document.createElement(\"div\");\n if (((col+row) % 2) == 0)\n {\n newTile.className = \"tile\";\n }\n else\n {\n newTile.className = \"tile odd\";\n }\n\n newTile.setAttribute(\"data-x\", col);\n newTile.setAttribute(\"data-y\", row);\n \n let tileStyle = \"grid-row: \" + (row+1) + \"; grid-column: \" + (col+1) + \";\";\n newTile.setAttribute(\"style\", tileStyle);\n\n this.gameState[col][row].tile = newTile;\n this.gameBoard.appendChild(newTile);\n }\n \n }\n\n this.setUpTileListeners();\n }", "function makeBoard() {\n\tfor (let y = 0; y < HEIGHT; y++) {\n\t\tconst row = [];\n\t\tfor (let x = 0; x < WIDTH; x++) {\n\t\t\trow.push(null);\n\t\t}\n\t\tboard.push(row);\n\t}\n}", "populateBoard() {\n // add a bubble at every row, col\n for (let row = 0; row < this.rows; row++) {\n for (let col = 0; col < this.cols; col++) {\n let pos = this.getBubbleLocAt(row, col);\n this.pieces[row][col] = this.drawBubbleAt(pos.x, pos.y, row, col);\n }\n }\n this.pieces.forEach(row => {\n row.forEach(bubble => {\n bubble.getNeighbors();\n });\n });\n }", "function PopulateBoard() {\n var Tile = document.getElementsByClassName(\"TileValue\"),\n Point = document.getElementsByClassName(\"TilePoint\");\n\n for (let index = 0; index < 16; index++) {\n GenerateBoard();\n Tile[index].innerText = WordArray[index];\n Point[index].innerText = PointArray[index];\n }\n vowel = 0;\n duplicate = 0;\n}", "function setup() {\n\n cells = new Array([document.getElementById(\"cell00\"),\n document.getElementById(\"cell01\"),\n document.getElementById(\"cell02\"),\n document.getElementById(\"cell03\")],\n [document.getElementById(\"cell10\"),\n document.getElementById(\"cell11\"),\n document.getElementById(\"cell12\"),\n document.getElementById(\"cell13\")],\n [document.getElementById(\"cell20\"),\n document.getElementById(\"cell21\"),\n document.getElementById(\"cell22\"),\n document.getElementById(\"cell23\")],\n [document.getElementById(\"cell30\"),\n document.getElementById(\"cell31\"),\n document.getElementById(\"cell32\"),\n document.getElementById(\"cell33\")]);\n placeNumbers();\n\n}", "function updateBoardView() {\n // at first, clean the table\n $(\"td\").empty();\n // then append numbers to their conrespondding positions\n for (var i = 0; i < 4; i++) {\n for (var j = 0; j < 4; j++) {\n if (all_numbers[i][j]) {\n showTile(i, j, all_numbers[i][j]);\n }\n has_merged[i][j] = false;\n }\n }\n}", "function createBoard() {\r\n // We'll use a for loop to iterate through all the elemtents of the layout array:\r\n for (let i = 0; i < layout.length; i++) {\r\n // For each element we create a square:\r\n const square = document.createElement('div')\r\n // Append the square to our grid:\r\n grid.appendChild(square)\r\n // And push the square to our squares array:\r\n squares.push(square)\r\n\r\n // Now we color each square depending on its number, by adding the corresponding class:\r\n if (layout[i] === 0) {\r\n squares[i].classList.add('pac-dot')\r\n } else if (layout[i] === 1) {\r\n squares[i].classList.add('wall')\r\n } else if (layout[i] === 2) {\r\n squares[i].classList.add('ghost-lair')\r\n } else if (layout[i] === 3) {\r\n squares[i].classList.add('power-pellet')\r\n }\r\n }\r\n}", "function createBoard() {\n let render = (arr)=>{\n for(let i=0;i<ncols;i++){\n arr.push(Math.random()>chance ? false:true)\n }\n }\n let initialBoard =[];\n let solvable = false;\n for(let i=0;i<nrows;i++){\n let arr = []\n render(arr)\n initialBoard.push([...arr])\n }\n while(solvable === false){\n let even = initialBoard.map((row)=>{\n let n = row.reduce((acc,bool)=>{\n return bool ? acc+1:acc\n },0)\n return n\n })\n even.forEach((num,index)=>{\n if(num%2!==0){\n initialBoard[index]=[]\n render(initialBoard[index])\n }\n })\n if(!even.some(num=>num%2!==0)){\n break\n }\n }\n \n // console.log({Board: initialBoard})\n\n return initialBoard;\n }", "function createBoard() {\n for (let i = 0; i < numSquaresY; i++) {\n board[i] = [];\n for (let j = 0; j < numSquaresX; j++) {\n board[i][j] = new Square(i, j, j * xIncrement, i * yIncrement + headerHeight);\n }\n }\n}", "createBoard() {\n let rows = [];\n let loc = 0\n for (let row = 0; row < 3; row++){\n let cols = [];\n for (let col = 0; col < 3 ; col++){\n let coords = [row, col]\n cols.push(\n <div key={coords} className=\"board-col\">\n {this.renderSquare(loc)}\n </div>\n )\n loc ++\n }\n rows.push(\n <div key={row} className=\"board-row\">\n {cols}\n </div>\n )\n }\n return rows\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}", "function applyArrayToGrid(array) {\r\n\tfor(let i=0 ; i<array.length ; i++) {\r\n\t\tfor(let j=0 ; j<array[i].length ; j++) {\r\n\t\t\tvar cellId = \"#cell\"+i+\"-\"+j;\r\n\t\t\t$( cellId ).css(\"background-color\", colors[array[i][j]]);\r\n\t\t}\r\n\t}\r\n}", "function CreateTiles(data) {\n\n //The DOM elements will be keept in an array\n let tilesArray = [];\n\n //Check each row\n for (let row of data) {\n\n //Look at each column in that row.\n for (let col of row) {\n\n //All game elements are created as div elements\n let tile = document.createElement('div');\n\n //Assign the class name tile.\n tile.classList.add('tile');\n\n switch (col) {\n case _WALL_0:\n tile.classList.add('wall_0');\n break;\n case _WALL_1:\n tile.classList.add('wall_1');\n break;\n case _WALL_2:\n tile.classList.add('wall_2');\n break;\n case _WALL_3:\n tile.classList.add('wall_3');\n break;\n case _WALL_4:\n tile.classList.add('wall_4');\n break;\n case _WALL_5:\n tile.classList.add('wall_5');\n break;\n case _WALL_6:\n tile.classList.add('wall_6');\n break;\n case _WALL_7:\n tile.classList.add('wall_7');\n break;\n case _WALL_8:\n tile.classList.add('wall_8');\n break;\n case _WALL_9:\n tile.classList.add('wall_9');\n break;\n case _GROUND:\n tile.classList.add('ground');\n break;\n case _CHESSE:\n tile.classList.add('cheese');\n break;\n case _RAT:\n tile.classList.add('mrrat');\n\n //For the rat we add another class to check the \n //direction it`s facing.\n tile.classList.add(mrRat.direction);\n break;\n case _CONSTANT_RAT_TRAP:\n tile.classList.add('const_rat_trap');\n break;\n case _RANDOM_CHEESE:\n tile.classList.add('randomCheese');\n break;\n case _RANDOM_RATPOISON:\n tile.classList.add('ratPoison');\n break;\n default:\n alert(\"Error: Unknown element!\")\n break;\n }\n\n //Add the tiles to the array\n tilesArray.push(tile);\n }\n\n //At the end of each row, we create a <br/> element\n let brTile = document.createElement('br');\n\n //Add that br element to the tilesArray.\n tilesArray.push(brTile);\n }\n\n //Return the array of configured tiles.\n return tilesArray;\n}", "function setupBoard() {\n var i = 0;\n while (i < rows) {\n boardTable[i] = [columns];\n boardNextTable[i] = [columns];\n i++;\n }\n}", "function draw() {\r\n\t//console.clear();\r\n\tlet line = '\\n';\r\n\tfor (let y=0; y<gridcopy.length; y++) {\r\n\t\tfor (let x=0; x<gridcopy[y].length; x++) {\r\n\t\t\tlet tile = gridcopy[y][x];\r\n\t\t\tline += tile + '';\r\n\t\t}\r\n\t\tline += '\\n';\r\n\t}\r\n\tconsole.log(line);\r\n}", "function GenerateField(boardContainer, cells){\n for (i = 0; i < cols; i++) {\n for (j = 0; j < rows; j++) {\n\n var cell = document.createElement(\"div\");\n boardContainer.appendChild(cell);\n\n cell.id = 'cell' + i + j;\n\n var topPosition = j * squareSize;\n var leftPosition = i * squareSize;\n\n cell.style.top = topPosition + 'px';\n cell.style.left = leftPosition + 'px';\n cell.style.width = squareSize + 'px';\n cell.style.height = squareSize + 'px';\n cells.push(cell);\n }\n }\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 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 fillBoard(width, height) {\n\n ctx.beginPath();\n ctx.lineWidth = lineWeight;\n for (var x = 0; x <= width; x += boxSize) { // vertical lines\n ctx.moveTo(x + padding, padding);\n ctx.lineTo(x + padding, height + padding);\n }\n\n for (var y = 0; y <= height; y += boxSize) { // horizontal lines\n ctx.moveTo(padding, y + padding);\n ctx.lineTo(width + padding, y + padding);\n }\n ctx.closePath();\n ctx.strokeStyle = \"black\";\n ctx.stroke();\n\n addCells(width, height);\n}", "function makeBoard() {\n\tfor (let row = 0; row < HEIGHT; row++) {\n\t\tlet c = [];\n\t\tboard.push(c);\n\t\tfor (let col = 0; col < WIDTH; col++) {\n\t\t\tc.push(null);\n\t\t}\n\t}\n}", "mergeNewPieceTo(array){\n\n\t\tthis.newPiece.reduce((acc, element, index) => {\n\n\t\t\tlet x = this.newPiecePosition[0] + index%this.newPieceLen;\n\t\t\tlet y = this.newPiecePosition[1] + Math.trunc(index/this.newPieceLen);\n\n\n\n\t\t\t//Ou juste element ?\n\t\t\tif(element > 0){\n\t\t\t\tacc[x + y * this.boardLen] = element;\n\t\t\t}\n\n\t\t\treturn acc;\n\n\t\t}, array);\n\n\t}", "push(...row)\n\t{\n\t\tthis.rows.push({\n\t\t\ttype: 'data',\n\t\t\talign: this.alignment || 'l'.repeat(row.length),\n\t\t\tdata: row.map(String),\n\t\t\tdiv: false\n\t\t});\n\n\t\tthis.width = Math.max(this.width, row.length);\n\t}", "_draw(data) {\n let m, n, x, y, currentValue, newValue;\n const resolution = this.resolution;\n const matrix = this.matrix;\n const context = this.context;\n\n for (n = 0; n < this.height; n++) {\n for (m = 0; m < this.width; m++) {\n x = m * resolution;\n y = n * resolution;\n currentValue = matrix[n][m];\n newValue = data[n][m];\n if (newValue !== currentValue) {\n if (newValue === 1) {\n context.fillStyle = this.cellColor;\n context.fillRect(x, y, resolution, resolution);\n } else {\n context.clearRect(x, y, resolution, resolution);\n }\n }\n }\n }\n }", "function createNewPuzzle(rows, cols) {\n xw[\"clues\"] = {};\n xw[\"title\"] = DEFAULT_TITLE;\n xw[\"author\"] = DEFAULT_AUTHOR;\n xw[\"rows\"] = rows || DEFAULT_SIZE;\n xw[\"cols\"] = cols || xw.rows;\n xw[\"fill\"] = [];\n for (let i = 0; i < xw.rows; i++) {\n xw.fill.push(\"\");\n for (let j = 0; j < xw.cols; j++) {\n xw.fill[i] += BLANK;\n }\n }\n console.log(xw.fill);\n updateInfoUI();\n document.getElementById(\"main\").innerHTML = \"\";\n createGrid(xw.rows, xw.cols);\n\n isSymmetrical = true;\n current = {\n \"row\": 0,\n \"col\": 0,\n \"acrossWord\": '',\n \"downWord\": '',\n \"acrossStartIndex\":0,\n \"acrossEndIndex\": DEFAULT_SIZE,\n \"downStartIndex\": 0,\n \"downEndIndex\": DEFAULT_SIZE,\n \"direction\": ACROSS\n };\n\n grid = document.getElementById(\"grid\");\n squares = grid.querySelectorAll('td');\n\n updateActiveWords();\n updateGridHighlights();\n updateSidebarHighlights();\n updateCluesUI();\n\n for (const square of squares) {\n square.addEventListener('click', mouseHandler);\n }\n grid.addEventListener('keydown', keyboardHandler);\n}", "function generateBoard() {\n var array = [], // 1-d array, with LxC, which will be ported to the main board at the end\n i, max = lines*collumns;\n \n // Put all mines in the beginning\n for (i = 0; i < max; i++) {\n if (i < mines) {\n array[i] = 1;\n }\n else {\n array[i] = 0;\n\t\t}\n }\n \n fisherYates(array); // Randomizes mine position\n \n makeBoard(array); // Passes 1-d array to 2-d board\n}", "_addRow() {\n\t this.coins.forEach((column, x) => {\n\t column.pop();\n\t let newCoin = new Coin(this._randomColor(), x, 0);\n\t column.unshift(newCoin);\n\t newCoin.drawAndMove(x, -1, x, 0);\n\t });\n\t }", "initBoard() {\n\n // Generate a new row\n const newRow = (rowNum) => {\n const row = document.createElement('div');\n row.classList.add('row');\n row.classList.add('row-' + rowNum);\n return row;\n }\n // Generate a new column\n const newCol = (colNum) => {\n const col = document.createElement('div');\n col.classList.add('col');\n col.classList.add('col-' + colNum);\n return col;\n }\n\n // For each number of rows make a new row element and fill with columns\n for (let r = 0; r < SnakeGame.NUM_ROWS; r++) {\n\n const row = newRow(r);\n const boardCellsRow = [];\n\n // For each number of columns make a new column element and add to the row\n for (let c = 0; c < SnakeGame.NUM_COLS; c++) {\n\n const col = newCol(c);\n row.appendChild(col);\n boardCellsRow.push(col);\n\n }\n\n this.board.appendChild(row);\n this.boardCells.push(boardCellsRow);\n\n }\n\n }", "function buildArray() {\n for(var x = 1; x < 9; x++) {\n tiles.push(x + '.jpg');\n }\n tiles = tiles.concat(tiles);\n}", "function buildBoard(Rows, Cols) {\n var board = [];\n for (var i = 0; i < Rows; i++) {\n board[i] = [];\n for (var j = 0; j < Cols; j++) {\n board[i][j] = {\n isBomb: false,\n coord: {i, j},\n numOfBombsAround: 0,\n isShown: false,\n isFlaged: false,\n textContent: '',\n };\n }\n }\n return board;\n}", "function handleNewData ( source, tileArrays, sourceKey ) {\n\t for ( var i = 0 ; i < tileArrays.length ; i++ ) {\n\t\tvar tileArray = tileArrays[ i ];\n\t\tvar tilePointer = loadBuffer( tileArray );\n\t\tvar start = source.getStart();\n\t\tvar end = source.getEnd();\n\t\tvar projection = source.getProjection();\n\t\tvar loadFunction = source.getLoadFunction();\n\t\tvar dataInfo = initSorceData( start, end, projection );\n\t\t\n\t\tloadGlBuffer( loadFunction, tilePointer, dataInfo, fBufferInfo );\n\n\t\tfSourceBuffers[ sourceKey ].push( dataInfo );\n\n\t\tif ( fMinY === undefined || fMinY > dataInfo.minY )\n\t\t fMinY = dataInfo.minY;\n\n\t\tif ( fMaxY === undefined || fMaxY < dataInfo.maxY )\n\t\t fMaxY = dataInfo.maxY;\n\t }\n\n\t fGl.bufferData(fGl.ARRAY_BUFFER, fBufferInfo.data, fGl.STATIC_DRAW);\n\n\t schudleDraw();\n\t}", "function buildBoard() {\r\n var boardLength = gCurrLevel.boardSize\r\n var board = [];\r\n for (var i = 0; i < boardLength; i++) {\r\n board[i] = [];\r\n for (var j = 0; j < boardLength; j++) {\r\n var cell = {\r\n type: EMPTY,\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: false,\r\n isMarked: false,\r\n isCanClick: true\r\n }\r\n board[i][j] = cell;\r\n }\r\n }\r\n return board;\r\n}", "_fillThis() {\n\n for (let row = 0; row < this.length; row++) {\n this[row] = [];\n\n for (let newCol = 0; newCol < 4; newCol++) {\n this[row][newCol] = 0;\n }\n }\n }", "function updateBoard(dataId, board, player){\n if(dataId == 0 || dataId == 1 || dataId == 2){\n board[0][dataId] = player;\n }else if(dataId == 3 || dataId == 4 || dataId == 5){\n board[1][dataId-3] = player;\n }else{\n board[2][dataId-6] = player;\n }\n}", "setMap(arr){\n this.setState({lightsOn: false})\n let squares = [];\n let rows = [];\n let size = this.state.squareNum * this.state.rowNum;\n for(let i = 0; i < arr.length; i++){\n for(let j = 0; j < arr[i].length; j++){\n if(arr[i][j] === 3){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"health\"/>);\n size--;\n }\n else {\n squares.push(<Square key = {size} class = \"health dark\"/>);\n size--;\n }\n }\n else if(arr[i][j] === 4){\n squares.push(<Square key = {size} class = \"player\"/>);\n size--;\n }\n else if(arr[i][j] === 5){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"enemy\"/>);\n size--;\n }\n else{\n squares.push(<Square key = {size} class = \"enemy dark\"/>);\n size--;\n }\n }\n else if(arr[i][j] === 6){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"weapon\"/>);\n size--;\n }\n else{\n squares.push(<Square key = {size} class = \"weapon dark\"/>);\n size--;\n }\n }\n else if(arr[i][j] === 7 && this.state.gameLevel <= 3){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"door\"/>);\n size--;\n }\n else{\n squares.push(<Square key = {size} class = \"door dark\"/>);\n size--;\n }\n }\n else if(arr[i][j] === 8 && this.state.gameLevel === 4){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"boss\"/>);\n size--;\n }\n else{\n squares.push(<Square key = {size} class = \"boss dark\"/>);\n size--;\n }\n\n }\n else if(arr[i][j] === 0){\n if(i == 0 || j== 0 || i ==25 || j ==25){\n squares.push(<Square key = {size} class = \"border\"/>);\n size--;\n }\n else if(i == 1 || j == 1|| i == 24 || j == 24){\n squares.push(<Square key = {size} class = \"wall dark\"/>);\n size--;\n }\n else{\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4){\n squares.push(<Square key = {size} class = \"wall\"/>);\n size--;\n }\n else{\n squares.push(<Square key = {size} class = \"wall dark\"/>);\n size--;\n }\n\n }\n }\n\n else if(arr[i][j] === 1){\n if(arr[i-1][j]===4 || arr[i+1][j]===4 || arr[i][j-1]===4 || arr[i][j+1] === 4 || arr[i-1][j-1] === 4 || arr[i+1][j+1] === 4 || arr[i+1][j-1] === 4 || arr[i-1][j+1] === 4 || arr[i-2][j] === 4 || arr[i+2][j]===4 || arr[i][j-2] === 4 || arr[i][j+2]===4 ||arr[i-2][j-2] === 4 || arr[i+2][j+2] === 4 || arr[i+2][j-2] === 4 || arr[i-2][j+2] === 4 || arr[i-1][j-2] === 4 || arr[i+1][j-2]===4 || arr[i+2][j-1]===4 || arr[i-2][j-1]===4 || arr[i+1][j+2]===4 || arr[i+2][j+1]===4 || arr[i-1][j+2]===4 || arr[i-2][j+1]===4) {\n squares.push(<Square key={size} class = \"floor\"/>);\n size--;\n }\n else {\n squares.push(<Square key={size} class = \"floor dark\"/>);\n size--;\n }\n\n\n }\n if(squares.length === this.state.squareNum){\n rows.push(<Row key = {size} squares = {squares}/>);\n squares = [];\n if(rows.length === this.state.rowNum){\n this.setState({map: rows})\n }\n }\n }\n }\n }", "function initialize(height, width)//sets the game grid to all 0's\n{\n\n\tTableSize = [height, width];\n\t//var ful = [];//the full table data\n\t//var row = [];//the data for one row\n\t//for (j = 0; j < width; j++) {\n\t//\trow.push(0);\n\t//}\n\t//for (i = 0; i < height; i++) {\n\t//\tvar temp = [...row];\n\t//\tful.push(temp);\n\t//}\n\t//data = ful;\n\tdata = [[\"l\", \"l\", \"l\", \"l\", \"l\", \"o\", \"o\", \"sr\", \"sr\", \"sr\", \"pr\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"l\", \"o\", \"o\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\", \"o\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"o\", \"l\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\"], [\"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\"], [\"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\"], [\"sg\", \"l\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\"], [\"sg\", \"l\", \"l\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"pt\", \"pt\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"l\", \"l\"], [\"sg\", \"l\", \"l\", \"o\", \"o\", \"w\", \"o\", \"o\", \"pt\", \"l\", \"l\", \"pt\", \"o\", \"w\", \"o\", \"o\", \"o\", \"l\", \"l\", \"pb\"], [\"pg\", \"l\", \"l\", \"o\", \"o\", \"o\", \"w\", \"o\", \"pt\", \"l\", \"l\", \"pt\", \"o\", \"o\", \"w\", \"o\", \"o\", \"l\", \"l\", \"sb\"], [\"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"pt\", \"pt\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"l\", \"l\", \"sb\"], [\"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"l\", \"sb\"], [\"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\"], [\"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\"], [\"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"l\", \"o\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"o\", \"w\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"o\", \"l\", \"l\", \"l\", \"o\", \"o\", \"o\", \"l\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"o\", \"o\", \"l\", \"l\", \"l\", \"l\", \"l\"], [\"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"l\", \"py\", \"sy\", \"sy\", \"sy\", \"o\", \"o\", \"l\", \"l\", \"l\", \"l\", \"l\"]];\n}", "function visualizeArray(array, canvas){\n var ee = \">>visualizeArray: \"; //console log cursor\n if (!(array instanceof Array)){\n alert(\"input error: visualizeArray\")\n return;\n }\n \n //todo: check for valid canvas obj\n \n var context = canvas.getContext(\"2d\");\n \n var arrlen = array.length; \n \n // calc num of cols and rows in approx ratio 3:4\n var cols = Math.ceil(Math.sqrt((3/3)*(arrlen)))\n var rows = Math.ceil(arrlen/cols)\n \n //console.log(ee+\"cols: \"+ cols + \" rows: \" + rows);\n \n var boxwidth = canvas.width/cols\n var boxheight = canvas.height/rows\n \n var d = Date.now();\n \n var count=0;\n clearCanvas(context, canvas)// clear canvas\n for (var r=0;r<rows;r++){\n for (var c=0;c<cols;c++){\n if (count<arrlen){\n count++;\n var red, green, blue;\n if (array[count]==-1){ //white\n red = 255; green=255; blue =255; \n }else if (array[count] ==0){ //yellow\n red = 255; green=255; blue =0;\n }else if (array[count] ==1){ //green\n red = 0; green=255; blue =0;\n }else if (array[count] ==2){ //red\n red = 255; green=0; blue =0;\n }\n \n context.fillStyle=\"rgb(\"+red+\",\"+green+\",\"+blue+\")\"; //function that returns color\n context.fillRect(c*boxwidth, r*boxheight, boxwidth-1, boxheight-1)\n }\n }\n }\n //console.log(ee+ \"drawtime: \"+(Date.now()-d)+\" ms\"); \n \n // erases all the content on canvas\n function clearCanvas(context, canvas) {\n \"use strict\"\n context.clearRect(0, 0, canvas.width, canvas.height);\n var w = canvas.width;\n canvas.width = 1;\n canvas.width = w;\n }\n}", "function resetBoard() {\n board = [];\n $(__BOARD__).children().remove();\n let nbTilesBuilt = 0;\n let arrayTmp = [];\n board.push(arrayTmp);\n let index1D = 0;\n let index2D = -1;\n while(nbTilesBuilt < nbTiles) {\n if(index2D !== 0 && index2D % (nbColumns - 1) === 0) {\n arrayTmp = [];\n board.push(arrayTmp);\n index1D++;\n index2D = 0;\n } else {\n index2D++;\n }\n arrayTmp.push(__BLACK_TILE_CLASS__);\n $(__BOARD__).append(\"<div data-index-1d='\" + index1D + \"' data-index-2d='\" + index2D + \"' class='\" + __BLACK_TILE_CLASS__ +\n \"' style='width:\"+ sizeTile +\"px; height:\"+ sizeTile +\"px;'></div>\");\n nbTilesBuilt++;\n }\n}", "function add() {\n /* iterate through every block in the tetromino */\n for (let i = 0; i < tetr[currTet].config[configState].length; i++) {\n /* current pos for each block*/\n let row = row_state + tetr[currTet].config[configState][i][0]*36;\n let col = col_state + tetr[currTet].config[configState][i][1]*36;\n\n /* set it in occupied */\n occupied[row/36][col/36] = true;\n }\n}", "function buildBoard(){\n for(var i = 0; i < boardArr.length; i++){\n const deTile = document.createElement('div');\n deTile.classList = \"allTile \" + boardArr[i].color+'Tile';\n deTile.id = boardArr[i].tileLocation + \"Tile\";\n boardApp.appendChild(deTile);\n }\n}", "function addCell(content, whichRow, whichKind, array){\r\n\tvar cell = document.createElement(whichKind);\r\n\tcell.innerHTML = content;\r\n\twhichRow.appendChild(cell);\r\n\tarray.push(cell);\r\n\tcell.id = \"newCell\" + (array.length - 4);\r\n}", "function storeArr(id){\n switch(id){\n case \"box1\":\n arr1[0][0]=\"O\";// store the value in the board\n $(\"#box1\").text(\"O\");//select box1 and raplace the text by O\n // code block\n break;\n case \"box2\":\n arr1[0][1]=\"O\";\n $(\"#box2\").text(\"O\");\n // code block\n break;\n case \"box3\":\n arr1[0][2]=\"O\";\n $(\"#box3\").text(\"O\");\n // code block\n break;\n case \"box4\":\n arr1[1][0]=\"O\";\n $(\"#box4\").text(\"O\");\n // code block\n break;\n case \"box5\":\n arr1[1][1]=\"O\";\n $(\"#box5\").text(\"O\");\n // code block\n break;\n case \"box6\":\n arr1[1][2]=\"O\";\n $(\"#box6\").text(\"O\");\n // code block\n break;\n case \"box7\":\n arr1[2][0]=\"O\";\n $(\"#box7\").text(\"O\");\n // code block\n break;\n case \"box8\":\n arr1[2][1]=\"O\";\n $(\"#box8\").text(\"O\");\n break;\n case \"box9\":\n arr1[2][2]=\"O\";\n $(\"#box9\").text(\"O\");}\n }", "initBoard() {\r\n // Generate a new row\r\n const newRow = (rowNum) => {\r\n const row = document.createElement('div');\r\n row.classList.add('row');\r\n row.classList.add('row-' + rowNum);\r\n console.log(\"row:\"+ row);\r\n return row;\r\n }\r\n // Generate a new column\r\n const newCol = (colNum) => {\r\n const col = document.createElement('div');\r\n col.classList.add('col');\r\n col.classList.add('col-' + colNum);\r\n console.log(\"col:\"+ col);\r\n return col;\r\n }\r\n\r\n // For each number of rows make a new row element and fill with columns\r\n for (let r = 0; r < SnakeGame.NUM_ROWS; r++) {\r\n\r\n const row = newRow(r);\r\n const boardCellsRow = [];\r\n\r\n // For each number of columns make a new column element and add to the row\r\n for (let c = 0; c < SnakeGame.NUM_COLS; c++) {\r\n\r\n const col = newCol(c);\r\n row.appendChild(col);\r\n boardCellsRow.push(col);\r\n\r\n }\r\n\r\n this.board.appendChild(row);\r\n this.boardCells.push(boardCellsRow);\r\n\r\n }\r\n\r\n }" ]
[ "0.63479364", "0.6178666", "0.59382224", "0.5932542", "0.5924977", "0.59157664", "0.5865979", "0.5833621", "0.579286", "0.57713133", "0.5712914", "0.5702255", "0.5696323", "0.56898004", "0.5666034", "0.5652696", "0.5640959", "0.56289196", "0.561524", "0.56107754", "0.5602725", "0.55951", "0.55925083", "0.5582177", "0.5581382", "0.5578675", "0.55530846", "0.55340385", "0.5530753", "0.55203295", "0.5514684", "0.5513447", "0.5503443", "0.5503384", "0.54965246", "0.5494088", "0.54785055", "0.5477135", "0.5467646", "0.5466928", "0.54657805", "0.5465165", "0.5456085", "0.54352444", "0.5425905", "0.5425656", "0.5416342", "0.5412815", "0.5400375", "0.5398447", "0.5396359", "0.53932357", "0.5390541", "0.53900087", "0.53854924", "0.5367853", "0.5365141", "0.5364756", "0.53644544", "0.536299", "0.536278", "0.53588545", "0.5352127", "0.534983", "0.5333394", "0.5329706", "0.53283733", "0.5328325", "0.5327778", "0.5322627", "0.532159", "0.5317463", "0.5317214", "0.5316128", "0.5315252", "0.5313009", "0.53038794", "0.5297452", "0.5295939", "0.5294678", "0.5291389", "0.52893406", "0.52885807", "0.52852416", "0.5284158", "0.528325", "0.527951", "0.52787566", "0.5276246", "0.5273005", "0.5271437", "0.5271307", "0.52701634", "0.5264887", "0.52632105", "0.5260733", "0.5254263", "0.525199", "0.5248474", "0.52430403" ]
0.56500983
16
Increase count in cell if it doesn't hold a bomb
function increaseTile(x, y) { if (board[x][y] === -1) return; board[x][y] += 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 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 }", "bombCountDown(bomb) {\n\t\tif (bomb.isIgnited()) return; //already ignited\n\t\tbomb.decCountDown(0.5);\n\t\tthis.gameMap.setTile(bomb.x, bomb.y, c.ITEM_BOMB);\n\t\tthis.makeNoise(c.SOUND_KEY_TICK);\n\t\tif (bomb.getCountDown() > 0) {\n\t\t\tsetTimeout(this.bombCountDown.bind(this), c.TIME_FACTOR * 500, bomb);\n\t\t}\n\t\tthis.commit();\n\t}", "function updateBombCounts(board) {\n for (let i = 0; i < board.length; i++) {\n for (let j = 0; j < board.length; j++) {\n var location = { i: i, j: j };\n board[i][j].neighBombs = countNeighBombs(board, location);\n if (board[i][j].neighBombs === 0) board[i][j].neighBombs = EMPTY;\n }\n }\n}", "function detect(e) \n{\n var bombAround = 0;\n // Lose\n if (this.classList.contains('cell-bomb')) \n {\n \talert('perdu !');\n reset();\n generate_bomb();\n pre_detect();\n }\n // Other possibilities\n else \n {\n _index = parseInt(this.getAttribute('data-index')) - 1;\n // There's nothing around\n if (_index + 1 <= $cell.length - 1) \t if ($cell[_index + 1].classList.contains('cell-bomb')) bombAround++;\n if (_index - 1 >= 0)\t\t\t\t\t if ($cell[_index - 1].classList.contains('cell-bomb')) bombAround++;\n if (_index - cols >= 0)\t\t\t\t\t if ($cell[(_index - cols)].classList.contains('cell-bomb')) bombAround++;\n if (_index - cols + 1 >= 0)\t\t\t\t if ($cell[(_index - cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (_index - cols - 1 >= 0)\t\t\t\t if ($cell[(_index - cols) - 1].classList.contains('cell-bomb')) bombAround++;\n if (_index + cols <= $cell.length - 1)\t if ($cell[(_index + cols)].classList.contains('cell-bomb')) bombAround++;\n if (_index + cols + 1 <= $cell.length - 1)if ($cell[(_index + cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (_index + cols - 1 <= $cell.length - 1)if ($cell[(_index + cols) - 1].classList.contains('cell-bomb')) bombAround++;\n\t// if there st around we write the value\n\tif (bombAround > 0) {\n $bomb.innerHTML = bombAround;\n this.innerHTML = bombAround;\n this.classList.add('secure');\n }\n // if there nt around we only reveal\n if (bombAround == 0) reveal(_index);\n }\n }", "function cellNumbers () {\n for (let i = 0; i < board.length; i++) {\n let adjMinesCount = 0\n const leftEdgeColumn = (i % width === 0) // index 10 % width which is also 10 === 0 therefore left edge\n \n // index 9,19,29 and so on ... i = 19 % 10 === 9 which is width - 1 and that would be out right edge\n const rightEdgeColumn = (i % width === width - 1)\n \n if (board[i].classList.contains('no_bomb')) {\n\n // to get the cell value to the left of the cell\n if (i > 0 && !leftEdgeColumn && board[i - 1].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // to get the right top corner\n if (i > 9 && !rightEdgeColumn && board[i + 1 - width].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // to get the cell right above \n if (i > 10 && board[i -width].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // top left corner cell\n if (i > 11 && !leftEdgeColumn && board[i - 1 - width].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // next right cell \n if (i < 98 && !rightEdgeColumn && board[i + 1].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // bottom left corner cell\n if (i < 90 && !leftEdgeColumn && board[i - 1 + width].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // bottom right corner cell\n if (i < 88 && !rightEdgeColumn && board[i + 1 + width].classList.contains('has_bomb')) {\n adjMinesCount ++\n }\n // right below cell\n if (i < 89 && !leftEdgeColumn && board[i + width].classList.contains('has_bomb')) {\n adjMinesCount ++\n } \n\n\n // now our div will hold another class and that will have a count in each cell\n board[i].setAttribute('totalNum', adjMinesCount)\n }\n }\n}", "function addFlag(cell) {\n if (gameOver) return\n // resetBtn.style.display = 'block';\n if (!cell.classList.contains('visited') && (flags < numberOfBombs)) {\n if (!cell.classList.contains('flag')) {\n cell.classList.add('flag')\n cell.innerHTML = ' 🎌 '\n flags ++\n flagsLeft.innerHTML = numberOfBombs- flags\n checkForWin();\n } else {\n cell.classList.remove('flag')\n cell.innerHTML = ''\n flags --\n flagsLeft.innerHTML = numberOfBombs- flags\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 bombCheck(value){\n if (bomb.value == value){\n bomb.count += 1;\n } else{\n bomb.value = value;\n bomb.count = 0;\n }\n if (bomb.count >= 3){\n pile.length = 0;\n bomb.count = 0;\n bomb.value = -1;\n console.log(\"pile:\",pile.length);\n }\n}", "function countSurroundingMines(cell) {\n var count = 0;\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n for (let index =0; index < surrounding.length; index++) {\n if (surrounding[index].isMine === true){\n count++;\n }\n }\n return count;\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 topLeft() {\n if (cellTopLeft.classList.contains('bomb')) {\n bombCount += 1\n }\n }", "function countCell( cells, i, j )\n{\n if ( i < 0 || i > dimen - 1 ) {\n return 0;\n }\n\n if ( j < 0 || j > dimen - 1 ) {\n return 0;\n }\n\n return isAlive( cells, i, j ) ? 1 : 0;\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 setCellsNumOfBombsAround() {\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard[0].length; j++) {\n var cell = gBoard[i][j];\n cell.numOfBombsAround = getNumOfBombsAround(cell.coord);\n }\n }\n}", "function liveCount(row,col) {\n\tvar c = 0\n\tfor (var i=-1; i <= 1; ++i) {\n\t\tfor (var j=-1; j <= 1; ++j) {\n\t\t\tif (i==0 && j==0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif (getCell(i+row,j+col).on.value)\n\t\t\t\tc++\n\t\t}\n\t}\n\t\n\treturn c\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}", "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 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 countSurroundingMines (cell) {\n var count = 0;\n var surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n for (var i = 0; i < surroundingCells.length; i++) {\n if (surroundingCells[i].isMine == true) {\n count++;\n }\n }\n return count;\n}", "function countSurroundingMines (cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n var count = 0;\n\n for (let a = 0; a < surrounding.length; a++) {\n if (surrounding[a].isMine == true) {\n count++\n } \n } return count\n}", "function countSurroundingMines(cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n var count = 0;\n for (var i = 0; i < surrounding.length; i++) {\n if (surrounding[i].isMine === true) {\n count += 1;\n }\n }\n return count;\n}", "function countSurroundingMines (cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n var count = 0;\n for(var i = 0; i < surrounding.length; i++){\n if(surrounding[i].isMine === true) {\n count++;\n }\n }\n return count;\n}", "function countSurroundingMines(cell) {\n var count = 0\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (let i = 0; i < surrounding.length; i++) {\n var cell = surrounding[i]\n if (cell.isMine) {\n count++\n }\n }\n return count\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 countSurroundingMines (cell) {\n var surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n var count = 0;\n for (var i = 0; i < surroundingCells.length; i++) {\n if (surroundingCells[i].isMine) {\n count++;\n }\n }\n return count;\n}", "function countSurroundingMines (cell) {\n var cnt = 0\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (var i = 0; i < surrounding.length; i++){\n if (surrounding[i].isMine){\n cnt++\n }\n }\n return cnt\n}", "function setCountersOfNearbyMines() {\n for (var i = 0; i < gLevel.SIZE; i++) {\n for (var j = 0; j < gLevel.SIZE; j++) {\n if (gBoard[i][j].cellContent === gEmpty) {\n gBoard[i][j].cellContent = setMinesNegsCount(i, j);\n }\n }\n }\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 plantMines(ele){\n\n\tvar arr = document.getElementsByTagName('td');\n\n\tfor(var i = 0 ;i<mines ;i++ ){\n\n\t\tvar b = Math.floor((Math.random() * arr.length));\n\n\t\tvar cell = arr[b].getElementsByTagName('div')[0];\n\n\t\tif(cell.bomb!=true&&cell!=ele){\n\t\t\tcell.bomb = true;\n\n\t\t\tcell.innerHTML = '<div class=\"uncover\" num=\"b\" >b</div>';\n\n\t\t}\n\t\telse{\n\t\t\ti--;\n\t\t}\n\n\n\t}\n\tfor(var i = 0 ;i<height ;i++ ){\n\n\t\tfor(var j = 0 ;j<width ;j++ ){\n\n\t\t\tvar cell = document.getElementById('row'+(i+1)+'col'+(j+1));\n\n\t\t\tif(cell != null){\n\t\t\t\tif(cell.bomb != true){\n\n\t\t\t\t\tvar count = 0;\n\t\t\t\t\tfor(var k = -1 ;k<2 ;k++ ){ \n\n\t\t\t\t\t\tfor(var l = -1 ;l<2 ;l++ ){ \n\t\t\t\t\t\t\t var neighbor = document.getElementById('row'+(i+1+k)+'col'+(j+1+l));\n\t\t\t\t\t\t\tif(neighbor != null){ \n\t\t\t\t\t\t\t\tif(neighbor.bomb == true ){\n\n \t\t\t\t\t\t\t\t\tcount++;\n \t\t\t\t\t\t\t\t}\n\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\tif(count!=0){\n\t\t\t\t\t\tcell.innerHTML='<div class=\"uncover\" num=\"'+count+'\" >'+count+'</div>';\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tcell.innerHTML='<div class=\"uncover\" num=\"'+count+'\" ></div>';\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\n\t}\n}\n\n}", "function countSurroundingMines(cell) {\r\n const surrounding = lib.getSurroundingCells(cell.row, cell.col);\r\n let count = 0;\r\n for (let i = 0; i < getSurroundingCells.length; i++) {\r\n if (surrounding[i].isMine) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n}", "function bombCountClick() {\n closeAllMenus();\n if ((!dead) && (!win) && (openRemaining) && ((maxNumBombs-bombsFlagged) == 0)) {\n clockStop();\n numMoves++;\n openRemainingUsed = true;\n if (openAll()) {\n winShowWindow(); \n updateNumBombs(); }\n else {\n dead = true;\n updateNumBombs();\n document.face.src = faceDead.src; } }\n forceFocus();\n return false; }", "function countSurroundingMines (cell) {\n var count = 0;\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (var i = 0; i < surrounding.length; i++) {\n if (surrounding[i].isMine) {\n count++\n }\n }\n return count;\n}", "function countSurroundingMines (cell) {\n // get surrounding cells as object\n var surroundingCells = lib.getSurroundingCells(board.cells[cell].row, board.cells[cell].col)\n // count how many are mines\n count = 0\n for (i in surroundingCells) {\n if (surroundingCells[i].isMine === true) {\n count++;}\n }\n return count\n}", "function cellMarked(cell) {\n var cellCoord = getCellCoord(cell.id);\n var cellObj = gBoard[cellCoord.i][cellCoord.j];\n if (cellObj.flagged === false && cellObj.visible === false) {\n updateCellTo(cell,'flag');\n mineCountEl.innerHTML--;\n cellObj.flagged = true;\n } else if (cellObj.flagged === true && cellObj.visible === false) {\n updateCellTo(cell,'hidden');\n mineCountEl.innerHTML++;\n cellObj.flagged = false;\n }\n}", "function countSurroundingMines (cell) {\n console.log(\"countSurroundingMines called\")\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n var count=0\n console.log(\"Surrounding is: \", surrounding) \n \n for (var k = 0; k < surrounding.length; k++) {\n if (surrounding[k].isMine === true ){\n count++\n console.log(count)\n\n } \n console.log(count)\n return count\n }\n}", "function countSurroundingMines (cell) {\n var mines = 0\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (c = 0; c < surrounding.length; c++) {\n if (surrounding[c].isMine === true) {\n mines ++\n }}\nreturn mines\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}", "bumpCell(x, y) {\n let { cellData } = this.state;\n const { cells, rows } = this.props;\n\n this.setColors(x, y, colors.yellow);\n\n for (let i = 0; i < cells; i++) {\n const index = i + y * cells;\n cellData[index]++;\n this.fibCheck(i, y);\n }\n\n for (let i = 0; i < rows; i++) {\n const index = x + i * cells;\n // Don't increment twice\n if (i !== y) {\n cellData[index]++;\n this.fibCheck(x, i);\n }\n }\n // Put this back in if it causes problems\n // this.setState({ cellData });\n this.setState({});\n // Set the colors back\n setTimeout(() => {\n this.setColors(x, y, colors.white);\n this.setState({});\n }, 500);\n }", "getNumber() {\n \n if (this.flagged == true) {\n this.number = -2;\n } else if (this.bomb == true) {\n this.number = -8;\n\n } else {\n\n let counter = 0;\n\n for (i = 0; i < this.neighbours.length; i++) {\n if (this.neighbours[i].bomb === true) {\n counter++;\n }\n }\n\n this.number = counter;\n }\n\n }", "function countSurroundingMines(cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n let mines = 0;\n\n // Create loop for surrounding to add the count if its a mine cells.isMine\n for (var i = 0; i < surrounding.length; i++) {\n if (surrounding[i].isMine === true) {\n mines++;\n }\n }\n\n // Return count\n return mines;\n}", "divide() {\n var bloodCellCount = agents.filter(a => a instanceof BloodCell).length;\n if(bloodCellCount < options.bloodCellLimit) {\n agents = [...agents,new BloodCell({x:this.pos.x,y:this.pos.y,id:\"bloodcell\"+bloodCellCount})];\n $(\"#bloodCellCount\").text(agents.filter(a => a instanceof BloodCell).length);\n }\n \n }", "function countNeighBombs(board, location) {\n var count = 0;\n for (let i = (location.i - 1); i <= (location.i + 1); i++) {\n for (let j = (location.j - 1); j <= (location.j + 1); j++) {\n if (i >= 0 && i < board.length && j >= 0 && j < board.length) {\n if (board[i][j].isBomb === true) count++;\n }\n }\n }\n if (board[location.i][location.j].isBomb === true) return (count - 1);\n else return count;\n}", "function cellsALiveCount(){\n let newCells = createCells();\n let cellsAlive = 0\n for (let y = 0; y < resolution; y++){\n for (let x = 0; x < resolution; x++){\n const neighbours = getNeightbourCount(x,y);\n if (cells[x][y] && neighbours >= 2 && neighbours <= 3) \n newCells[x][y] = true;\n else if (!cells[x][y] && neighbours === 3) \n newCells[x][y] = true;\n cellsAlive += cells[x][y] ? 1 : 0 \n }\n }\n return cellsAlive;\n}", "boredIncrease() {\n\t\tif(this.timeSpan % 10 === 0) {\n\t\t\tthis.currentPet.boredom += 1;\n\t\t}\n\t}", "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 step()\n{\n\tvar numAround = new Array(cellYCount)\n\t\n\t//Loop through and build the count array\n\tfor(i = 0; i < cellYCount; i++)\n\t{\n\t\tnumAround[i] = new Array(cellXCount);\n\t\tfor(j = 0; j < cellXCount; j++)\n\t\t{\n\t\t\tnumAround[i][j] = countNeighbors(j, i);\n\t\t\t//console.log(j + \" \" + i + \": \" + numAround[i][j])\n\t\t}\n\t}\n\t\n\t//Use the count array to determine the new states for each cell\n\tfor(i = 0; i < cellYCount; i++)\n\t{\n\t\tfor(j = 0; j < cellXCount; j++)\n\t\t{\n\n\t\t\t//If 3, the cell is alive\n\t\t\tif(numAround[i][j] == 3)\n\t\t\t{\n\t\t\t\t//console.log(j + \" \" + i + \" = \" + numAround[i][j]);\n\t\t\t\tdrawCell(j, i, 1);\n\t\t\t}\n\t\t\t//If four, the cell stays the same\n\t\t\telse if(numAround[i][j] == 4);\n\t\t\t//Otherwise, the cell is dead\n\t\t\telse\n\t\t\t{\n\t\t\t\tdrawCell(j, i, 0);\n\t\t\t}\n\t\t\n\t\t}\n\t}\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}", "flagCell(cell) {\r\n // Avoid placing flags on digged cell\r\n if (cell.digged) return;\r\n\r\n // Place a flag\r\n if (!cell.flaged && (this.flags > 0)) {\r\n this.flags -= 1;\r\n cell.flaged = true;\r\n }\r\n else if (cell.flaged) {\r\n this.flags += 1;\r\n cell.flaged = false;\r\n }\r\n\r\n cell.updateView();\r\n }", "function markFlag() {\n let $td = $(this)\n if (unclickable(this)) {\n return false;\n }\n let id = $td.attr(\"id\")\n let cell = game.getCellByID(id);\n if (!cell.hasRevealed) {\n if (cell.hasFlag) {\n cell.hasFlag = false\n flagCount--\n } else {\n cell.hasFlag = true\n flagCount++\n }\n render()\n }\n return false\n}", "cellAdjMineCount(row, col) {\n const cells = this.cells;\n return cells[ this.to_1d(row, col) * this.cellBytes + 2];\n }", "function setMinesNegsCount(rowIdx, colIdx) {\n var minesCount = 0;\n\n for (var i = rowIdx - 1; i <= rowIdx + 1; i++) {\n if (i < 0 || i > gLevel.SIZE - 1) //if the is on the range\n continue;\n for (var j = colIdx - 1; j <= colIdx + 1; j++) {\n if ((j < 0 || j > gLevel.SIZE - 1) || (i === rowIdx && j === colIdx))//if its the cell itself or out of the board\n continue;\n if (gBoard[i][j].cellContent === gMINE) {\n minesCount++;\n continue;\n }\n }\n }\n return minesCount;\n}", "function numGen(bombs) {\n bombs.map(a => {\n let area;\n\n // defining how to look at each cell and determine whether to add a number\n\n // specific for right side of the grid to not add numbers to cells on next line\n \n if ((a + 1) % size === 0) {\n area = [a - 1, a + size, a - size, a + size - 1, a - size - 1];\n } \n \n // specific for left side of the grid to not add numbers to cells on next line\n\n else if (a % size === 0) {\n area = [a + 1, a + size, a - size, a + size + 1, a - size + 1];\n } \n\n // gets all the cells in the middle that arent on the edges\n\n else {\n area = [a + 1, a - 1, a + size, a - size, a + size - 1, a - size - 1, a + size + 1, a - size + 1];\n }\n\n // iterates through the area within the board and the non-mine cells and increments each number\n // in the cell based on the number of mines it is touching.\n area.map(b => {\n if ((b < (size * size) && b >= 0) && (HTMLboard.children[b].getAttribute(\"data-ismine\") == \"false\")) {\n let num = HTMLboard.children[b].getAttribute(\"data-touching\");\n HTMLboard.children[b].setAttribute(\"data-touching\", parseInt(num) + 1);\n }\n });\n\n });\n}", "function mouseReleased() {\r\n\r\n\tif(!gameOver) {\r\n\t\tonContextMenu = false;\r\n\r\n\t\t// get box released on\r\n\t\tvar boxX = int(mouseX/30);\r\n\t\tvar boxY = int(mouseY/30);\r\n\r\n\t\tlet cell = table[boxX][boxY];\r\n\r\n\t\t// for testing\r\n\t\tif(cell.getIsBomb()) {\r\n\t\t\tconsole.log(\"Is a bomb\")\r\n\t\t}\r\n\t\telse {\r\n\t\tconsole.log(cell.getBombCount());\r\n\r\n\t\t}\r\n\r\n\t\t\r\n\t\t// process what event to do based on the which button is clicked\r\n\t\tif(mouseButton === RIGHT) {\r\n\t\t\tif(bombsLeft > 0 && !cell.getIsShown()) {\t\r\n\t\t\t\t// top corner of the box\r\n\t\t\t\tlet cornerX = cell.getX()*30;\r\n\t\t\t\tlet cornerY = cell.getY()*30;\r\n\r\n\t\t\t\tif(cell.getFlagged()) {\r\n\r\n\t\t\t\t\tfill(160,160,160); // was 140,140,140\r\n\t\t\t\t\trect(cornerX,cornerY,30,30);\r\n\r\n\t\t\t\t\tcell.setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\r\n\t\t\t\t\tfill(110,255,210);\r\n\r\n\t\t\t\t\t// top corner bottom corner point of the flag \r\n\t\t\t\t\ttriangle(cornerX + 17,cornerY+5, cornerX+17,cornerY+15, cornerX+7, cornerY+10);\r\n\t\t\t\t\trect(cornerX+17,cornerY+5,2,20);\r\n\t\t\t\t\tbombsLeft--;\r\n\r\n\t\t\t\t\tcell.setFlagged();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse { // process the left. either revels number/open space(DONE) or makes all bombs red(DONE)\r\n\t\t\t\r\n\t\t\tif(cell.getIsBomb()) { // if the cell is a bomb\r\n\t\t\t\tfor(var x = 0; x < rowLength; x ++) {\r\n\t\t\t\t\tfor(var y = 0; y < columnLength; y++) {\r\n\r\n\t\t\t\t\t\tif(table[x][y].getIsBomb()) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tfill(255,0,0);\r\n\t\t\t\t\t\t\trect(table[x][y].getX()*30,table[x][y].getY()*30,30,30);\r\n\r\n\t\t\t\t\t\t\tfill(0,0,0);\r\n\t\t\t\t\t\t\tellipse(table[x][y].getX()*30 + 15, table[x][y].getY()*30 +15, 10);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgameOver = true;\r\n\t\t\t}\r\n\t\t\telse { // the cell is not a bomb\r\n\r\n\t\t\t\t// paints the current square\r\n\t\t\t\tpaintSquare(cell.getX(),cell.getY());\r\n\r\n\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tconsole.log(\"Mouse Button: \" + mouseButton);\r\n\t}\r\n}", "function plantBombs() {\n console.log('---------------[ PLANTING BOMBS ]---------------');\n var cells = document.getElementsByClassName('cell');\n while (game.bombsOnBoard < game.flagsAvaliable) {\n var cell = cells[[Math.floor(Math.random()*cells.length)]];\n if (cell.getAttribute('isBomb') !== \"true\") {\n cell.setAttribute('isBomb', 'true');\n game.bombsOnBoard++;\n\n console.log('Planted Bomb at ' + cell.id);\n }\n }\n console.log('---------------[ PLANTED BOMBS ]---------------');\n\n}", "function countNegs(cellI,cellJ) {\n var negs = 0;\n for (var i =cellI-1; i <= cellI+1; i++) {\n for (var j =cellJ-1; j <= cellJ+1; j++) {\n if ( i === cellI && j === cellJ ) continue;\n if ( i < 0 || i > board.length-1) continue;\n if ( j < 0 || j > board[0].length-1) continue;\n if (board[i][j].contain === 'mine') {negs++;}\n }\n }\n if (negs === 0) {negs = 'empty';}\n return negs;\n }", "function checkEngage(cell, opponent,i,j, ghostCount) {\n if (cell === opponent) {\n // TODO: basic support for eating power-ball (which is not in the game yet)\n if (gPacman.isSuper) {\n if (ghostCount) {\n \n \n }\n else {\n // console.log('i: '+i);\n // console.log('j: '+j);\n var currGhost = gGhosts[i];\n var previusItem = currGhost.currCellContent\n var strFood='<img src=\"img/food.png\">'\n if (previusItem === strFood) {\n // console.log('EATEN');\n gState.numOfFood--;\n updateScore(1);\n }\n }\n\n } else {\n clearInterval(gIntervalGhosts);\n gState.isGameDone = true;\n var elH1 = document.querySelector('h1')\n elH1.innerText = 'Game over...You lose !'\n openModal();\n\n return true;\n }\n }\n return false;\n}", "function countSurroundingMines (currentRow, currentCol) {\n var mineCount = 0;\n var checkReturn = lib.getSurroundingCells(currentRow, currentCol);\n \n for(var a = 0; a < checkReturn.length; a++){\n if(checkReturn[a].isMine === true){\n mineCount++;\n }\n }\n return mineCount;\n}", "function checkGameOver() {\n var numOfCellsWithNums = (gLevel.SIZE * gLevel.SIZE) - gLevel.MINES;\n return gGame.shownCount === numOfCellsWithNums && gGame.markedCount === gLevel.MINES;\n}", "livingNeighbors(row, col) {\n // TODO: Return the count of living neighbors.\n\n let livingCount = 0;\n\n\n for (let i = row-1; i < row+2; i++) {\n for (let j = col-1; j< col+2; j++) {\n\n //if this cell exists\n if (!(this.getCell(i,j) === null)) {\n //if neighbor is alive\n if (this.board[i][j] === 1) {\n livingCount++;\n }\n }\n // console.log('current coordinates of neighbors: ', `[${i}][${j}]`)\n }\n }\n\n //if current cell is ME and alive\n\n if (this.board[row][col] === 1) {\n livingCount--;\n }\n\n console.log('current coordinates: ', `[${row}][${col}]`)\n\n console.log(`living count ${livingCount}`);\n return livingCount;\n\n }", "game_won() {\n if (this.game_state !== \"alive\") {\n return;\n }\n\n for (let row = 0; row < this.visible_board.length; row++) {\n for (let col = 0; col < this.visible_board[0].length; col++) {\n if (this.game_board[row][col] === mine_value) {\n if (this.visible_board[row][col] === marked_value) {\n continue; // flagged correctly. Flag stays.\n }\n else {\n this.visible_board[row][col] = marked_value;\n }\n }\n else {\n this.visible_board[row][col] = this.game_board[row][col];\n }\n\n }\n } \n this.mine_counter = 0;\n this.stop_timer();\n this.game_state = \"won\";\n alert(\"You won!\");\n }", "function countLiveNeighbor() {\n for (let i = 0; i < allCell.length; i++) {\n allCell[i].liveNeighbor = 0;\n for (let j = 0; j < allCell[i].neighbor.length; j++) {\n\n if (allCell[allCell[i].neighbor[j]].isLife === true) {\n allCell[i].liveNeighbor++;\n }\n }\n }\n}", "function flagCell(board,row,column) {\n var ret=2;\n var flag=parseInt(getItemFromLocalStorage('flags'));\n var mines=parseInt(getItemFromLocalStorage('mines'));\n if(board[row][column].open!==1){\n if(board[row][column].flag) {\n flag += 1;\n board[row][column].flag=!board[row][column].flag;\n ret=0;\n }\n else if(!board[row][column].flag && flag>0){\n flag-=1;\n board[row][column].flag=!board[row][column].flag;\n ret=1;\n }\n\n if(ret<2 && board[row][column].value==='x'){\n mines+=ret?-1:1;\n saveItemInLocalStorage('mines',mines);\n }\n\n }\n saveItemInLocalStorage('flags',flag);\n return [ret,flag,mines];\n}", "updateBombCount(amount) {\n this.amountBombs += amount;\n\n if (this.id === this.game.id) {\n // set counter of your bombs in the browser\n document.getElementById(\"amountBombs\").innerText = this.amountBombs;\n }\n }", "function bombJuggler(numBombs) {\n\n}", "function reveal(_index) \n{\n if (!$cell[_index].classList.contains('cell-bomb')) \n {\n $cell[_index].classList.add('secure');\n _index = parseInt($cell[_index].getAttribute('data-index')) - 1;\n if (!$cell[_index + 1].classList.contains('cell-bomb')) {\n $cell[_index + 1].classList.add('secure');\n if (bombArounds[_index + 1] > 0) $cell[_index + 1].innerHTML = bombArounds[_index + 1];\n }\n if (!$cell[_index - 1].classList.contains('cell-bomb')) {\n $cell[_index - 1].classList.add('secure');\n if (bombArounds[_index - 1] > 0) $cell[_index - 1].innerHTML = bombArounds[_index - 1];\n }\n if (!$cell[(_index - cols)].classList.contains('cell-bomb')) {\n $cell[_index - cols].classList.add('secure');\n if (bombArounds[_index - cols] > 0) $cell[_index - cols].innerHTML = bombArounds[_index - cols];\n\n }\n if (!$cell[(_index - cols) + 1].classList.contains('cell-bomb')) {\n $cell[(_index - cols) + 1].classList.add('secure');\n if (bombArounds[(_index - cols) + 1] > 0) $cell[(_index - cols) + 1].innerHTML = bombArounds[_index - cols + 1];\n\n }\n if (!$cell[(_index - cols) - 1].classList.contains('cell-bomb')) {\n $cell[(_index - cols) - 1].classList.add('secure');\n if (bombArounds[(_index - cols) - 1] > 0) $cell[(_index - cols) - 1].innerHTML = bombArounds[_index - cols + 1];\n }\n if (!$cell[(_index + cols)].classList.contains('cell-bomb')) {\n $cell[(_index + cols)].classList.add('secure');\n if (bombArounds[(_index + cols)] > 0) $cell[(_index + cols)].innerHTML = bombArounds[_index + cols];\n\n }\n if (!$cell[(_index + cols) + 1].classList.contains('cell-bomb')) {\n $cell[(_index + cols) + 1].classList.add('secure');\n if (bombArounds[(_index + cols) + 1] > 0) $cell[(_index + cols) + 1].innerHTML = bombArounds[_index + cols + 1];\n }\n if (!$cell[(_index + cols) - 1].classList.contains('cell-bomb')) {\n $cell[(_index + cols) - 1].classList.add('secure');\n if (bombArounds[(_index + cols) - 1] > 0) $cell[(_index + cols) - 1].innerHTML = bombArounds[_index + cols - 1];\n }\n }\n}", "function addFlag(square) {\n if (isGameOver) return \n if (!square.classList.contains('checked') && (flags < bombAmount)) {\n if (!square.classList.contains('flag')) {\n square.classList.add('flag')\n square.innerHTML = ' 🚩'\n flags ++\n flagsLeft.innerHTML = bombAmount- flags\n checkForWin()\n } else {\n square.classList.remove('flag')\n square.innerHTML = ''\n flags --\n flagsLeft.innerHTML = bombAmount- flags\n }\n }\n }", "amountCellsInSnake(cell) {\n return this.snake.filter(({x, y}) => x === cell.x && y === cell.y)\n .length;\n }", "getNumberOfNeighborBombs(rowIndex, columnIndex) {\n const neighborOffsets = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]];\n const numberOfRows = this._bombBoard.length;\n const numberOfColumns = this._bombBoard[0].length;\n let numberOfBombs = 0;\n neighborOffsets.forEach((offset) => {\n const neighborRowIndex = rowIndex + offset[0];\n const neighborColumnIndex = columnIndex + offset[1];\n if (neighborRowIndex >= 0 && neighborRowIndex < numberOfRows &&\n neighborColumnIndex >= 0 && neighborColumnIndex < numberOfColumns) {\n if (this._bombBoard[neighborRowIndex][neighborColumnIndex] === 'B') {\n numberOfBombs++;\n }\n }\n });\n return numberOfBombs;\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}", "function bombFired()\n{\n let oneBomb = balloonAmmo[bombIndex];\n if (oneBomb !== undefined && oneBomb !== null)\n {\n oneBomb.fired = true;\n bombIndex++;\n bombsLeft--;\n }\n else\n {\n console.log(\"You are out of bombs!!\");\n }\n}", "function berekenBuren(paramX, paramY) {\n let celRechts = paramY + 1;\n let celLinks = paramY - 1;\n let celBoven = paramX - 1;\n let celOnder = paramX + 1;\n if (checkbomb(paramX, celRechts)) {\n bombCount++;\n }\n if (checkbomb(paramX, celLinks)) {\n bombCount++;\n }\n if (checkbomb(celBoven, paramY)) {\n bombCount++;\n }\n if (checkbomb(celOnder, paramY)) {\n bombCount++;\n }\n //Rechts Boven\n if (checkbomb(celBoven, celRechts)) {\n bombCount++;\n }\n //Rechts Onder\n if (checkbomb(celOnder, celRechts)) {\n bombCount++;\n }\n //Links Boven\n if (checkbomb(celBoven, celLinks)) {\n bombCount++;\n }\n //Links Onder\n if (checkbomb(celOnder, celLinks)) {\n bombCount++;\n }\n return bombCount;\n }", "function incrementNeigbours(cells, x, y) {\n x = parseInt(x);\n y = parseInt(y);\n for (var j = (x - 1); j <= (x + 1); j++) {\n if (typeof cells[j] !== 'undefined') {\n for (var k = (y - 1); k <= (y + 1); k++) {\n if (typeof cells[j][k] !== 'undefined'\n && cells[j][k] instanceof Cell) {\n cells[j][k].neighbourMines++;\n\n }\n }\n }\n }\n }", "function addFlag(square){\n if (isGameOver) return\n if (!square.classList.contains('checked') && (flags < bombAmount)){\n if (!square.classList.contains('flag')) {\n square.classList.add('flag')\n square.innerHTML = ' 🚩'\n flags++\n checkForWin()\n }\n else {\n square.classList.remove('flag')\n square.innerHTML = ''\n flags--\n }\n document.getElementById('flags-left').innerHTML = (20 - flags) + \"\"\n }\n }", "function addCount() {\n game.count++;\n $(\"#count\").text(game.count);\n $(\"#count\").addClass('animated bounce');\n setTimeout(() => {\n $('#count').removeClass('animated bounce');\n }, 800);\n newMove();\n }", "numberAdjacentBombs(xSpace, ySpace)\n {\n let count = 0;\n\n let bounds = this.squareBounds(xSpace, ySpace);\n\n for (let col = bounds.colStart; col <= bounds.colEnd; col++)\n {\n for (let row = bounds.rowStart; row <= bounds.rowEnd; row++)\n {\n if (this.isBomb(col, row))\n {\n count++;\n }\n }\n }\n return count;\n }", "addNoMore() { this.noMore.value++; this.updateHitStat(this.noMore); }", "function countLiveNeighbors(grid, row, col) {\r\n var count = 0;\r\n var countInf = 0;\r\n //go through neighbors\r\n for (var i = row - 1; i <= row + 1; i += 1) {\r\n for (var j = col - 1; j <= col + 1; j += 1) {\r\n //check boundary\r\n if (validPosition(i, j)) {\r\n //count\r\n if (!grid[i][j].dead) {\r\n count = count + 1;\r\n } \r\n }\r\n }\r\n }\r\n //avoid the points that are being checked to be count \r\n if (!grid[row][col].dead) {\r\n count = count - 1;\r\n }\r\n \r\n \r\n return count;\r\n \r\n }", "function addFlag(square) {\n if (isGameOver) return;\n if (!square.classList.contains('checked') && (flags <= bombAmount)) {\n if (!square.classList.contains('flag')) {\n square.classList.add('flag');\n square.innerHTML = ' 🚩';\n flags++;\n flagsLeft.innerHTML = bombAmount - flags;\n checkForWin();\n\n\n } else {\n square.classList.remove('flag');\n square.innerHTML = '';\n flags--;\n flagsLeft.innerHTML = bombAmount - flags;\n }\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 }", "minedRendering(bomb_loc, mined_loc) {\n for (let i = 0; i < 12; i++) {\n for (let j = 0; j < 18; j++) {\n if (mined_loc[i][j] !== null && !\"GOAL\".includes(mined_loc[i][j])) {\n mined_loc[i][j] = this.countBombs(bomb_loc, [i, j]);\n }\n }\n }\n\n return mined_loc;\n }", "function cellFlagged(elCell, i, j) {\n if (gState.isGameOn && !elCell.classList.contains('mark')) {\n var isRightClick;\n var winEvent = window.event;\n isRightClick = (winEvent.which && winEvent.which == 3) || (winEvent.button && winEvent.button == 2);\n if (isRightClick) {\n var cell = gBoard[i][j];\n if (gState.shownCount && !cell.isFlagged) {\n cell.isFlagged = true;\n elCell.classList.add('flag');\n gState.shownCount--;\n } else {\n if (cell.isFlagged) gState.shownCount++;\n cell.isFlagged = false;\n elCell.classList.remove('flag');\n\n }\n updateShownCount(gState.shownCount)\n }\n }\n}", "function hitBomb(player, bomb){\nvie = --vie;\n\nvieText.setText('PV: '+vie);\n\t\n\tif(vie===0){\n\t\tthis.physics.pause();\n\t\tplayer.setTint(0xff0000);\n\t\tplayer.anims.play('turn');\n\t\tgameOver=true;\n\t}\n}", "function TypeCell(board, pos) {\r\n var count = countMines(board, pos);\r\n gBoard[pos.i][pos.j].minesAroundCount = count;\r\n if (gBoard[pos.i][pos.j].type === EMPTY && gBoard[pos.i][pos.j].minesAroundCount !== 0) {\r\n gBoard[pos.i][pos.j].type = gBoard[pos.i][pos.j].minesAroundCount;\r\n }\r\n}", "getNumberOfNeighborBombs(rowIndex, columnIndex) {\r\n const neighborOffsets = [\r\n [-1, -1], [-1, 0], [-1, 0],\r\n [0, -1], [0, 1],\r\n [1, -1], [1, 0], [1, 1]\r\n ];\r\n \r\n const numberOfRows = this._bombBoard.length; \r\n /* because the board generated by \r\n generateBombBoard is a 2D array - the first layer of array values = # of rows */\r\n const numberOfColumns = this._bombBoard[0].length; // how many values in first row\r\n let numberOfBombs = 0;\r\n \r\n /* this runs on EVERY element in the array, aka [1, -1] is ONE element.\r\n The first parameter in foreach(), aka offset here, represents the \r\n current element in the array that foreach() is iterating through. \r\n rowIndex and columnIndex is the row/column of the tile the player's flipping. */\r\n neighborOffsets.forEach(offset => {\r\n \r\n /* offset[0] means the row offset, offset[1] means the column offset,\r\n because each element in the neighborOffsets array has 2 elements (aka [-1, -1]). */\r\n const neighborRowIndex = rowIndex + offset[0];\r\n const neighborColumnIndex = columnIndex + offset[1]; \r\n \r\n // check if the neighbor cell selected is off the board or not\r\n if(neighborRowIndex >= 0 && neighborRowIndex < numberOfRows &&\r\n neighborColumnIndex >= 0 && neighborColumnIndex < numberOfColumns)\r\n {\r\n if(this._bombBoard[neighborRowIndex][neighborColumnIndex] === 'B')\r\n {\r\n numberOfBombs++;\r\n }\r\n }\r\n }); // this ends the parameters for the forEach() method\r\n return numberOfBombs;\r\n }", "function getFutureCellState(cell) {\n const neighbours = getCellNeighbours(cell);\n const aliveNeighbours = neighbours.filter((cell) =>\n cell.classList.contains(\"alive\")\n );\n // Any live cell with two or three live neighbours survives\n if (cell.classList.contains(\"alive\")) {\n if (aliveNeighbours.length === 2 || aliveNeighbours.length === 3) {\n return 1;\n }\n }\n // Any dead cell with three live neighbours becomes a live cell\n else {\n if (aliveNeighbours.length === 3) {\n return 1;\n }\n }\n // All other live cells die in the next generation\n // All other dead cells stay dead.\n return 0;\n}", "function boom() {\t\t\t\t// called by setInterval() automatically\n\t\t\tcount += 1;\t\t\t\t\t// update the current count\n\t\t\tif (count == numBooms) {\t// if we've reached the specified number of booms...\n\t\t\t\tclearInterval(id);\t\t// ...stop the setInterval()\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('boom!');\t// otherwise, print a 'boom!'\n\t\t\t}\n\t\t}", "function setMinesNegsCount(board) {\r\n for (var i = 0; i < board.length; i++) {\r\n for (var j = 0; j < board.length; j++) {\r\n TypeCell(board, { i, j });\r\n }\r\n }\r\n}", "function checkVictory() {\n if (gGame.revealedCount === (gLevel.curr.SIZE ** 2) - gLevel.curr.MINES\n && gGame.markedCount === gLevel.curr.MINES) {\n gameEnd(EMOJI.won);\n updateHighScore(gTime.totalTime);\n }\n}", "function updateBombCounter(change) {\n let bombPanel = document.getElementById(\"bomb-qty\");\n bombPanel.textContent = bombCounter + change;\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 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 countEmptyGear() {\n let count = 0;\n for (let slot of Object.values(character.slots)) {\n if (!slot) count += 1;\n }\n return count;\n}", "function putFlag(elCell, event, i, j) {\n event.preventDefault();\n if (gIsGameOver || gIsWin) return;\n var cell = gBoard[i][j];\n if (cell.isShown) return;\n\n if (cell.isFlaged) {\n removeFlag(cell);\n addColorTranspernt(cell.coord);\n return;\n }\n gUndoState.moves.push(copyMat(gBoard));\n var info = {\n lives: gLives,\n timer: gTimer,\n safeClicks: gSafeClicksCount,\n clickedCellsCounter: gClickedCellsCounter,\n flagsCount: gFlagsCount,\n };\n gUndoState.stateInfo.push(info);\n cell.isFlaged = true;\n elCell.innerText = FLAG;\n gFlagsCount--;\n\n if (cell.isBomb) gClickedCellsCounter--;\n updateFlagsCounterDom(gFlagsCount);\n removeColorTranspernt(cell.coord);\n\n checkIsWin();\n}", "function bonk(e) {\n score++;\n //this.parentNode.classList.remove('up');\n scoreBoard.textContent = score;\n }", "function cellClicked(elCell, i, j) {\n if (gState.isGameOn) {\n // build board data on first click\n if (!gState.markedCount){\n initMines(gBoard,i,j);\n setMinesNegsCount(gBoard); \n }\n if (!gBoard[i][j].isFlagged) {\n if (gBoard[i][j].isMine) {\n elCell.classList.add('mine','mark');\n } else {\n elCell.classList.add(getNumClass(gBoard[i][j].MineNegCnt));\n if (!elCell.classList.contains('mark')) {\n elCell.classList.add('mark');\n if (gState.markedCount === 0) gGameInterval = setInterval(updTime, 1000);\n gState.markedCount++;\n expandShown(gBoard, i, j);\n }\n }\n checkGameOver(i, j);\n }\n }\n}", "function getNumOfBombsAround(coord) {\n var bombsCount = 0;\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 if (cell.isBomb) bombsCount++;\n }\n }\n return bombsCount;\n}", "function isWin() {\n var cellsClickedCount = gGame.shownCount + gGame.markedCount;\n if (cellsClickedCount === (gSize * gSize) && (gGame.markedCount === gBombAmount)) {\n clearInterval(gTimerInterval);\n elBtn.innerHTML = '😎';\n getBestScore();\n gGame.isOn = false;\n return true;\n }\n return false;\n}", "function gameoflife() {\n let arr = []; //array for save the chenges\n let temp;\n let changecell;\n for (let i = 0; i < rownum; i++)\n for (let j = 0; j < colnum; j++) {\n let alivecnt = 0;\n let td = document.querySelector(`#id${i}_${j}`);\n // for each cell check 9 cases and save alive neighbors\n if (i === 0 && j === 0) {\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j+1}`).className === \"alive\")\n alivecnt++;\n } else if (i === 0 && j === colnum - 1) {\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j-1}`).className === \"alive\")\n alivecnt++;\n } else if (i === 0 && j !== colnum - 1 && j !== 0) {\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j+1}`).className === \"alive\")\n alivecnt++;\n } else if (i === rownum - 1 && j === 0) {\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n } else if (i !== 0 && i !== rownum - 1 && j === 0) {\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j+1}`).className === \"alive\")\n alivecnt++;\n } else if (i === rownum - 1 && j === colnum - 1) {\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n } else if (i === rownum - 1 && j !== colnum - 1 && j !== 0) {\n if (document.querySelector(`#id${i-1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n } else if (i !== rownum - 1 && i !== 0 && j === colnum - 1) {\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n } else {\n if (document.querySelector(`#id${i-1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i-1}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i}_${j+1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j-1}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j}`).className === \"alive\")\n alivecnt++;\n if (document.querySelector(`#id${i+1}_${j+1}`).className === \"alive\")\n alivecnt++;\n }\n //the 4 rules\n if (td.className === \"dead\") {\n if (alivecnt === 3)\n arr.push({ //push the change\n id: `#id${i}_${j}`,\n class: \"alive\"\n });\n } else {\n if (alivecnt < 2 || alivecnt > 3)\n arr.push({ //push the change\n id: `#id${i}_${j}`,\n class: \"dead\"\n });\n }\n }\n //make the changes\n while (arr.length !== 0) {\n temp = arr.pop();\n changecell = document.querySelector(temp.id);\n changecell.className = temp.class;\n }\n}", "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 }" ]
[ "0.6969766", "0.6847151", "0.6770352", "0.6756747", "0.6754687", "0.6672098", "0.6627683", "0.66135097", "0.6579581", "0.65109485", "0.6497079", "0.6478597", "0.64785534", "0.64456975", "0.64448273", "0.64311904", "0.6346996", "0.6339653", "0.6329239", "0.6319604", "0.63156575", "0.6302538", "0.6290263", "0.6276471", "0.6270826", "0.62598616", "0.62442845", "0.62081414", "0.61767244", "0.61760443", "0.61759937", "0.61399835", "0.6133169", "0.6101255", "0.6065874", "0.5999089", "0.5994677", "0.59915847", "0.5986906", "0.5984658", "0.59617096", "0.5958331", "0.5952817", "0.5947076", "0.5940423", "0.5930579", "0.59014213", "0.5900367", "0.5887015", "0.5862399", "0.58405703", "0.5806872", "0.5794169", "0.57937163", "0.57925206", "0.57748413", "0.5774144", "0.57672757", "0.5738782", "0.5738357", "0.57363486", "0.5730295", "0.57246774", "0.57244796", "0.57205725", "0.57173955", "0.57154286", "0.5706449", "0.5700623", "0.56962407", "0.56952035", "0.569367", "0.56923425", "0.5688059", "0.568766", "0.5686811", "0.56802726", "0.56766284", "0.5667194", "0.5659683", "0.56515175", "0.5651513", "0.5649674", "0.5643105", "0.56299376", "0.5622813", "0.56216115", "0.5618762", "0.5617053", "0.5614742", "0.5613162", "0.561032", "0.5606415", "0.55989337", "0.5596582", "0.5575011", "0.5571944", "0.5571653", "0.55715257", "0.556691" ]
0.5582657
95
/ PART 3: FILE CREATION
function generateJSON() { var saveFile = new Object(), /* Centralizes cards by discovering the position of the top-left card */ posX = ((-collumns) + !(collumns%2)), posZ = (lines - !(lines%2)); /* Start save-file object */ saveFile.SaveName = "Minesweeper " + lines + "x" + collumns + " (" + mines + " mines)"; saveFile.GameMode = "Minesweeper"; saveFile.Date = "11/7/2015 7:16:23 PM"; // TO-DO saveFile.Table = "Table_RPG"; saveFile.Sky = "Sky_Field"; saveFile.Note = "MINESWEEPER\n\n" + lines + " lines\n" + collumns + " collumns\n" + mines + " mines (" + Math.floor(100*mines/(lines*collumns)) + "%)"; saveFile.Rules = ""; saveFile.PlayerTurn = ""; saveFile.Grid = new Object(); saveFile.Grid.Type = 0; saveFile.Grid.Lines = false; saveFile.Grid.Snapping = false; saveFile.Grid.Offset = true; saveFile.Grid.BothSnapping = false; saveFile.Grid.xSize = 2.0; saveFile.Grid.ySize = 2.0; saveFile.Grid.PosOffset = new Object(); saveFile.Grid.PosOffset.x = 0.0 saveFile.Grid.PosOffset.y = 1.0 saveFile.Grid.PosOffset.z = 0.0 saveFile.Hands = new Object(); saveFile.Hands.Enable = false; saveFile.Hands. DisableUnused = false; saveFile.Hands.Hidding = 0; saveFile.DrawImage = "iVBORw0KGgoAAAANSUhEUgAAAWAAAADQCAYAAAA53LuNAAAFFElEQVR4Ae3QgQAAAADDoPlTH+SFUGHAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgy8DQx5DAABHyNK3wAAAABJRU5ErkJggg==" saveFile.VectorLines = []; saveFile.ObjectStates = []; // Flags deck var flagsDeck = new Object(); flagsDeck.Name = "Deck"; flagsDeck.Transform = new Object(); flagsDeck.Transform.posX = 10.9998751; flagsDeck.Transform.posY = 3.76623344; flagsDeck.Transform.posZ = -18.99992; flagsDeck.Transform.rotX = 0; flagsDeck.Transform.rotY = 180.013916; flagsDeck.Transform.rotZ = 180.000015; flagsDeck.Transform.scaleX = 0.625; flagsDeck.Transform.scaleY = 0.625; flagsDeck.Transform.scaleZ = 0.625; flagsDeck.Nickname = ""; flagsDeck.Description = ""; flagsDeck.ColorDiffuse = new Object(); flagsDeck.ColorDiffuse.r = 0.713266432; flagsDeck.ColorDiffuse.g = 0.713266432; flagsDeck.ColorDiffuse.b = 0.713266432; flagsDeck.Locked = false; flagsDeck.Grid = true; flagsDeck.Snap = true; flagsDeck.Autoraise = true; flagsDeck.Sticky = true; flagsDeck.SidewaysCard = false; flagsDeck.DeckIDs = []; for (var i = 0; i < mines; i++) { // Adds one flag for each mine flagsDeck.DeckIDs.push(110); } flagsDeck.CustomDeck = { 1: { FaceURL: "http://i.imgur.com/aHiVv66.jpg", BackURL: "http://i.imgur.com/xL8AXmY.jpg{Unique}" } } saveFile.ObjectStates.push(flagsDeck); // Interrogation mark deck var interrogationDeck = new Object(); interrogationDeck.Name = "Deck"; interrogationDeck.Transform = new Object(); interrogationDeck.Transform.posX = 16.9999142; interrogationDeck.Transform.posY = 3.76623344; interrogationDeck.Transform.posZ = -18.99992; interrogationDeck.Transform.rotX = 0; interrogationDeck.Transform.rotY = 180.013916; interrogationDeck.Transform.rotZ = 180.000015; interrogationDeck.Transform.scaleX = 0.625; interrogationDeck.Transform.scaleY = 0.625; interrogationDeck.Transform.scaleZ = 0.625; interrogationDeck.Nickname = ""; interrogationDeck.Description = ""; interrogationDeck.ColorDiffuse = new Object(); interrogationDeck.ColorDiffuse.r = 0.713266432; interrogationDeck.ColorDiffuse.g = 0.713266432; interrogationDeck.ColorDiffuse.b = 0.713266432; interrogationDeck.Locked = false; interrogationDeck.Grid = true; interrogationDeck.Snap = true; interrogationDeck.Autoraise = true; interrogationDeck.Sticky = true; interrogationDeck.SidewaysCard = false; interrogationDeck.DeckIDs = []; for (var i = 0; i < mines; i++) { // Adds one ? for each mine interrogationDeck.DeckIDs.push(111); } interrogationDeck.CustomDeck = { 1: { FaceURL: "http://i.imgur.com/aHiVv66.jpg", BackURL: "http://i.imgur.com/xL8AXmY.jpg{Unique}" } } saveFile.ObjectStates.push(interrogationDeck); // Regular game cards for (var i = 1; i <= lines; i++) { for (var j = 1; j <= collumns; j++) { var card = addCard(i, j, posX, posZ) saveFile.ObjectStates.push(card); } } /* End save-file object */ var json = JSON.stringify(saveFile, null, '\t'); saveTextAs(json, "Minesweeper.json"); // FileSaver.js by Eli Grey, modified by Brian Chen }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createFile(){\n if (projectType == \"Basic\") {\n internalReference = idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId,internalReference,documentType,description,dateCreated,diffusionDate,externalReference,localization,form,status);\n //Internal Reference as Full\n } else if (projectType == \"Full\") {\n internalReference = documentType + \"-\" + padToFour(projectCode) + \"-\" + padToTwo(avenant) + \"-\" + idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId, internalReference, documentType, description, dateCreated, diffusionDate, externalReference, localization, form, status);\n //Internal Reference as Full Without Project \n } else {\n\n internalReference = documentType + \"-\" + idAgency + \"-\" + padToFour(orderNumber) + \"-\" + padToTwo(version) + \"-\" + padToTwo(revision);\n updateListItem(fileId, internalReference, documentType, description, dateCreated, diffusionDate, externalReference, localization, form, status);\n }\n }", "function createFile() {\n var message = 'create file randomly',\n params = {\n message: message,\n committer: {\n name: 'yukihirai0505',\n email: 'hogehoge@gmail.com'\n },\n content: Utilities.base64Encode(message)\n },\n data = fetchJson(FILE_URL.replace(FILE_PATH_PLACEHOLDER, getRandomString()), 'PUT', params);\n Logger.log(data);\n}", "static createFile(evt, {path=null, str=\"\"}){\n // must have file path\n if(!path){\n let err = \"No file name provided (path is null).\";\n IpcResponder.respond(evt, \"file-create\", {err});\n return;\n }\n\n // figure file path data from file string \n let fileName = path.split(\"/\").pop();\n let dir = path.split(`/${fileName}`)[0];\n let knownFolder = FolderData.folderPaths.includes(path);\n\n // create the file \n FileUtils.createFile(path, str)\n .then(() => {\n // file created\n IpcResponder.respond(evt, \"file-create\", {dir, fileName, knownFolder});\n\n // update recent files \n FolderData.updateRecentFiles([path]);\n })\n .catch(err => {\n // error\n IpcResponder.respond(evt, \"file-create\", {err: err.message});\n });\n }", "createFile(dirname, filename, content, cb) {\n var mkdirp = require('mkdirp');\n //var asq = require(\"async\");\n\n mkdirp(dirname, function(err) {\n if (err) {\n console.error(\"err: \", err);\n if (typeof cb == 'function') {\n return cb(err);\n }\n } else {\n fs.writeFile(dirname + '/' + filename, content, function(err) {\n if (typeof cb == 'function') {\n return cb(err);\n }\n });\n }\n });\n }", "function createNewFile() {\n file = {\n name: 'novo-arquivo.txt',\n content: '',\n saved: false,\n path: app.getPath('documents') + '/novo-arquivo.txt'\n }\n\n mainWindow.webContents.send('set-file', file)\n}", "function createFile(fullPathToFile, newFilePath, newFileName, newFileParentPath, timestamp, markAsPermanentlyNotRelevant) {\n\n //if this should be ignored due to the st-ignore.json file\n if(!ignoreThisFileOrDir(newFilePath)) {\n \n //create an id for this file\n var newFileId = \"fileId-\" + branchId + \"_\" + autoGeneratedFileId;\n \n //get the id ready for the next file/dir\n autoGeneratedFileId++;\n\n //create a new file object\n var newFile = {\n id: newFileId,\n parentId: getIdFromDirPath(newFileParentPath),\n currentName: newFileName,\n isDeleted: false\n };\n\n //add the file to the object of all files\n allFiles[newFileId] = newFile;\n\n //make a connection between the file path and an id \n addFilePathToIdMap(newFilePath, newFileId);\n \n //create a new empty 2D array to hold insert events for the default file\n allInsertEventsByFile[newFileId] = [];\n\n //create a new file event\n var createFileEvent = {\n id: \"ev_\" + branchId + \"_\" + autoGeneratedEventId, \n timestamp: timestamp,\n type: \"Create File\",\n initialName: newFileName,\n fileId: newFileId,\n parentDirectoryId: newFile.parentId,\n createdByDevGroupId: currentDeveloperGroup.id\n };\n \n //increase the id so the next event has a unique id\n autoGeneratedEventId++;\n \n //if the user wants to mark this file as NOT relevant (because it is an existing file\n //that is being reconciled in a new project)\n if(markAsPermanentlyNotRelevant === true) {\n\n //pre-mark the event as not even possible to become relevant\n createFileEvent.permanentRelevance = \"never relevant\";\n }\n\n //add the event to the collection of all events\n codeEvents.push(createFileEvent);\n\n //occassionally a new file has something in it, for example, if a tool has generated the file\n //if the file has anything in it, take the contents and make them events in the system\n\n //open the file and read the text\n var fileText = fs.readFileSync(fullPathToFile, \"utf8\");\n \n //if there is anything in the new file\n if(fileText !== \"\") {\n\n //add the text into \n insertText(newFilePath, fileText, 0, 0, false, [], new Date().getTime(), markAsPermanentlyNotRelevant);\n }\n }\t \n}", "createFile(path) {\n touch.sync(path.absolute);\n }", "function createFile(filename, content) {\n if (existsSync(filename)) return console.log(filename + ' already exists - exiting');\n const data = new Uint8Array(Buffer.from(content));\n writeFile(filename, data, (err) => {\n if (err) throw err;\n console.log(filename + ' created.');\n });\n}", "function createFile(path, fileName) {\n if (!isExists(path, fileName)) {\n aqFile.Create(path + fileName); \n }\n}", "function fileCreate(fileName, data) {\n fs.writeFile(fileName, data, err => {\n if (err) {\n return console.log(err);\n }\n console.log('Your readme has been generated!')\n});\n}", "function createFile(req, res, next) {\n if (!(req.body.images instanceof Array && req.body.metadata)) {\n return next(new Error('Missing some fields'));\n }\n req.body.metadata.idParent = req.body.metadata.idParent || null;\n req.body.images = req.body.images.map(function(image) {\n return {\n imgNum: parseInt(image.imgNum),\n idImg: image.idImg,\n bytes: parseInt(image.bytes),\n accessToken: image.accessToken\n };\n });\n fsCreateFile(\n req.body.images, \n req.body.metadata, \n req.user.idUser, \n function(err, idNode) {\n err ? next(err) : res.send({idNode: idNode});\n });\n}", "async newFile(options){\n const self = this;\n const validateConfig = await ObjectValidator.validate({ object: options, against: \"File_Creation\", });\n\n if(validateConfig.success){\n if(validateConfig.object.folder !== \"\"){\n await this.makeLocalDir(`${self.config.basePath}${self.config.basePath === \"\" ? \"\" : \"/\"}${validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", \"\")}`);\n }\n\n if(validateConfig.object.request){\n // If an Http request is provided.\n let requestFiles = await this.getFilesFromHttpRequest(validateConfig.object.request);\n let FCFiles = [];\n\n for(let requestFile of requestFiles){\n let { contents, contentType, contentLength, readStream } = await this.getLocalFileContents(requestFile.path, false, null); // contents & readStream are same since 2nd parameter, decrypt, is false. If decrypt is true, contents is a pipeline.\n let isStream = true;\n let doEncrypt = false;\n let didEncrypt = false;\n\n if(contents){\n let finalContents = contents;\n if(this.file_protector !== null && validateConfig.object.isEncrypted === false){\n // If a file protector is assigned & passed value of isEncrypted is not true, encrypt the contents.\n doEncrypt = true;\n // Encrypt contents while writing the file.\n }\n\n let requestFileName = requestFile.originalFilename;\n let ext_regex = /(?:\\.([^.]+))?$/;\n let requestFileExt = ext_regex.exec(requestFileName)[1];\n let folderPath = validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", requestFileExt.toString().toLowerCase());\n let fullFolderPath = await this.beautifyPath(folderPath, true);\n\n await this.makeLocalDir(fullFolderPath);\n\n let newLocalFileCreated = await this.makeLocalFile(`${fullFolderPath}${fullFolderPath == \"\" ? \"\" : \"/\"}${requestFileName}`, finalContents, readStream, doEncrypt, isStream, contentLength, false);\n if(newLocalFileCreated === true){\n if(doEncrypt === true){ didEncrypt = true; }\n\n let obj = { name: requestFileName.replace(\".\"+requestFileExt, \"\"), ext: requestFileExt, folder: folderPath, handler: self, isEncrypted: validateConfig.object.isEncrypted === true ? true : didEncrypt, };\n let newFCFile = await self.newFCFile(obj); // Wrap file values in a FCFile instance.\n\n Logger.log(\"New LSfile created\");\n newFCFile ? FCFiles.push(newFCFile) : false;\n }\n }else{ }\n }\n\n return FCFiles.length > 0 ? FCFiles : null;\n }else{\n let folderPath = validateConfig.object.folder.replace(\"FILE_EXTENSION_WISE\", validateConfig.object.ext.toString().toLowerCase());\n let fullFolderPath = await this.beautifyPath(folderPath, true);\n\n await this.makeLocalDir(fullFolderPath);\n\n let finalContents = validateConfig.object.contents;\n let doEncrypt = false;\n let didEncrypt = false;\n if(this.file_protector !== null && validateConfig.object.isEncrypted === false){\n // If a file protector is assigned & passed value of isEncrypted is not true, encrypt the contents.\n doEncrypt = true;\n // Encrypt contents while writing the file.\n }\n\n let newLocalFileCreated = await this.makeLocalFile(\n `${fullFolderPath}${fullFolderPath == \"\" ? \"\" : \"/\"}${validateConfig.object.name}.${validateConfig.object.ext}`,\n finalContents,\n validateConfig.object.readStream !== null ? validateConfig.object.readStream : validateConfig.object.isStream === true ? finalContents : null,\n doEncrypt,\n validateConfig.object.isStream,\n validateConfig.object.isStream === true ? validateConfig.object.contentLength : finalContents.length,\n false\n );\n\n if(newLocalFileCreated === true){\n if(doEncrypt === true){ didEncrypt = true; }\n\n let obj = { name: validateConfig.object.name, ext: validateConfig.object.ext, folder: folderPath, handler: self, isEncrypted: validateConfig.object.isEncrypted === true ? true : didEncrypt, };\n let newFCFile = await self.newFCFile(obj); // Wrap file values in a FCFile instance.\n\n Logger.log(\"New LSfile created\");\n return newFCFile;\n }\n\n Logger.log(\"New LSfile creation failed\");\n }\n }else{ Logger.log(\"New LSfile creation failed\"); }\n\n return null;\n }", "function createFile() {\n fileName = document.getElementById(\"miiText\").value\n newDir = path.join(FileSystem.currentDirectory, fileName)\n absolutePath = path.resolve(newDir);\n correctedPath = path.normalize(absolutePath);\n errorMessage = document.createElement(\"P\")\n errorMessage.style.position = \"absolute\"\n errorMessage.className = \"errorMessage\"\n errorMessage.id = \"miiErr\"\n document.getElementById(\"buttons\").appendChild(errorMessage)\n try {\n if(fs.existsSync(correctedPath))\n {\n document.getElementById(\"miiErr\").innerHTML = \"File Already Exists\"\n document.getElementById(\"miiPicture\").src = \"MiiBrawlPic.png\"\n }\n else {\n fs.closeSync(fs.openSync(correctedPath, 'a'))\n document.getElementById(\"miiErr\").innerHTML = \"File Successfully Created\"\n document.getElementById(\"miiPicture\").src = \"MiiGunnerPic.png\"\n }\n } catch {\n document.getElementById(\"miiErr\").innerHTML = \"File Could Not Be Created\"\n document.getElementById(\"miiPicture\").src = \"MiiBrawlPic.png\"\n\n }\n}", "function File() {}", "function create (path, mode, cb) {\n\tconsole.log(\"create(path, mode, cb)\");\n\tvar err = 0; // assume success\n\tlookup(connection, path, function (info) {\n\n\t\t\tif (info === undefined) \n\t\t\t\ttmp.tmpName(function _tempNameGenerated(err, path) {\n\t\t\t\t\t\tif (err) cb(err);\n\t\t\t\t\t\tconnection.uploadFile(info.name, info.parent, cb);\n\t\t\t\t\t\t});\n\t\t\terr = -17; // -EEXIST\n\t\t\tcb(err);\n\t\t\t});\n}", "createNewfile(state, options) {\n //Get desired filename\n let name;\n if(options !== undefined && options.name !== undefined)\n name = getDefaultName(options.name);\n else\n name = getDefaultName();\n\n //Insert empty rows to fill up to the desired well count\n state.plate = plates[\"MWP 24\"];\n var values = [];\n for (let i = 0; i < state.plate.wells; i++) {\n values.push([0, 0]);\n }\n\n state.file = {\n substances: [\n { name: \"Water\", color: \"#6699ff\" },\n { name: \"Sample 1\", color: \"#66ff33\" },\n ],\n\n name: name,\n values: values,\n };\n }", "function createFakeFile() {\n const owner = ld.sample(owners);\n const startedAt = faker.date.past().getTime();\n\n return {\n uploadId: uuid.v4(),\n status: ld.sample(statusValues),\n startedAt,\n uploadedAt: startedAt + 1000,\n name: faker.commerce.productName(),\n files: JSON.stringify([]), // can insert real files, but dont care\n contentLength: ld.random(1, 2132311),\n parts: ld.random(1, 4),\n [FILES_OWNER_FIELD]: owner,\n };\n }", "function createFile(srcURL, destURL) {\n fs.appendFile(destURL, '', function (err) {\n if (err) throw err;\n console.log('File Saved');\n });\n fs.copyFile(srcURL, destURL, (error) => {\n // incase of any error\n if (error) {\n console.error(error);\n return;\n }\n\n console.log(\"File Copied\");\n });\n}", "async createFile(name, filePath, fileKeys) {\n let auth = this.auth;\n let res = {\"fileId\": \"\", \"keyId\": \"\", \"name\": name, keys: fileKeys};\n var drive = google.drive({ version: 'v3', auth });\n var fileMetadata = {\n 'name': name\n };\n var media = {\n mimeType: 'text/plain', \n body: fs.createReadStream(filePath+\".enc\")\n };\n var key_media = {\n mimeType: 'text/plain', \n body: fs.createReadStream(filePath+\".key\")\n }\n \n const fileRes = await drive.files.create({\n resource: fileMetadata,\n media: media,\n fields: 'id'\n });\n res.fileId = fileRes.data.id;\n fs.unlinkSync(filePath+\".enc\");\n \n const keyRes = await drive.files.create({\n resource: {\n 'name': fileMetadata[\"name\"] + \".key\"\n },\n media: key_media,\n fields: 'id'\n });\n res.keyId = keyRes.data.id;\n fs.unlinkSync(filePath+\".key\");\n this.db.collection('filesCollection').insertOne(res);\n var jsonUpload= {\n \"$class\": \"org.example.mynetwork.Document\",\n \"DocumentId\" : res.fileId.toString(),\n \"owner\": \"u1\",\n \"description\": \"test\",\n \"UsersWithAccess\": [\n \"u1\"\n ]\n };\n request.post(this.BLOCKCHAIN_URL+'/api/Document',{json: jsonUpload}, function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body)\n }\n });\n return res;\n }", "function createFile(){\n\n var reader = new FileReader();\n \n reader.readAsDataURL(blob)\n\n reader.onloadend = function () {\n\n var base64String = reader.result;\n\n // Remove the additional data at the front of the string\n\n var base64Substring = base64String.substr(base64String.indexOf(',') + 1)\n\n // Upload to the CSV Creator element\n context.uploadContent( filename, base64Substring, uploadFile);\n\n }\n\n }", "function createNewFile(fullpath, contents, testExt) {\n function _getUntitledFileSuggestion(dir, baseFileName, fileExt, isFolder) {\n var result = new $.Deferred();\n var suggestedName = baseFileName + fileExt;\n var dirEntry = new NativeFileSystem.DirectoryEntry(dir);\n\n result.progress(function attemptNewName(suggestedName, nextIndexToUse) {\n if (nextIndexToUse > 99) {\n //we've tried this enough\n result.reject();\n return;\n }\n\n //check this name\n var successCallback = function (entry) {\n //file exists, notify to the next progress\n result.notify(baseFileName + \"-\" + nextIndexToUse + fileExt, nextIndexToUse + 1);\n };\n var errorCallback = function (error) {\n //most likely error is FNF, user is better equiped to handle the rest\n result.resolve(suggestedName);\n };\n \n if (isFolder) {\n dirEntry.getDirectory(\n suggestedName,\n {},\n successCallback,\n errorCallback\n );\n } else {\n dirEntry.getFile(\n suggestedName,\n {},\n successCallback,\n errorCallback\n );\n }\n });\n\n //kick it off\n result.notify(baseFileName + fileExt, 1);\n\n return result.promise();\n }\n var basedir = fullpath.substring(0, fullpath.lastIndexOf(\"/\")),\n name = fullpath.substring(fullpath.lastIndexOf(\"/\") + 1),\n testname = name.substring(0, name.lastIndexOf('.js')) + testExt;\n var deferred = _getUntitledFileSuggestion(basedir, testname, \".js\", false);\n var createWithSuggestedName = function (suggestedName) {\n var result = ProjectManager.createNewItem(basedir, suggestedName, true, false);\n result.done(function (entry) {\n DocumentManager.getDocumentForPath(entry.fullPath).done(function (doc) {\n doc.setText(contents);\n });\n });\n };\n\n deferred.done(createWithSuggestedName);\n return deferred;\n }", "function createFile(auth, filePath) {\n var encrypted_file = encrypt(filePath);\n // {'fileName': name, 'fileData': data, 'fileKey': key}\n // var file_path = filePath;\n\n var drive = google.drive({ version: 'v3', auth });\n var fileMetadata = {\n 'name': encrypted_file[\"fileName\"]\n };\n var media = {\n mimeType: 'text/plain', // TODO: check the mime type of the files to be uploaded\n body: encrypted_file[\"fileData\"]\n };\n var key_media = {\n mimeType: 'text/plain', // TODO: check the mime type of the files to be uploaded\n body: encrypted_file[\"fileKey\"]\n }\n drive.files.create({\n resource: fileMetadata,\n media: media,\n fields: 'id'\n }, function (err, file) {\n if (err) {\n // Handle error\n console.error(err);\n } else {\n console.log(`File uploaded with Id ${file.data.id}`);\n }\n });\n drive.files.create({\n resource: {\n 'name': encrypted_file[\"fileName\"]+\".key\"\n },\n media: key_media,\n fields: 'id'\n }, function (err, file) {\n if (err) {\n // Handle error\n console.error(err);\n } else {\n console.log(`File key uploaded with Id ${file.data.id}`);\n }\n });\n}", "function create(req, res) {\n req.files.file.uid = req.user.email;\n req.files.file.path = req.files.file.path.replace(\"client\\\\\", \"\").replace('client/', '').replace('client//', ''); \n \n var str = req.files.file.path;\n var arr = str.split(\"\\\\\");\n console.log(str);\n console.log(arr);\n var tempPath = arr[4];\n var fullPath = \"https://s3.amazonaws.com/mediabox-adverts//resources/\"+tempPath; \n req.files.file.path = fullPath;\n \n var CODE_PATH = '/resources/';\n var fileList = getFileList(__dirname + CODE_PATH);\n\n fileList.forEach(function(entry) {\n uploadFile(CODE_PATH + entry, __dirname + CODE_PATH + entry);\n \n fs.unlink(__dirname + CODE_PATH + entry, function(error) {\n if (error) {\n throw error;\n }\n console.log('Deleted dog.jpg!!');\n });\n \n }); \n \n \n return _media2.default.create(req.files.file).then(respondWithResult(res, 201)).catch(handleError(res));\n}", "static addNewFile(username, fullPath) {\n const entry = metaUtils.getFileMetadata(username, fullPath);\n Databases.fileMetaDataDb.update({path: entry.path}, entry, {upsert: true}, (err, doc) => {\n if (err) {\n console.log(\"could not insert : \" + err);\n }\n else {\n console.log('Inserted');\n }\n });\n }", "function createBlob() {\n}", "function fileFactory(arg) {\n\t// Files can be constructed from either a siapath or a status object\n\t// returned from /renter/files||downloads\n\tvar f = Object.create(file);\n\tif (typeof arg === 'object'){\n\t\tObject.assign(f, arg);\n\t\tf.path = arg.siapath;\n\t} else if (typeof arg === 'string') {\n\t\tf.path = arg;\n\t} else {\n\t\tconsole.error('Unrecognized constructur argument: ', arguments);\n\t}\n\n\treturn f;\n}", "function create(path, mode, callback) {\n console.log(\"TODO: Implement create\", arguments);\n }", "createFile(user, repo, branch, path, content, accessToken) {\n debug(`${user}/${repo}: Creating file ${path} on branch ${branch}`)\n const url = API_URL_TEMPLATES.REPO_CONTENT\n .replace('${owner}', user)\n .replace('${repo}', repo) + `${path}`\n const message = `Create ${path}`\n const encodedContent = encode(content)\n return this.fetchPath('PUT', url, {message, branch, content: encodedContent}, accessToken)\n }", "function createFile(params){\n if(checkFormat()){\n var filename = params[0].substr(0,60);\n var fileFound = false;\n var reachedEnd = false;\n var i = \"001\";\n while(!reachedEnd){\n if(sessionStorage.getItem(i)[0] === \"1\"){\n if (filename === sessionStorage.getItem(i).split(\"|\")[1].split(\"~\")[0]){\n fileFound = true;\n reachedEnd = true;\n }\n i = stringFormatAndInc(i);\n }\n else{\n reachedEnd = true;\n }\n }\n if(!fileFound){\n var dirSection = sessionStorage.getItem(MBR).substring(4,7);\n //var newDirSection = stringFormatAndInc(dirSection);\n \n var currentFileSection = sessionStorage.getItem(MBR).substring(8,11);\n //var newFileSection = stringFormatAndInc(currentFileSection);\n\n //regex to replace the amount of characters that filename will take up\n var re = new RegExp(\"^.{\"+filename.length+\"}\")\n var replacedData = sessionStorage.getItem(dirSection).substring(5).replace(re,filename);\n sessionStorage.setItem(currentFileSection,\"1---\"+FILE_DIVIDER+FILE_FILLER);\n sessionStorage.setItem(dirSection,\"1\"+currentFileSection+FILE_DIVIDER+replacedData);\n updateMBR();\n //sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(dirSection,newDirSection).replace(currentFileSection,newFileSection));\n \n \n _StdIn.putText(\"File Created!\");\n _StdIn.advanceLine();\n _OsShell.putPrompt();\n }\n else{\n if(params[3]){//FROM OS\n\n }else{\n _StdIn.putText(\"File Has Already Been Created!\");\n _StdIn.advanceLine();\n _OsShell.putPrompt();\n }\n }\n /*\n var data = params[1];\n var sections = Math.ceil(data.length/60);\n var dataSections = [];\n dataSections = data.match(/.{1,60}/g) || [];\n\n\n while(sections>0){\n if(sections === 1){\n fileSection = sessionStorage.getItem(MBR).substring(8,11);\n newSection = stringFormatAndInc(fileSection);\n sessionStorage.setItem(fileSection,\"1---|\"+data);\n sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(fileSection,newFileSection));\n }\n else{\n fileSection = sessionStorage.getItem(MBR).substring(8,11);\n newFileSection = stringFormatAndInc(fileSection);\n sessionStorage.setItem(fileSection,\"1\"+newFileSection+FILE_DIVIDER+data);\n sessionStorage.setItem(MBR,sessionStorage.getItem(MBR).replace(fileSection,newFileSection));\n }\n sections--;\n }*/\n\n /*for (var i=0; i<MAX_DIR_TRACK_LEN; i++) {\n for (var j=1; j<=MAX_BLOCK_LEN; j++) {\n if(j<=9){\n if(sessionStorage[\"00\"+j].substring(0,1)===\"0\"){\n sessionStorage[\"00\"+j] = \n }\n }\n else{\n if(sessionStorage[\"0\"+j].substring(0,1)===\"0\"){\n sessionStorage[\"0\"+j] = \n }\n }\n }\n }*/\n }\n}", "function crearArchivo(path, content){fs.writeFile(path, content, (err) => {if(err) throw err;});}", "function createFile() {\n var e = new emitter();\n\n fs.readFile('newdocument.txt', function (err) {\n if (err) throw err;\n e.emit('theProcess');\n });\n\n return e;\n}", "async createFile(filePath, contents, newFileName = \"Untitled.spell\", die) {\n if (!die) die = getDier(this, \"creating file\", { projectId: this.projectId, filePath })\n\n if (!filePath) filePath = prompt(\"Name for the new file?\", newFileName)\n if (!filePath) return undefined\n die.params.filePath = filePath\n\n await this.loadOrDie(die)\n if (this.getFile(filePath)) die(\"File already exists.\")\n\n // Tell the server to create the file, which returns updated index\n try {\n const newIndex = await $fetch({\n url: `/api/projects/create/file`,\n contents: {\n projectId: this.projectId,\n filePath,\n contents: contents ?? `## This space intentionally left blank`\n },\n requestFormat: \"json\",\n format: \"json\"\n })\n this.setContents(newIndex)\n } catch (e) {\n die(\"Server error creating file\", e)\n }\n\n // Return the file\n return this.getFile(filePath) || die(\"Server didn't create file.\")\n }", "create() {\n this.proc.args.file = null;\n\n this.emit('new-file');\n\n this.updateWindowTitle();\n }", "function FileHelper()\n{\n}", "function createTable()\n{\n \n\tfilesDB.transaction(\n function (transaction) {\n transaction.executeSql('CREATE TABLE IF NOT EXISTS files(id VARCHAR NOT NULL PRIMARY KEY, LastModified TIMESTAMP NOT NULL, name TEXT NOT NULL, json BLOB NOT NULL DEFAULT \"\");', [], nullDataHandler, killTransaction);\n \t}\n\t);\n}", "function createObject(metadata) {\n\t return request.post(config.base + '/api/1/files/create_object/').set('Authorization', 'Token ' + config.token).send(metadata).then(processResponse);\n\t}", "function createFile(filePath, fileName, content) {\n fs.writeFile(filePath, content, function(err) {\n if (err) {\n return console.log(err);\n }\n console.log(`${fileName} was saved!`);\n });\n}", "function createFVSObject (fileContents) {\n // a. Hash the contents of the file\n // b. Use the first two characters of the hash as the directory in .fvs/objects\n // c. Check if the directory already exists! Do you know how to check if a directory exists in node?\n // Hint: you'll need to use a try/catch block\n // Another hint: look up fs.statSync\n // d. Write a file whose name is the rest of the hash, and whose contents is the contents of the file\n // e. Return the hash!\n}", "function createTxtErrorFile(fileErrorString, rootFldr, numFiles, fileAction) {\n\n // various file strings\n var arrowEnd = \"<END>\\n\";\n var header_searchRoot = \"\\n\\n< --- ROOT SEARCH PATH --- >\\n\";\n var header_AIFiles = \"\\n\\n< --- AI FILE PATHS --- >\\n\";\n var dateHeader = \"< --- CREATED ON --- >\\n\" + new Date() + \"\\n<END>\" + \"\\n\";\n \n // creates file\n if(fileAction == \"create\"){\n // extracts folder location \n var reg = /[^\\\\]+$/g; //last folder sting in full path\n var folderLocation = rootFldr.fsName.match(reg).toString().replace(/( +)/, \"\");\n \n // create a text file to store all the file and artboard data\n file_errorsInFile = File(rootFldr + '/' + 'log_errorFiles_' + folderLocation + '.txt');\n file_errorsInFile.open(\"w\");\n file_errorsInFile.write(dateHeader); // writes date header string to file\n \n file_errorsInFile.write(header_searchRoot + rootFldr +\"\\n\" + arrowEnd); \n file_errorsInFile.write(header_AIFiles);\n } // end of create action\n \n // write errors to file\n if(fileAction == \"write\"){\n file_errorsInFile.writeln(fileErrorString);\n }// end of write action\n\n // close file\n if(fileAction == \"close\"){ \n file_errorsInFile.write(\n arrowEnd +\n \"\\n\\n< --- PROCESS DATA --- >\"\n + \"\\n\" + \"Total number of files that failed check = \" + numFiles\n + \"\\n\" + arrowEnd);\n file_errorsInFile.close();\n } // end of close action\n}", "function createFile() {\r\n const iterator1 = stories[Symbol.iterator]();\r\n var combos = \"\";\r\n for (const item of iterator1) {\r\n combos = combos + item[0] + '\\n' + splitConstant + '\\n' + item[1] + '\\n' + splitConstant + '\\n';\r\n }\r\n var text = combos;\r\n var filename = 'stories.txt';\r\n var element = document.createElement('a');\r\n element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));\r\n element.setAttribute('download', filename);\r\n element.style.display = 'none';\r\n document.body.appendChild(element);\r\n element.click();\r\n document.body.removeChild(element);\r\n}", "function FileHelper() {\n\n}", "function create( src, dst, opts ) {\n\n if( !src || !src.length )\n throw { fluenterror: HMSTATUS.createNameMissing, quit: true };\n\n _.each( src, function( t ) {\n var safeFmt = opts.format.toUpperCase();\n this.stat( HMEVENT.beforeCreate, { fmt: safeFmt, file: t } );\n MKDIRP.sync( PATH.dirname( t ) ); // Ensure dest folder exists;\n var RezClass = require('../core/' + safeFmt.toLowerCase() + '-resume' );\n RezClass.default().save(t);\n this.stat( HMEVENT.afterCreate, { fmt: safeFmt, file: t } );\n }, this);\n\n }", "function newfile() {\n let newFile = document.querySelector(\".add-file\");\n\n fileDiv = document.createElement(\"div\");\n fileDiv.classList.add(`file-div-${fileCounter}`);\n\n buttonRemoveFile = document.createElement(\"button\");\n buttonRemoveFile.classList.add(`file-div-${fileCounter}`);\n buttonRemoveFile.setAttribute(\"type\", \"button\");\n buttonRemoveFile.innerHTML = \"Remove File -\";\n\n labelFileComplete = document.createElement(\"label\");\n labelFileComplete.setAttribute(\"for\", \"completed-file\");\n labelFileComplete.innerHTML = \"Completed\"\n fileCompleteRadio = document.createElement(\"input\");\n fileCompleteRadio.setAttribute(\"type\", \"checkbox\");\n fileCompleteRadio.setAttribute(\"id\", \"completed-file\");\n fileCompleteRadio.setAttribute(\"name\", `file-name-${fileCounter}`);\n fileCompleteRadio.setAttribute(\"value\", \"completed\");\n fileCompleteRadio.classList.add(\"create-checkbox\");\n\n labelFileName = document.createElement(\"label\");\n labelFileName.setAttribute(\"for\", \"file-name\");\n labelFileName.classList.add(`label-filename`);\n labelFileName.innerHTML = \"File name: \";\n \n inputFileName = document.createElement(\"input\");\n inputFileName.setAttribute(\"type\", \"text\");\n inputFileName.setAttribute(\"id\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"name\", `file-name-${fileCounter}`);\n inputFileName.setAttribute(\"size\", \"50.5\");\n\n labelFileDesc = document.createElement(\"label\");\n labelFileDesc.setAttribute(\"for\", \"file-desc\");\n labelFileDesc.classList.add(\"label-filedesc\");\n labelFileDesc.innerHTML = \"File Description: \";\n\n inputFileDesc = document.createElement(\"textarea\");\n inputFileDesc.setAttribute(\"id\", `file-desc`);\n inputFileDesc.setAttribute(\"name\", `file-name-${fileCounter}`);\n\n newBreak = document.createElement(\"br\");\n oneMoreBreak = document.createElement(\"br\");\n secMoreBreak = document.createElement(\"br\");\n\n inputFileName.append(newBreak);\n\n divAddClass = document.createElement(\"div\");\n divAddClass.classList.add(`add-class-${fileCounter}`, \"add-class\");\n \n buttonAddClass = document.createElement(\"button\");\n buttonAddClass.classList.add(`${fileCounter}`);\n buttonAddClass.classList.add(`add-class-button`);\n buttonAddClass.setAttribute(\"type\", \"button\");\n buttonAddClass.innerHTML = \"Add Class +\";\n\n divAddClass.append(buttonAddClass);\n divAddClass.append(newBreak);\n fileDiv.append(labelFileName);\n fileDiv.append(inputFileName);\n fileDiv.append(fileCompleteRadio);\n fileDiv.append(labelFileComplete);\n fileDiv.append(buttonRemoveFile);\n fileDiv.append(secMoreBreak);\n fileDiv.append(labelFileDesc);\n fileDiv.append(oneMoreBreak);\n fileDiv.append(inputFileDesc);\n fileDiv.append(divAddClass);\n fileDiv.append(newBreak);\n newFile.append(fileDiv);\n fileCounter = fileCounter + 1;\n}", "function FileMgr() {\n}", "function createFileOrFolder(parentId, type) {\n var parent = findElementById(parentId);\n var newElementName = type == \"folder\" ? \"new folder\" : \"new file.txt\";\n var newName = getUniqueName(newElementName, parent);\n var newElement = {id: ++lastAddedId, name: newName};\n if (type == \"file\") {\n newElement.content = \"\";\n } else {\n newElement.children = [];\n }\n parent.children.push(newElement);\n saveData();\n }", "function makeTheFile(name, data){\n fs.writeFile('README.md', data, (err) => {\n if (err){\n console.log(err);\n }\n console.log(\"README has been successfully generated.\")\n })\n }", "create (file,data) {\n fs.open(`${baseDir}/${file}.json`,'wx',(err,identifier)=>{\n if(!err && identifier){\n //Overide default to place objects inside of an array\n //let jsonArray = [];\n\n //jsonArray.push(data);\n\n let stringData = JSON.stringify(data,null,3);\n\n fs.writeFile(identifier,stringData,(err)=>{\n if(!err){\n fs.close(identifier,(err) =>{\n if(!err) console.log('no errors');\n else console.log(err);\n })\n } else console.log(err);\n })\n }\n else console.log(err);\n });\n }", "function createFile(path, content) {\n fs.writeFileSync(path, content, { encoding: \"utf-8\" });\n}", "phototaked(file) {}", "function createFile(path) {\n if(!fs.existsSync(path)){\n log('creating file to :::', path);\n return fs.writeFileSync('./1-json.json', jsonBook);\n } \n else log('The file already exists');\n}", "static genEmptyFileObj() {\n return new FileObject();\n }", "function File(info) {\n this.name = info.name;\n this.kind = info.kind;\n this.genre = info.genre;\n this.size = info.size;\n this.last_revision = info.commit_revision;\n this.author = info.commit_author;\n this.last_date = info.commit_date;\n this.id = info.index;\n this.commit_history = {};\n this.comments = [];\n}", "function processFileCreated(event) {\n // Get file info from slack.\n var res = getFileInfo(event.file.id);\n\n // Download Image\n var blob = getPrivateImage(res.file.url_private_download);\n \n // save my googel driver\n var folder = DriveApp.getFolderById(applicationFileFolderId);\n folder.createFile(blob);\n}", "function makeTempFile()\r\n{\r\n var tfolder, TemporaryFolder = 2;\r\n tfolder = fso.GetSpecialFolder(TemporaryFolder);\r\n \r\n var tname = fso.GetTempName();\r\n var tfile = tfolder.CreateTextFile(tname);\r\n tfile.Close();\r\n \r\n return tfolder.Path + \"\\\\\" + tname;\r\n}", "function create(files){\n\tvar AWS = require('aws-sdk');\n\n\tvar awsConfig = new AWS.Config({\n\t\taccessKeyId: config.accessKeyId, \n\t\tsecretAccessKey:config.secretAccessKey,\n\t\tregion: config.region\n\t});\n\n\tAWS.config=awsConfig;\n\n\tvar s3 = new AWS.S3( { params: {Bucket: config.s3BucketName} } );\t\n\n\tvar date = new Date();\n\tfiles.forEach(function(item){\n\t\tvar options={\n\t\t\tKey:item.filename,\n\t\t Body:new Buffer(item.data.replace(/^data:image\\/\\w+;base64,/, \"\"),'base64'),\n\t\t ContentEncoding: 'base64',\n\t\t ContentType: 'image/jpeg'\n\t\t};\n\n\t\ts3.putObject(options, function(err,data){\n\t\t\tif(err){\n\t\t\t\tconsole.log('~~error~',err);\n\t\t\t}else{\n\t\t\t\tconsole.log('~~success~'+date.toTimeString());\n\t\t\t}\n\t\t});\n\t});\n}", "async createFile(name) {\n let normalizedDir = this.fullPath;\n if (normalizedDir.charAt(normalizedDir.length - 1) === path_1.sep) {\n normalizedDir = normalizedDir.slice(0, -1);\n }\n const fd = await util_1.promisify(fs_1.open)(`${normalizedDir}${path_1.sep}${name}`, 'w');\n await util_1.promisify(fs_1.close)(fd);\n this.context.socketService.notifyRefresh(this.path.replace(/\\\\/g, '/').replace(/\\/$/, \"\"));\n return this.context.getHierarchyItem(this.path + name);\n }", "createFile() {\n try {\n fse.ensureDirSync(this.directory);\n } catch(e) {\n if ( e.code != 'EEXIST' ) throw e;\n }\n\n if (!utils.fileExists(this.file)) {\n fs.writeFileSync(this.file, this.serialize(this.defaultConfig));\n log.d('Created the default config file in ' + this.file);\n }\n }", "putFile(folder, key, file) {\r\n throw \"putFile(folder,key,file) Not Implemented\";\r\n }", "function initCreateFileActions(){\r\n\t\t\r\n\t\tjQuery(\"#uc_dialog_create_file_action\").on(\"click\",createFile);\r\n\t\t\r\n\t\tjQuery(\"#uc_dialog_create_file_name\").doOnEnter(createFile);\r\n\t}", "function addFile(fileInfo)\n{\n\tvar $FileObj = $(\"#FileTemplate\").clone();\n\n\t$FileObj.attr(\"id\", \"file-\" + globalFileCount);\n\n\tglobalFileCount++;\n\n\tif(fileInfo.name)\n\t\t$FileObj.find(\".file-name\").html(fileInfo.name);\n\n\tif(fileInfo.size)\n\t\t$FileObj.find(\".file-size\").html(fileInfo.size);\n\n\tif(fileInfo.chunks)\n\t\t$FileObj.find(\".file-chunk\").html(fileInfo.chunks);\n\n\t$(\".file-list-container\").append($FileObj);\n}", "function onInitFs(fs){\r\n\t\tvar write = data ? true : false;\r\n\t\tfs.root.getFile(file, { create: createFile }, function(x){\r\n\t\t\tif (createFile) { callback(\"\"); return }\t// arquivo não existia, foi criado\r\n\t\t\tif (data && x.isFile){\r\n\t\t\t\t// file write, remove first\r\n\t\t\t\tx.remove(function(){\t// remove\r\n\t\t\t\t\tfs.root.getFile(file, { create: true }, function(x){\r\n\t\t\t\t\t\tx.createWriter(function(fileWriter){\r\n\t\t\t\t\t\t\tfileWriter.seek(fileWriter.length); // Start write position at EOF.\r\n\t\t\t\t\t\t\tvar blob = new Blob([data], {type: 'text/plain'});\r\n\t\t\t\t\t\t\tfileWriter.write(blob);\r\n\t\t\t\t\t\t\tcallback(true)\r\n\t\t\t\t\t\t}, function(e){ console.log('api file write (create) error: ' + e.name + \" (\" + file + \")\"); callback(null) });\r\n\t\t\t\t\t}, function(e){ console.log('api file create error: ' + e.name + \" (\" + file + \")\"); callback(null) });\r\n\t\t\t\t}, function(e){ console.log('api file remove: ' + e.name + \" (\" + file + \")\"); callback(null) });\r\n\t\t\t}else\r\n\t\t\t\t// file read\r\n\t\t\t\tx.file(function(f){\r\n\t\t\t\t\tvar reader = new FileReader();\r\n\t\t\t\t\treader.onloadend = function(e) {\r\n\t\t\t\t\t\tcallback(this.result)\r\n\t\t\t\t\t}\r\n\t\t\t\t\treader.readAsText(f);\r\n\t\t\t\t}, function(e){ console.log('api file read error: ' + e.name + \" (\" + file + \")\"); callback(null) });\r\n\t\t}, function(e){ \r\n\t\t\tif (!createFile) api.fileRW(file, data, true, function(x){\t// arquivo não existe, crie-o\r\n\t\t\t\tconsole.log('api file: arquivo criado (' + file + \")\");\r\n\t\t\t\tcallback(x)\r\n\t\t\t})\r\n\t\t\telse{\r\n\t\t\t\tconsole.log('api file error (criação): ' + e.name + \" (\" + file + \")\");\r\n\t\t\t\tcallback(null)\t// erro de leitura/gravação\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function addFile(path) {\n db.run(\"INSERT INTO paths VALUES (null, (?))\", path, function (err) {\n if (err) {\n console.log(err);\n return;\n }\n console.log(\"INSERT: \"+this.lastID);\n });\n}", "function gotFileEntry(fileEntry) {\n\t\t\tvar d = new Date();\n\t\t\tvar nome_arquivo = d.getTime().toString() + '.jpg';\n\t\t\tfileEntry.moveTo(fs.root, nome_arquivo , fsSuccess, deuerro);\n\t\t}", "function writeFile() {\n const ERR_MESS_WRITE = \"TODO: Trouble writing file\";\n\n todocl.dbx.filesUpload({\n contents: todocl.todoText,\n path: todocl.path,\n mode: 'overwrite',\n autorename: false,\n mute: true\n }).then(function (response) {\n\n }).catch(function (error) {\n todocl.dbx.accessToken = null;\n todocl.out.innerHTML = ERR_MESS_WRITE;\n });\n }", "function createTextFile(fn, txt, server) {\n if (getTextFile(fn, server) !== null) {\n console.log(\"ERROR: createTextFile failed because the specified \" +\n \"server already has a text file with the same fn\");\n return;\n }\n var file = new TextFile(fn, txt);\n server.textFiles.push(file);\n return file;\n}", "addMediaFile(narrationId, filename, tmpPath, type) {\n const filesDir = path.join(config.files.path, narrationId.toString());\n const typeDir = type === \"backgroundImages\" ?\n \"background-images\" : type;\n const finalDir = path.join(filesDir, typeDir);\n\n return getFinalFilename(finalDir, filename).then(finalPath => {\n return Q.nfcall(fs.move, tmpPath, finalPath).then(() => ({\n name: path.basename(finalPath),\n type: type\n }));\n });\n }", "function addFile() {\n document.getElementById(\"chronovisor-converter-container\").appendChild(fileTemplate.cloneNode(true));\n maps.push(null);\n files.push(null);\n data.push(null);\n og_data.push(null);\n }", "function createNewFile() {\n winList.push(createWindow());\n}", "function addFile(filename, filesize){\n\tvar query = connection.query('insert into filelist(school_patch_id, filename, filesize, download_status) values ('+schoolPatchId+',\"'+filename+'\", \"'+filesize+'\",\"0\" ) ', function(err, rows) {\n\t\tif (err)\n\t\t\tthrow err;\n\n\t\tconsole.log(\"file added \"+filename+\" in db after compression\");\n\t});\n}", "function createUpload(filename, file) {\n return api.postJSON(api.CREATE_ENDPOINT, {\n name: filename.trim() || file.name,\n type: file.type || \"application/octet-stream\",\n size: file.size,\n }).then(function (text) {\n return parseInt(text);\n });\n}", "function create_account(data,files)\r\n{var f=[];\r\n for(var i=0;i<3;i++)\r\n {\r\n if(files[i]==undefined)\r\n f[i]=null;\r\n else\r\n f[i]=files[i].filename;\r\n\r\n }\r\n var query='insert into info values (\"'+data.newemail+'\",\"'+data.pass+'\",\"'\r\n +data.firstname+'\",\"'+data.date+'\",\"'+data.month+'\",\"'+data.year+'\",\"'+data.address+'\",\"'+f[0]+'\",\"'+f[1]+'\",\"'+f[2]+'\")';\r\n\r\n con.query(query,function(err,response,feilds){\r\n if(err)\r\n throw err;\r\n return;\r\n });\r\n\r\n}", "function createPrintFile(uid, artworkUID, artistName) {\n var curatorStorage = authenticateCurator();\n var artStorage = authenticateArtist();\n\n var pfBucket = curatorStorage.bucket(\"printfiles\");\n var artBucket = artStorage.bucket(\"art-uploads\");\n var artPath = \"portal/\" + uid + \"/uploads/\" + artworkUID;\n var master = artBucket.file(artPath);\n var white = 0xFFFFFFFF; //R G B A in HEXDEC\n\n //NOTE arbitrary spacing variables\n var widthRatio = 4/3; //NOTE width of whiteboard to artwork\n var nameHeight = 50; //50px\n var logoSize = 75; //75px (its a square)\n var maxLabelWidth = 1800; // name shouldnt be wider than artwork\n var maxLabelHeight = 400;\n var minArtworkDim = 1500; // no dimension of an artwork less than {}px\n\n master.download( function (err,artBuffer) {\n if (err) {\n console.log(err);\n res.status(500).send({error:\"Error connecting to Art Bucket file\", e:err});\n }\n\n jimp.read(artBuffer).then(function (artwork) {\n // Set Artwork variables\n var artWidth = artwork.bitmap.width;\n var artHeight = artwork.bitmap.height;\n // Set Whiteboard Variables\n var dims = getPaddingRatio(artWidth,artHeight,widthRatio);\n var whiteWidth = dims[0];\n var whiteHeight = dims[1];\n var wPad = Math.floor((whiteWidth-artWidth)/2); //\n var hPad = Math.floor(((whiteHeight-artHeight)/2));\n\n if (artWidth >= minArtworkDim && artHeight >= minArtworkDim) {\n console.log(\">Image Meets Min Resolution\");\n var placeholder = new jimp(dims[0], dims[1], white, function (err, whiteboard) {\n // console.log(\">Whiteboard Drawn\");\n jimp.loadFont('./font/tekuma128.fnt').then(function (font) {\n // console.log(\">Font Loaded\");\n jimp.read('./img/logo.png').then(function(rawLogo) {\n // console.log(\">Logo Loaded\");\n var placeholder2 = new jimp(maxLabelWidth,maxLabelHeight, function (err,fullLabel) {\n if (err) {console.log(err);}\n // Write the artist name, crop around it, then down scale it.\n var name = fullLabel.clone()\n .print(font, 0,0, artistName)\n .autocrop()\n .resize(jimp.AUTO, nameHeight); // 50px height\n var nameWidth = name.bitmap.width;\n\n // Set Logo Params\n var logo = rawLogo.autocrop().resize(logoSize,logoSize);\n var logoX = nameWidth/2 - logoSize/2;\n var logoY = nameHeight + logoSize/2;\n // Create Label ( name and logo composition )\n var cropHeight = nameHeight + logoSize*2;\n var cropWidth = nameWidth + 5;\n fullLabel.composite(name,0,0)\n .composite(logo,logoX,logoY)\n .crop(0,0, cropWidth, cropHeight);\n\n var labelWidth = fullLabel.bitmap.width;\n var labelHeight = fullLabel.bitmap.height;\n var labelX = (whiteWidth/2) - (labelWidth/2);\n var labelY = (whiteHeight) - (hPad/2) - (labelHeight/2);\n\n console.log(\">Label Made\");\n whiteboard\n .composite(artwork ,wPad, hPad)\n .composite(fullLabel, labelX,labelY)\n .rgba(false)\n .getBuffer(jimp.MIME_PNG, function (err,printBuffer){\n var savePath = uid + '/' + artworkUID;\n var printfile = pfBucket.file(savePath);\n var options = {\n metadata:{\n contentType: 'image/png'\n },\n predefinedAcl:\"projectPrivate\"\n };\n printfile.save(printBuffer,options, function (err) {\n if (!err) {\n console.log(\">>>Printfile Generated Successfully\");\n res.status(200).send(\">Printfile Generated Successfully\")\n } else {\n console.log(\">>>Error:\",err);\n res.status(500).send({error: \">Error uploading to Curator, but file was made\"});\n }\n });\n });\n });\n });\n });\n });\n } else {\n console.log(\">Image Error. Min w or h is \"+minArtworkDim+\" px. Was:\",artWidth,artHeight);\n res.status(400).send({error: \"Requested image does not meet 1800x1800px minimum.\"});\n }\n });\n });\n }", "function getFile(callback) {\n if (msg.rootDirectoryFID) {\n var parent = tree.getFile(msg.rootDirectoryFID);\n // todo evaluate/handle rootDirectoryFID, i.e. resolve filename relative to specified parent directory\n }\n tree.openOrCreate(msg.fileName, msg.createDisposition, !!(msg.createOptions & common.FILE_DIRECTORY_FILE), callback);\n }", "createModelFile() {\n // check if the `users.js` file exists already\n if (!fs.existsSync(`${this.model}/users.js`)) {\n const file = path.join(__dirname, '../files/users.js')\n\n fs.readFile(file, \"utf-8\", (err, data) => {\n if (err) {\n console.log(err);\n return;\n }\n\n // write `userrs.js` file\n fs.writeFile(`${this.model}/users.js`, data, (err) => {\n if (err) {\n console.log('Error creating users.js file');\n return;\n }\n\n console.log(\"Successfully created users.js\");\n });\n });\n\n return;\n }\n\n console.log(`users.js already exists`);\n }", "function addFile(target, file) {\n const isImage = file.type.match(\"image.*\"),\n objectURL = URL.createObjectURL(file);\n\n const clone = isImage\n ? imageTempl.content.cloneNode(true)\n : fileTempl.content.cloneNode(true);\n\n clone.querySelector(\"h1\").textContent = file.name;\n clone.querySelector(\"li\").id = objectURL;\n clone.querySelector(\".delete\").dataset.target = objectURL;\n clone.querySelector(\".size\").textContent =\n file.size > 1024\n ? file.size > 1048576\n ? Math.round(file.size / 1048576) + \"mb\"\n : Math.round(file.size / 1024) + \"kb\"\n : file.size + \"b\";\n\n isImage &&\n Object.assign(clone.querySelector(\"img\"), {\n src: objectURL,\n alt: file.name\n });\n\n empty.classList.add(\"hidden\");\n target.prepend(clone);\n\n FILES[objectURL] = file;\n}", "function createNewSketchFile (){\n var newFile = MSDocument.new();\n newFile.setFileName(context.document.fileName().replace('.sketch','') + \" Library.sketch\")\n newFile.saveDocumentAs(newFile)\n log(newFile.fileName())\n return newFile\n}", "function savefile(paramsubsidi, paraminshead){\r\n\t// Valida si es OneWorld\r\n\tvar featuresubs = nlapiGetContext().getFeature('SUBSIDIARIES');\r\n\r\n\t// Ruta de la carpeta contenedora\r\n\tvar FolderId = nlapiGetContext().getSetting('SCRIPT', 'custscript_lmry_pe_2016_rg_file_cabinet');\r\n\r\n\t// Almacena en la carpeta de Archivos Generados\r\n\tif (FolderId!='' && FolderId!=null) {\r\n\t\t// Extension del archivo\r\n\t\tvar fileext = '.txt';\r\n\t\tif ( paraminshead=='T' ) \r\n\t\t{\r\n\t\t\tfileext = '.csv';\r\n\t\t\t\r\n\t\t\t// Reemplaza la coma por blank space\r\n\t\t\tstrName1 = strName1.replace(/[,]/gi,' ');\r\n\t\t\t// Reemplaza la pipe por coma\r\n\t\t\tstrName1 = strName1.replace(/[|]/gi,',');\r\n\t\t\tif(strName2!=''){\r\n\t\t\t\t// Reemplaza la coma por blank space\r\n\t\t\t\tstrName2 = strName2.replace(/[,]/gi,' ');\r\n\t\t\t\t// Reemplaza la pipe por coma\r\n\t\t\t\tstrName2 = strName2.replace(/[|]/gi,',');\r\n\t\t\t}\r\n\t\t\tif(strName3!=''){\r\n\t\t\t\t// Reemplaza la coma por blank space\r\n\t\t\t\tstrName3 = strName3.replace(/[,]/gi,' ');\r\n\t\t\t\t// Reemplaza la pipe por coma\r\n\t\t\t\tstrName3 = strName3.replace(/[|]/gi,',');\r\n\t\t\t}\r\n\t\t\tif(strName4!=''){\r\n\t\t\t\t// Reemplaza la coma por blank space\r\n\t\t\t\tstrName4 = strName4.replace(/[,]/gi,' ');\r\n\t\t\t\t// Reemplaza la pipe por coma\r\n\t\t\t\tstrName4 = strName4.replace(/[|]/gi,',');\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Genera el nombre del archivo\r\n\t\tvar FileName = Name_File(paramsubsidi);\r\n\t\tvar NameFile = FileName + '(1)' + fileext;\r\n\t\tvar NameFile2 = FileName + '(2)' + fileext;\r\n\t\tvar NameFile3 = FileName + '(3)' + fileext;\r\n\t\tvar NameFile4 = FileName + '(4)' + fileext;\r\n\t\t\r\n\t\t// Crea el archivo\r\n\t\tvar File = nlapiCreateFile(NameFile, 'PLAINTEXT', strName1);\t\r\n\t\t\tFile.setFolder(FolderId);\r\n\t\t// Termina de grabar el archivo\r\n\t\tvar idfile = nlapiSubmitFile(File);\r\n\t\t// Trae URL de archivo generado\r\n\t\tvar idfile2 = nlapiLoadFile(idfile);\r\n\t\r\n\t\t// Segundo archivo generado\r\n\t\tif(strName2!=''){\r\n\t\t\tvar File2 = nlapiCreateFile(NameFile2, 'PLAINTEXT', strName2);\t\r\n\t\t\t \tFile2.setFolder(FolderId);\r\n\t\t\t// Termina de grabar el archivo\r\n\t\t\tvar idfile_2 = nlapiSubmitFile(File2);\r\n\t\t\t// Trae URL de archivo generado\r\n\t\t\tvar idfile2_2 = nlapiLoadFile(idfile_2);\r\n\t\t}\r\n\t\t\r\n\t\t// Tercer archivo generado\r\n\t\tif(strName3!=''){\r\n\t\t\tvar File3 = nlapiCreateFile(NameFile3, 'PLAINTEXT', strName3);\t\r\n\t\t\t\tFile3.setFolder(FolderId);\r\n\t\t\t// Termina de grabar el archivo\r\n\t\t\tvar idfile_3 = nlapiSubmitFile(File3);\r\n\t\t\t// Trae URL de archivo generado\r\n\t\t\tvar idfile2_3 = nlapiLoadFile(idfile_3);\r\n\t\t}\t\t\t\r\n\t\t\t\r\n\t\t// Cuarto archivo generado\r\n\t\tif(strName4!=''){\r\n\t\t\tvar File4 = nlapiCreateFile(NameFile4, 'PLAINTEXT', strName4);\t\r\n\t\t\t\tFile4.setFolder(FolderId);\r\n\t\t\t// Termina de grabar el archivo\r\n\t\t\tvar idfile_4 = nlapiSubmitFile(File4);\r\n\t\t\t// Trae URL de archivo generado\r\n\t\t\tvar idfile2_4 = nlapiLoadFile(idfile_4);\r\n\t\t}\t\t\t\r\n\r\n\t\tvar urlfile = '';\r\n\t\tvar urlfile_2 = '';\r\n\t\tvar urlfile_3 = '';\r\n\t\tvar urlfile_4 = '';\r\n\r\n\t\t// Obtenemo de las prefencias generales el URL de Netsuite (Produccion o Sandbox)\r\n\t\tvar getURL = objContext.getSetting('SCRIPT', 'custscript_lmry_netsuite_location');\r\n\t\tif (getURL!='' && getURL!=''){\r\n\t\t\turlfile = 'https://' + getURL;\r\n\t\t\turlfile_2 = 'https://' + getURL;\r\n\t\t\turlfile_3 = 'https://' + getURL;\r\n\t\t\turlfile_4 = 'https://' + getURL;\r\n\t\t}\r\n\r\n\t\t// Asigna el URL al link del log de archivos generados\r\n\t\turlfile += idfile2.getURL();\r\n\t\tif(strName2!=''){\r\n\t\t\turlfile_2 += idfile2_2.getURL();\r\n\t\t}\r\n\t\tif(strName3!=''){\r\n\t\t\turlfile_3 += idfile2_3.getURL();\r\n\t\t}\r\n\t\tif(strName4!=''){\r\n\t\t\turlfile_4 += idfile2_4.getURL();\r\n\t\t}\r\n\t\t\r\n\t\t//Genera registro personalizado como log\r\n\t\tif(idfile) {\r\n\t\t\tvar usuario = objContext.getName();\r\n\t\t\tvar subsidi = '';\r\n\t\t\t// Valida si es OneWorld \r\n\t\t\tif (featuresubs == false){\r\n\t\t\t\tvar company = nlapiLoadConfiguration('companyinformation'); \r\n\t\t\t\tvar\tnamecom = company.getFieldValue('companyname');\r\n\t\t\t\t\tcompany = null;\r\n\t\t\t\tsubsidi = namecom;\r\n\t\t\t}else{\r\n\t\t\t\tif (paramsubsidi!=null && paramsubsidi!='') {\r\n\t\t\t\t\tsubsidi = nlapiLookupField('subsidiary', paramsubsidi, 'legalname');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar tmdate = new Date();\r\n\t\t var myDate = nlapiDateToString(tmdate);\r\n\t\t var myTime = nlapiDateToString(tmdate, 'timeofday'); \r\n\t\t var current_date = myDate + ' ' + myTime;\r\n\t\t var myfile = NameFile;\r\n\t\t \r\n\t\t var record = nlapiLoadRecord('customrecord_lmry_pe_2016_rpt_genera_log', parainternal);\r\n\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_name', NameFile);\r\n\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_transaction', 'Registro de Ventas Electronico 2016');\r\n\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_postingperiod', periodname);\r\n\t\t\t\tif (subsidi!='' && subsidi!=null){\r\n\t\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_subsidiary', subsidi);\r\n\t\t\t\t}else{\r\n\t\t\t\t\tsubsidi = record.getFieldValue('custrecord_lmry_pe_2016_rg_subsidiary');\r\n\t\t\t\t}\r\n\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_url_file', urlfile);\r\n\t\t\t\trecord.setFieldValue('custrecord_lmry_pe_2016_rg_employee', usuario);\r\n\t\t\tnlapiSubmitRecord(record, true);\r\n\t\t\t\r\n\t\t\tif(strName2!=''){\r\n\t\t\t\tvar record2 = nlapiCreateRecord('customrecord_lmry_pe_2016_rpt_genera_log');\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_name', NameFile2);\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_transaction', 'Registro de Ventas Electronico 2016');\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_postingperiod', periodname);\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_subsidiary', subsidi);\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_url_file', urlfile_2);\r\n\t\t\t\t\trecord2.setFieldValue('custrecord_lmry_pe_2016_rg_employee', usuario);\r\n\t\t\t\tnlapiSubmitRecord(record2, true);\r\n\t\t\t\t\r\n\t\t\t\tmyfile = myfile + '\\n\\r' + NameFile2;\r\n\t\t\t}\r\n\t\t\tif(strName3!=''){\r\n\t\t\t\tvar record3 = nlapiCreateRecord('customrecord_lmry_pe_2016_rpt_genera_log');\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_name', NameFile3);\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_transaction', 'Registro de Ventas Electronico 2016');\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_postingperiod', periodname);\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_subsidiary', subsidi);\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_url_file', urlfile_3);\r\n\t\t\t\t\trecord3.setFieldValue('custrecord_lmry_pe_2016_rg_employee', usuario);\r\n\t\t\t\tnlapiSubmitRecord(record3, true);\r\n\t\t\t\t\r\n\t\t\t\tmyfile = myfile + '\\n\\r' + NameFile3;\r\n\t\t\t}\r\n\t\t\tif(strName4!=''){\r\n\t\t\t\tvar record4 = nlapiCreateRecord('customrecord_lmry_pe_2016_rpt_genera_log');\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_name', NameFile4);\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_transaction', 'Registro de Ventas Electronico 2016');\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_postingperiod', periodname);\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_subsidiary', subsidi);\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_url_file', urlfile_4);\r\n\t\t\t\t\trecord4.setFieldValue('custrecord_lmry_pe_2016_rg_employee', usuario);\r\n\t\t\t\tnlapiSubmitRecord(record4, true);\r\n\t\t\t\t\r\n\t\t\t\tmyfile = myfile + '\\n\\r' + NameFile4;\r\n\t\t\t}\r\n\r\n\t\t\t// Envia mail de conformidad al usuario\r\n\t\t\tsendrptuser('PE - Registro de Ventas', 3, myfile);\r\n\t\t}\r\n\t} else {\r\n\t\t// Debug\r\n\t\tnlapiLogExecution('ERROR', 'Creacion de PDF', 'No existe el folder');\r\n\t}\r\n}", "function crearCarpeta(path){fs.mkdir(path, { recursive: true }, (err) => {if (err) throw err;});}", "function writeFile(FPath, info, docName) {\n if ( $.os.search(/windows/i) !== -1 ) { // Detect line feed type\n fileLineFeed = \"Windows\";\n }\n else {\n fileLineFeed = \"Macintosh\";\n } \n try {\n var f = new File(FPath + \"/\" + docName + \".txt\");\n f.remove();\n f.open('a');\n f.lineFeed = fileLineFeed;\n f.write(info);\n f.close();\n }\n catch(e){}\n} //end function", "_save() {\n let content = this.input.getContent().split(\"</div>\").join(\"\")\n .split(\"<div>\").join(\"\\n\");\n this.file.setContent(content);\n\n // create new file\n if (this.createFile)\n this.parentDirectory.addChild(this.file);\n }", "function createNewFileEntry(imgUri) {\n window.resolveLocalFileSystemURL(cordova.file.cacheDirectory, function success(dirEntry) {\n\n // JPEG file\n dirEntry.getFile(\"tempFile.jpeg\", { create: true, exclusive: false }, function (fileEntry) {\n\n // Do something with it, like write to it, upload it, etc.\n // writeFile(fileEntry, imgUri);\n console.log(\"got file: \" + fileEntry.fullPath);\n // displayFileData(fileEntry.fullPath, \"File copied to\");\n\n }, onErrorCreateFile);\n\n }, onErrorResolveUrl);\n}", "function createFiles(downloadPath, metadata, callback) {\n \n var basePath = path.join(downloadPath, metadata.name);\n\n if (metadata.length) {\n var file = new File(basePath, metadata.length, null, function(error) {\n if (error) {\n callback(new Error('Error creating file, error = ' + error));\n } else {\n callback(null, [file], metadata.length);\n }\n });\n } else {\n makeDirectory(basePath, function(error) {\n if (error) {\n callback(error);\n } else {\n nextFile(basePath, metadata.files, [], 0, callback);\n }\n });\n }\n}", "createFileKey() {\n return c.randomBytes(32);\n }", "constructor(filename) {\n if (!filename) {\n throw new Error(\"Creating a repository requires a new filename\");\n }\n this.filename = filename;\n //chek if the file exixts\n try {\n fs.accessSync(this.filename);\n //if not create a new file\n } catch (err) {\n fs.writeFileSync(this.filename, \"[]\");\n }\n }", "function create() {\n\t// make the overarching dir for ease of copying data around\n\tif(!fs.existsSync(\"instructions.md\")){\n\t\tconsole.log(\"ERR : No instructions.md file. Exiting without finishing...\");\n\t\treturn 1;\n\t}\n\tif(!fs.existsSync(\"tests\")){\n\t\tconsole.log(\"ERR : No tests file. Exiting without finishing... \");\n\t\treturn 1;\n\t}\n\tif(!fs.existsSync(project)){\n\t\tfs.mkdirSync(project);\n\t\tfullpath = project + \"/\";\n\t\tconsole.log(\"INFO : Project folder created\");\n\t}\n\tObject.keys(students).forEach(function (key) {\n\t\tvar err = genDir(students[key].login);\n\t\tif(err) {\n\t\t\tconsole.log(\"ERR : Error during creation of directory for : \" + students[key].login);\n\t\t} else {\n\t\t\tconsole.log(\"INFO : Directory created for : \" + students[key].login);\n\t\t}\n\t});\n}", "function _create() {\n if (vm.useFile == true) {\n return filesService.upload(vm.user.fileInput[0])\n .then(res => {\n vm.user.imageUrl = res.config.url\n _serviceCreate()\n })\n } else {\n _checkImage()\n _serviceCreate()\n }\n }", "function gotFile(file) {\n createDiv(\"<h1>\"+file.name+\"</h1>\").class(tabNumber).parent(\"left\");\n\n // Handle image and text differently\n if (file.type === 'image') {\n createImg(file.data);\n } \n else if (file.type === 'text') {\n tabs[file.name] = new Tab(file.name, tabNumber);\n switchTab(file.name, tabNumber);\n analyzeText(file, tabNumber);\n }\n}", "function generate_a_file_name (hashName) {\n\t\t\n\t\tvar maxi_lenght = 10;\n \t\tvar text = \"\";\n \t\tvar possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n\n \t\tfor (var i = 0; i < maxi_lenght; i++)\n \t\t\ttext += possible.charAt(Math.floor(Math.random() * possible.length));\n\n \t\t//verify to the data base if the file doesn't exixt yet\n \t\tIntello.verify_if_the_file_name_exist(text,function (statu) { \n \t\t\t\n \t\t\tif(statu==true){\n\n \t\t\t\thashName(text)\n \t\t\t}else{\n \t\t\t\tgenerate_a_file_name(hashName)\n \t\t\t}\n \t\t})\n\t}", "saveFile(file) {\r\n try {\r\n const fileExetnsion = file.picture.name.split('.').pop()\r\n //The v4 method creates a unique random name\r\n const fileName = uuid.v4() + '.'+fileExetnsion\r\n //The path.resolve() method is a cross-platform way of creating paths.\r\n const filePath = path.resolve('static', fileName)\r\n //The mv method will move the file to the specified path\r\n file.picture.mv(filePath)\r\n return fileName\r\n } catch (error) {\r\n console.log(error)\r\n }\r\n\r\n }", "function createTempFile(callback) {\r\n\t\tvar tmpFilename = \"tmp.dat\";\r\n\t\trequestFileSystem(TEMPORARY, 4 * 1024 * 1024 * 1024, function(filesystem) {\r\n\t\t\tfunction create() {\r\n\t\t\t\tfilesystem.root.getFile(tmpFilename, {\r\n\t\t\t\t\tcreate : true\r\n\t\t\t\t}, function(zipFile) {\r\n\t\t\t\t\tcallback(zipFile);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tfilesystem.root.getFile(tmpFilename, null, function(entry) {\r\n\t\t\t\tentry.remove(create, create);\r\n\t\t\t}, create);\r\n\t\t});\r\n\t}", "function mk_file_save_action(msg, action) {\n return function(file) {\n var data = new FormData();\n data.append('action', action);\n data.append('file', file);\n\n return {\n 'msg': msg.replace('%s', file.name),\n 'data': data,\n 'type': 'file'\n };\n };\n }", "function createFileEntry(fileURI) {\n window.resolveLocalFileSystemURL(fileURI, function(entry) {\n return copyFile(entry);\n }, fail);\n }", "function create(images, metadata, idOwner, callback) {\n var image = images[0];\n var idNode;\n async.waterfall(\n [\n // function(callback) {\n // connection.beginTransaction(function(err) {\n // err ? callback(err) : callback(null);\n // });\n // },\n function(callback) {\n Nodes.insertFile(\n metadata.idParent, \n idOwner, \n metadata.name,\n function(err, result) {\n if(err) { return callback(err); }\n idNode = result;\n callback(null);\n });\n },\n function(callback) {\n image.idNode = idNode;\n Images.create(image, callback);\n }\n // function(callback) {\n // connection.commit(callback);\n // }\n ],\n function(err) {\n // if (err) {\n // connection.rollback(function(err) {\n // if (err) { return callback(new Error('error with database rollback!'));}\n // return callback(new Error('could not store file in database!'));\n // });\n // }\n err ? callback(err) : callback(null, idNode);\n });\n}", "function subirFoto (event, template, anuncianteId, id) {\n\n let archivo = document.getElementById(id);\n\n if ('files' in archivo) {\n\n \n\n if (archivo.files.length == 0) {\n console.log('Selecciona una foto');\n } else if (archivo.files.length > 1) {\n console.log('Selecciona solo una foto');\n } else {\n\n\n for (var i = 0; i < archivo.files.length; i++) {\n\n var filei = archivo.files[i];\n\n var doc = new FS.File(filei);\n\n var nuevoNombre = removeDiacritics(doc.name());\n doc.name(nuevoNombre);\n\n doc.metadata = {\n anuncianteId,\n };\n\n Fotos.insert(doc, function (err, fileObj) {\n if (err) {\n console.log(err);\n } else {\n\n console.log('Foto subida');\n }\n });\n }\n }\n }\n} // Fin de la funcion subirFoto", "getFileById(uniqueId) {\r\n return new File(this, `getFileById('${uniqueId}')`);\r\n }", "function createNewElement(path,mode){\n (debug?console.log(\"\\n________________________________________\\n\\tcreateNewElement\"):null);\n if(path.indexOf(\"//\") > -1) path = path.split(\"//\")[1];\n (debug?console.log(\"Path : \" + path):null);\n (debug?console.log(\"Mode : \" + mode):null);\n\n if(mode === \"dir\") {\n var i = sakura.apis.operator.create_directory(path).then(function(ret) {\n (debug?console.log(\"\\nDirectory successfully created : \" + path):null);\n });\n generateTree();\n highlightTree();\n } else if(mode === \"file\") {\n var i = sakura.apis.operator.create_file(path, \"\").then(function(ret) {\n (debug?console.log(\"\\nFile successfully created : \" + path):null);\n generateTree();\n setFocusOnNewElement(path);\n });\n }\n}", "function actionFileNOTExist() {\r\n // Format the content of the file\r\n const data = new Uint8Array(Buffer.from(contentFile));\r\n // We want to write the content of the file to the file\r\n fs.writeFile(realPathFile, data, (err) => {\r\n // If an error occured, we want to know about it\r\n if (err) {\r\n throw err;\r\n // Otherwise everything went well\r\n } else {\r\n console.log('The content has been saved to the file');\r\n }\r\n });\r\n}", "function writeFile(fileObj, fileContent, encoding) {\n //var csvContent = 'data:text/csv;charset=utf-8,%EF%BB%BF'\n encoding = encoding || \"UTF-8\";\n var titleRow = [csvQuotes(\"FilePath\"),csvQuotes(\"Title\"),csvQuotes(\"Biography\"),\n csvQuotes(\"Employee Name\"),csvQuotes(\"Title\"),csvQuotes(\"Biography\"),\n csvQuotes(\"Education\"),csvQuotes(\"Registration\"),csvQuotes(\"Memberships\"),\n csvQuotes(\"Awards\"),csvQuotes(\"Publications\"),csvQuotes(\"Project Name\"),\n csvQuotes(\"Project Location\"),csvQuotes(\"Project Summary\")]\n \n if (!fileObj.exists) fileContent2 = titleRow.toString() + \"\\n\" + fileContent;\n else fileContent2 = fileContent;\n \n fileObj = (fileObj instanceof File) ? fileObj : new File(fileObj); \n \n var parentFolder = fileObj.parent;\n if (!parentFolder.exists && !parentFolder.create()) \n throw new Error(\"Cannot create file in path \" + fileObj.fsName); \n \n fileObj.encoding = encoding; \n fileObj.open(\"a\"); \n fileObj.write(fileContent2); \n fileObj.close();\n \n return fileObj; \n}", "function addFile(){\n\n let elem = document.getElementById(\"addBox\");\n \n /*\n * adds either a file or directory depending \n */\n if(elem.value.toString().indexOf('.') !== -1){\n console.log(elem.value.toString().indexOf('.') !== -1)\n fs.open(path.join(homedir,elem.value,'/'),'w',function(err) {\n if(err) throw err;\n document.getElementById(\"addBox\").remove();\n objectClick(homedir);\n });\n }else{\n try{\n \n fs.mkdirSync(path.join(homedir,elem.value))\n document.getElementById(\"addBox\").remove();\n objectClick(homedir);\n \n }catch(err) {\n if(err) throw alert(err);\n }\n \n }\n}", "function loadTempFile($fileContent)\n{\n filepath = \"/tmp\";\n filename = \"tmp.ama\";\n\n fileData = $fileContent;\n\n //Here we create a file in the Emscripten virutal file system.\n if(FS.findObject(filepath + \"/\" + filename) != null) FS.unlink(filepath + \"/\" + filename);//Remove the tmp file\n FS.createDataFile(filepath, filename, fileData, true, true, true); //Create the tmp.ama file\n\n AmandaJSLoad(filepath + \"/\" + filename);\n}", "function mkfs(diskRoot, files, binFiles, dirStruct, onReturn, printOut) {\n var Module;\n (function() {\n var diskImg;\n diskImg = diskRoot + '.img';\n Module = {\n arguments: [diskImg, diskRoot],\n printErr: printOut,\n preRun: [function() {\n var saveFile;\n saveFile = function(file) {\n if (!file.filename.endsWith(expandedFileSuffix)) {\n FS.writeFile(file.filename, file.content, {\n encoding: file.encoding\n });\n }\n };\n mkDirs('', dirStruct, FS.mkdir);\n files.forEach(saveFile);\n binFiles.forEach(saveFile);\n }],\n postRun: [function() {\n var img;\n img = FS.readFile(diskImg, {\n encoding: 'binary'\n });\n onReturn(img);\n }]\n };\n }());\n /* {{emcc_stub}} */\n}" ]
[ "0.7006033", "0.6826074", "0.6825213", "0.6450591", "0.6441167", "0.6438422", "0.64316", "0.6416728", "0.6395184", "0.63768137", "0.63693815", "0.6320899", "0.630623", "0.6193851", "0.6161416", "0.6145348", "0.61449903", "0.61437964", "0.6135374", "0.6104618", "0.6039327", "0.6025042", "0.6004406", "0.5999225", "0.5995928", "0.5991112", "0.59894824", "0.5983708", "0.59665394", "0.59489274", "0.59147614", "0.59002185", "0.5888318", "0.58772475", "0.58668077", "0.58665895", "0.58529097", "0.58483386", "0.58462495", "0.58446246", "0.58409935", "0.58310306", "0.5825673", "0.5814595", "0.5802058", "0.5792017", "0.57826394", "0.5781261", "0.57805955", "0.5772496", "0.5771889", "0.57049173", "0.56711656", "0.5657542", "0.565211", "0.56421643", "0.5625007", "0.5624401", "0.5620761", "0.55891895", "0.5582346", "0.5574599", "0.55540735", "0.5548635", "0.5548079", "0.5541518", "0.55284923", "0.5525904", "0.55246395", "0.55213004", "0.551979", "0.55193794", "0.5512195", "0.55071175", "0.5502432", "0.5501057", "0.5498732", "0.5493714", "0.5493521", "0.549116", "0.54761815", "0.5475762", "0.54729277", "0.5455466", "0.54547477", "0.5454612", "0.5449739", "0.5442898", "0.54390997", "0.5434727", "0.53949744", "0.5389788", "0.538228", "0.53752965", "0.5370035", "0.53658", "0.53440964", "0.53401405", "0.534", "0.5335808", "0.5319854" ]
0.0
-1
Add each card on the board
function addCard(line, collumn, posX, posZ) { var card = new Object(); // For each card, modify posX [1], posZ [2] and ID [3] card.Name = "Card"; card.Transform = new Object(); card.Transform.posX = (posX + 2.0*(collumn-1)); /* [1] */ card.Transform.posY = 3.76623344; card.Transform.posZ = (posZ - 2.0*(line-1)); /* [2] */ card.Transform.rotX = 0; card.Transform.rotY = 180.013916; card.Transform.rotZ = 180.000015; card.Transform.scaleX = 0.625; card.Transform.scaleY = 0.625; card.Transform.scaleZ = 0.625; card.Nickname = ""; card.Description = ""; card.ColorDiffuse = new Object(); card.ColorDiffuse.r = 0.713266432; card.ColorDiffuse.g = 0.713266432; card.ColorDiffuse.b = 0.713266432; card.Locked = false; card.Grid = true; card.Snap = true; card.Autoraise = true; card.Sticky = true; card.SidewaysCard = false; if (board[line][collumn] == -1) { /* [3] */ card.CardID = 109; // Mine cards } else { card.CardID = 100 + board[line][collumn]; // Cards 0 to 8 use IDs 100 to 108 respectively } card.CustomDeck = { 1: { FaceURL: "http://i.imgur.com/aHiVv66.jpg", BackURL: "http://i.imgur.com/xL8AXmY.jpg{Unique}" } } return card; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddCards(allCards) {\n const fragment = document.querySelector('.deck');\n for(let i =0; i < allCards.length; i++)\n {\n fragment.appendChild(allCards[i]);\n }\n}", "function addCards() {\n var boardGame = document.getElementById(\"boardGame\");\n for (var i = 0; i < 12; i++) {\n var card = createCard();\n boardGame.appendChild(card);\n }\n}", "addSuit(suit){\n suit.forEach(card => {\n this.add(card); \n });\n }", "add(card){\n\t\tthis.theDeck.push(card);\n\t}", "function addEachCard(div) {\n document.getElementById(\"observation-cards\").appendChild(div);\n}", "function giveCards() {\n\tshuffle(cards).forEach(function createCard(x) {\n\t\t$(\".deck\").append(`<li class=\"card\"><i class=\"fa ${x}\"></i></li>`);\n\t});\n}", "addCard(card) {\n this.hand.push(card);\n }", "add(card){\n this.cards.push(card);\n }", "function addingCards(newCards) {\n $(\".card-group\").html(\"\");\n for (let i = 0; i < newCards.length; i++) {\n $(\".card-group\").append(newCards[i]);\n }\n}", "add(card){\n this.list.push(card);\n }", "function appendCardList (card) {\n openCards.push(card);\n }", "function addCardsToDeck(cards, deck) {\n var elements = [];\n var id = 1;\n for (var card of cards) {\n var element = $(`<li class='card' id='card${id}'</li>`);\n element.append(`<i class='fa ${card}'></i>`);\n elements.push(element);\n id++;\n }\n deck.append(elements);\n}", "function generateBoard() {\n //clear previous board\n $('.deck').empty();\n //shuffle board\n let shuffledBoard = shuffle(cardList);\n //loop to set new board\n for (cards in shuffledBoard) {\n let card = document.createElement('li');\n card.classList.add('card');\n deck.appendChild(card);\n let icon = document.createElement('i');\n icon.classList.add('fa');\n icon.classList.add(`${shuffledBoard[cards]}`);\n card.appendChild(icon);\n card.addEventListener('click', displayCard);\n card.addEventListener('click', cardUp);\n }\n }", "function createBoard() {\n debug(\"createBoard\");\n shuffle(cardList);\n cardList.forEach(function(i) {\n newCard = document.createElement('li');\n newIcon = document.createElement('i');\n deck = document.querySelector('.deck');\n \n newCard.setAttribute(\"class\", \"card\");\n newIcon.setAttribute(\"class\", i);\n deck.appendChild(newCard);\n deck.lastChild.appendChild(newIcon);\n })\n evtListener(); \n }", "addCard(card)\n {\n this.cards.push(card);\n }", "addCard(card)\n {\n this.cards.push(card);\n }", "function addCharacterCards(element, arr) {\n $.each(arr, function (indexInArray) {\n element.append(createCharacterCard(arr[indexInArray], indexInArray));\n });\n }", "function setupCards(col, cards) {\n cards.forEach(function(card) {\n var cardObj = new Card(card.id, card.name);\n col.addCard(cardObj);\n });\n}", "function addCards() {\r\n cards = cards.concat(cards);\r\n \r\n /* Shuffle Card Icons to be Random */\r\n let currentIndex = cards.length, temporaryValue, randomIndex;\r\n while (currentIndex !== 0) {\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex--;\r\n temporaryValue = cards[currentIndex];\r\n cards[currentIndex] = cards[randomIndex];\r\n cards[randomIndex] = temporaryValue;\r\n }\r\n\r\n for (let i = 0; i < 16; i++){\r\n /* Creates Cards */\r\n const newElement = document.createElement('div');\r\n newElement.className = 'card';\r\n newElement.id = cards[0];\r\n /* Create divs and Adds Icons */\r\n newElement.innerHTML = `<div class='card_face front' id=${cardNum}></div><div class='card_face back'><i class='icons md-light'>${cards[0]}</i></div>`;\r\n cardNum++;\r\n cards.shift();\r\n fragment.appendChild(newElement);\r\n } \r\n \r\n /* Add Stars Rating */\r\n for (let i = 0; i < 3; i++){\r\n let v = rating.innerHTML;\r\n const s = `<div class='stars'><i class='icons md-light'>star</i></div>`;\r\n rating.innerHTML = v + s;\r\n }\r\n \r\n element.appendChild(fragment);\r\n}", "function addClickedCards(clickCard){\n clickedCards.push(clickCard);\n \n}", "addCard(card) {\n this._decks.forEach(deck => deck.addCard(card));\n return super.addCard(card);\n }", "function add_list(cards) {\n var shuffledCards = shuffle(cards);\n for (var i= 0; i < shuffledCards.length; i++){\n [].forEach.call(shuffledCards, function(item){\n deck.appendChild(item);\n });\n }\n}", "function placeCards(x) {\n let index = 0;\n moveCount.html('0');\n cardIcon.each(function () {\n let icon = cards[index].icon;\n $(this).addClass(icon);\n index++;\n });\n}", "function addAllCards() {\r\n for (var i = 3; i < profileData.allnames.length; i++){\r\n let newProfile = new Profile(profileData.allnames[i],\r\n profileData.allage[i],\r\n profileData.alltitles[i],\r\n profileData.allphotos[i][0]);\r\n // listedProfile.push(newProfile);\r\n let newProfileCard = document.createElement('div');\r\n newProfileCard.classList.add('swipe-card');\r\n cardsContainer.appendChild(newProfileCard);\r\n newProfileCard.innerHTML = `<img src=\"${newProfile.photos}\" alt=\"\">\r\n <div class=\"name-wrapper\">\r\n <div class=\"card-name\">${newProfile.name}, ${newProfile.age}</div>\r\n <i class=\"fas fa-check-circle\"></i>\r\n </div>\r\n <div class=\"card-title\">${newProfile.title}</div>`\r\n }\r\n}", "function addCardToList(card) {\n openCardsList.push(card);\n}", "function createCard() {\n $(\".deck\").empty();\n let cardList = shuffle(cards);\n for (const card of cardList) {\n $(\".deck\").append('<li class=\"card\"><i class=\"fa fa-' + card + '\"></i></li>');\n };\n }", "function renderCards() {\n for (let i = 0; i < cardList.length; i++) {\n $('.deck').append(`<li class=\"card\"><i id=\"card-${i}\" class=\"fa ${cardList[i]}\"></i></li>`);\n }\n}", "function addToOpenedCards(card){\n openedCards.push(card);\n }", "function createCard() {\n let cardList = shuffle(cards);\n cardList.forEach(function(card) {\n $(\".deck\").append('<li><i class=\"card fa ' + card + '\"></i></li>');\n\n });\n}", "function addCard (crd) {\n openCardList.push(crd);\n}", "function createCards() {\n cardsData.forEach((data, index) => createCard(data, index));\n }", "function addDeck()\r\n{\r\n\tfor (var s=0; s<SUITE.length; s++)\r\n\t\tfor (var c=0; c<CARDS_IN_SUITE; c++)\r\n\t\t\tCards.push(s+':'+(c+1));\r\n\t\tshuffleCards();\r\n}", "function addCard(card) {\n\treturn openCards.push($(card));\n}", "function drawCards () {\r\n for ( let i = 0; i < cards.length; i++ ) {\r\n let element = document.createElement(\"div\");//Create a new div element\r\n \r\n element.className = \"card\";//Add the text node to the newly created div\r\n element.innerHTML = \"\";//Turn down all cards\r\n element.index = i;//Store cards number as \"index\"\r\n element.onclick = click;//Call the following click() function once a user clicks a card\r\n \r\n $field.appendChild( element );\r\n }\r\n}", "function createBoard () {\n\tfor (var i=0; i<cards.length; i++) {\n\t\tvar newCard = document.createElement('div');\n\t\tnewCard.className = 'card';\n\t\tnewCard.setAttribute('data-card', cards[i]);\n\t\tnewCard.addEventListener('click', isTwoCards);\n\t\tgameBoard.appendChild(newCard);\n\t}\n}", "function placeCardsOnDeck(){\n\tgameDeck.innerHTML=\"\";\n\tfor(var r=0; r<myCardList.length; r++){\n\t\t// Create one card\n\t\tlet thisCard = document.createElement(\"LI\");\n\t\tthisCard.setAttribute(\"class\", \"card\");\n\t\tthisCard.innerHTML = \"<i class='\" + myCardList[r] + \"'></i>\";\n\t\t// Display the created card\n\t\tgameDeck.appendChild(thisCard);\n\t}\n}", "function buildCards(){\n for (const card of cards){\n const newCards = document.createElement('li');\n newCards.setAttribute('class', 'card fa fa-' + card);\n deck.appendChild(newCards);\n }\n}", "function addCardsToClickedCards(event) {\n clickedCards.push(event.target);\n}", "addCards(num) {\n for (let i = 0; i < num; i++) {\n this.hand.push(shuffleDeck.pop());\n }\n return this.hand;\n }", "addFlop(card1, card2, card3) {\n this.hand.push(card1);\n this.hand.push(card2);\n this.hand.push(card3);\n }", "function dealCards() {\n\t// create array of i elements which represents cards\n\tconst cardsList = document.querySelectorAll(\".entire-card .fas\");\n\t// add icon-class for each i element\n\tfor (let i = 0; i < cardsList.length; i++) {\n\t\tlet addIcon = cardsList[i];\n\t\taddIcon.classList.add(cardsDeck[i]);\n\t} \n}", "function addCard() {\n let player = {};\n player.id = data.players.length + 1;\n player.name = document.getElementById(\"playername\").value;\n player.school = document.getElementById(\"playerschool\").value;\n player.points = document.getElementById(\"ppg\").value;\n player.assists = document.getElementById(\"apg\").value;\n player.rebounds = document.getElementById(\"rpg\").value;\n player.note = document.getElementById(\"playernote\").value;\n data.players.push(player);\n $('.gridView').append(createCard(player));\n }", "function addCards(){\n if (model.getCardObjArr().length >= 3) {\n controller.addMoreCards();\n } else {\n displayNoCardPopup();\n }\n }", "function stackAddCard(card) {\n\n this.cards.push(card);\n}", "function initializeCharacterCards(){\n for (let i = 0; i < 6; i++){\n Game.characterDatabase[i].displayNewCard(i);\n }\n }", "function createBoard() {\n\n//loop through the cards array.\n for (var i=0; i<cards.length; i++) {\n//div element that will be used as a card.\n var cardElement = document.createElement('div');\n//add a class to the card element.\n cardElement.className = 'card';\n\n//attribute that equals the card value.\n cardElement.setAttribute('data-card', cards[i]);\n//click event listener to each card.\n cardElement.addEventListener('click', isTwoCards);\n\n//append the card to the board\n board.appendChild(cardElement);\n board.appendChild(cardElement);\n }\n\n}", "collectCard(card) {\n this.state.cards.push(\n card\n );\n\n console.log(this.state.name + \" got card:\");\n console.dir(this.state.cards);\n }", "function generateCards(arr) {\n for (let item of arr) {\n // Använda Instans-metod för att skap kort\n let card_element = item.createCard();\n imgWrappers.appendChild(card_element);\n\n }\n}", "function appendCard() {\n const newCard = generateCard();\n const resultsArea = document.querySelector('.results-area');\n resultsArea.appendChild(newCard);\n}", "function setNewCards() {\n\tcardList = shuffle(cardList);\n\tfor (let i = 0; i < cardList.length; i++) {\n\t\tcardList[i].classList.remove('match', 'open', 'show');\n\t\tcardList[i].addEventListener('click', turnCard);\n\t\tmyDeck.appendChild(cardList[i]);\n\t}\n}", "buildDeck(){\n for(let i = 1; i < 14; i++){\n for(let j = 0; j < 4; j++){\n let value = '';\n let suit = '';\n let point = i;\n if(j == 0){\n suit = 'Heart';\n }\n if(j == 1){\n suit = 'Diamond';\n }\n if(j == 2){\n suit = 'Club';\n }\n if(j == 3){\n suit = 'Spade';\n }\n value = i.toString();\n if(i == 1){\n value = 'Ace';\n point = 1;\n }\n if(i == 11){\n value = 'Jack';\n point = 10;\n }\n if(i == 12){\n value = 'Queen';\n point = 10;\n }\n if(i == 13){\n value = 'King';\n point = 10;\n }\n this.base.push(new Card(suit, value, point));\n }\n }\n }", "function setBoard() {\n const cards = $('.card');\n\n const shuffledCards = shuffle(cards);\n\n for (let i = 0; i < shuffledCards.length; i++) {\n $('.deck').append(shuffledCards[i]);\n }\n}", "function addMyCards(card, divName, pos) {\r\n let strs = card.split(\" \");\r\n let num = strs[0];\r\n let type = strs[1];\r\n\r\n // add points of my cards\r\n if (divName == \"my-cards\") {\r\n if (parseInt(num) > 10) {\r\n sum += 10\r\n } else {\r\n sum += parseInt(num)\r\n }\r\n }\r\n if (sum > 21) { // if exceed disable the draw btn\r\n $(\"#game-draw\").addClass(\"disabled\")\r\n $(\"#game-draw\").prop(\"disabled\", true)\r\n }\r\n\r\n // add padding\r\n if ($(\"#\" + divName).children().length == 0) {\r\n let interval = \" <div class=\\\"col-sm-1\\\">\" +\r\n \" </div>\"\r\n $(\"#\" + divName).append(interval)\r\n }\r\n let cardName = type + \"-\" + num + \".jpg\";\r\n let newCard;\r\n // hide first card on the opponents' deck\r\n if (divName === \"opponent-cards\" && $(\"#\" + divName).children().length == 1) {\r\n newCard = \"<img src=\\\"\" + CARD_STATIC_URL\r\n + \"blue-card.png\" + \"\\\" class=\\\"col-sm-2 cards img-rounded\\\">\"\r\n } else {\r\n newCard = \"<img src=\\\"\" + CARD_STATIC_URL\r\n + cardName + \"\\\" class=\\\"col-sm-2 cards img-rounded\\\">\"\r\n }\r\n if (pos == -1) {\r\n $(\"#\" + divName).append(newCard)\r\n } else if (pos == 0) {\r\n $(\"#\" + divName + \" img:nth-child(2)\").before(newCard)\r\n }\r\n}", "drawCard() {\n let card = this.hand.shift()\n this.currentCards.push( card )\n }", "_getPlayerCards(){\n let newCard = _deck.draw()\n _playersHand.push(newCard)\n return _playersHand\n }", "static addExistingCards(array) {\n // for each collection, add some html with unique information for each card in a collection\n array.forEach( collection => {\n if (collection.cards.length === 0) {\n // will only create collection header and cards if there are any cards in the collection\n } else {\n let set = document.getElementById(collection.name);\n set.innerHTML += `<tr id=\"coll-row-${collection.name}\"> <th> ${collection.name} </th> </tr>`\n collection.cards.forEach(card => { \n set.innerHTML += `<tr id=\"card-row-${card.name}\"> <td> <button id=\"${card.id}\">X</button> ${card.name} </td> </tr>`\n })\n }\n })\n Generate.addDeleteButtonToCards();\n }", "function setCards() {\n const newArray = initialCards.concat(initialCards);\n const initialCards2 = shuffle(newArray);\n\n initialCards2.forEach((element) => {\n const cardData = {\n name: element.name,\n link: element.link,\n id: i,\n };\n\n const makeCard = createCard(cardData);\n // addCard(makeCard);\n i++;\n });\n}", "function readyCards() {\n // When the begin button is pressed, the board is revealed.\n for (let i = 0; i <= 4; i++) {\n // The cards are spread out onto the board. To create a second row, a wrap will occur.\n }\n}", "function addCardsDeck() {\n for (let i = 0; i < imageclasses.length; i++) {\n let li = document.createElement('li');\n li.classList.add(\"card\");\n let img = document.createElement('i');\n img.classList.add(\"fa\");\n img.classList.add(imageclasses[i]);\n li.appendChild(img);\n let ul = document.querySelector('.deck');\n ul.appendChild(li);\n }\n}", "function createCard() {\n \tconst shuffleCards = shuffle(cardList);\n \tshuffleCards.forEach(function(card){\n \t\tconst li = document.createElement('li');\n \t\tconst i = document.createElement('i');\n \t\tli.setAttribute('class','card');\n \t\ti.setAttribute('class',card);\n \t\tli.appendChild(i);\n \t\tul.appendChild(li);\n \t});\n \tdeck.appendChild(ul);\n }", "addNewCards(index) { // set index to 0 for first run, use total cards in matrix to determine index for each addition afterwards\n let slicedCards;\n let num = this.deck.length - index + 1;\n if (this.deck.length - index + 1 < 15 ) {\n slicedCards = this.deck.slice(index, index+num);\n } else {\n slicedCards = this.deck.slice(index, index+15);\n }\n // slice n cards from deck array, push to matrix[2]\n slicedCards.forEach(card => this.matrix[2].push(card.cardId));\n }", "render(){\n let boardElement = document.getElementById(\"board\");\n this.cards.forEach( e => {\n boardElement.append(e.render());\n })\n }", "addCard(card){\n this.items.cards[card.code] = card;\n }", "function putCardsOnTable() {\n let BUTTON = document.createElement(\"button\");\n BUTTON.classList.add(\"btn\");\n INTERACTIONS.appendChild(BUTTON);\n BUTTON.innerHTML = \"Get Cards\";\n BUTTON.addEventListener(\"click\", event => {\n event.preventDefault();\n for (let i = 0; i < DECK; i++) {\n cards.push(getCard());\n }\n drawCards(cards);\n });\n}", "function addCardObjToDisplayedArr(cardObj){\n displayedCard.push(cardObj)\n }", "function addCardToStockPile() {\n\t\tvar cardArray = game.getStockCards();\n\t\tvar cardNumber = cardArray.length;\n\t\tvar holder = document.getElementById('stockpile-holder');\n\t\tfor(var i = 0; i < cardNumber; i++) {\n\t\t\tvar node = document.createElement('li');\n\t\t\tnode.setAttribute('id', 'card-' + cardArray[i].id);\n\t\t\tnode.setAttribute('class', 'card-back card');\n\t\t\tnode.setAttribute('style', uiUtil.getRandomRotateStyle() + uiUtil.getRandomCoordStyle());\n\t\t\tnode.innerHTML = '&nbsp;';\n\t\t\tholder.appendChild(node);\n\t\t}\n\t}", "function gameBoardSetup(){\n\n\tshuffle(cards);\n\t$(\"#mainBoard\").empty();\n\t$.each(cards, function(i, card){\n\t\t$(\"#mainBoard\").append(\"<div class='card \" + i +\"'><div class='face back'><img src='\" + card.cardImage + \"' id='\" + i + \"'></div><div class='face front'><img src='images/cardBack.png'></div></div>\");\n\t});\n\t$(\".card\").on(\"click\", flipCard);\n\n}", "function setCards() {\n let containerCards = document.getElementById('contenedor-pokemon');\n let emptyCard = '';\n data.pokemon.forEach(poke => emptyCard += createCard(poke));\n\n containerCards.innerHTML = emptyCard;\n}", "function generateDeck() {\n for (var num = 0; num < 16; num += 1) {\n $(deck).append('<li class=\"card\"><i class=\"fa ' + givenCardsArray[num] + '\"></i></li>');\n }\n}", "function addCard(column,cardNumber) {\r var card = initCard(cardNumber);\r\r var containerBox = column['elements']['innerElements']['container'];\r //we created the var\r\r card['elements']['domElement'].appendChild(card['elements']['innerElements']['title']);\r containerBox.appendChild(card['elements']['domElement']);\r\r linkCardEvent(card,column);\r return card;\r}", "addCard(card) {\n if(card.Type === 'Bronze') {\n if(this.cardCount(card) >= 3) {\n return;\n }\n } else {\n if((card.Type === 'Silver' && this.state.silverAmount >= 6) || (card.Type === 'Gold' && this.state.goldAmount >= 4) || this.cardCount(card) >= 1) {\n return;\n }\n }\n\n if(card.Type === 'Bronze') {\n this.state.bronzeAmount++;\n } else if(card.Type === 'Silver') {\n this.state.silverAmount++;\n } else {\n this.state.goldAmount++;\n }\n\n //Adds the new card, also sorts the array for readability purposes\n this.setState({currentDeck:[...this.state.currentDeck, card].sort((a,b) => a.Name.localeCompare(b.Name))}); \n \n }", "function takeCards()\n {\n if (state.turnedCard)\n {\n state.turnedCard.turn(true);\n }\n\n showMenuId = cards[0].addEventListener(\"move\", showMenu);\n\n for (var counter = 0; counter < cards.length; counter++)\n {\n cards[counter].move(DOM.cardsContainer, {width: sizes.desk.width + \"PX\", height: sizes.desk.height + \"PX\"}, true);\n }\n }", "function addToOpenCardsList(card) {\n openCardsList.push(card);\n}", "function addCard(card, person) {\n // Add the card to the person's play area if this fuction is being called in hitMe \n if (person.cards > 1) {\n $('#' + person.name).find('.card' + (person.cards)).after(\"<div class='extraCard card\" + (person.cards + 1) + \"'>X</div>\");\n $('#' + person.name).find('.card' + (person.cards +1)).html(deck[index].slice(1)).addClass(\"suit\" + (deck[index])[0]);\n }\n\n \n // Parse the card and assign to to sum or aces\n function parseCard(slicedCard) {\n\n if (slicedCard === \"A\") {\n person.aces++;\n } else if (slicedCard === \"J\" || slicedCard === \"Q\" || slicedCard === \"K\") {\n person.sum += 10;\n } else { person.sum += parseInt((slicedCard), 10); }\n }\n\n // Parse the value of the card to a number or an Ace.\n parseCard(card.slice(1));\n\n // Increase the card count of that person\n person.cards++;\n\n // Once the card has been added, the index is increased\n index++;\n}", "function generateCardBoard(){\n\n for(var i=0;i<5;i++){\n cardBoard[0].push((Math.floor(Math.random() * 50)+1));\n };\n\n for(var i=0;i<5;i++){\n cardBoard[1].push((Math.floor(Math.random() * 50)+1));\n };\n\n for(var i=0;i<5;i++){\n cardBoard[2].push((Math.floor(Math.random() * 50)+1));\n };\n console.log(cardBoard.join(\"\\n\"));\n newCarboards()\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 createCards() {\n for (let i = 0; i < imgList.length; i += 1) {\n const cards = document.createElement('div');\n cards.classList.add('card');\n cards.innerHTML = `<div class='back'>${imgList[i]}</div>\n <div class='front'><i class=\"fa fa-line-chart\" style=\"font-size:2em;color:#ffffff;\"></i></div>`;\n cardArray.push(cards);\n }\n // Loops and Shuffles Card Array\n for (let i = cardArray.length - 1; i >= 0; i -= 1) {\n const randomIndex = Math.floor(Math.random() * (i + 1));\n const itemAtIndex = cardArray[randomIndex];\n cardArray[randomIndex] = cardArray[i];\n cardArray[i] = itemAtIndex;\n }\n }", "function newCard() {\n//draw a new card by pushing a card into the deck\n//then add this card into the sum\nif( isAlive === true && hasBlackJack === false) {\n let newPlCardDrawn = getPlayerRandomCard()\n let newDlCardDrawn = getDealerRandomCard()\n plcardSum += newPlCardDrawn\n dealercardSum += newDlCardDrawn\n plcards.push(newPlCardDrawn)\n dlcards.push(newDlCardDrawn)\n \n renderGame()\n}\n}", "function addCardToList(card) {\n listOfCards.length === 0 ? ($(\".open\").addClass(\"noDuplicate\"), listOfCards.push(card)) : listOfCards.push(card);\n}", "function renderCards(deck, list) {\n list.forEach((elem, index) => {\n \n let li = document.createElement('li');\n let i = document.createElement('i');\n li.className = 'card';\n deck.appendChild(li);\n li.appendChild(i);\n i.className = \"fa fa-\" + list[index];\n\n li.addEventListener('click', e => {\n clicked++;\n addToSelectedCards(index);\n })\n \n });\n}", "drawCards() {\n let g = this,\n cxt = g.context,\n cards = window._main.cards;\n for (let card of cards) {\n card.draw(cxt);\n }\n }", "function createCards(cards) {\n let type;\n return cards.map((cardConfig) => {\n const tempCards = [];\n if (cardConfig[2]) {\n type = cardConfig[2];\n }\n for (let i = 0; i < cardConfig[0]; i++) {\n tempCards.push({text: cardConfig[1], type})\n }\n return tempCards;\n }).flat().map( function(item, index){\n const el = document.createElement('div');\n el.setAttribute('text', item.text);\n el.setAttribute('type', item.type);\n el.innerHTML = `\n<p>\n ${item.type}\n</p>\n<p>\n ${item.text}\n</p>\n`;\n el.classList.add('card');\n document.body.appendChild(el);\n addListeners(el);\n el.setAttribute('deck', 'origin');\n return el;\n });\n}", "function generateCards(){\n shuffle(cardList.concat(cardList)).forEach(createCard);\n}", "function addToflippedCards(card) {\n flippedCards.push(card);\n console.log(flippedCards)\n}", "updateCard() {\n this.addAddress();\n this.addWeatherData();\n }", "createCardOnBoard(text, color, heading, onBoard, left, top) {\n this.setState(prevState => ({\n //alter State wird kopiert\n cards: [...prevState.cards,\n {\n id: this.state.lastIndex,\n text: text,\n color: color,\n heading: heading,\n onBoard: onBoard,\n left: left,\n top: top,\n }],\n lastIndex: this.state.lastIndex + 1,\n }));\n\n }", "function addCardObj(cardObj){\n cardObjArr.push(cardObj);\n }", "function dataToCards() {\n // console.log(myNYTimesData);\n // el={(...item.keywords.value)}\n let itemList = myNYTimesData.map((item, index) => {\n // console.log(item.keywords[0].value);\n let itemPush = []\n item.keywords.forEach(el => itemPush.push(el.value, \"---\"))\n console.log(\"itemPush: \", itemPush)\n itemPush.length = itemPush.length - 1\n console.log(\"itemPush removed: \", itemPush)\n return <div key={index}> <MyCard element={item.abstract}\n el01={itemPush}\n // el02={\"essai01\"}\n /></div>;\n })\n setButtonsOnCanvos([...buttonsOnCanvos, itemList]);\n }", "function addCard() {\n // match timer start with first click\n const viewCard = this;\n const previousCard = openedCards[0];\n\n if (openedCards.length === 1) {\n card.classList.add('open', 'show', 'remove');\n openedCards.push(this);\n moves++;\n moveNumber.textContent = moves;\n compare(viewCard, previousCard);\n stars();\n } else {\n card.classList.add('open', 'show', 'remove');\n openedCards.push(this);\n stars();\n }\n\n if (isFirstClick === true) {\n timer();\n isFirstClick = false;\n }\n }", "function addCards(addHand) {\n var total = 0;\n var list = [];\n\n for (var i = 0; i < addHand.cards.length; i++) {\n\n if (addHand.cards[i].face != 'A') {\n list.unshift(addHand.cards[i]);\n }\n else {\n list.push(addHand.cards[i]);\n }\n }\n\n\n\n for (var i = 0; i < list.length; i++) {\n\n if (list[i].face != 'A') {\n total += list[i].value;\n }\n else {\n\n if (total < 11) {\n total += 11;\n }\n else {\n total += 1;\n }\n }\n }\n\n return total;\n}", "function createBoard() {\n for(let i = 0; i < cardArray.length; i++){\n var card = document.createElement('img')\n\n card.setAttribute('src', 'images/pokeball.png') // giving a \"style\" and its value - black is the back of the card\n card.setAttribute('data-id', i)\n\n card.addEventListener('click', flipCard) //when there is \"click\" the function flipcard is called\n\n grid.appendChild(card) // linking the gameboard to the css\n }\n }", "addNewCard(flashCards){\n this.flashCards.push(flashCards);\n this.setState({\n flashCardsNumber: this.flashCards.length - 1\n });\n }", "function buildBoard() {\n //clear game board.\n $('.deck').empty();\n openCards = [];\n\n //initialize counters\n clearTimeout(gameTimer);\n gameTimer = setInterval(onGameTimerCount, 1000);\n moveCount = 0;\n gameTimeCount = 0;\n $('.moves').text(moveCount);\n $('.time').text(\" (0 seconds)\");\n\n //initialize star ratings\n $('#star-3').removeClass('fa-star-o');\n $('#star-3').addClass('fa-star');\n $('#star-2').removeClass('fa-star-o');\n $('#star-2').addClass('fa-star');\n\n //shuffle the list of cards\n shuffle(cards);\n\n //loop through each card and create its HTML\n for (let i = 0; i < cards.length; i++) {\n //add each card's HTML to the page\n $('.deck').append('<li id=\\\"card-' + i + '\\\" class=\\\"card\\\"><figure class=\"back\"></figure><figure class=\\\"front fa ' + cards[i].name + '\\\"></figure>');\n cards[i].id = i;\n }\n\n $('.card').on('click', onCardClicked);\n}", "function addThree () {\n if (deck.length > 0) {\n board.push(draw(deck));\n board.push(draw(deck));\n board.push(draw(deck));\n }\n // Ensure there is a set with the three new cards added\n const numSets = numberOfSets(false);\n if (numSets === 0) {\n if (deck.length == 0) {\n endGame();\n } else {\n deck = board.concat(deck);\n board = dealBoard();\n }\n }\n\n document.getElementById('remainingCards').innerHTML = deck.length;\n displayBoard();\n}", "renderCards() {\n for (let i = 0; i < this.pairs * 2; i++) {\n const card = document.createElement('div');\n card.className = 'card';\n card.innerHTML = this.cardBackgroundImageTag;\n\n this.containerNode.appendChild(card);\n }\n }", "function screenView(){\n boardItems.forEach((item, index) =>{\n // this will add the items to web screen view\n $(\"#number-screen\").append(`<div class=\"col-md-4\">\n <div class=\"card screen-card\" style=\"background-color:`+ colors[index]+`\">`+ item +`</div>\n </div>`);\n // this will add the items to mobile screen view\n $(\"#number-screen-mobile\").append(`<div class=\"col-md-4\">\n <div class=\"card board-mobile-card\" style=\"border-left: 10px solid `+ colors[index]+`\">`+ item +`</div>\n </div>`);\n })\n}", "function initCards(cardsnum){\n for (i = 0; i < cardsnum; i++) { \n let div = document.createElement(\"div\");\n div.className ='card'+i;\n cards.appendChild(div);\n };\n }", "function buildBoard$$1() {\n // Variables\n const cardsArray = [];\n\n // Creating cards\n for (let i = 0; i < cards$$1/2; i++) {\n for (let j = 0; j < 2; j++) {\n const card = `\n <div class=\"flip-card\">\n <div class=\"flip-card-inner\">\n <div class=\"flip-card-front\">\n <img src=\"images/card-${i}.jpg\">\n </div>\n <div class=\"flip-card-back\">\n <img src=\"images/back.jpg\">\n </div>\n </div>\n </div>`;\n cardsArray.push(card);\n }\n }\n\n // Shuffeling cards\n cardsArray.sort(function() {\n return 0.5 - Math.random();\n });\n\n // Adding cards to board\n for (let i = 0; i < cardsArray.length; i++) {\n $(board$$1).prepend(cardsArray[i]);\n }\n\n // Adding board to DOM\n $('#wrapper').prepend(board$$1);\n\n // Click event for the cards\n $('.flip-card').click(function(e) {\n cardClick(e);\n });\n }", "_addRow() {\n this.coins.forEach((column, x) => {\n column.pop();\n let newCoin = new Coin(this._randomColor(), x, 0);\n column.unshift(newCoin);\n newCoin.drawAndMove(x, -1, x, 0);\n });\n }", "function appendCardsToDom(cards) {\n cards.forEach((card, i) => {\n const k = i;\n setTimeout(() => {\n const positionFromLeft = i * 30;\n const cardElement = document.createElement('div');\n cardElement.setAttribute('data-value', card.value);\n cardElement.classList.add('card', `${card.suit}-${card.value}`);\n cardElement.style.left = `${positionFromLeft}px`;\n cardsWrapper.append(cardElement);\n }, 75 * (k + 1));\n });\n}" ]
[ "0.76849854", "0.74895567", "0.74499696", "0.72334117", "0.7187234", "0.7181875", "0.715759", "0.714325", "0.7080886", "0.7059476", "0.70571494", "0.70318323", "0.7021243", "0.7011357", "0.70092773", "0.70092773", "0.69831264", "0.6979432", "0.6965259", "0.6922808", "0.6914898", "0.68857265", "0.6878355", "0.6873823", "0.68724054", "0.68667066", "0.68565553", "0.6851926", "0.68499273", "0.6840861", "0.6840085", "0.6823033", "0.68040824", "0.6787743", "0.6779761", "0.6779565", "0.6739064", "0.6738448", "0.6718636", "0.6701083", "0.66975236", "0.66943604", "0.66759753", "0.666046", "0.665852", "0.6656755", "0.663714", "0.6630884", "0.66278833", "0.6625302", "0.6625272", "0.6624413", "0.6619638", "0.6616176", "0.661577", "0.6614377", "0.65990514", "0.6588329", "0.65864396", "0.65828663", "0.6570661", "0.65604776", "0.65581745", "0.6555633", "0.6528037", "0.6523171", "0.6519153", "0.65155834", "0.6511797", "0.65110606", "0.65086895", "0.6508548", "0.65067714", "0.6503641", "0.64999175", "0.64930075", "0.6491059", "0.6464539", "0.6462528", "0.64576936", "0.6456739", "0.6451826", "0.6445074", "0.64426523", "0.6435703", "0.64308435", "0.64296865", "0.64255947", "0.64253336", "0.6403019", "0.6402652", "0.6399836", "0.6399391", "0.6397442", "0.6389971", "0.6389479", "0.6386749", "0.6384576", "0.63815975", "0.6380456" ]
0.6787559
34
Attaches attrs.chartRisk scope variable watcher
function attachListener() { scope.$watch(attrs.chartRisk, function (riskSummaryData) { setChartBlockWidth(riskSummaryData); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onRiskCreated() {\n vm.riskList = getRiskList();\n }", "function updateAtRisk(){\n\tvar svgAtRisk = d3.select(\"#vis-sec-at-risk\")\n\t\t\t\t\t\t.append(\"svg\")\n\t\t\t\t\t\t.attr(\"width\", width + margin.left + margin.right)\n\t\t\t\t\t\t.attr(\"height\", height + margin.top + margin.bottom)\n\t\t\t\t\t\t.style(\"margin-left\", margin.left + \"px\")\n\t\t\t\t\t\t.append(\"g\")\n\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\tvar data = bubbleData[\"at_risk\"];\n\taddChartInfo(data, svgAtRisk);\n}", "function addBudgetWatch() {\n var unwatch = $scope.$watch('budget', function (newVal, oldVal) {\n if (!angular.equals(newVal, oldVal)) {\n unwatch();\n\n // updateObj = angular.copy(updateObj);\n\n // updateObj = totalValues.updateTotals();\n // // console.log(updateObj);\n // console.log(updateObj);\n // $scope.budget.MasterCategories = updateObj;\n\n angular.copy(\n totalValues.updateTotals(),\n $scope.budget.MasterCategories\n );\n $scope.breakdownChartSource.data(\n chartValues.update()\n );\n addBudgetWatch();\n }\n }, true);\n }", "addRisk(risk) {\n this.risks.push(risk);\n }", "function addRisk()\n {\n $scope.inserted = {\n id: $scope.currentReport.CurrentDetail.Risks.length + 1,\n RiskID: 0,\n WeekNo: $scope.selectedWeekFilter.WeekNo,\n Description: '',\n Effect: '',\n PercentLikelihood: 0.00\n };\n\n $scope.currentReport.CurrentDetail.Risks.push($scope.inserted);\n }", "function thicknessExperiment(scope){\n\t/** Setting the slider value to the label variable */\t\n\tthickness = scope.thickness_num = scope.thicknessNum;\n}", "function updateAtRiskHigh(){\n\tvar svgAtRiskHigh = d3.select(\"#vis-sec-at-risk-high\")\n\t\t\t\t\t\t\t.append(\"svg\")\n\t\t\t\t\t\t\t.attr(\"width\", width + margin.left + margin.right)\n\t\t\t\t\t\t\t.attr(\"height\", height + margin.top + margin.bottom)\n\t\t\t\t\t\t\t.style(\"margin-left\", margin.left + \"px\")\n\t\t\t\t\t\t\t.append(\"g\")\n\t\t\t\t\t\t\t.attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\tvar data = bubbleData[\"at_risk_high\"];\n\taddChartInfo(data, svgAtRiskHigh);\n}", "function addWatches() {\n scope.watcher = watchClass();\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 compile() {\n\t\t\treturn function (scope, element, attrs) {\n\t\t\t\tscope.$watch('chartconfig', function (newVal) {\n\t\t\t\t\tif (newVal) {\n\t\t\t\t\t\trenderChart(scope, element, attrs);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t}", "function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() == MODE_DETERMINATE) {\n animateIndicator(percentValue);\n }\n });\n attr.$observe('mdMode',function(mode){\n switch( mode ) {\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n spinnerWrapper.removeClass('ng-hide');\n spinnerWrapper.removeClass( lastMode );\n spinnerWrapper.addClass( lastMode = \"md-mode-\" + mode );\n break;\n default:\n spinnerWrapper.removeClass( lastMode );\n spinnerWrapper.addClass('ng-hide');\n lastMode = undefined;\n break;\n }\n });\n }", "_chartJsChanged(newValue) {\n this.initChart(newValue);\n }", "function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);\n });\n\n attr.$observe('mdBufferValue', function(value) {\n animateIndicator(bar1, clamp(value));\n });\n\n attr.$observe('mdMode',function(mode){\n switch( mode ) {\n case MODE_QUERY:\n case MODE_BUFFER:\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n container.removeClass( 'ng-hide' + ' ' + lastMode );\n container.addClass( lastMode = \"md-mode-\" + mode );\n break;\n default:\n container.removeClass( lastMode );\n container.addClass('ng-hide');\n lastMode = undefined;\n break;\n }\n });\n }", "function initWatchVal(){}", "function initWatchVal(){}", "function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);\n });\n\n attr.$observe('mdBufferValue', function(value) {\n animateIndicator(bar1, clamp(value));\n });\n\n attr.$observe('mdMode',function(mode){\n if (lastMode) container.removeClass( lastMode );\n\n switch( mode ) {\n case MODE_QUERY:\n case MODE_BUFFER:\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n container.addClass( lastMode = \"_md-mode-\" + mode );\n break;\n default:\n container.addClass( lastMode = \"_md-mode-\" + MODE_INDETERMINATE );\n break;\n }\n });\n }", "function sparkline() {\n return {\n restrict : 'A',\n scope : {\n sparkData : '=',\n sparkOptions : '=',\n },\n link : function(scope, element, attrs) {\n scope.$watch(scope.sparkData, function() {\n render();\n });\n scope.$watch(scope.sparkOptions, function() {\n render();\n });\n var render = function() {\n $(element).sparkline(scope.sparkData, scope.sparkOptions);\n };\n }\n }\n}", "_chartJsInit(newValue) {\n this.initChart(newValue);\n }", "addEarlyWarningScopeLimits() {\n let $chart = App.pathFinder.chart;\n\n var xAxis = $chart.xAxis[0],\n yAxis = $chart.yAxis[0];\n\n var left = xAxis.toPixels(-25 + App.pathFinder.data.scope_size[0]*2),\n right = xAxis.toPixels(25 - App.pathFinder.data.scope_size[0]*2);\n\n // Left target path line\n $chart.renderer.path(['M', left, yAxis.toPixels(-25), 'L', left, yAxis.toPixels(25)]).attr({\n 'stroke-width': 1, stroke: 'silver', dashstyle: 'dot'\n }).add();\n\n // Right target path line\n $chart.renderer.path(['M', right, yAxis.toPixels(-25), 'L', right, yAxis.toPixels(25)]).attr({\n 'stroke-width': 1, stroke: 'silver', dashstyle: 'dot'\n }).add();\n }", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "valueChanged(newValue) {\n this.chartConfig = newValue;\n }", "function updateChart(chart, data) {\n\t\tchart.selectAll(\"polyline\")\n\t\t .data(data)\n\t\t .attr(\"opacity\", function(d, i){\n\t\t \tif( crimeVisible[d[\"type\"]] ) {\n\t\t \treturn 1;\n\t\t } else {\n\t\t \treturn 0;\n\t\t }\n\t\t });\n\t}", "function updateAnnotValue($scope, newVal){\n $scope.annotValue = newVal;\n}", "attributeChangedCallback (name, oldVal, newVal) {\n console.log('attributeChangedCallback', name, newVal);\n this[name] = newVal;\n }", "function addWatch(child, index) {\n $scope.$watch(function(scope){\n $scope.child = child;\n return $scope.child.dob;\n }, function(){\n $scope.setAge(false, index);\n })\n }", "on() {\n activeEffectScope = this;\n }", "function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);\n });\n\n attr.$observe('mdBufferValue', function(value) {\n animateIndicator(bar1, clamp(value));\n });\n\n attr.$observe('disabled', function(value) {\n if (value === true || value === false) {\n isDisabled = !!value;\n } else {\n isDisabled = angular.isDefined(value);\n }\n\n element.toggleClass(DISABLED_CLASS, isDisabled);\n container.toggleClass(lastMode, !isDisabled);\n });\n\n attr.$observe('mdMode', function(mode) {\n if (lastMode) container.removeClass(lastMode);\n\n switch (mode) {\n case MODE_QUERY:\n case MODE_BUFFER:\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n container.addClass(lastMode = \"md-mode-\" + mode);\n break;\n default:\n container.addClass(lastMode = \"md-mode-\" + MODE_INDETERMINATE);\n break;\n }\n });\n }", "function changeSingleChart_smartvehicle(data, thresholdTrendlinePercentage, thresholdRangePercentage, trendline) {\n\n /**\n * Method to get the count of the current sensor\n * @param sensor\n * @returns {number}\n */\n function getSensorCount_sv(sensor) {\n var count = 0;\n switch(sensor) {\n case \"tachometer\":\n count = 0;\n break;\n case \"wss\":\n count = 1;\n break;\n case \"potentiometer\":\n count = 2;\n break;\n case \"brake_sensor\":\n count = 3;\n break;\n }\n return count;\n }\n\n var count = 0;\n var sensors = [\"tachometer\", \"wss\", \"potentiometer\", \"brake_sensor\"];\n var lineLabels = [\"RPM\", \"Speed\", \"Accelerator angle\", \"Brake pressure\"];\n\n count = getSensorCount_sv($(\"#sensor-name\").text());\n\n var trendlineData = [];\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n genereteSingleChart(lineLabels[count], getSensorMeasurementLabels(data), getSensorMeasurementValues_sv(sensors[count], data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayTachometer = getSensorMeasurementValues_sv(\"tachometer\", data);\n var arrayWss = getSensorMeasurementValues_sv(\"wss\", data);\n var arrayPotentiometer = getSensorMeasurementValues_sv(\"potentiometer\", data);\n var arrayBrakeSensor = getSensorMeasurementValues_sv(\"brake_sensor\", data);\n\n generateMultipleChart_smartvehicle(getSensorMeasurementLabels(data), arrayTachometer, arrayWss, arrayPotentiometer, arrayBrakeSensor);\n\n\n $('.btn-forward').off().on('click', function() {\n count = getSensorCount_sv($(\"#sensor-name\").text());\n count++;\n\n if (count >= sensors.length) {\n count = 0;\n }\n var sensor = sensors[count];\n var lineLabel = lineLabels[count];\n\n var thresholdTrendlinePercentage = $(\"#threshold\").val();\n var thresholdRangePercentage = $(\"#threshold-range\").val();\n\n var trendline = $(\"#select-trendline\").val();\n var trendlineData = [];\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n $(\"#sensor-name\").val(sensor);\n $(\"#sensor-name\").text(sensor);\n genereteSingleChart(lineLabel, getSensorMeasurementLabels(data), getSensorMeasurementValues_sv(sensor, data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayTachometer = getSensorMeasurementValues_sv(\"tachometer\", data);\n var arrayWss = getSensorMeasurementValues_sv(\"wss\", data);\n var arrayPotentiometer = getSensorMeasurementValues_sv(\"potentiometer\", data);\n var arrayBrakeSensor = getSensorMeasurementValues_sv(\"brake_sensor\", data);\n\n generateMultipleChart_smartvehicle(getSensorMeasurementLabels(data), arrayTachometer, arrayWss, arrayPotentiometer, arrayBrakeSensor);\n\n });\n\n $('.btn-back').off().on('click', function() {\n\n count = getSensorCount_sv($(\"#sensor-name\").text());\n count--;\n\n if (count < 0) {\n count = sensors.length-1;\n }\n var sensor = sensors[count];\n var lineLabel = lineLabels[count];\n\n var thresholdTrendlinePercentage = $(\"#threshold\").val();\n var thresholdRangePercentage = $(\"#threshold-range\").val();\n\n var trendline = $(\"#select-trendline\").val();\n var trendlineData = [];\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_sv(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_sv(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n $(\"#sensor-name\").val(sensor);\n $(\"#sensor-name\").text(sensor);\n genereteSingleChart(lineLabel, getSensorMeasurementLabels(data), getSensorMeasurementValues_drone(sensor, data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayTachometer = getSensorMeasurementValues_sv(\"tachometer\", data);\n var arrayWss = getSensorMeasurementValues_sv(\"wss\", data);\n var arrayPotentiometer = getSensorMeasurementValues_sv(\"potentiometer\", data);\n var arrayBrakeSensor = getSensorMeasurementValues_sv(\"brake_sensor\", data);\n\n generateMultipleChart_smartvehicle(getSensorMeasurementLabels(data), arrayTachometer, arrayWss, arrayPotentiometer, arrayBrakeSensor);\n });\n }", "function watchVariable(variable,alias){newScope[alias]=scope[variable];scope.$watch(variable,function(value){$mdUtil.nextTick(function(){newScope[alias]=value;});});}", "function watchAttributes() {\n attr.$observe('value', function(value) {\n var percentValue = clamp(value);\n element.attr('aria-valuenow', percentValue);\n\n if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);\n });\n\n attr.$observe('mdBufferValue', function(value) {\n animateIndicator(bar1, clamp(value));\n });\n\n attr.$observe('disabled', function(value) {\n if (value === true || value === false) {\n isDisabled = !!value;\n } else {\n isDisabled = angular.isDefined(value);\n }\n\n element.toggleClass(DISABLED_CLASS, isDisabled);\n container.toggleClass(lastMode, !isDisabled);\n });\n\n attr.$observe('mdMode', function(mode) {\n if (lastMode) container.removeClass( lastMode );\n\n switch( mode ) {\n case MODE_QUERY:\n case MODE_BUFFER:\n case MODE_DETERMINATE:\n case MODE_INDETERMINATE:\n container.addClass( lastMode = \"md-mode-\" + mode );\n break;\n default:\n container.addClass( lastMode = \"md-mode-\" + MODE_INDETERMINATE );\n break;\n }\n });\n }", "function hookDigestRateCounter() {\n resetDigestRateCounter();\n unhookDigestRateCounter = scope.$watch(function () { digestRateCount++; });\n }", "attributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\t\tif (this.$$r) return;\n\t\t\t\tattr = this.$$g_p(attr);\n\t\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t\t}", "attributeChangedCallback(attr, oldValue, newValue) {\r\n if (attr == \"gpio\") {\r\n this.gpio = parseFloat(newValue);\r\n console.log(\"GPIO: \", this.gpio);\r\n }\r\n }", "get riskAdjustment () {\n\t\treturn this._riskAdjustment;\n\t}", "function updatePlot() {\n if (typeof envData === 'undefined') {\n return;\n }\n \n // Adjust scales' min and max\n xScale.domain([new Date(envData[0].time), new Date(envData[envData.length -1].time)]).range([W_PADDING, WIDTH - W_PADDING]); \n \n if (envData[0][scope.plottype] || envData[0][scope.plottype] == 0) {\n if (scope.thresholddata) {\n var min = Math.min(d3.min(envData, function(d) {return d[scope.plottype];}),\n scope.thresholddata.marginalData[scope.plottype], \n scope.thresholddata.severeData[scope.plottype]);\n var max = Math.max(d3.max(envData, function(d) {return d[scope.plottype];}),\n scope.thresholddata.marginalData[scope.plottype], \n scope.thresholddata.severeData[scope.plottype]);\n yScale.domain([min, max]).range([HEIGHT - H_PADDING, TOP_PADDING]);\n }\n else {\n yScale.domain([d3.min(envData, function(d) {return d[scope.plottype];}), d3.max(envData, function(d) {\n return d[scope.plottype];\n })]).range([HEIGHT - H_PADDING, TOP_PADDING]);\n }\n }\n \n svg.select('#d3plotline')\n .datum(envData) // set the new data\n .transition() // start a transition to bring the new value into view\n .attr(\"d\", line) // apply the new data values \n .ease(\"linear\")\n .duration(DURATION);\n \n if (scope.thresholddata) {\n setThresholdClipAttributes(); \n \n svg.selectAll(\".line\")\n .data(CLIP_NAMES)\n .attr(\"clip-path\", function(d) { \n return \"url(#clip-\" + d + \")\"; })\n .datum(envData)\n .transition()\n .attr(\"d\", line)\n .ease(\"linear\")\n .duration(DURATION); \n } \n \n svg.select(\".y.axis\") // update the y axis\n .transition()\n .duration(DURATION)\n .call(yAxis); \n \n svg.select(\"#yLabel\").text(yAxisLabel[scope.plottype]);\n\n svg.select(\".x.axis\") // update the x axis\n .transition()\n .duration(DURATION)\n .call(xAxis); \n \n svg.selectAll('#xAxis g text').each(insertLineBreaks);\n }", "function watch(scope, elem, attrs) {\n\n // compile - ng-model pointing to checked\n $compile(elem)(scope);\n\n // getter and setter for original model\n var getter = $parse(attrs.bossyCheckboxMultiselect);\n var setter = getter.assign;\n\n // value added to list\n var value = $parse(attrs.bossyListValue)(scope.$parent);\n\n // watch the change of checked values\n scope.$watch('checked', function(newValue, oldValue) {\n if (newValue === oldValue) {\n return;\n }\n var actual = getter(scope.$parent);\n if (newValue === true) {\n setter(scope.$parent, addChoice (actual, value));\n } else {\n setter(scope.$parent, removeChoice(actual, value));\n }\n });\n\n // watch change of original model\n scope.$parent.$watch(attrs.bossyCheckboxMultiselect, function(newArr) {\n scope.checked = containCheckbox (newArr, value);\n }, true);\n }", "on() {\n activeEffectScope = this;\n }", "function initWatchVal() {} // 16439", "attributeChangedCallback(attrName, oldVal, newVal) {\n this.currentCount = newVal;\n this.update();\n }", "attributeChangedCallback() { }", "attributeChangedCallback(name, oldValue, newValue) {\n //this._who = newValue; this is handled by WebComponent decorator\n this._updateRendering();\n }", "watchOnScope($scope, propName){\n\t\t// for init watching\n\t\tif(curr !== undefined){\n\t\t\t// compare current with this collection to determine the change\n\t\t\tif(curr !== collection){\n\t\t\t\t$scope.$apply(() => {\n\t\t\t\t\t$scope[propName] = this\n\t\t\t\t})\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t$scope[propName] = this;\n\t\tlet connector = this.getConfig('connector');\n\t\tif(!connector){\n\t\t\tthrow new Error('Connector is not configured for this model')\n\t\t}\n\t\tvar model = this;\n\t\tvar unsubscribe = connector.$subscribe(() => {\n\t\t\tconnector.$isChanged(model).then((isChanged) => {\n\t\t\t\tif(isChanged){\n\t\t\t\t\t$scope.$apply(() => {\n\t\t\t\t\t\t$scope[propName] = isChanged\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\t// unsubscribe on $scope destroy event\n\t\t$scope.$on(\"$destroy\", unsubscribe);\n\t\treturn unsubscribe;\n\t}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(/*attr, oldValue, newValue, namespace*/) {\n\t}", "function changeSingleChart_wearable(data, thresholdTrendlinePercentage, thresholdRangePercentage, trendline) {\n\n /**\n * Method to get the count of the current sensor\n * @param sensor\n * @returns {number}\n */\n function getSensorCount_wearable(sensor) {\n var count = 0;\n switch(sensor) {\n case \"battery\":\n count = 0;\n break;\n case \"accelerometer\":\n count = 1;\n break;\n case \"gyroscope\":\n count = 2;\n break;\n case \"hrm\":\n count = 3;\n break;\n }\n return count;\n }\n\n var count = 0;\n var sensors = [\"battery\", \"accelerometer\", \"gyroscope\", \"hrm\"];\n var lineLabels = [\"Percentage\", \"Acceleration\", \"Rotation\", \"Heart rate\"];\n\n count = getSensorCount_wearable($(\"#sensor-name\").text());\n\n /*\n Only first load uses this slice of code. (i.e. Drone uses it to load battery)\n */\n var trendlineData = [];\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n // Carico subito il sensore battery\n\n genereteSingleChart(lineLabels[count], getSensorMeasurementValues_wearable_notNull(sensors[count], data), getSensorMeasurementValues_wearable_notNull(sensors[count], data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayBattery = getSensorMeasurementValues_wearable(\"battery\", data);\n var arrayAcceleration = getAcceleration(getSensorMeasurementValues_wearable(\"accelerometer\", data));\n var arrayRotation = getRotation(getSensorMeasurementValues_wearable(\"gyroscope\", data));\n var arrayHeartRate = getSensorMeasurementValues_wearable(\"hrm\", data);\n\n generateMultipleChart_wearable(getSensorMeasurementLabels(data), arrayBattery, arrayAcceleration, arrayRotation, arrayHeartRate);\n\n\n $('.btn-forward').off().on('click', function() {\n count = getSensorCount_wearable($(\"#sensor-name\").text());\n count++;\n\n if (count >= sensors.length) {\n count = 0;\n }\n var sensor = sensors[count];\n var lineLabel = lineLabels[count];\n\n var thresholdTrendlinePercentage = $(\"#threshold\").val();\n var thresholdRangePercentage = $(\"#threshold-range\").val();\n\n var trendline = $(\"#select-trendline\").val();\n var trendlineData = [];\n\n /*\n Loading new sensors thresholds\n */\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n $(\"#sensor-name\").val(sensor);\n $(\"#sensor-name\").text(sensor);\n genereteSingleChart(lineLabel, getSensorMeasurementLabels_notNull(data, sensor), getSensorMeasurementValues_wearable_notNull(sensor, data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayBattery = getSensorMeasurementValues_wearable(\"battery\", data);\n var arrayAcceleration = getAcceleration(getSensorMeasurementValues_wearable(\"accelerometer\", data));\n var arrayRotation = getRotation(getSensorMeasurementValues_wearable(\"gyroscope\", data));\n var arrayHeartRate = getSensorMeasurementValues_wearable(\"hrm\", data);\n\n generateMultipleChart_wearable(getSensorMeasurementLabels(data), arrayBattery, arrayAcceleration, arrayRotation, arrayHeartRate);\n });\n\n $('.btn-back').off().on('click', function() {\n\n count = getSensorCount_wearable($(\"#sensor-name\").text());\n count--;\n\n if (count < 0) {\n count = sensors.length-1;\n }\n var sensor = sensors[count];\n var lineLabel = lineLabels[count];\n\n var thresholdTrendlinePercentage = $(\"#threshold\").val();\n var thresholdRangePercentage = $(\"#threshold-range\").val();\n\n var trendline = $(\"#select-trendline\").val();\n var trendlineData = [];\n switch(trendline) {\n case 'linear':\n var dataForTrendline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n trendlineData = getLinearTrendline(dataForTrendline);\n break;\n case 'frequent':\n trendlineData = getStaticMostFrequentValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'avg':\n trendlineData = getStaticAverageValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'min':\n trendlineData = getStaticMinValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'max':\n trendlineData = getStaticMaxValueTrendline(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n break;\n case 'trendzone':\n let interval = parseInt($(\"#timestamp-trendzone\").val());\n trendlineData = [];\n let dataForBaseline = changeIndexValues(getSensorMeasurementValues_wearable_notNull(sensors[count], data));\n for(let i = 0; i < dataForBaseline.length; i += interval) {\n let currentDataSplitted = dataForBaseline.slice(i, Math.min(i+interval-1, dataForBaseline.length));\n trendlineData = trendlineData.concat(getLinearTrendline(currentDataSplitted));\n }\n break;\n }\n\n $(\"#sensor-name\").val(sensor);\n $(\"#sensor-name\").text(sensor);\n genereteSingleChart(lineLabel, getSensorMeasurementLabels_notNull(data, sensor), getSensorMeasurementValues_wearable_notNull(sensor, data), trendlineData, thresholdTrendlinePercentage, thresholdRangePercentage);\n\n var arrayBattery = getSensorMeasurementValues_wearable(\"battery\", data);\n var arrayAcceleration = getAcceleration(getSensorMeasurementValues_wearable(\"accelerometer\", data));\n var arrayRotation = getRotation(getSensorMeasurementValues_wearable(\"gyroscope\", data));\n var arrayHeartRate = getSensorMeasurementValues_wearable(\"hrm\", data);\n\n generateMultipleChart_wearable(getSensorMeasurementLabels(data), arrayBattery, arrayAcceleration, arrayRotation, arrayHeartRate);\n\n });\n }", "function configureWatchers(){$scope.$watch('$mdTabsCtrl.selectedIndex',handleSelectedIndexChange);}", "attributeChangedCallback(attrName, oldVal, newVal) {\n }", "function aconChangeFn(scope) {\n\tif ( scope.acon == true ) {\n\t\tacon_flag = true;\n\t} else {\n\t\tacon_flag = false;\n\t}\n\tmarkerProteinsCheck(scope, scope.acon, total_marker_array[2]); /** Function for marker proteins check */\n}", "function updateTrendValue() {\n\t if (!$scope.trendMap) return;\n\t var av = $scope.aggregateValueAsXrp;\n\t for (var cur in $scope.trendMap) {if ($scope.trendMap.hasOwnProperty(cur)){\n\t var rate = ($scope.exchangeRates[cur] || 0);\n\t var sbAsXrp = $scope.trendMap[cur] * rate;\n\t av -= sbAsXrp;\n\t }}\n\t $scope.trendValueAsPercentage = ($scope.aggregateValueAsXrp - av) / av;\n\t }", "function drawLineChart($scope){\n\tif(!$scope.chartTypeToggle.line){\n\t\treturn;\n\t}\n\tvar svg = $scope.svg;\n\tvar $axisProvider = $scope.$axisProvider;\n\tvar $lineChartProvider = $scope.$injector.get(\"$lineChartProvider\");\n\t$scope.$lineChartProvider = $lineChartProvider;\n\t$lineChartProvider.axisProvider = $axisProvider;\n\t$lineChartProvider.svg = svg;\n\t$lineChartProvider.data = getDataFromScope($scope);\n\t$lineChartProvider.effect = $scope.chartEffect;\n\t$lineChartProvider.dataX = $scope.chartX;\n\t$lineChartProvider.dataY = $scope.chartY;\n\t$lineChartProvider.animate = $scope.chartAnimate;\n \n\t$lineChartProvider.draw();\n\t\n\t$scope.$watch('chartAnimate',function(newValue,oldValue){\n\t\t$lineChartProvider.animate = newValue;\n\t\t//redraw only when animate was turned on from off.\n\t\tif(!oldValue && newValue && $scope.chartTypeToggle.line){\n\t\t\t$lineChartProvider.draw();\n\t\t}\n\t});\n\t$scope.$watch('chartEffect',function(newValue,oldValue){\n\t\t$lineChartProvider.effect = newValue;\n\t\tif(oldValue!=newValue && $scope.chartTypeToggle.line){\n\t\t\t$lineChartProvider.draw();\n\t\t}\n\t});\t\n}", "attributeChangedCallback(attrName, oldVal, newVal) {\n this.render();\n }", "attributeChangedCallback(attrName, oldVal, newVal) {\n this.render();\n }", "function ovalChangeFn(scope) {\n\tif ( scope.oval == true ) {\n\t\toval_flag = true;\n\t} else {\n\t\toval_flag = false;\n\t}\n\tmarkerProteinsCheck(scope, scope.oval, total_marker_array[1]); /** Function for marker proteins check */\n}" ]
[ "0.62455934", "0.5657551", "0.5550135", "0.548623", "0.54443216", "0.5205934", "0.51886714", "0.5124011", "0.5082364", "0.50385934", "0.5036777", "0.50070745", "0.49811822", "0.4980709", "0.4980709", "0.49757075", "0.49747786", "0.49603048", "0.491466", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.49080738", "0.4899733", "0.48639584", "0.48546737", "0.48208463", "0.4805626", "0.47978413", "0.47951204", "0.4790222", "0.47895607", "0.4788932", "0.47803685", "0.4740964", "0.47131643", "0.47002196", "0.46918714", "0.46855924", "0.46680897", "0.46625674", "0.46544397", "0.46505406", "0.46452188", "0.46392143", "0.46281368", "0.46281368", "0.46281368", "0.46281368", "0.4602522", "0.4601636", "0.4599356", "0.45987275", "0.45953077", "0.45910293", "0.45858255", "0.45766938", "0.45766938", "0.45712516" ]
0.7296781
0
jshint rhino:true /eslintenv rhino
function getEnv (name) { return String(java.lang.System.getProperty(name)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JSHint() {\n\n\treturn parent.gulp.src(parent.CONFIG.scripts)\n\t\t.pipe(parent.jshint())\n\t\t.pipe(parent.jshint.reporter(parent.stylish));\n\t\t\n}", "function jslint() {\n return gulp.src(paths.scripts.watch)\n .pipe(jshint('.jshintrc'))\n .pipe(jshint.reporter('default'));\n}", "function jshint (jshintfile) {\n return lazypipe()\n .pipe(g.jshint, jshintfile)\n .pipe(g.jshint.reporter, stylish)();\n}", "function jshint(jshintfile) {\r\n return lazypipe()\r\n .pipe(g.jshint, jshintfile)\r\n .pipe(g.jshint.reporter, stylish)();\r\n}", "function _jshint (isStylish) {\n var jshintfile = './.jshintrc';\n var jshintSettings = JSON.parse (fs.readFileSync (jshintfile, 'utf8'));\n\n return lazypipe ()\n .pipe (jshint, jshintSettings)\n .pipe (jshint.reporter, isStylish ? stylish : 'default') ();\n}", "function hint( src, path ) {\n write( \"Validating with JSHint...\");\n\n if ( jshint( src, config.jshint ) ) {\n ok();\n } else {\n error();\n\n jshint.errors.forEach(function( e ) {\n if ( !e ) { return; }\n var str = e.evidence ? e.evidence.inverse : \"\";\n\n str = str.replace( /\\t/g, \" \" ).trim();\n error( path + \" [L\" + e.line + \":C\" + e.character + \"] \" + e.reason + \"\\n \" + str );\n });\n fail( \"JSHint found errors.\" );\n }\n}", "function lintCode() {\n return gulp.src(mergeSources(\n config.assets.env.js,\n config.assets.client.js.app,\n config.assets.client.js.tests,\n config.assets.server.js.app,\n config.assets.server.js.tests\n )).pipe(cached('lintAll'))\n .pipe(jshint())\n .pipe(jscs())\n .on('error', noop)\n .pipe(stylish.combineWithHintResults())\n .pipe(jshint.reporter('jshint-stylish'));\n}", "function DSL(code, opts) {\n code = code || \"var foo = 1\";\n opts = opts || options;\n var result = jshint(code, opts);\n return fixMyJS(jshint.data(), code);\n}", "function lintJS() {\r\n\treturn gulp\r\n\t\t.src( paths.lintFiles.js )\r\n\t\t.pipe( eslint() )\r\n\t\t.pipe( eslint.format() )\r\n\t\t.on( 'error', notify.onError() );\r\n}", "async fixLint() {\n try {\n await execa(path.join('node_modules', '.bin', 'eslint'), ['--fix', '.']);\n } catch (e) {\n return;\n }\n }", "function lintJs () {\n var task = config.task.lintJs;\n\n return pipeline([\n gulp.src(task.src),\n eslint(),\n eslint.format(),\n eslint.failOnError(),\n gulpif(!hideNotify, notify(task.notifyOptions))\n ], errorFormatter);\n}", "function lintClientCode() {\n return gulp.src(mergeSources(\n config.assets.client.js.app,\n config.assets.client.js.tests\n )).pipe(cached('lintClient'))\n .pipe(jshint())\n .pipe(jscs())\n .on('error', noop)\n .pipe(stylish.combineWithHintResults())\n .pipe(jshint.reporter('jshint-stylish'));\n}", "function scaffoldJS() {\n\n prompt.get({\n properties: {\n answer: {\n description: 'What flavour of javascript would you like? [coffeescript, es6, js, skip]\\n(default: coffeescript)'.cyan\n }\n }\n }, function (err, result) {\n switch (result.answer.toLowerCase()) {\n case 'skip':\n whisper('skipping JS setup...');\n jsChoice = null;\n break;\n case 'es6':\n affirm('EcmaScript6 ... I can see you live on the edge.');\n jsChoice = 'es6';\n fs.ensureDirSync(workingDir + 'src/es6');\n break;\n case 'js':\n affirm('Nothing wrong with vanilla JavaScript!');\n jsChoice = 'js';\n fs.ensureDirSync(workingDir + 'src/js');\n break;\n case 'coffeescript':\n case '':\n affirm('Brewing coffeescript...');\n jsChoice = 'coffeescript';\n fs.ensureDirSync(workingDir + 'src/coffeescript');\n break;\n default:\n error('Please select \"coffeescript\", \"es6\", \"js\", or \"skip\".');\n return scaffoldJS(); // Repeat this step\n }\n\n scaffoldNPM(); // Go to next step\n });\n}", "function lint() {\n return gulp.src([\n paths.scripts.src + '*.js',\n `!${paths.scripts.src}*.min.js`,\n ])\n .pipe(jshint())\n .pipe(jshint.reporter('jshint-stylish'));\n}", "async function lint() {\n\tif (cli.flags.lint === true) {\n\t\tif (cli.flags.strict === true) {\n\t\t\tif (cli.flags.watch === true) {\n\t\t\t\t// Lint Strict True, Watch True\n\t\t\t\tgulpfile.watchLintStrict();\n\t\t\t} else {\n\t\t\t\t// Lint Strict True, Watch False\n\t\t\t\tgulpfile.lintStrict();\n\t\t\t}\n\t\t} else if (cli.flags.watch === true) {\n\t\t\t// Lint Strict False, Watch True\n\t\t\tgulpfile.watchLint();\n\t\t} else {\n\t\t\t// Lint Strict False, Watch False\n\t\t\tgulpfile.lint();\n\t\t}\n\n\t\tif (cli.flags.fix) {\n\t\t\tif (cli.flags.watch) {\n\t\t\t\tgulpfile.autoFixSrc();\n\t\t\t} else {\n\t\t\t\tgulpfile.fixSrc();\n\t\t\t}\n\t\t}\n\t}\n}", "function jshintNotify(file) {\n\tif (!file.jshint) {\n\t\treturn;\n\t}\n\treturn file.jshint.success ? false : 'JSHint failed';\n}", "function compileTsLintRules() {\n\tconsole.log('Compile TSLint rules');\n\texecSync(\n\t\t`${path.normalize(\n\t\t\tENV_NODE\n\t\t)} ./node_modules/typescript/lib/tsc.js -p ${TSLINT_RULES_PATH}`\n\t);\n}", "async updateEslintRc() {\n const after = /['\"`]testem\\.js['\"`],/;\n const content = \"\\n 'testem-electron.js',\";\n await this.insertIntoFile('.eslintrc.js', content, { after });\n }", "function eslintCompliance() {\n return gulp.src([SRC_DIR, 'jest.config.js'])\n .pipe(eslint({\n useEslintrc: true,\n }));\n}", "function lintJS(src, dest) {\n dest = dest || config.src.jsPath;\n\n return gulp.src(src)\n .pipe(eslint({\n fix: true\n }))\n .pipe(eslint.format())\n .pipe(isFixed(dest));\n}", "function lintServerCode() {\n return gulp.src(mergeSources(\n config.assets.server.js.app,\n config.assets.server.js.tests\n )).pipe(cached('lintServer'))\n .pipe(jshint())\n .pipe(jscs())\n .on('error', noop)\n .pipe(stylish.combineWithHintResults())\n .pipe(jshint.reporter('jshint-stylish'));\n}", "function lint() {\n return gulp.src(\n [\n srcRoot + \"**/*.js\"\n ]\n ).pipe(\n eslint()\n ).pipe(\n eslint.format()\n ).pipe(\n eslint.failAfterError()\n );\n }", "function fixMyJS(data, src, options) {\n var code = new Code(src);\n var warnings = data.errors || [];\n var results = [];\n var config = data.options || {};\n var current = 0;\n\n// merge custom options into config\n if (options) {\n Object.keys(options).forEach(function (option) {\n config[option] = options[option];\n });\n }\n\n function resetResults() {\n var dupes = {};\n// Filter out errors we don't support.\n// If the error is null then we immediately return false\n// Then we check for duplicate errors. Sometimes JSHint will complain\n// about the same thing twice. This is a safeguard.\n// Otherwise we return true if we support this error.\n results = warnings.filter(function (v) {\n if (!v) {\n return false;\n }\n\n var err = 'line' + v.line +\n 'char' + v.character +\n 'reason' + v.reason;\n\n if (dupes.hasOwnProperty(err)) {\n return false;\n }\n dupes[err] = v;\n\n if (v.hasOwnProperty('fixable')) {\n return v.fixable;\n }\n\n return (v.fixable = errors.hasOwnProperty(v.code));\n });\n\n// sorts errors by priority.\n results.sort(byPriority);\n }\n\n resetResults();\n\n\n// fixMyJS API\n//\n// * getErrors\n// * getAllErrors\n// * getCode\n// * next\n// * fix\n// * getDetails\n// * run\n var api = {\n// returns are supported errors that can be fixed.\n getErrors: function () {\n return results.slice(0);\n },\n\n getAllErrors: function () {\n return warnings.slice(0);\n },\n\n// returns the current state of the code.\n getCode: function () {\n return code.getCode();\n },\n\n// Iterator method. Returns Boolean if there is a next item\n//\n// Example:\n// while (af.hasNext()) {\n// var a = af.next();\n// }\n hasNext: function () {\n return (current < results.length);\n },\n\n// Iterator method. Iterates through each error in the\n// Array and returns an Object with fix and getDetails methods.\n// if the end of the Array is reached then an error is thrown.\n//\n// fix function will fix the current error and return the state of the code.\n// getDetails will return a prototype of the current error's details\n next: function () {\n if (!this.hasNext()) {\n throw new Error('End of list.');\n }\n\n var r = copyResults(results[current], config);\n var data = {\n fix: function () {\n fixError(r, code);\n return code.getCode();\n },\n fixVerbose: function () {\n return {\n original: code._src[r.line],\n replacement: fixError(r, code)\n };\n },\n getDetails: function () {\n return Object.create(r);\n }\n };\n current += 1;\n return data;\n },\n\n filterErrors: function (fn) {\n warnings = warnings.map(function (w) {\n w.fixable = fn(w);\n return w;\n });\n resetResults();\n return warnings.slice(0);\n },\n\n// runs through all errors and fixes them.\n// returns the fixed code.\n//\n// **returnErrors** Boolean - true if you'd like an Array of all errors\n// with the proposed fix.\n//\n// returns the code String || an Array of JSHint errors.\n run: function (returnErrors) {\n if (returnErrors) {\n return warnings\n .slice(0)\n .sort(byPriority)\n .map(function (v) {\n v.fixable && (v.fix = fixError(copyResults(v, config), code));\n return v;\n });\n } else {\n results.forEach(fixErrors(code, config));\n return code.getCode();\n }\n },\n\n runVerbose: function () {\n var lint = [];\n var dup = {};\n var next;\n while (api.hasNext()) {\n next = api.next();\n lint.push(copyResults(next.fixVerbose(), next.getDetails()));\n }\n return lint.reverse().filter(function (x) {\n if (dup.hasOwnProperty(x.original)) {\n return false;\n }\n x.line = x.config.line;\n dup[x.original] = x;\n return true;\n });\n }\n };\n\n return api;\n }", "function lintPHP() {\r\n\treturn gulp\r\n\t\t.src( paths.lintFiles.php )\r\n\t\t.pipe(\r\n\t\t\tphpcs( {\r\n\t\t\t\tbin: 'vendor/bin/phpcs',\r\n\t\t\t\tstandard: 'phpcs.xml',\r\n\t\t\t\twarningSeverity: 0\r\n\t\t\t} )\r\n\t\t)\r\n\t\t.pipe( phpcs.reporter( 'log' ) )\r\n\t\t.pipe( phpcs.reporter( 'fail', { failOnFirst: false } ) )\r\n\t\t.on( 'error', notify.onError() );\r\n}", "function resetJsdocEnv() {\n const env = require('jsdoc/env');\n\n env.conf = {\n tags: {\n dictionaries: ['jsdoc']\n },\n templates: {\n cleverLinks: false,\n monospaceLinks: false\n }\n };\n env.dirname = path.resolve(__dirname, '../../node_modules/jsdoc');\n env.opts = {\n // list of source files parsed by JSDoc\n _: [],\n // encoding for reading/writing files\n encoding: 'utf8',\n // destination for template output\n destination: './out/',\n // path to the JSDoc template\n template: path.resolve(__dirname, '../..')\n };\n env.version = {\n number: '1.2.3.4'\n };\n}", "function commonjsMain(args) {\n if (!args[1]) {\n console.log('Usage: ' + args[0] + ' FILE');\n process.exit(1);\n }\n\n var source = require('fs').readFileSync(require('path').normalize(args[1]), \"utf8\");\n\n return exports.parser.parse(source);\n } // debug mixin for LR parser generators", "function runLint () {\n execSync('yarn lint');\n}", "function tryToEnableLint() {\n try {\n cm.setOption(\"lint\", false);\n cm.setOption(\"lint\", true);\n } catch (ignore) {}\n }", "function ecma (){}", "function run() {\n 'use strict';\n}", "function lint(files, options) {\n return () => {\n return gulp.src(files)\n .pipe(reload({stream: true, once: true}))\n .pipe($.eslint(options))\n .pipe($.eslint.format())\n .pipe($.if(!browserSync.active, $.eslint.failAfterError()));\n };\n}", "function strictly() {\n 'use strict';\n\n}", "function hello2() {\n const bye = \"bye\";\n\n /**\n * For disable the es-lint on the line\n * Please put the below comment\n * now instead of the error we will have the warning for below 2\n */\n // eslint-disable-next-line\n console.log(\"this is sample \", bye);\n\n /**\n * disabling a particular rule for the eslint\n */\n // eslint-disable-next-line quotes\n console.log(\"this is sample \", 2323232);\n\n const a = 95;\n\n console.log(`vaylue for the a the `, a);\n}", "function yo(){ }", "function linter(source) {\r\n return [\r\n view_1.ViewPlugin.create(function (view) {\r\n var lintTime = Date.now() + LintDelay, set = true;\r\n function run() {\r\n var now = Date.now();\r\n if (now < lintTime - 10)\r\n return setTimeout(run, lintTime - now);\r\n set = false;\r\n view.dispatch(view.state.t().annotate(exports.setDiagnostics(source(view))));\r\n }\r\n setTimeout(run, LintDelay);\r\n return {\r\n update: function (update) {\r\n if (update.docChanged) {\r\n lintTime = Date.now() + LintDelay;\r\n if (!set) {\r\n set = true;\r\n setTimeout(run, LintDelay);\r\n }\r\n }\r\n }\r\n };\r\n }).extension,\r\n linting()\r\n ];\r\n}", "async updateEslintIgnore() {\n const toAppend = ['', '# ember-electron', `/${electronProjectPath}/`].join(\n '\\n'\n );\n\n await this.insertIntoFile('.eslintignore', toAppend);\n }", "function runJsLintChecksAsync() {\n console.log('\\nRunning JS lint checks...');\n var rootDir = path.join(__dirname, projectConfig.OPTIONS.rootSrcDir);\n\n // Some common options projects may want to change:\n // --strict: Checks stricter rules like line spacing\n // --nojsdoc: For projects not using jsDoc type annotations\n // Run gjslint --help to see a complete list of options.\n var jsLintOptions = ['-r', rootDir, '--strict'];\n var jsLinter =\n child_process.spawn('gjslint', jsLintOptions, {stdio: 'inherit'});\n var promise = kew.defer();\n\n jsLinter.on('error', function(err) {\n console.error('Unable to run Closure linter.\\n' +\n 'Make sure gjslint is installed and on your path. See:\\n' +\n ' http://developers.google.com/closure/utilities/docs/linter_howto');\n promise.reject(err);\n });\n\n jsLinter.on('close', function(exitCode) {\n if (exitCode != EXIT_SUCCESS) {\n promise.reject(new Error('JS linter had errors'));\n } else {\n promise.resolve(null);\n }\n });\n\n return promise;\n}", "function foo() {\n \"use strict\";\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 esLint(eslint, config) {\r\n if (!config) {\r\n config = {\r\n parserOptions: { ecmaVersion: 2019, sourceType: \"module\" },\r\n env: { browser: true, node: true, es6: true, es2015: true, es2017: true, es2020: true },\r\n rules: {}\r\n };\r\n eslint.getRules().forEach(function (desc, name) {\r\n if (desc.meta.docs.recommended)\r\n config.rules[name] = 2;\r\n });\r\n }\r\n function range(state, from, to) {\r\n if (from === void 0) { from = 0; }\r\n if (to === void 0) { to = state.doc.length; }\r\n var fromLine = state.doc.lineAt(from), offset = { line: fromLine.number - 1, col: from - fromLine.start, pos: from };\r\n return eslint.verify(state.doc.slice(from, to), config)\r\n .map(function (val) { return translateDiagnostic(val, state.doc, offset); });\r\n }\r\n return function (view) {\r\n var syntax = view.state.behavior(state_1.EditorState.syntax)[0];\r\n if (syntax == javascript_1.javascriptSyntax)\r\n return range(view.state);\r\n if (!syntax || !(syntax instanceof syntax_1.LezerSyntax && syntax.parser.hasNested))\r\n return [];\r\n var found = [];\r\n syntax.getPartialTree(view.state, 0, view.state.doc.length).iterate({\r\n enter: function (type, start, end) {\r\n if (type == javascript_1.javascriptSyntax.docNodeType) {\r\n for (var _i = 0, _a = range(view.state, start, end); _i < _a.length; _i++) {\r\n var d = _a[_i];\r\n found.push(d);\r\n }\r\n return false;\r\n }\r\n return undefined;\r\n }\r\n });\r\n return found;\r\n };\r\n}", "function commonjsMain(args) {\n if (!args[1]) {\n console.log('Usage: '+args[0]+' FILE');\n process.exit(1);\n }\n let source = fs.readFileSync(path.normalize(args[1]), 'utf8');\n return exports.parser.parse(source);\n}", "function confine(exprSrc, env) {\n exprSrc = ''+exprSrc;\n const names = Object.getOwnPropertyNames(env);\n // Note: no newline prior to ${exprSrc}, so that line numbers for\n // errors within exprSrc are accurate. Column numbers on the first\n // line won't be, but will on following lines.\n let closedFuncSrc =\n`(function(${names.join(',')}) { \"use strict\"; return (${exprSrc});\n})\n//# sourceURL=data:${encodeURIComponent(exprSrc)}\n`;\n const closedFunc = (1,eval)(closedFuncSrc);\n return closedFunc(...names.map(n => env[n]));\n }", "function commonjsMain (args) {\n if (!args[1]) {\n console.log('Usage: ' + args[0] + ' FILE');\n process.exit(1);\n }\n var source = require('fs').readFileSync(require('path').normalize(args[1]), 'utf8');\n return exports.parser.parse(source);\n}", "afterInstall() {\n // load .eslintrc\n let eslintrcPath = path.join(this.project.root, '.eslintrc.js');\n let eslintrc = fs.existsSync(eslintrcPath) && fs.readFileSync(eslintrcPath, { encoding: 'utf8' });\n let eslintrcLines = eslintrc && eslintrc.split('\\n');\n // load tsconfig.json\n let tsconfigPath = path.join(this.project.root, 'tsconfig.json');\n let tsconfigJSON = fs.existsSync(tsconfigPath) && fs.readFileSync(tsconfigPath, { encoding: 'utf8' });\n let tsconfig = tsconfigJSON && JSON.parse(tsconfigJSON);\n\n // Mod .eslintrc file to add parser if it doesn't already have one defined\n let parserIndex = eslintrcLines && eslintrcLines.findIndex(line => line.match(/parser:/));\n let rootIndex = eslintrcLines && eslintrcLines.findIndex(line => line.match(/root:/));\n\n if (parserIndex > -1) {\n this.project.ui.writeWarnLine(\n `Found an ESLint parser already defined, and so could not automatically set the eslint parser. You\n may need to add \\`parser: 'babel-eslint'\\` to your eslintrc.js. Note: if specifically using another\n parser (like, \\`parser: 'typescript-eslint-parser'\\`), this may not be necessary.`\n );\n } else if (eslintrcLines && rootIndex > -1) {\n eslintrcLines.splice(rootIndex + 1, 0, ` parser: 'babel-eslint',`);\n fs.writeFileSync(eslintrcPath, eslintrcLines.join('\\n'));\n } else {\n this.project.ui.writeWarnLine(\n 'Could not automatically set the eslint parser, add `parser: \\'babel-eslint\\' to your eslintrc.js'\n );\n }\n\n // If tsconfig file found, add experimentalDecorators support\n if (tsconfig && (typeof tsconfig.compilerOptions === 'object' || !tsconfig.compilerOptions)) {\n tsconfig.compilerOptions = Object.assign(tsconfig.compilerOptions || {}, { experimentalDecorators: true });\n fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));\n }\n\n return this.addPackageToProject('babel-eslint', '^8.0.0').then(() => {\n return addScopedAddonToProject(this, {\n name: '@ember-decorators/babel-transforms',\n target: '^3.1.0'\n });\n });\n }", "function esLint(eslint, config) {\n if (!config) {\n config = {\n parserOptions: { ecmaVersion: 2019, sourceType: \"module\" },\n env: { browser: true, node: true, es6: true, es2015: true, es2017: true, es2020: true },\n rules: {}\n };\n eslint.getRules().forEach((desc, name) => {\n if (desc.meta.docs.recommended)\n config.rules[name] = 2;\n });\n }\n return (view) => {\n let { state } = view, found = [];\n for (let { from, to } of javascriptLanguage.findRegions(state)) {\n let fromLine = state.doc.lineAt(from), offset = { line: fromLine.number - 1, col: from - fromLine.from, pos: from };\n for (let d of eslint.verify(state.sliceDoc(from, to), config))\n found.push(translateDiagnostic(d, state.doc, offset));\n }\n return found;\n };\n}", "function lintFile(data, fileObj, finish) {\n //run the linter promise\n type_javascript_linter(data)\n .then(function (results) {\n //add the results to the fileObj\n fileObj[\"lint\"] = results;\n //run the junction callback\n finish();\n });\n }", "Program(node) {\n const scope = context.getScope(),\n features = context.parserOptions.ecmaFeatures || {};\n\n stack.push({\n init: true,\n node,\n valid: !(\n scope.isStrict ||\n node.sourceType === \"module\" ||\n (features.globalReturn && scope.childScopes[0].isStrict)\n )\n });\n }", "function lintJs(js_file) {\n\t\tlet report = eslint.executeOnFiles([ js_file ]);\n\t\tlet filename = './' + js_file.replace(site.directory + '/', '');\n\n\t\t// output report only when something to show\n\t\tif (report.errorCount != 0 || report.warningCount != 0) {\n\t\t\tif (report.errorCount) {\n\t\t\t\t// found an error\n\t\t\t\tlogit.log('js', 'found an error in script ' + filename.bold, 'fail');\n\n\t\t\t\tlet formatted = formatter(report.results);\n\t\t\t\tconsole.log(formatted);\n\t\t\t\tlet html = convert.toHtml(formatted);\n\n\t\t\t\tbs.app.notify(html, 12000);\n\t\t\t\treturn false;\n\t\t\t} else if (report.warningCount) {\n\t\t\t\t// got a warning\n\t\t\t\tlogit.log('js', 'found a potential issue in script ' + filename.bold, 'warn');\n\n\t\t\t\tlet formatted = formatter(report.results);\n\t\t\t\tconsole.log(formatted);\n\t\t\t\tlet html = convert.toHtml(formatted);\n\n\t\t\t\tbs.app.notify(html, 12000);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else {\n\t\t\tlogit.log('js', 'successfully linted ' + filename.bold , 'pass');\n\n\t\t\tlet html = 'successfully linted ' + filename\n\t\t\tbs.app.notify(html, 12000);\n\t\t\treturn true;\n\t\t}\n\t}", "function greet() {\n 'use strict';\n console.log('hi');\n}", "cleanScript(jsfile) {// N/A in web\n }", "function commonLintTasks(inputStream) {\n return inputStream\n .pipe(eslint())\n .pipe(eslint.formatEach())\n .pipe( $if( production, eslint.failAfterError() ) )\n}", "function goLint(fileUri, goConfig, scope) {\n epoch++;\n const closureEpoch = epoch;\n if (tokenSource) {\n if (running) {\n tokenSource.cancel();\n }\n tokenSource.dispose();\n }\n tokenSource = new vscode.CancellationTokenSource();\n const currentWorkspace = util_1.getWorkspaceFolderPath(fileUri);\n const cwd = scope === 'workspace' && currentWorkspace ? currentWorkspace : path.dirname(fileUri.fsPath);\n if (!path.isAbsolute(cwd)) {\n return Promise.resolve([]);\n }\n const lintTool = goConfig['lintTool'] || 'golint';\n const lintFlags = goConfig['lintFlags'] || [];\n const lintEnv = goEnv_1.toolExecutionEnvironment();\n const args = [];\n lintFlags.forEach((flag) => {\n // --json is not a valid flag for golint and in gometalinter, it is used to print output in json which we dont want\n if (flag === '--json') {\n return;\n }\n if (flag.startsWith('--config=') || flag.startsWith('-config=')) {\n let configFilePath = flag.substr(flag.indexOf('=') + 1).trim();\n if (!configFilePath) {\n return;\n }\n configFilePath = util_1.resolvePath(configFilePath);\n args.push(`${flag.substr(0, flag.indexOf('=') + 1)}${configFilePath}`);\n return;\n }\n args.push(flag);\n });\n if (lintTool === 'gometalinter') {\n if (args.indexOf('--aggregate') === -1) {\n args.push('--aggregate');\n }\n if (goConfig['toolsGopath']) {\n // gometalinter will expect its linters to be in the GOPATH\n // So add the toolsGopath to GOPATH\n lintEnv['GOPATH'] += path.delimiter + util_1.getToolsGopath();\n }\n }\n if (lintTool === 'golangci-lint') {\n if (args.indexOf('run') === -1) {\n args.unshift('run');\n }\n if (args.indexOf('--print-issued-lines=false') === -1) {\n // print only file:number:column\n args.push('--print-issued-lines=false');\n }\n if (args.indexOf('--out-format=colored-line-number') === -1) {\n // print file:number:column.\n // Explicit override in case .golangci.yml calls for a format we don't understand\n args.push('--out-format=colored-line-number');\n }\n if (args.indexOf('--issues-exit-code=') === -1) {\n // adds an explicit no-error-code return argument, to avoid npm error\n // message detection logic. See golang/vscode-go/issues/411\n args.push('--issues-exit-code=0');\n }\n }\n if (scope === 'workspace' && currentWorkspace) {\n args.push('./...');\n goStatus_1.outputChannel.appendLine(`Starting linting the current workspace at ${currentWorkspace}`);\n }\n else if (scope === 'file') {\n args.push(fileUri.fsPath);\n goStatus_1.outputChannel.appendLine(`Starting linting the current file at ${fileUri.fsPath}`);\n }\n else {\n goStatus_1.outputChannel.appendLine(`Starting linting the current package at ${cwd}`);\n }\n running = true;\n const lintPromise = util_1.runTool(args, cwd, 'warning', false, lintTool, lintEnv, false, tokenSource.token).then((result) => {\n if (closureEpoch === epoch) {\n running = false;\n }\n return result;\n });\n return lintPromise;\n}", "function lintOpenFiles() {\n (vscode.workspace.textDocuments || []).forEach(lint);\n}", "function beautify(js) {\n return _beautify(js, {\n indent_size: 2,\n max_preserve_newlines: 2,\n jslint_happy: true,\n space_after_anon_function: true,\n end_with_newline: true,\n good_stuff: true\n });\n}", "provideLinter() {\n return {\n name: 'dummy', // the name of the lint tool\n grammarScopes: ['source.dummy'], // the grammar source (an atom language usually)\n scope: 'file',\n lintsOnChange: false, // lints on the fly or on save only\n lint: async (editor) => {\n if (!atom.workspace.isTextEditor(editor)) {\n // If we somehow get fed an invalid TextEditor just immediately return\n return null;\n }\n\n // the actual opened file\n const filePath = editor.getPath();\n if (!filePath) {\n return null;\n }\n\n loadDeps();\n\n // arguments passed to dummy lint tool (depends on your tool options)\n const args = [];\n\n args.push(filePath);\n\n if (this.extraOptions.length > 0) {\n args.push(this.extraOptions);\n }\n\n const execOptions = {\n stream: 'stderr', // the output receiver of the lint process\n uniqueKey: `linter-dummy::${filePath}`,\n allowEmptyStderr: true,\n };\n\n let output;\n try {\n // the output from stderr after calling dummy\n output = await helpers.exec(this.executablePath, args, execOptions);\n } catch (e) {\n // Message dialog on execution timeout\n if (e.message === 'Process execution timed out') {\n atom.notifications.addInfo('linter-dummy: `dummy` timed out', {\n description: 'A timeout occured while executing `dummy`, it could be due to lower resources '\n + 'or a temporary overload.',\n });\n } else {\n // An unexpected error dialog\n atom.notifications.addError('linter-dummy: Unexpected error', { description: e.message });\n }\n return null;\n }\n\n // Process was canceled by newer process\n if (output === null) { return null; }\n\n // Parse the output\n return parseDummyOutput(output, filePath, editor);\n },\n };\n }", "function FooRule() {\n}", "extend(config, ctx) {\n // Run ESLint on save\n /*\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options : {\n fix : true\n }\n })\n }\n */\n }", "function linter(source, config = {}) {\n return [\n lintConfig.of({ source, config }),\n lintPlugin,\n lintExtensions\n ];\n}", "function quit(code, line, chr) {\n var percentage = Math.floor((line / state.lines.length) * 100);\n var message = messages.errors[code].desc;\n \n throw {\n name: \"JSHintError\",\n line: line,\n character: chr,\n message: message + \" (\" + percentage + \"% scanned).\",\n raw: message,\n code: code\n };\n }", "_setupQualityFiles() {\n if (this.project.useQuality) {\n const { BASE, REACT, TYPESCRIPT } = QUALITY;\n const qualityFiles = [`${this.FILES_PATH}/quality/.*`, `${this.FILES_PATH}/quality/*`];\n\n this._consoleOutput('info', this.LOG_MESSAGES.copyQualityFiles);\n shell.cp('-R', qualityFiles, '.');\n\n this.eslint = this._loadFileContents('JSON', this.ESLINT_FILE);\n this._updatePackageFile('devDependencies', BASE.DEV_DEPENDENCIES);\n this._updatePackageFile('scripts', BASE.SCRIPTS);\n this._updateReadMeContent('quality');\n\n const { parserOptions, rules, settings } = this.eslint;\n\n if (this.REACT_PROJECT_TYPES.includes(this.project.type)) {\n // Remove the eslintConfig property injected by create-react-app.\n delete this.json.eslintConfig;\n\n // full stack inclusion will likely need these eslint declarations\n this.eslint.extends = this.eslint.extends.concat(REACT.EXTENDS);\n this.eslint.plugins = this.eslint.plugins.concat(REACT.PLUGINS);\n this.eslint.parserOptions = { ...parserOptions, ...REACT.PARSER_OPTIONS };\n this.eslint.rules = { ...rules, ...REACT.RULES };\n this.eslint.settings = { ...settings, ...REACT.SETTINGS };\n\n this._updatePackageFile('devDependencies', REACT.DEV_DEPENDENCIES);\n }\n\n // TODO: Fullstack option - we will probably need to manually add\n // certain eslint plugins and extensions for fullstack boilerplate projects\n // if (this.project.type === \"fullstack\") {\n // this.devDependencies = this.devDependencies.concat(\n // FULLSTACK.DEV_DEPENDENCIES\n // );\n // }\n\n // do a typescript check or create it's own function?\n if (this.project.useTypeScript) {\n this.babelConfig.presets = this.babelConfig.presets.concat(TYPESCRIPT.BABEL.PRESETS);\n\n this.eslint.extends = this.eslint.extends.concat(TYPESCRIPT.EXTENDS);\n this.eslint.parser = TYPESCRIPT.PARSER;\n this.eslint.parserOptions = { ...parserOptions, ...TYPESCRIPT.PARSER_OPTIONS };\n this.eslint.plugins = this.eslint.plugins.concat(TYPESCRIPT.PLUGINS);\n\n this._updatePackageFile('devDependencies', TYPESCRIPT.DEV_DEPENDENCIES);\n this._updatePackageFile('scripts', TYPESCRIPT.SCRIPTS);\n }\n }\n\n return this;\n }", "function test(){\r\n alert(\"this is a test\");\r\n\r\n // wanting to add more comments to see gulp in action pretending to be huge file\r\n}", "function sourceCodeChange(event) {\n\tvar codeText = $(\"sourcecode\").value;\n\tvar lineCount = codeText ? trim(codeText).split(/[\\r]?\\n/).length : 0;\n\n\tif ($(\"languagehtml\").checked) {\n\t\t// remove multi-line <!-- ... --> comments from HTML\n\t\tcodeText = codeText.replace(/\\<!--([^-]|-[^-])*--\\>/gi, \"\");\n\t} else if ($(\"languageml\").checked) {\n\t\t// remove multi-line (* ... *) comments from ML code\n\t\tcodeText = codeText.replace(/\\(\\*([^*]*\\*[^\\)])*([^*]*\\*)\\)/gi, \"\");\n\t\t\n\t\t// try not to count lines that contain only \"in\" or \"end\"\n\t\tcodeText = codeText.replace(/[ \\t]*let[ \\t]*/gi, \"\");\n\t\tcodeText = codeText.replace(/[ \\t]*in[ \\t]*/gi, \"\");\n\t\tcodeText = codeText.replace(/[ \\t]*end[ \\t]*[;]?/gi, \"\");\n\t} else if ($(\"languagescheme\").checked) {\n\t\t// remove ; comments\n\t\tcodeText = \"\\n\" + codeText + \"\\n\"; // makes regexes match ends of input\n\t\tcodeText = codeText.replace(/\\s*;.*/gim, \"\");\n\n\t\t// remove blank lines and lines containing only ( or ) (or [ or ])\n\t\t// (hack: I remove the regex 5x because for some reason it doesn't\n\t\t// properly remove multiple lines of ) in a row)\n\t\tcodeText = codeText.replace(/\\r/, \"\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t} else {\n\t\tif ($(\"languagephp\").checked) {\n\t\t\t// remove # comments (not Java syntax, but useful for Perl/PHP/shell/etc.)\n\t\t\tcodeText = codeText.replace(/\\s*#[! \\t].*/gim, \"\");\n\t\t}\n\n\t\t// remove // comments\n\t\tcodeText = \"\\n\" + codeText + \"\\n\"; // makes regexes match ends of input\n\t\tcodeText = codeText.replace(/\\s*\\/\\/.*/gim, \"\");\n\n\t\t// remove multi-line / * * / comments\n\t\t// codeText = codeText.replace(/\\/\\*([^*]*\\*)*([^*]*\\*)\\//gi, \"\");\n\t\tcodeText = codeText.replace(/\\/\\*([^*]*\\*[^\\/])*([^*]*\\*)\\//gi, \"\");\n\t}\n\n\t// remove blank lines and lines containing only { or } braces\n\t// (hack: I remove the regex 5x because for some reason it doesn't\n\t// properly remove multiple lines of } in a row)\n\tcodeText = codeText.replace(/\\r/, \"\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\n\tcodeText = trim(codeText); // kill leading/trailing \\n that I inserted\n\n\t// dump to page for debugging\n\t// $(\"dumptarget\").innerHTML = htmlEncode(codeText);\n\n\tvar substantiveLineCount = codeText ? trim(codeText).split(/[\\r]?\\n/).length : 0;\n\t$(\"linecount\").innerHTML = lineCount;\n\t$(\"substantivelinecount\").innerHTML = substantiveLineCount;\n}", "function main(argv)\n{\n\tif(argv.h)\n\t{\n\t\tdisplayUsage();\n\t\tprocess.exit(0);\n\t}\n\n\tif(argv.l)\n\t{\n\t\tdisplayTasks();\n\t\tprocess.exit(0);\n\t}\n\n\t//default doesn't seem to be working for OPTIMIST right now\n\t//if task is not specified, we default to ALL\n\tvar task = (!argv.tasks)?\"ALL\":argv.tasks.toUpperCase();\n\n\tif(!taskIsRecognized(task))\n\t{\n\t\tprint(\"Unrecognized task : \" + task);\n\t\tdisplayUsage();\n\t\tprocess.exit(1);\n\t}\n\n\tverbose = argv.v != undefined;\n\tversion = argv.version;\n\n\textraSourceFiles = argv.s;\n\t\n\tif(argv.o)\n\t{\n\t\tjs_file_name = argv.o;\n\t}\n\n\tvar shouldBuildSource = (task == TASK.BUILDSOURCE);\n\tvar shouldBuildDocs = (task == TASK.BUILDDOCS);\n\n\tif(task==TASK.CLEAN)\n\t{\n\t\tcleanTask(\n\t\t\tfunction(success)\n\t\t\t{\n\t\t\t\tprint(\"Clean Task Completed\");\n\t\t\t}\n\t\t);\n\t}\n\n\tif(task == TASK.ALL)\n\t{\t\n\t\tshouldBuildSource = true;\n\t\tshouldBuildDocs = true;\n\t}\n\n\tif(shouldBuildDocs && (version == undefined))\n\t{\n\t\tdisplayUsage();\n\t\tprocess.exit(0);\n\t}\n\n\tif(shouldBuildSource)\n\t{\n\t\tbuildSourceTask(function(success)\n\t\t{\t\t\n\t\t\tprint(\"Build Source Task Complete\");\n\t\t\tif(shouldBuildDocs)\n\t\t\t{\n\t\t\t\tbuildDocsTask(version,\n\t\t\t\t\tfunction(success)\n\t\t\t\t\t{\n\t\t\t\t\t\tprint(\"Build Docs Task Complete\");\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t});\n\t}\n\n\tif(shouldBuildDocs && task != \"ALL\")\n\t{\n\t\tbuildDocsTask(version,\n\t\t\tfunction(success)\n\t\t\t{\n\t\t\t\tprint(\"Build Docs Task Complete\");\n\t\t\t}\n\t\t);\n\t}\t\n}", "function makeFiles() {\n const out = {}\n const isNode = rule => /^node/.test(rule)\n const splitNodeEnv = splitObject(standardConfig.env, isNode)\n const splitNodePlugins = splitArray(standardConfig.plugins, isNode)\n const splitNodeRules = splitObject(standardConfig.rules, isNode)\n\n const coreConfig = {\n ...standardConfig,\n env: splitNodeEnv.no,\n globals: {\n clearInterval: 'readonly',\n clearTimeout: 'readonly',\n console: 'readonly',\n setInterval: 'readonly',\n setTimeout: 'readonly',\n ...standardConfig.globals\n },\n plugins: splitNodePlugins.no,\n rules: splitNodeRules.no\n }\n const coreLintConfig = filterStyleRules(coreConfig)\n\n out['index.js'] = makeFile({\n comment: 'Core rules for Standard.js',\n upstream: 'eslint-config-standard',\n config: coreConfig\n })\n\n out['lint/index.js'] = makeFile({\n comment: 'Core rules for Standard.js (without style rules)',\n upstream: 'eslint-config-standard',\n config: coreLintConfig\n })\n\n out['prettier/index.js'] = makeFile({\n comment: 'Core rules for Standard.js + Prettier',\n upstream: 'eslint-config-standard',\n config: {\n ...coreLintConfig,\n plugins: [...coreLintConfig.plugins, 'prettier'],\n rules: {\n ...coreLintConfig.rules,\n 'prettier/prettier': [\n 'error',\n {\n arrowParens: 'avoid',\n semi: false,\n singleQuote: true,\n trailingComma: 'none'\n }\n ]\n }\n }\n })\n\n makeFilePair(out, 'jsx', {\n comment: 'JSX support',\n upstream: 'eslint-config-standard-jsx',\n config: jsxConfig\n })\n\n makeFilePair(out, 'flow', {\n comment: 'Flow language support',\n upstream: 'eslint-plugin-flowtype',\n config: {\n ...removeProps(flowConfig, ['parser', 'rules']),\n overrides: [\n {\n files: ['*.flow', '*.js', '*.jsx'],\n parser: flowConfig.parser,\n rules: {\n ...removeProps(flowConfig.rules, [\n 'flowtype/no-mixed',\n 'flowtype/require-readonly-react-props'\n ]),\n 'flowtype/array-style-complex-type': ['error', 'verbose'],\n 'flowtype/array-style-simple-type': ['error', 'shorthand']\n }\n }\n ]\n }\n })\n\n makeFilePair(out, 'typescript', {\n comment: 'Typescript language support',\n upstream: 'eslint-config-standard-with-typescript',\n config: {\n ...removeProps(typescriptConfig, ['extends'])\n }\n })\n\n makeFilePair(out, 'node', {\n comment: 'Node.js support',\n upstream: 'eslint-config-standard',\n config: {\n env: splitNodeEnv.yes,\n plugins: splitNodePlugins.yes,\n rules: splitNodeRules.yes\n }\n })\n\n makeFilePair(out, 'react', {\n comment: 'React support',\n upstream: 'eslint-config-standard-react & eslint-plugin-react-hooks',\n config: {\n ...reactConfig,\n plugins: [...reactConfig.plugins, ...hooksConfig.plugins],\n rules: {\n ...reactConfig.rules,\n ...hooksConfig.rules\n }\n }\n })\n\n return out\n}", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/,\n // options: {\n // fix: false\n // }\n // })\n // }\n }", "extend(config, ctx) {\n // // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n }", "function linting() {\r\n return lintExtension;\r\n}", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n }", "function lintTS (done) {\n console.log(\"TODO: TSLint not configured yet. \");\n done();\n // return gulp.src(\"**/*.tsx\")\n // .pipe(plumber())\n // .pipe(tslint({\n // formatter: \"verbose\"\n // }))\n // .pipe(tslint.report({\n // formatter: \"verbose\"\n // }));\n}", "function forUseStrict() {\n \"use strict\";\n // start coding from here\n console.log(\"hello world\");\n}", "function forceLinting(view) {\n let plugin = view.plugin(lintPlugin);\n if (plugin)\n plugin.force();\n}", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n \n }", "execute (scriptLine){\r\n var commentPattern = /^\\s*;.*$/;\r\n if (commentPattern.test(scriptLine))\r\n {\r\n //nothing to do \r\n }\r\n }", "function u(a,b,c){\"use strict\";var d=c,e=function(a){a instanceof Error==!1&&(a=new Error(a)),c(a)},f=a&&a.context||{};f.include&&!f.include.length&&(f.include=[document]);var g=a&&a.options||{};switch(a.command){case\"rules\":return y(f,g,d,e);case\"cleanup-plugin\":return s(d,e);default:\n// go through the registered commands\nif(axe._audit&&axe._audit.commands&&axe._audit.commands[a.command])return axe._audit.commands[a.command](a,c)}}", "function runLintChecks() {\n log('Running lint checks for the repo...');\n timedExecOrDie(`npm run lint`);\n logWithoutTimestamp('\\n\\n');\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n\n /*\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n */\n }\n }", "function init(params) {\n /**\n\t\tProject configuration.\n\t\t@toc 5.\n\t\t*/\n grunt.initConfig({\n jscs: {\n src: 'src/*.js',\n options: {\n config: '.jscsrc',\n preset: 'airbnb',\n requireCurlyBraces: [\"if\"]\n }\n },\n changelog: {\n options: {\n from: 'f2f61ee2618153f955ebce0b33624c9a5206e8bc',\n to: 'HEAD'\n }\n },\n bump: {\n options: {\n files: ['package.json', 'bower.json'],\n updateConfigs: [],\n commit: true,\n commitMessage: 'Release %VERSION%',\n commitFiles: ['package.json', 'bower.json', /*'CHANGELOG.md',*/\n 'angular-harmonized.js', 'angular-harmonized.min.js'\n ],\n createTag: true,\n tagName: '%VERSION%',\n tagMessage: 'Version %VERSION%',\n push: true,\n pushTo: 'origin',\n prereleaseName: 'alpha',\n }\n },\n concat: {\n build: {\n src: ['src/*.js'],\n dest: 'angular-harmonized.js'\n }\n },\n jshint: {\n options: {\n //force: true,\n globalstrict: true,\n //sub: true,\n node: true,\n loopfunc: true,\n browser: true,\n devel: true,\n globals: {\n angular: false,\n $: false,\n moment: false,\n Pikaday: false,\n _: false,\n module: false,\n forge: false,\n IDBKeyRange: false,\n harmonized: false,\n }\n },\n beforeconcat: {\n options: {\n force: false,\n ignores: ['**.min.js']\n },\n files: {\n src: []\n }\n },\n //quick version - will not fail entire grunt process if there are lint errors\n beforeconcatQ: {\n options: {\n force: true,\n ignores: ['**.min.js']\n },\n files: {\n src: ['src/*.js']\n }\n }\n },\n uglify: {\n options: {\n mangle: false\n },\n build: {\n files: {},\n src: 'angular-harmonized.js',\n dest: 'angular-harmonized.min.js'\n }\n }\n /*,\n \t\t\tkarma: {\n \t\t\t\tunit: {\n \t\t\t\t\tconfigFile: publicPathRelativeRoot+'config/karma.conf.js',\n \t\t\t\t\tsingleRun: true,\n \t\t\t\t\tbrowsers: ['PhantomJS']\n \t\t\t\t}\n \t\t\t}*/\n });\n\n\n /**\n\t\tregister/define grunt tasks\n\t\t@toc 6.\n\t\t*/\n // Default task(s).\n grunt.registerTask('default', ['jshint:beforeconcatQ', 'concat:build',\n 'uglify:build'\n ]);\n\n grunt.registerTask('release', 'bump and changelog', function(type) {\n grunt.task.run([\n 'default',\n 'bump:' + (type || 'patch') + ':bump-only',\n //'changelog',\n 'bump-commit'\n ]);\n });\n }", "function setup() {\n\t'use strict';\n\n}", "extend(config, ctx) {\n // Added Line\n config.devtool = ctx.isClient ? \"eval-source-map\" : \"inline-source-map\";\n\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n\n }", "function __ncc_wildcard$0 (arg) {\n if (arg === \"cat.js\" || arg === \"cat\") return __nccwpck_require__(4201);\n else if (arg === \"cd.js\" || arg === \"cd\") return __nccwpck_require__(4724);\n else if (arg === \"chmod.js\" || arg === \"chmod\") return __nccwpck_require__(4457);\n else if (arg === \"common.js\" || arg === \"common\") return __nccwpck_require__(4396);\n else if (arg === \"cp.js\" || arg === \"cp\") return __nccwpck_require__(9926);\n else if (arg === \"dirs.js\" || arg === \"dirs\") return __nccwpck_require__(5417);\n else if (arg === \"echo.js\" || arg === \"echo\") return __nccwpck_require__(8484);\n else if (arg === \"error.js\" || arg === \"error\") return __nccwpck_require__(6147);\n else if (arg === \"exec-child.js\" || arg === \"exec-child\") return __nccwpck_require__(2020);\n else if (arg === \"exec.js\" || arg === \"exec\") return __nccwpck_require__(3378);\n else if (arg === \"find.js\" || arg === \"find\") return __nccwpck_require__(4385);\n else if (arg === \"grep.js\" || arg === \"grep\") return __nccwpck_require__(415);\n else if (arg === \"head.js\" || arg === \"head\") return __nccwpck_require__(4049);\n else if (arg === \"ln.js\" || arg === \"ln\") return __nccwpck_require__(6655);\n else if (arg === \"ls.js\" || arg === \"ls\") return __nccwpck_require__(7513);\n else if (arg === \"mkdir.js\" || arg === \"mkdir\") return __nccwpck_require__(6738);\n else if (arg === \"mv.js\" || arg === \"mv\") return __nccwpck_require__(9503);\n else if (arg === \"popd.js\" || arg === \"popd\") return __nccwpck_require__(2720);\n else if (arg === \"pushd.js\" || arg === \"pushd\") return __nccwpck_require__(9835);\n else if (arg === \"pwd.js\" || arg === \"pwd\") return __nccwpck_require__(6214);\n else if (arg === \"rm.js\" || arg === \"rm\") return __nccwpck_require__(1177);\n else if (arg === \"sed.js\" || arg === \"sed\") return __nccwpck_require__(7776);\n else if (arg === \"set.js\" || arg === \"set\") return __nccwpck_require__(5091);\n else if (arg === \"sort.js\" || arg === \"sort\") return __nccwpck_require__(9552);\n else if (arg === \"tail.js\" || arg === \"tail\") return __nccwpck_require__(662);\n else if (arg === \"tempdir.js\" || arg === \"tempdir\") return __nccwpck_require__(2979);\n else if (arg === \"test.js\" || arg === \"test\") return __nccwpck_require__(8760);\n else if (arg === \"to.js\" || arg === \"to\") return __nccwpck_require__(9934);\n else if (arg === \"toEnd.js\" || arg === \"toEnd\") return __nccwpck_require__(3934);\n else if (arg === \"touch.js\" || arg === \"touch\") return __nccwpck_require__(4536);\n else if (arg === \"uniq.js\" || arg === \"uniq\") return __nccwpck_require__(2619);\n else if (arg === \"which.js\" || arg === \"which\") return __nccwpck_require__(3698);\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options : {\n fix : true\n }\n })\n }\n }", "extend (config, { isDev, isClient }) {\n /*\n // questo linta ogni cosa ad ogni salvataggio\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }*/\n }", "function jsValidateTask() {\n return gulp.src(config.src)\n .pipe(jsvalidate());\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/,\n options: {\n fix: true\n }\n });\n }\n }", "function __ncc_wildcard$0 (arg) {\n if (arg === \"cat.js\" || arg === \"cat\") return __nccwpck_require__(271);\n else if (arg === \"cd.js\" || arg === \"cd\") return __nccwpck_require__(2051);\n else if (arg === \"chmod.js\" || arg === \"chmod\") return __nccwpck_require__(4975);\n else if (arg === \"common.js\" || arg === \"common\") return __nccwpck_require__(3687);\n else if (arg === \"cp.js\" || arg === \"cp\") return __nccwpck_require__(4932);\n else if (arg === \"dirs.js\" || arg === \"dirs\") return __nccwpck_require__(1178);\n else if (arg === \"echo.js\" || arg === \"echo\") return __nccwpck_require__(243);\n else if (arg === \"error.js\" || arg === \"error\") return __nccwpck_require__(232);\n else if (arg === \"exec-child.js\" || arg === \"exec-child\") return __nccwpck_require__(9607);\n else if (arg === \"exec.js\" || arg === \"exec\") return __nccwpck_require__(896);\n else if (arg === \"find.js\" || arg === \"find\") return __nccwpck_require__(7838);\n else if (arg === \"grep.js\" || arg === \"grep\") return __nccwpck_require__(7417);\n else if (arg === \"head.js\" || arg === \"head\") return __nccwpck_require__(6613);\n else if (arg === \"ln.js\" || arg === \"ln\") return __nccwpck_require__(5787);\n else if (arg === \"ls.js\" || arg === \"ls\") return __nccwpck_require__(5561);\n else if (arg === \"mkdir.js\" || arg === \"mkdir\") return __nccwpck_require__(2695);\n else if (arg === \"mv.js\" || arg === \"mv\") return __nccwpck_require__(9849);\n else if (arg === \"popd.js\" || arg === \"popd\") return __nccwpck_require__(227);\n else if (arg === \"pushd.js\" || arg === \"pushd\") return __nccwpck_require__(4177);\n else if (arg === \"pwd.js\" || arg === \"pwd\") return __nccwpck_require__(8553);\n else if (arg === \"rm.js\" || arg === \"rm\") return __nccwpck_require__(2830);\n else if (arg === \"sed.js\" || arg === \"sed\") return __nccwpck_require__(5899);\n else if (arg === \"set.js\" || arg === \"set\") return __nccwpck_require__(1411);\n else if (arg === \"sort.js\" || arg === \"sort\") return __nccwpck_require__(2116);\n else if (arg === \"tail.js\" || arg === \"tail\") return __nccwpck_require__(2284);\n else if (arg === \"tempdir.js\" || arg === \"tempdir\") return __nccwpck_require__(6150);\n else if (arg === \"test.js\" || arg === \"test\") return __nccwpck_require__(9723);\n else if (arg === \"to.js\" || arg === \"to\") return __nccwpck_require__(1961);\n else if (arg === \"toEnd.js\" || arg === \"toEnd\") return __nccwpck_require__(3736);\n else if (arg === \"touch.js\" || arg === \"touch\") return __nccwpck_require__(8358);\n else if (arg === \"uniq.js\" || arg === \"uniq\") return __nccwpck_require__(7286);\n else if (arg === \"which.js\" || arg === \"which\") return __nccwpck_require__(4766);\n}", "function scanIfNDefBlocks (source, regexs, grunt)\n{\n var regexType = \"array\";\n var regexs_ = regexs;\n \n if (Object.prototype.toString.call(regexs) === \"[object Object]\")\n {\n regexs = [0];\n regexType = \"object\";\n }\n\n var contents = source;\n\n for (var i = 0; i < regexs.length; i++)\n {\n var regex = regexs[i];\n \n if (regexType !== \"array\")\n {\n regex = regexs_;\n }\n\n contents = contents.replace(regex.ifndef, function (match, test, include) {\n if (definitions[test.trim()] === undefined)\n {\n grunt.verbose.write(\"Found \" + \"#ifndef\".cyan + \" tag on \" + test.trim().cyan + \", and it \" + \"IS NOT\".red + \" defined\\n\");\n return include;\n }\n else\n {\n grunt.verbose.write(\"Found \" + \"#ifndef\".cyan + \" tag on \" + test.trim().cyan + \", and it \" + \"IS\".yellow + \" defined\\n\");\n return \"\";\n }\n });\n }\n\n return contents;\n}", "function strictMode() {\n 'use strict';\n\n //..\n //..\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n // options: {\n // fix: true\n // }\n })\n }\n }", "function errorHandler(inWatchTask) {\n // we want to be lenient on syntax and compilation errors in development,\n // but harsh when building our plugin for distribution. Therefore,\n // we only activate plumber if we're running gulp via our watch task.\n return gulpIf(inWatchTask, plumber());\n}", "function anotherFunction() {\n /***/\n console.log(\"This function.\");\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options: {\n fix: true\n }\n })\n }\n }", "function getRhinoContext() {\n return Context.getCurrentContext();\n}", "async function minify(){\n const { terser } = await import('rollup-plugin-terser');\n return terser({\n output: {\n //comments: \"all\",\n comments: function(node, comment) {\n var text = comment.value;\n var type = comment.type;\n if (type == 'comment2') {\n // multiline comment\n return /@preserve|@license|@cc_on/i.test(text);\n }\n },\n }\n });\n}", "function Lint(eslintNode, targets = ['chrome', 'firefox', 'safari', 'edge'], polyfills = new Set()) {\n // Find the corresponding rules for a eslintNode by it's ASTNodeType\n const failingRule = _index.rules.filter(rule => rule.ASTNodeType === eslintNode.type // Check if polyfill is provided\n && !polyfills.has(rule.id)) // Find the first failing rule\n .find(rule => !rule.isValid(rule, eslintNode, targets));\n\n return failingRule ? {\n rule: failingRule,\n isValid: false,\n unsupportedTargets: failingRule.getUnsupportedTargets(failingRule, targets)\n } : {\n rule: {},\n unsupportedTargets: [],\n isValid: true\n };\n}", "function setUp() {\n\tdojo.setModulePrefix(\"dojo\", \"../../dojo/src\"); // relative to testRunner.html\n\tdojo.setModulePrefix(\"orp\", \"../../../source\"); // relative to dojo.js\n\tdojo.require(\"orp.util.LintTool\");\n}", "function sum(a, a, c) { // !!! syntax error\n  'use strict';\n  return a + b + c; // wrong if this code ran\n}", "function scanIfDefBlocks (source, regexs, grunt)\n{\n var regexType = \"array\";\n var regexs_ = regexs;\n \n if (Object.prototype.toString.call(regexs) === \"[object Object]\")\n {\n regexs = [0];\n regexType = \"object\";\n }\n\n var contents = source;\n\n for (var i = 0; i < regexs.length; i++)\n {\n var regex = regexs[i];\n \n if (regexType !== \"array\")\n {\n regex = regexs_;\n }\n\n contents = contents.replace(regex.ifdef, function (match, test, include) {\n if (definitions[test.trim()] !== undefined)\n {\n grunt.verbose.write(\"Found \" + \"#ifdef\".cyan + \" tag on \" + test.trim().cyan + \", and it \" + \"IS\".yellow + \" defined\\n\");\n return include;\n }\n else\n {\n grunt.verbose.write(\"Found \" + \"#ifdef\".cyan + \" tag on \" + test.trim().cyan + \", and it \" + \"IS NOT\".red + \" defined\\n\");\n return \"\";\n }\n });\n }\n\n return contents;\n}", "function bug_report(){\n //Get or Create a terminal\n let terminal = this.get_terminal(\"bug_report\");\n let cfg_abspath = os.userInfo().homedir + path.sep + constants.node_app + constants.node_branch + constants.config_abspath;\n fs.writeFileSync(cfg_abspath,constants.workspace + constants.workspace_json);\n //cd to the folder\n //let node_abspath = constants.workspace.substring(0,constants.workspace.indexOf(\"/\",6)+1)//node app absolute path.\n let node_branch = null;\n let platform = os.platform();\n if(platform == \"win32\"){\n node_branch = os.userInfo().homedir + path.sep + constants.node_app + constants.node_branch; //node app absolute path.\n }else{\n node_branch = constants.workspace.substring(0,constants.workspace.indexOf(\"/\",6)+1) + constants.node_app + constants.node_branch; //node app absolute path.\n }\n terminal.sendText(`cd \"${node_branch}\"`);\n //Show commands in the terminal\n terminal.show(true);\n //Start the node app\n terminal.sendText(\"npm run start\");\n}", "callRuleLint(rule, node, inline_config = {}) {\n const issues = [];\n function report(data) {\n const meta = {\n ...data.meta,\n severity: rule.severity\n };\n\n issues.push(new Issue(\n data.code,\n data.position,\n rule.name,\n meta\n ));\n }\n if (inline_config[rule.name] && inline_config[rule.name].disabled === true) {\n return issues;\n }\n const config = inline_config[rule.name] && inline_config[rule.name].config\n ? { ...this.config.legacy_config, [rule.name]: inline_config[rule.name].config }\n : this.config.legacy_config;\n rule.lint(node, config, { report, rules: this.config.activatedRules });\n\n // No rules without `.need` for the moment\n // rule.need ? rule.lint(node, config, { report, rules: this.config.activatedRules }) : rule.lint(node, rule.config, { report });\n return issues;\n }", "extend(config, ctx) {\n //Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "function generateJS(ast, options) {\n /* These only indent non-empty lines to avoid trailing whitespace. */\n function indent2(code) {\n return code.replace(/^(.+)$/gm, ' $1');\n }\n\n function indent6(code) {\n return code.replace(/^(.+)$/gm, ' $1');\n }\n\n function indent10(code) {\n return code.replace(/^(.+)$/gm, ' $1');\n }\n\n function generateTables() {\n if (options.optimize === \"size\") {\n return ['peg$consts = [', indent2(ast.consts.join(',\\n')), '],', '', 'peg$bytecode = [', indent2(arrays.map(ast.rules, function (rule) {\n return 'peg$decode(\"' + js.stringEscape(arrays.map(rule.bytecode, function (b) {\n return String.fromCharCode(b + 32);\n }).join('')) + '\")';\n }).join(',\\n')), '],'].join('\\n');\n } else {\n return arrays.map(ast.consts, function (c, i) {\n return 'peg$c' + i + ' = ' + c + ',';\n }).join('\\n');\n }\n }\n\n function generateRuleHeader(ruleNameCode, ruleIndexCode) {\n var parts = [];\n parts.push('');\n\n if (options.trace) {\n parts.push(['peg$tracer.trace({', ' type: \"rule.enter\",', ' rule: ' + ruleNameCode + ',', ' location: peg$computeLocation(startPos, startPos)', '});', ''].join('\\n'));\n }\n\n if (options.cache) {\n parts.push(['var key = peg$currPos * ' + ast.rules.length + ' + ' + ruleIndexCode + ',', ' cached = peg$resultsCache[key];', '', 'if (cached) {', ' peg$currPos = cached.nextPos;', ''].join('\\n'));\n\n if (options.trace) {\n parts.push(['if (cached.result !== peg$FAILED) {', ' peg$tracer.trace({', ' type: \"rule.match\",', ' rule: ' + ruleNameCode + ',', ' result: cached.result,', ' location: peg$computeLocation(startPos, peg$currPos)', ' });', '} else {', ' peg$tracer.trace({', ' type: \"rule.fail\",', ' rule: ' + ruleNameCode + ',', ' location: peg$computeLocation(startPos, startPos)', ' });', '}', ''].join('\\n'));\n }\n\n parts.push([' return cached.result;', '}', ''].join('\\n'));\n }\n\n return parts.join('\\n');\n }\n\n function generateRuleFooter(ruleNameCode, resultCode) {\n var parts = [];\n\n if (options.cache) {\n parts.push(['', 'peg$resultsCache[key] = { nextPos: peg$currPos, result: ' + resultCode + ' };'].join('\\n'));\n }\n\n if (options.trace) {\n parts.push(['', 'if (' + resultCode + ' !== peg$FAILED) {', ' peg$tracer.trace({', ' type: \"rule.match\",', ' rule: ' + ruleNameCode + ',', ' result: ' + resultCode + ',', ' location: peg$computeLocation(startPos, peg$currPos)', ' });', '} else {', ' peg$tracer.trace({', ' type: \"rule.fail\",', ' rule: ' + ruleNameCode + ',', ' location: peg$computeLocation(startPos, startPos)', ' });', '}'].join('\\n'));\n }\n\n parts.push(['', 'return ' + resultCode + ';'].join('\\n'));\n return parts.join('\\n');\n }\n\n function generateInterpreter() {\n var parts = [];\n\n function generateCondition(cond, argsLength) {\n var baseLength = argsLength + 3,\n thenLengthCode = 'bc[ip + ' + (baseLength - 2) + ']',\n elseLengthCode = 'bc[ip + ' + (baseLength - 1) + ']';\n return ['ends.push(end);', 'ips.push(ip + ' + baseLength + ' + ' + thenLengthCode + ' + ' + elseLengthCode + ');', '', 'if (' + cond + ') {', ' end = ip + ' + baseLength + ' + ' + thenLengthCode + ';', ' ip += ' + baseLength + ';', '} else {', ' end = ip + ' + baseLength + ' + ' + thenLengthCode + ' + ' + elseLengthCode + ';', ' ip += ' + baseLength + ' + ' + thenLengthCode + ';', '}', '', 'break;'].join('\\n');\n }\n\n function generateLoop(cond) {\n var baseLength = 2,\n bodyLengthCode = 'bc[ip + ' + (baseLength - 1) + ']';\n return ['if (' + cond + ') {', ' ends.push(end);', ' ips.push(ip);', '', ' end = ip + ' + baseLength + ' + ' + bodyLengthCode + ';', ' ip += ' + baseLength + ';', '} else {', ' ip += ' + baseLength + ' + ' + bodyLengthCode + ';', '}', '', 'break;'].join('\\n');\n }\n\n function generateCall() {\n var baseLength = 4,\n paramsLengthCode = 'bc[ip + ' + (baseLength - 1) + ']';\n return ['params = bc.slice(ip + ' + baseLength + ', ip + ' + baseLength + ' + ' + paramsLengthCode + ');', 'for (i = 0; i < ' + paramsLengthCode + '; i++) {', ' params[i] = stack[stack.length - 1 - params[i]];', '}', '', 'stack.splice(', ' stack.length - bc[ip + 2],', ' bc[ip + 2],', ' peg$consts[bc[ip + 1]].apply(null, params)', ');', '', 'ip += ' + baseLength + ' + ' + paramsLengthCode + ';', 'break;'].join('\\n');\n }\n\n parts.push(['function peg$decode(s) {', ' var bc = new Array(s.length), i;', '', ' for (i = 0; i < s.length; i++) {', ' bc[i] = s.charCodeAt(i) - 32;', ' }', '', ' return bc;', '}', '', 'function peg$parseRule(index) {'].join('\\n'));\n\n if (options.trace) {\n parts.push([' var bc = peg$bytecode[index],', ' ip = 0,', ' ips = [],', ' end = bc.length,', ' ends = [],', ' stack = [],', ' startPos = peg$currPos,', ' params, i;'].join('\\n'));\n } else {\n parts.push([' var bc = peg$bytecode[index],', ' ip = 0,', ' ips = [],', ' end = bc.length,', ' ends = [],', ' stack = [],', ' params, i;'].join('\\n'));\n }\n\n parts.push(indent2(generateRuleHeader('peg$ruleNames[index]', 'index')));\n parts.push([\n /*\n * The point of the outer loop and the |ips| & |ends| stacks is to avoid\n * recursive calls for interpreting parts of bytecode. In other words, we\n * implement the |interpret| operation of the abstract machine without\n * function calls. Such calls would likely slow the parser down and more\n * importantly cause stack overflows for complex grammars.\n */\n ' while (true) {', ' while (ip < end) {', ' switch (bc[ip]) {', ' case ' + op.PUSH + ':', // PUSH c\n ' stack.push(peg$consts[bc[ip + 1]]);', ' ip += 2;', ' break;', '', ' case ' + op.PUSH_UNDEFINED + ':', // PUSH_UNDEFINED\n ' stack.push(void 0);', ' ip++;', ' break;', '', ' case ' + op.PUSH_NULL + ':', // PUSH_NULL\n ' stack.push(null);', ' ip++;', ' break;', '', ' case ' + op.PUSH_FAILED + ':', // PUSH_FAILED\n ' stack.push(peg$FAILED);', ' ip++;', ' break;', '', ' case ' + op.PUSH_EMPTY_ARRAY + ':', // PUSH_EMPTY_ARRAY\n ' stack.push([]);', ' ip++;', ' break;', '', ' case ' + op.PUSH_CURR_POS + ':', // PUSH_CURR_POS\n ' stack.push(peg$currPos);', ' ip++;', ' break;', '', ' case ' + op.POP + ':', // POP\n ' stack.pop();', ' ip++;', ' break;', '', ' case ' + op.POP_CURR_POS + ':', // POP_CURR_POS\n ' peg$currPos = stack.pop();', ' ip++;', ' break;', '', ' case ' + op.POP_N + ':', // POP_N n\n ' stack.length -= bc[ip + 1];', ' ip += 2;', ' break;', '', ' case ' + op.NIP + ':', // NIP\n ' stack.splice(-2, 1);', ' ip++;', ' break;', '', ' case ' + op.APPEND + ':', // APPEND\n ' stack[stack.length - 2].push(stack.pop());', ' ip++;', ' break;', '', ' case ' + op.WRAP + ':', // WRAP n\n ' stack.push(stack.splice(stack.length - bc[ip + 1], bc[ip + 1]));', ' ip += 2;', ' break;', '', ' case ' + op.TEXT + ':', // TEXT\n ' stack.push(input.substring(stack.pop(), peg$currPos));', ' ip++;', ' break;', '', ' case ' + op.IF + ':', // IF t, f\n indent10(generateCondition('stack[stack.length - 1]', 0)), '', ' case ' + op.IF_ERROR + ':', // IF_ERROR t, f\n indent10(generateCondition('stack[stack.length - 1] === peg$FAILED', 0)), '', ' case ' + op.IF_NOT_ERROR + ':', // IF_NOT_ERROR t, f\n indent10(generateCondition('stack[stack.length - 1] !== peg$FAILED', 0)), '', ' case ' + op.WHILE_NOT_ERROR + ':', // WHILE_NOT_ERROR b\n indent10(generateLoop('stack[stack.length - 1] !== peg$FAILED')), '', ' case ' + op.MATCH_ANY + ':', // MATCH_ANY a, f, ...\n indent10(generateCondition('input.length > peg$currPos', 0)), '', ' case ' + op.MATCH_STRING + ':', // MATCH_STRING s, a, f, ...\n indent10(generateCondition('input.substr(peg$currPos, peg$consts[bc[ip + 1]].length) === peg$consts[bc[ip + 1]]', 1)), '', ' case ' + op.MATCH_STRING_IC + ':', // MATCH_STRING_IC s, a, f, ...\n indent10(generateCondition('input.substr(peg$currPos, peg$consts[bc[ip + 1]].length).toLowerCase() === peg$consts[bc[ip + 1]]', 1)), '', ' case ' + op.MATCH_REGEXP + ':', // MATCH_REGEXP r, a, f, ...\n indent10(generateCondition('peg$consts[bc[ip + 1]].test(input.charAt(peg$currPos))', 1)), '', ' case ' + op.ACCEPT_N + ':', // ACCEPT_N n\n ' stack.push(input.substr(peg$currPos, bc[ip + 1]));', ' peg$currPos += bc[ip + 1];', ' ip += 2;', ' break;', '', ' case ' + op.ACCEPT_STRING + ':', // ACCEPT_STRING s\n ' stack.push(peg$consts[bc[ip + 1]]);', ' peg$currPos += peg$consts[bc[ip + 1]].length;', ' ip += 2;', ' break;', '', ' case ' + op.FAIL + ':', // FAIL e\n ' stack.push(peg$FAILED);', ' if (peg$silentFails === 0) {', ' peg$fail(peg$consts[bc[ip + 1]]);', ' }', ' ip += 2;', ' break;', '', ' case ' + op.LOAD_SAVED_POS + ':', // LOAD_SAVED_POS p\n ' peg$savedPos = stack[stack.length - 1 - bc[ip + 1]];', ' ip += 2;', ' break;', '', ' case ' + op.UPDATE_SAVED_POS + ':', // UPDATE_SAVED_POS\n ' peg$savedPos = peg$currPos;', ' ip++;', ' break;', '', ' case ' + op.CALL + ':', // CALL f, n, pc, p1, p2, ..., pN\n indent10(generateCall()), '', ' case ' + op.RULE + ':', // RULE r\n ' stack.push(peg$parseRule(bc[ip + 1]));', ' ip += 2;', ' break;', '', ' case ' + op.SILENT_FAILS_ON + ':', // SILENT_FAILS_ON\n ' peg$silentFails++;', ' ip++;', ' break;', '', ' case ' + op.SILENT_FAILS_OFF + ':', // SILENT_FAILS_OFF\n ' peg$silentFails--;', ' ip++;', ' break;', '', ' default:', ' throw new Error(\"Invalid opcode: \" + bc[ip] + \".\");', ' }', ' }', '', ' if (ends.length > 0) {', ' end = ends.pop();', ' ip = ips.pop();', ' } else {', ' break;', ' }', ' }'].join('\\n'));\n parts.push(indent2(generateRuleFooter('peg$ruleNames[index]', 'stack[0]')));\n parts.push('}');\n return parts.join('\\n');\n }\n\n function generateRuleFunction(rule) {\n var parts = [],\n code;\n\n function c(i) {\n return \"peg$c\" + i;\n } // |consts[i]| of the abstract machine\n\n\n function s(i) {\n return \"s\" + i;\n } // |stack[i]| of the abstract machine\n\n\n var stack = {\n sp: -1,\n maxSp: -1,\n push: function (exprCode) {\n var code = s(++this.sp) + ' = ' + exprCode + ';';\n\n if (this.sp > this.maxSp) {\n this.maxSp = this.sp;\n }\n\n return code;\n },\n pop: function (n) {\n var values;\n\n if (n === void 0) {\n return s(this.sp--);\n } else {\n values = arrays.map(arrays.range(this.sp - n + 1, this.sp + 1), s);\n this.sp -= n;\n return values;\n }\n },\n top: function () {\n return s(this.sp);\n },\n index: function (i) {\n return s(this.sp - i);\n }\n };\n\n function compile(bc) {\n var ip = 0,\n end = bc.length,\n parts = [],\n value;\n\n function compileCondition(cond, argCount) {\n var baseLength = argCount + 3,\n thenLength = bc[ip + baseLength - 2],\n elseLength = bc[ip + baseLength - 1],\n baseSp = stack.sp,\n thenCode,\n elseCode,\n thenSp,\n elseSp;\n ip += baseLength;\n thenCode = compile(bc.slice(ip, ip + thenLength));\n thenSp = stack.sp;\n ip += thenLength;\n\n if (elseLength > 0) {\n stack.sp = baseSp;\n elseCode = compile(bc.slice(ip, ip + elseLength));\n elseSp = stack.sp;\n ip += elseLength;\n\n if (thenSp !== elseSp) {\n throw new Error(\"Branches of a condition must move the stack pointer in the same way.\");\n }\n }\n\n parts.push('if (' + cond + ') {');\n parts.push(indent2(thenCode));\n\n if (elseLength > 0) {\n parts.push('} else {');\n parts.push(indent2(elseCode));\n }\n\n parts.push('}');\n }\n\n function compileLoop(cond) {\n var baseLength = 2,\n bodyLength = bc[ip + baseLength - 1],\n baseSp = stack.sp,\n bodyCode,\n bodySp;\n ip += baseLength;\n bodyCode = compile(bc.slice(ip, ip + bodyLength));\n bodySp = stack.sp;\n ip += bodyLength;\n\n if (bodySp !== baseSp) {\n throw new Error(\"Body of a loop can't move the stack pointer.\");\n }\n\n parts.push('while (' + cond + ') {');\n parts.push(indent2(bodyCode));\n parts.push('}');\n }\n\n function compileCall() {\n var baseLength = 4,\n paramsLength = bc[ip + baseLength - 1];\n var value = c(bc[ip + 1]) + '(' + arrays.map(bc.slice(ip + baseLength, ip + baseLength + paramsLength), function (p) {\n return stack.index(p);\n }).join(', ') + ')';\n stack.pop(bc[ip + 2]);\n parts.push(stack.push(value));\n ip += baseLength + paramsLength;\n }\n\n while (ip < end) {\n switch (bc[ip]) {\n case op.PUSH:\n // PUSH c\n parts.push(stack.push(c(bc[ip + 1])));\n ip += 2;\n break;\n\n case op.PUSH_CURR_POS:\n // PUSH_CURR_POS\n parts.push(stack.push('peg$currPos'));\n ip++;\n break;\n\n case op.PUSH_UNDEFINED:\n // PUSH_UNDEFINED\n parts.push(stack.push('void 0'));\n ip++;\n break;\n\n case op.PUSH_NULL:\n // PUSH_NULL\n parts.push(stack.push('null'));\n ip++;\n break;\n\n case op.PUSH_FAILED:\n // PUSH_FAILED\n parts.push(stack.push('peg$FAILED'));\n ip++;\n break;\n\n case op.PUSH_EMPTY_ARRAY:\n // PUSH_EMPTY_ARRAY\n parts.push(stack.push('[]'));\n ip++;\n break;\n\n case op.POP:\n // POP\n stack.pop();\n ip++;\n break;\n\n case op.POP_CURR_POS:\n // POP_CURR_POS\n parts.push('peg$currPos = ' + stack.pop() + ';');\n ip++;\n break;\n\n case op.POP_N:\n // POP_N n\n stack.pop(bc[ip + 1]);\n ip += 2;\n break;\n\n case op.NIP:\n // NIP\n value = stack.pop();\n stack.pop();\n parts.push(stack.push(value));\n ip++;\n break;\n\n case op.APPEND:\n // APPEND\n value = stack.pop();\n parts.push(stack.top() + '.push(' + value + ');');\n ip++;\n break;\n\n case op.WRAP:\n // WRAP n\n parts.push(stack.push('[' + stack.pop(bc[ip + 1]).join(', ') + ']'));\n ip += 2;\n break;\n\n case op.TEXT:\n // TEXT\n parts.push(stack.push('input.substring(' + stack.pop() + ', peg$currPos)'));\n ip++;\n break;\n\n case op.IF:\n // IF t, f\n compileCondition(stack.top(), 0);\n break;\n\n case op.IF_ERROR:\n // IF_ERROR t, f\n compileCondition(stack.top() + ' === peg$FAILED', 0);\n break;\n\n case op.IF_NOT_ERROR:\n // IF_NOT_ERROR t, f\n compileCondition(stack.top() + ' !== peg$FAILED', 0);\n break;\n\n case op.WHILE_NOT_ERROR:\n // WHILE_NOT_ERROR b\n compileLoop(stack.top() + ' !== peg$FAILED', 0);\n break;\n\n case op.MATCH_ANY:\n // MATCH_ANY a, f, ...\n compileCondition('input.length > peg$currPos', 0);\n break;\n\n case op.MATCH_STRING:\n // MATCH_STRING s, a, f, ...\n compileCondition(eval(ast.consts[bc[ip + 1]]).length > 1 ? 'input.substr(peg$currPos, ' + eval(ast.consts[bc[ip + 1]]).length + ') === ' + c(bc[ip + 1]) : 'input.charCodeAt(peg$currPos) === ' + eval(ast.consts[bc[ip + 1]]).charCodeAt(0), 1);\n break;\n\n case op.MATCH_STRING_IC:\n // MATCH_STRING_IC s, a, f, ...\n compileCondition('input.substr(peg$currPos, ' + eval(ast.consts[bc[ip + 1]]).length + ').toLowerCase() === ' + c(bc[ip + 1]), 1);\n break;\n\n case op.MATCH_REGEXP:\n // MATCH_REGEXP r, a, f, ...\n compileCondition(c(bc[ip + 1]) + '.test(input.charAt(peg$currPos))', 1);\n break;\n\n case op.ACCEPT_N:\n // ACCEPT_N n\n parts.push(stack.push(bc[ip + 1] > 1 ? 'input.substr(peg$currPos, ' + bc[ip + 1] + ')' : 'input.charAt(peg$currPos)'));\n parts.push(bc[ip + 1] > 1 ? 'peg$currPos += ' + bc[ip + 1] + ';' : 'peg$currPos++;');\n ip += 2;\n break;\n\n case op.ACCEPT_STRING:\n // ACCEPT_STRING s\n parts.push(stack.push(c(bc[ip + 1])));\n parts.push(eval(ast.consts[bc[ip + 1]]).length > 1 ? 'peg$currPos += ' + eval(ast.consts[bc[ip + 1]]).length + ';' : 'peg$currPos++;');\n ip += 2;\n break;\n\n case op.FAIL:\n // FAIL e\n parts.push(stack.push('peg$FAILED'));\n parts.push('if (peg$silentFails === 0) { peg$fail(' + c(bc[ip + 1]) + '); }');\n ip += 2;\n break;\n\n case op.LOAD_SAVED_POS:\n // LOAD_SAVED_POS p\n parts.push('peg$savedPos = ' + stack.index(bc[ip + 1]) + ';');\n ip += 2;\n break;\n\n case op.UPDATE_SAVED_POS:\n // UPDATE_SAVED_POS\n parts.push('peg$savedPos = peg$currPos;');\n ip++;\n break;\n\n case op.CALL:\n // CALL f, n, pc, p1, p2, ..., pN\n compileCall();\n break;\n\n case op.RULE:\n // RULE r\n parts.push(stack.push(\"peg$parse\" + ast.rules[bc[ip + 1]].name + \"()\"));\n ip += 2;\n break;\n\n case op.SILENT_FAILS_ON:\n // SILENT_FAILS_ON\n parts.push('peg$silentFails++;');\n ip++;\n break;\n\n case op.SILENT_FAILS_OFF:\n // SILENT_FAILS_OFF\n parts.push('peg$silentFails--;');\n ip++;\n break;\n\n default:\n throw new Error(\"Invalid opcode: \" + bc[ip] + \".\");\n }\n }\n\n return parts.join('\\n');\n }\n\n code = compile(rule.bytecode);\n parts.push('function peg$parse' + rule.name + '() {');\n\n if (options.trace) {\n parts.push([' var ' + arrays.map(arrays.range(0, stack.maxSp + 1), s).join(', ') + ',', ' startPos = peg$currPos;'].join('\\n'));\n } else {\n parts.push(' var ' + arrays.map(arrays.range(0, stack.maxSp + 1), s).join(', ') + ';');\n }\n\n parts.push(indent2(generateRuleHeader('\"' + js.stringEscape(rule.name) + '\"', asts.indexOfRule(ast, rule.name))));\n parts.push(indent2(code));\n parts.push(indent2(generateRuleFooter('\"' + js.stringEscape(rule.name) + '\"', s(0))));\n parts.push('}');\n return parts.join('\\n');\n }\n\n function generateToplevel() {\n var parts = [],\n startRuleIndices,\n startRuleIndex,\n startRuleFunctions,\n startRuleFunction,\n ruleNames;\n parts.push(['function peg$subclass(child, parent) {', ' function ctor() { this.constructor = child; }', ' ctor.prototype = parent.prototype;', ' child.prototype = new ctor();', '}', '', 'function peg$SyntaxError(message, expected, found, location) {', ' this.message = message;', ' this.expected = expected;', ' this.found = found;', ' this.location = location;', ' this.name = \"SyntaxError\";', '', ' if (typeof Error.captureStackTrace === \"function\") {', ' Error.captureStackTrace(this, peg$SyntaxError);', ' }', '}', '', 'peg$subclass(peg$SyntaxError, Error);', '', 'peg$SyntaxError.buildMessage = function(expected, found) {', ' var DESCRIBE_EXPECTATION_FNS = {', ' literal: function(expectation) {', ' return \"\\\\\\\"\" + literalEscape(expectation.text) + \"\\\\\\\"\";', ' },', '', ' \"class\": function(expectation) {', ' var escapedParts = \"\",', ' i;', '', ' for (i = 0; i < expectation.parts.length; i++) {', ' escapedParts += expectation.parts[i] instanceof Array', ' ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])', ' : classEscape(expectation.parts[i]);', ' }', '', ' return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";', ' },', '', ' any: function(expectation) {', ' return \"any character\";', ' },', '', ' end: function(expectation) {', ' return \"end of input\";', ' },', '', ' other: function(expectation) {', ' return expectation.description;', ' }', ' };', '', ' function hex(ch) {', ' return ch.charCodeAt(0).toString(16).toUpperCase();', ' }', '', ' function literalEscape(s) {', ' return s', ' .replace(/\\\\\\\\/g, \\'\\\\\\\\\\\\\\\\\\')', // backslash\n ' .replace(/\"/g, \\'\\\\\\\\\"\\')', // closing double quote\n ' .replace(/\\\\0/g, \\'\\\\\\\\0\\')', // null\n ' .replace(/\\\\t/g, \\'\\\\\\\\t\\')', // horizontal tab\n ' .replace(/\\\\n/g, \\'\\\\\\\\n\\')', // line feed\n ' .replace(/\\\\r/g, \\'\\\\\\\\r\\')', // carriage return\n ' .replace(/[\\\\x00-\\\\x0F]/g, function(ch) { return \\'\\\\\\\\x0\\' + hex(ch); })', ' .replace(/[\\\\x10-\\\\x1F\\\\x7F-\\\\x9F]/g, function(ch) { return \\'\\\\\\\\x\\' + hex(ch); });', ' }', '', ' function classEscape(s) {', ' return s', ' .replace(/\\\\\\\\/g, \\'\\\\\\\\\\\\\\\\\\')', // backslash\n ' .replace(/\\\\]/g, \\'\\\\\\\\]\\')', // closing bracket\n ' .replace(/\\\\^/g, \\'\\\\\\\\^\\')', // caret\n ' .replace(/-/g, \\'\\\\\\\\-\\')', // dash\n ' .replace(/\\\\0/g, \\'\\\\\\\\0\\')', // null\n ' .replace(/\\\\t/g, \\'\\\\\\\\t\\')', // horizontal tab\n ' .replace(/\\\\n/g, \\'\\\\\\\\n\\')', // line feed\n ' .replace(/\\\\r/g, \\'\\\\\\\\r\\')', // carriage return\n ' .replace(/[\\\\x00-\\\\x0F]/g, function(ch) { return \\'\\\\\\\\x0\\' + hex(ch); })', ' .replace(/[\\\\x10-\\\\x1F\\\\x7F-\\\\x9F]/g, function(ch) { return \\'\\\\\\\\x\\' + hex(ch); });', ' }', '', ' function describeExpectation(expectation) {', ' return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);', ' }', '', ' function describeExpected(expected) {', ' var descriptions = new Array(expected.length),', ' i, j;', '', ' for (i = 0; i < expected.length; i++) {', ' descriptions[i] = describeExpectation(expected[i]);', ' }', '', ' descriptions.sort();', '', ' if (descriptions.length > 0) {', ' for (i = 1, j = 1; i < descriptions.length; i++) {', ' if (descriptions[i - 1] !== descriptions[i]) {', ' descriptions[j] = descriptions[i];', ' j++;', ' }', ' }', ' descriptions.length = j;', ' }', '', ' switch (descriptions.length) {', ' case 1:', ' return descriptions[0];', '', ' case 2:', ' return descriptions[0] + \" or \" + descriptions[1];', '', ' default:', ' return descriptions.slice(0, -1).join(\", \")', ' + \", or \"', ' + descriptions[descriptions.length - 1];', ' }', ' }', '', ' function describeFound(found) {', ' return found ? \"\\\\\"\" + literalEscape(found) + \"\\\\\"\" : \"end of input\";', ' }', '', ' return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";', '};', ''].join('\\n'));\n\n if (options.trace) {\n parts.push(['function peg$DefaultTracer() {', ' this.indentLevel = 0;', '}', '', 'peg$DefaultTracer.prototype.trace = function(event) {', ' var that = this;', '', ' function log(event) {', ' function repeat(string, n) {', ' var result = \"\", i;', '', ' for (i = 0; i < n; i++) {', ' result += string;', ' }', '', ' return result;', ' }', '', ' function pad(string, length) {', ' return string + repeat(\" \", length - string.length);', ' }', '', ' if (typeof console === \"object\") {', // IE 8-10\n ' console.log(', ' event.location.start.line + \":\" + event.location.start.column + \"-\"', ' + event.location.end.line + \":\" + event.location.end.column + \" \"', ' + pad(event.type, 10) + \" \"', ' + repeat(\" \", that.indentLevel) + event.rule', ' );', ' }', ' }', '', ' switch (event.type) {', ' case \"rule.enter\":', ' log(event);', ' this.indentLevel++;', ' break;', '', ' case \"rule.match\":', ' this.indentLevel--;', ' log(event);', ' break;', '', ' case \"rule.fail\":', ' this.indentLevel--;', ' log(event);', ' break;', '', ' default:', ' throw new Error(\"Invalid event type: \" + event.type + \".\");', ' }', '};', ''].join('\\n'));\n }\n\n parts.push(['function peg$parse(input, options) {', ' options = options !== void 0 ? options : {};', '', ' var peg$FAILED = {},', ''].join('\\n'));\n\n if (options.optimize === \"size\") {\n startRuleIndices = '{ ' + arrays.map(options.allowedStartRules, function (r) {\n return r + ': ' + asts.indexOfRule(ast, r);\n }).join(', ') + ' }';\n startRuleIndex = asts.indexOfRule(ast, options.allowedStartRules[0]);\n parts.push([' peg$startRuleIndices = ' + startRuleIndices + ',', ' peg$startRuleIndex = ' + startRuleIndex + ','].join('\\n'));\n } else {\n startRuleFunctions = '{ ' + arrays.map(options.allowedStartRules, function (r) {\n return r + ': peg$parse' + r;\n }).join(', ') + ' }';\n startRuleFunction = 'peg$parse' + options.allowedStartRules[0];\n parts.push([' peg$startRuleFunctions = ' + startRuleFunctions + ',', ' peg$startRuleFunction = ' + startRuleFunction + ','].join('\\n'));\n }\n\n parts.push('');\n parts.push(indent6(generateTables()));\n parts.push(['', ' peg$currPos = 0,', ' peg$savedPos = 0,', ' peg$posDetailsCache = [{ line: 1, column: 1 }],', ' peg$maxFailPos = 0,', ' peg$maxFailExpected = [],', ' peg$silentFails = 0,', // 0 = report failures, > 0 = silence failures\n ''].join('\\n'));\n\n if (options.cache) {\n parts.push([' peg$resultsCache = {},', ''].join('\\n'));\n }\n\n if (options.trace) {\n if (options.optimize === \"size\") {\n ruleNames = '[' + arrays.map(ast.rules, function (r) {\n return '\"' + js.stringEscape(r.name) + '\"';\n }).join(', ') + ']';\n parts.push([' peg$ruleNames = ' + ruleNames + ',', ''].join('\\n'));\n }\n\n parts.push([' peg$tracer = \"tracer\" in options ? options.tracer : new peg$DefaultTracer(),', ''].join('\\n'));\n }\n\n parts.push([' peg$result;', ''].join('\\n'));\n\n if (options.optimize === \"size\") {\n parts.push([' if (\"startRule\" in options) {', ' if (!(options.startRule in peg$startRuleIndices)) {', ' throw new Error(\"Can\\'t start parsing from rule \\\\\"\" + options.startRule + \"\\\\\".\");', ' }', '', ' peg$startRuleIndex = peg$startRuleIndices[options.startRule];', ' }'].join('\\n'));\n } else {\n parts.push([' if (\"startRule\" in options) {', ' if (!(options.startRule in peg$startRuleFunctions)) {', ' throw new Error(\"Can\\'t start parsing from rule \\\\\"\" + options.startRule + \"\\\\\".\");', ' }', '', ' peg$startRuleFunction = peg$startRuleFunctions[options.startRule];', ' }'].join('\\n'));\n }\n\n parts.push(['', ' function text() {', ' return input.substring(peg$savedPos, peg$currPos);', ' }', '', ' function location() {', ' return peg$computeLocation(peg$savedPos, peg$currPos);', ' }', '', ' function expected(description, location) {', ' location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)', '', ' throw peg$buildStructuredError(', ' [peg$otherExpectation(description)],', ' input.substring(peg$savedPos, peg$currPos),', ' location', ' );', ' }', '', ' function error(message, location) {', ' location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)', '', ' throw peg$buildSimpleError(message, location);', ' }', '', ' function peg$literalExpectation(text, ignoreCase) {', ' return { type: \"literal\", text: text, ignoreCase: ignoreCase };', ' }', '', ' function peg$classExpectation(parts, inverted, ignoreCase) {', ' return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };', ' }', '', ' function peg$anyExpectation() {', ' return { type: \"any\" };', ' }', '', ' function peg$endExpectation() {', ' return { type: \"end\" };', ' }', '', ' function peg$otherExpectation(description) {', ' return { type: \"other\", description: description };', ' }', '', ' function peg$computePosDetails(pos) {', ' var details = peg$posDetailsCache[pos], p;', '', ' if (details) {', ' return details;', ' } else {', ' p = pos - 1;', ' while (!peg$posDetailsCache[p]) {', ' p--;', ' }', '', ' details = peg$posDetailsCache[p];', ' details = {', ' line: details.line,', ' column: details.column', ' };', '', ' while (p < pos) {', ' if (input.charCodeAt(p) === 10) {', ' details.line++;', ' details.column = 1;', ' } else {', ' details.column++;', ' }', '', ' p++;', ' }', '', ' peg$posDetailsCache[pos] = details;', ' return details;', ' }', ' }', '', ' function peg$computeLocation(startPos, endPos) {', ' var startPosDetails = peg$computePosDetails(startPos),', ' endPosDetails = peg$computePosDetails(endPos);', '', ' return {', ' start: {', ' offset: startPos,', ' line: startPosDetails.line,', ' column: startPosDetails.column', ' },', ' end: {', ' offset: endPos,', ' line: endPosDetails.line,', ' column: endPosDetails.column', ' }', ' };', ' }', '', ' function peg$fail(expected) {', ' if (peg$currPos < peg$maxFailPos) { return; }', '', ' if (peg$currPos > peg$maxFailPos) {', ' peg$maxFailPos = peg$currPos;', ' peg$maxFailExpected = [];', ' }', '', ' peg$maxFailExpected.push(expected);', ' }', '', ' function peg$buildSimpleError(message, location) {', ' return new peg$SyntaxError(message, null, null, location);', ' }', '', ' function peg$buildStructuredError(expected, found, location) {', ' return new peg$SyntaxError(', ' peg$SyntaxError.buildMessage(expected, found),', ' expected,', ' found,', ' location', ' );', ' }', ''].join('\\n'));\n\n if (options.optimize === \"size\") {\n parts.push(indent2(generateInterpreter()));\n parts.push('');\n } else {\n arrays.each(ast.rules, function (rule) {\n parts.push(indent2(generateRuleFunction(rule)));\n parts.push('');\n });\n }\n\n if (ast.initializer) {\n parts.push(indent2(ast.initializer.code));\n parts.push('');\n }\n\n if (options.optimize === \"size\") {\n parts.push(' peg$result = peg$parseRule(peg$startRuleIndex);');\n } else {\n parts.push(' peg$result = peg$startRuleFunction();');\n }\n\n parts.push(['', ' if (peg$result !== peg$FAILED && peg$currPos === input.length) {', ' return peg$result;', ' } else {', ' if (peg$result !== peg$FAILED && peg$currPos < input.length) {', ' peg$fail(peg$endExpectation());', ' }', '', ' throw peg$buildStructuredError(', ' peg$maxFailExpected,', ' peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,', ' peg$maxFailPos < input.length', ' ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)', ' : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)', ' );', ' }', '}'].join('\\n'));\n return parts.join('\\n');\n }\n\n function generateWrapper(toplevelCode) {\n function generateGeneratedByComment() {\n return ['/*', ' * Generated by PEG.js 0.10.0.', ' *', ' * http://pegjs.org/', ' */'].join('\\n');\n }\n\n function generateParserObject() {\n return options.trace ? ['{', ' SyntaxError: peg$SyntaxError,', ' DefaultTracer: peg$DefaultTracer,', ' parse: peg$parse', '}'].join('\\n') : ['{', ' SyntaxError: peg$SyntaxError,', ' parse: peg$parse', '}'].join('\\n');\n }\n\n var generators = {\n bare: function () {\n return [generateGeneratedByComment(), '(function() {', ' \"use strict\";', '', indent2(toplevelCode), '', indent2('return ' + generateParserObject() + ';'), '})()'].join('\\n');\n },\n commonjs: function () {\n var parts = [],\n dependencyVars = objects.keys(options.dependencies),\n requires = arrays.map(dependencyVars, function (variable) {\n return variable + ' = require(\"' + js.stringEscape(options.dependencies[variable]) + '\")';\n });\n parts.push([generateGeneratedByComment(), '', '\"use strict\";', ''].join('\\n'));\n\n if (requires.length > 0) {\n parts.push('var ' + requires.join(', ') + ';');\n parts.push('');\n }\n\n parts.push([toplevelCode, '', 'module.exports = ' + generateParserObject() + ';', ''].join('\\n'));\n return parts.join('\\n');\n },\n amd: function () {\n var dependencyIds = objects.values(options.dependencies),\n dependencyVars = objects.keys(options.dependencies),\n dependencies = '[' + arrays.map(dependencyIds, function (id) {\n return '\"' + js.stringEscape(id) + '\"';\n }).join(', ') + ']',\n params = dependencyVars.join(', ');\n return [generateGeneratedByComment(), 'define(' + dependencies + ', function(' + params + ') {', ' \"use strict\";', '', indent2(toplevelCode), '', indent2('return ' + generateParserObject() + ';'), '});', ''].join('\\n');\n },\n globals: function () {\n return [generateGeneratedByComment(), '(function(root) {', ' \"use strict\";', '', indent2(toplevelCode), '', indent2('root.' + options.exportVar + ' = ' + generateParserObject() + ';'), '})(this);', ''].join('\\n');\n },\n umd: function () {\n var parts = [],\n dependencyIds = objects.values(options.dependencies),\n dependencyVars = objects.keys(options.dependencies),\n dependencies = '[' + arrays.map(dependencyIds, function (id) {\n return '\"' + js.stringEscape(id) + '\"';\n }).join(', ') + ']',\n requires = arrays.map(dependencyIds, function (id) {\n return 'require(\"' + js.stringEscape(id) + '\")';\n }).join(', '),\n params = dependencyVars.join(', ');\n parts.push([generateGeneratedByComment(), '(function(root, factory) {', ' if (typeof define === \"function\" && define.amd) {', ' define(' + dependencies + ', factory);', ' } else if (typeof module === \"object\" && module.exports) {', ' module.exports = factory(' + requires + ');'].join('\\n'));\n\n if (options.exportVar !== null) {\n parts.push([' } else {', ' root.' + options.exportVar + ' = factory();'].join('\\n'));\n }\n\n parts.push([' }', '})(this, function(' + params + ') {', ' \"use strict\";', '', indent2(toplevelCode), '', indent2('return ' + generateParserObject() + ';'), '});', ''].join('\\n'));\n return parts.join('\\n');\n }\n };\n return generators[options.format]();\n }\n\n ast.code = generateWrapper(generateToplevel());\n}" ]
[ "0.5940843", "0.5702928", "0.55635834", "0.55454826", "0.5495067", "0.54584265", "0.5366921", "0.5262324", "0.52322745", "0.51971656", "0.5176405", "0.51371455", "0.5105554", "0.5087184", "0.5071049", "0.50298166", "0.50227123", "0.5021358", "0.49860197", "0.49845386", "0.4980698", "0.497842", "0.49574435", "0.4956904", "0.49331477", "0.49223748", "0.49177688", "0.49173856", "0.4900801", "0.48697492", "0.4831534", "0.48215264", "0.47826898", "0.47609293", "0.47458658", "0.47266588", "0.47150713", "0.46963927", "0.4683135", "0.46817988", "0.46750087", "0.46396574", "0.4603583", "0.45757878", "0.45746264", "0.45580778", "0.45401746", "0.45389813", "0.4514837", "0.4474412", "0.44684407", "0.446593", "0.4459295", "0.44529027", "0.44277614", "0.44167426", "0.44147158", "0.44135445", "0.43995476", "0.43938747", "0.4391404", "0.43761066", "0.43758014", "0.43757817", "0.4375506", "0.43742222", "0.43623444", "0.4357449", "0.43561015", "0.4337851", "0.43284622", "0.43211752", "0.43205255", "0.43135852", "0.43115386", "0.4302942", "0.42975563", "0.4280315", "0.4273757", "0.42734638", "0.42632607", "0.42624906", "0.4258202", "0.42532414", "0.4242991", "0.42417336", "0.42396164", "0.42389113", "0.42379087", "0.42288125", "0.42226312", "0.42108837", "0.42084685", "0.42022076", "0.41926202", "0.41916046", "0.41818935", "0.41724208", "0.41695467", "0.4167483", "0.41580072" ]
0.0
-1
end datepicker function definition
function main() { styleSetup() // var map = newMap(); // console.log(map) var map = new L.Map('map', { center: [38, -119], zoom: 6, }); addTiles(map); // Make sure this runs first to get global variables jQuery.ajaxSetup({async:false}); // Define date range and set global variables $.getJSON('https://california-data-collaborative.carto.com/api/v2/sql?q=SELECT%20min(supply_reading_date),%20max(supply_reading_date)%20FROM%20supply_reading_extract', dateRange) //$.getJSON('https://california-data-collaborative.carto.com/api/v2/sql?q=ALTER%20TABLE%20reservoir_reading_extract%20ADD%20dateUTC%20timestamp') //$.getJSON('https://california-data-collaborative.carto.com/api/v2/sql?q=UPDATE%20reservoir_reading_extract%20SET%20dateUTC%20=%20date+"T00:00:00Z"FROM%20reservoir_reading_extract') jQuery.ajaxSetup({async:true}); // Get capacity data //drawCapacity(map, state.endDate); // Draw Animation of reservoir levels on map drawAnimation(map); // Adjust Statewide storage based on datepicker drawDatePicker(map); drawLegends(); } // end main
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Datepicker() {}", "function Datepicker() {}", "function DatePickerControl()\n{\n}", "function d(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId=\"ui-datepicker-div\",this._inlineClass=\"ui-datepicker-inline\",this._appendClass=\"ui-datepicker-append\",this._triggerClass=\"ui-datepicker-trigger\",this._dialogClass=\"ui-datepicker-dialog\",this._disableClass=\"ui-datepicker-disabled\",this._unselectableClass=\"ui-datepicker-unselectable\",this._currentClass=\"ui-datepicker-current-day\",this._dayOverClass=\"ui-datepicker-days-cell-over\",this.regional=[],this.regional[\"\"]={closeText:\"Done\",prevText:\"Prev\",nextText:\"Next\",currentText:\"Today\",monthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],monthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],dayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],dayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],dayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],weekHeader:\"Wk\",dateFormat:\"mm/dd/yy\",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:\"\"},this._defaults={showOn:\"focus\",showAnim:\"fadeIn\",showOptions:{},defaultDate:null,appendText:\"\",buttonText:\"...\",buttonImage:\"\",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:\"c-10:c+10\",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:\"+10\",minDate:null,maxDate:null,duration:\"fast\",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:\"\",altFormat:\"\",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[\"\"]),this.regional.en=e.extend(!0,{},this.regional[\"\"]),this.regional[\"en-US\"]=e.extend(!0,{},this.regional.en),this.dpDiv=p(e(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"))}", "function addDatePicker() {\n $(\"#dueDate\").datepicker();\n } // end function addDatePicker", "function tglinput(par){ \n\t$(par).datepicker();\n}", "function init(){\n\t\t//para la fecha del calendario\n\t\t$(\".datepicker\").datepicker({ \n\t\t\tformat: \"yyyy-mm-dd\",\n\t autoclose: true\n\t\t}).datepicker(\"setDate\",\"today\");\n\t}", "function date_time_picker_init(){\n}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst=null;// The current instance in use\nthis._keyEvent=false;// If the last event was a key event\nthis._disabledInputs=[];// List of date picker inputs that have been disabled\nthis._datepickerShowing=false;// True if the popup picker is showing , false if not\nthis._inDialog=false;// True if showing within a \"dialog\", false if not\nthis._mainDivId=\"ui-datepicker-div\";// The ID of the main datepicker division\nthis._inlineClass=\"ui-datepicker-inline\";// The name of the inline marker class\nthis._appendClass=\"ui-datepicker-append\";// The name of the append marker class\nthis._triggerClass=\"ui-datepicker-trigger\";// The name of the trigger marker class\nthis._dialogClass=\"ui-datepicker-dialog\";// The name of the dialog marker class\nthis._disableClass=\"ui-datepicker-disabled\";// The name of the disabled covering marker class\nthis._unselectableClass=\"ui-datepicker-unselectable\";// The name of the unselectable cell marker class\nthis._currentClass=\"ui-datepicker-current-day\";// The name of the current day marker class\nthis._dayOverClass=\"ui-datepicker-days-cell-over\";// The name of the day hover marker class\nthis.regional=[];// Available regional settings, indexed by language code\nthis.regional[\"\"]={// Default regional settings\ncloseText:\"Done\",// Display text for close link\nprevText:\"Prev\",// Display text for previous month link\nnextText:\"Next\",// Display text for next month link\ncurrentText:\"Today\",// Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"],// Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],// For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],// For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],// For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"],// Column headings for days starting at Sunday\nweekHeader:\"Wk\",// Column header for week of the year\ndateFormat:\"mm/dd/yy\",// See format options on parseDate\nfirstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false,// True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false,// True if the year select precedes month, false for month then year\nyearSuffix:\"\"// Additional text to append to the year in the month headers\n};this._defaults={// Global defaults for all the date picker instances\nshowOn:\"focus\",// \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\",// Name of jQuery animation for popup\nshowOptions:{},// Options for enhanced animations\ndefaultDate:null,// Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\",// Display text following the input box, e.g. showing the format\nbuttonText:\"...\",// Text for trigger button\nbuttonImage:\"\",// URL for trigger button image\nbuttonImageOnly:false,// True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false,// True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false,// True if date formatting applied to prev/today/next links\ngotoCurrent:false,// True if today link goes back to current selection instead\nchangeMonth:false,// True if month can be selected directly, false if only prev/next\nchangeYear:false,// True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\",// Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false,// True to show dates in other months, false to leave blank\nselectOtherMonths:false,// True to allow selection of dates in other months, false for unselectable\nshowWeek:false,// True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week,// How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\",// Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null,// The earliest selectable date, or null for no limit\nmaxDate:null,// The latest selectable date, or null for no limit\nduration:\"fast\",// Duration of display/closure\nbeforeShowDay:null,// Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null,// Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null,// Define a callback function when a date is selected\nonChangeMonthYear:null,// Define a callback function when the month or year is changed\nonClose:null,// Define a callback function when the datepicker is closed\nnumberOfMonths:1,// Number of months to show at a time\nshowCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1,// Number of months to step back/forward\nstepBigMonths:12,// Number of months to step back/forward for the big links\naltField:\"\",// Selector for an alternate field to store selected dates into\naltFormat:\"\",// The date format to use for the alternate field\nconstrainInput:true,// The input is constrained by the current date format\nshowButtonPanel:false,// True to show button panel, false to not show it\nautoSize:false,// True to size the input for the date format, false to leave as is\ndisabled:false// The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en=$.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"]=$.extend(true,{},this.regional.en);this.dpDiv=datepicker_bindHover($(\"<div id='\"+this._mainDivId+\"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function DatePickerPlugin() {\n\n }", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function Datepicker(){this._curInst = null; // The current instance in use\nthis._keyEvent = false; // If the last event was a key event\nthis._disabledInputs = []; // List of date picker inputs that have been disabled\nthis._datepickerShowing = false; // True if the popup picker is showing , false if not\nthis._inDialog = false; // True if showing within a \"dialog\", false if not\nthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\nthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\nthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\nthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\nthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\nthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\nthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\nthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\nthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\nthis.regional = []; // Available regional settings, indexed by language code\nthis.regional[\"\"] = { // Default regional settings\ncloseText:\"Done\", // Display text for close link\nprevText:\"Prev\", // Display text for previous month link\nnextText:\"Next\", // Display text for next month link\ncurrentText:\"Today\", // Display text for current month link\nmonthNames:[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\nmonthNamesShort:[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"], // For formatting\ndayNames:[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"], // For formatting\ndayNamesShort:[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"], // For formatting\ndayNamesMin:[\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\nweekHeader:\"Wk\", // Column header for week of the year\ndateFormat:\"mm/dd/yy\", // See format options on parseDate\nfirstDay:0, // The first day of the week, Sun = 0, Mon = 1, ...\nisRTL:false, // True if right-to-left language, false if left-to-right\nshowMonthAfterYear:false, // True if the year select precedes month, false for month then year\nyearSuffix:\"\" // Additional text to append to the year in the month headers\n};this._defaults = { // Global defaults for all the date picker instances\nshowOn:\"focus\", // \"focus\" for popup on focus,\n// \"button\" for trigger button, or \"both\" for either\nshowAnim:\"fadeIn\", // Name of jQuery animation for popup\nshowOptions:{}, // Options for enhanced animations\ndefaultDate:null, // Used when field is blank: actual date,\n// +/-number for offset from today, null for today\nappendText:\"\", // Display text following the input box, e.g. showing the format\nbuttonText:\"...\", // Text for trigger button\nbuttonImage:\"\", // URL for trigger button image\nbuttonImageOnly:false, // True if the image appears alone, false if it appears on a button\nhideIfNoPrevNext:false, // True to hide next/previous month links\n// if not applicable, false to just disable them\nnavigationAsDateFormat:false, // True if date formatting applied to prev/today/next links\ngotoCurrent:false, // True if today link goes back to current selection instead\nchangeMonth:false, // True if month can be selected directly, false if only prev/next\nchangeYear:false, // True if year can be selected directly, false if only prev/next\nyearRange:\"c-10:c+10\", // Range of years to display in drop-down,\n// either relative to today's year (-nn:+nn), relative to currently displayed year\n// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\nshowOtherMonths:false, // True to show dates in other months, false to leave blank\nselectOtherMonths:false, // True to allow selection of dates in other months, false for unselectable\nshowWeek:false, // True to show week of the year, false to not show it\ncalculateWeek:this.iso8601Week, // How to calculate the week of the year,\n// takes a Date and returns the number of the week for it\nshortYearCutoff:\"+10\", // Short year values < this are in the current century,\n// > this are in the previous century,\n// string value starting with \"+\" for current year + value\nminDate:null, // The earliest selectable date, or null for no limit\nmaxDate:null, // The latest selectable date, or null for no limit\nduration:\"fast\", // Duration of display/closure\nbeforeShowDay:null, // Function that takes a date and returns an array with\n// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n// [2] = cell title (optional), e.g. $.datepicker.noWeekends\nbeforeShow:null, // Function that takes an input field and\n// returns a set of custom settings for the date picker\nonSelect:null, // Define a callback function when a date is selected\nonChangeMonthYear:null, // Define a callback function when the month or year is changed\nonClose:null, // Define a callback function when the datepicker is closed\nnumberOfMonths:1, // Number of months to show at a time\nshowCurrentAtPos:0, // The position in multipe months at which to show the current month (starting at 0)\nstepMonths:1, // Number of months to step back/forward\nstepBigMonths:12, // Number of months to step back/forward for the big links\naltField:\"\", // Selector for an alternate field to store selected dates into\naltFormat:\"\", // The date format to use for the alternate field\nconstrainInput:true, // The input is constrained by the current date format\nshowButtonPanel:false, // True to show button panel, false to not show it\nautoSize:false, // True to size the input for the date format, false to leave as is\ndisabled:false // The initial disabled state\n};$.extend(this._defaults,this.regional[\"\"]);this.regional.en = $.extend(true,{},this.regional[\"\"]);this.regional[\"en-US\"] = $.extend(true,{},this.regional.en);this.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));}", "function createDatePickerComponent() {\n $(\"#datepicker\").datepicker({\n format: \"yyyy-mm-dd\",\n language: \"fr\",\n autoclose: true,\n clearBtn: true,\n todayHighlight: true,\n todayBtn: \"linked\"\n });\n}", "function datePickerVisitDate(id){\n\t$(\"#visitDate_\"+id).datepicker();\n}", "function Datepicker() {\n this._curInst = null; // The current instance in use\n this._keyEvent = false; // If the last event was a key event\n this._disabledInputs = []; // List of date picker inputs that have been disabled\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\n this._inDialog = false; // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n this.regional = []; // Available regional settings, indexed by language code\n this.regional[ \"\" ] = { // Default regional settings\n closeText: \"Done\", // Display text for close link\n prevText: \"Prev\", // Display text for previous month link\n nextText: \"Next\", // Display text for next month link\n currentText: \"Today\", // Display text for current month link\n monthNames: [ \"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\" ], // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ], // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ], // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ], // For formatting\n dayNamesMin: [ \"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\" ], // Column headings for days starting at Sunday\n weekHeader: \"Wk\", // Column header for week of the year\n dateFormat: \"mm/dd/yy\", // See format options on parseDate\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false, // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\n yearSuffix: \"\" // Additional text to append to the year in the month headers\n };\n this._defaults = { // Global defaults for all the date picker instances\n showOn: \"focus\", // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\", // Name of jQuery animation for popup\n showOptions: {}, // Options for enhanced animations\n defaultDate: null, // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\", // Display text following the input box, e.g. showing the format\n buttonText: \"...\", // Text for trigger button\n buttonImage: \"\", // URL for trigger button image\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false, // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n gotoCurrent: false, // True if today link goes back to current selection instead\n changeMonth: false, // True if month can be selected directly, false if only prev/next\n changeYear: false, // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false, // True to show dates in other months, false to leave blank\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n showWeek: false, // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\", // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null, // The earliest selectable date, or null for no limit\n maxDate: null, // The latest selectable date, or null for no limit\n duration: \"fast\", // Duration of display/closure\n beforeShowDay: null, // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null, // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null, // Define a callback function when a date is selected\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\n onClose: null, // Define a callback function when the datepicker is closed\n numberOfMonths: 1, // Number of months to show at a time\n showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1, // Number of months to step back/forward\n stepBigMonths: 12, // Number of months to step back/forward for the big links\n altField: \"\", // Selector for an alternate field to store selected dates into\n altFormat: \"\", // The date format to use for the alternate field\n constrainInput: true, // The input is constrained by the current date format\n showButtonPanel: false, // True to show button panel, false to not show it\n autoSize: false, // True to size the input for the date format, false to leave as is\n disabled: false // The initial disabled state\n };\n $.extend( this._defaults, this.regional[ \"\" ] );\n this.regional.en = $.extend( true, {}, this.regional[ \"\" ] );\n this.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n this.dpDiv = datepicker_bindHover( $( \"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\" ) );\n}", "function Ezdteformtcur(date1,frmt) {\n $(date1).datetimepicker({\n defaultDate: new Date(),\n format: frmt,\n showClose: true,\n showClear: true,\n // minDate: new Date(), \n });\n }", "function changeDate(){\n\n\t\t$(\"#d1\").datepicker({\n\t\t format: 'yyyy-mm-dd',\n\t\t todayHighlight: true,\n\t\t autoclose: true,\n\t\t}).on('changeDate', function (selected) {\n\t\t $('#d2').datepicker({\n\t\t format: 'yyyy-mm-dd',\n\t\t autoclose: true,\n\t\t todayHighlight: true\n\t\t });\n\t\t var minDate = new Date(selected.date.valueOf());\n\t\t $('#d2').datepicker(\"update\", minDate);\n\t\t $('#d2').datepicker('setStartDate', minDate);\n\t\t});\n\t\t//for end date\n\t\t$(\"#d2\").datepicker({\n\t\t format: 'yyyy-mm-dd',\n\t\t autoclose: true\n\t\t}).on('changeDate', function (selected) {\n\t\t var maxDate = new Date(selected.date.valueOf());\n\t\t $('#d1').datepicker('setEndDate', maxDate);\n\t\t});\n\t}", "function datePickerEndDate(id){\n\t$(\"#endDate_\"+id).datepicker();\n}", "function setDatePicker(dateObjId)\n {\n\t $(\"#\" + dateObjId + \"\").datepicker( {\n dateFormat: 'yy-mm-dd' , changeYear: true , showButtonPanel: true\n , autoSize: true\n } ) ;\n }", "function onDatePick() {\n calRadioGroupSelectItem(\"view-field\", \"custom-range\");\n refreshHtml();\n}", "function date_navigation(){\t\n\t\t$('#prev_day').live('click', function() {\n\t\t\tset_date_controls('previous');\n\t\t}); //end of prev day\n\t\t\n\t\t$('#next_day').live('click', function() {\n\t\t\tset_date_controls('next');\n\t\t}); //end of next day\n\t\t\n\t\t$('#nav_date_field').datepicker({ \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowOn: 'button',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuttonImage: '/images/calendar.gif', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuttonImageOnly: true, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelect: function(){set_date_controls('popup_calendar')}\n\t }); // end of date picker\n\t\t\n} // date navigation", "function opreg_dynamic(value)\n {\n //alert(\"--- \"+value);\n if(value!='1')\n {\n //alert(\"--- \"+value);\n $( \"#datepicker2,#datepicker3\" ).datepicker(\"destroy\");\n document.getElementById('in').innerHTML=document.getElementById(value).innerHTML;\n $( \"#datepicker2,#datepicker3\" ).datepicker({\n\t\t\tshowOn: \"button\",\n\t\t\tbuttonImage: \"images/calendar.gif\",\n\t\t\tbuttonImageOnly: true\n\t\t});\n }\n else\n document.getElementById('in').innerHTML=\"\";\n }", "function DPC_onButtonClick(event){DatePickerControl.onButtonClick(event);}", "function datePickerStartDate(id){\n\t$(\"#startDate_\"+id).datepicker();\n}", "function datePick() {\r\n $('.date-pick').daterangepicker({\r\n singleDatePicker: true,\r\n showDropdowns: true,\r\n opens: 'right',\r\n drops: 'up',\r\n })\r\n }", "function Ezdatejoindate(Ide, JIde, fIde, errmsg) {\n $(Ide).on('dp.change', function (e) {\n \n if (e.oldDate !== null) {\n var ab = 1;\n if (new Date(Ezsetdtpkdate($(JIde).val())) <= new Date(Ezsetdtpkdate($(Ide).val()))) {\n ab = 0;\n }\n if (ab == 0) {\n $(fIde).focus();\n $(fIde).select();\n }\n else {\n $(Ide).focus();\n $(Ide).select(); \n $(Ide).val(EzdteTblPkEdit(new Date()));\n EzAlerterrtxt(errmsg);\n }\n }\n });\n}", "function EzdtePkMMyy(date1) {\n $(date1).datetimepicker({\n defaultDate: new Date(),\n format: 'MMMM-YYYY', \n showClose: true,\n showClear: true,\n \n });\n }", "function EzdtePkMMyyEdit(date1, dtval) { \n $(date1).datetimepicker({\n defaultDate: new Date($(dtval).val()),\n format: 'MMMM-YYYY',\n showClose: true,\n showClear: true, \n });\n }", "function cmpFecha(){\n\t\t$('.fecha').daterangepicker({\n\t\t\tautoclose: true,\n\t\t\tformat:'yyyy-mm-dd'\n\t });\n\t}", "function Datepicker() {\n this._curInst = null;\n // The current instance in use\n this._keyEvent = false;\n // If the last event was a key event\n this._disabledInputs = [];\n // List of date picker inputs that have been disabled\n this._datepickerShowing = false;\n // True if the popup picker is showing , false if not\n this._inDialog = false;\n // True if showing within a \"dialog\", false if not\n this._mainDivId = \"ui-datepicker-div\";\n // The ID of the main datepicker division\n this._inlineClass = \"ui-datepicker-inline\";\n // The name of the inline marker class\n this._appendClass = \"ui-datepicker-append\";\n // The name of the append marker class\n this._triggerClass = \"ui-datepicker-trigger\";\n // The name of the trigger marker class\n this._dialogClass = \"ui-datepicker-dialog\";\n // The name of the dialog marker class\n this._disableClass = \"ui-datepicker-disabled\";\n // The name of the disabled covering marker class\n this._unselectableClass = \"ui-datepicker-unselectable\";\n // The name of the unselectable cell marker class\n this._currentClass = \"ui-datepicker-current-day\";\n // The name of the current day marker class\n this._dayOverClass = \"ui-datepicker-days-cell-over\";\n // The name of the day hover marker class\n this.regional = [];\n // Available regional settings, indexed by language code\n this.regional[\"\"] = {\n // Default regional settings\n closeText: \"Done\",\n // Display text for close link\n prevText: \"Prev\",\n // Display text for previous month link\n nextText: \"Next\",\n // Display text for next month link\n currentText: \"Today\",\n // Display text for current month link\n monthNames: [ \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\" ],\n // Names of months for drop-down and formatting\n monthNamesShort: [ \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\" ],\n // For formatting\n dayNames: [ \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\" ],\n // For formatting\n dayNamesShort: [ \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" ],\n // For formatting\n dayNamesMin: [ \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\" ],\n // Column headings for days starting at Sunday\n weekHeader: \"Wk\",\n // Column header for week of the year\n dateFormat: \"mm/dd/yy\",\n // See format options on parseDate\n firstDay: 0,\n // The first day of the week, Sun = 0, Mon = 1, ...\n isRTL: false,\n // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false,\n // True if the year select precedes month, false for month then year\n yearSuffix: \"\"\n };\n this._defaults = {\n // Global defaults for all the date picker instances\n showOn: \"focus\",\n // \"focus\" for popup on focus,\n // \"button\" for trigger button, or \"both\" for either\n showAnim: \"fadeIn\",\n // Name of jQuery animation for popup\n showOptions: {},\n // Options for enhanced animations\n defaultDate: null,\n // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n appendText: \"\",\n // Display text following the input box, e.g. showing the format\n buttonText: \"...\",\n // Text for trigger button\n buttonImage: \"\",\n // URL for trigger button image\n buttonImageOnly: false,\n // True if the image appears alone, false if it appears on a button\n hideIfNoPrevNext: false,\n // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false,\n // True if date formatting applied to prev/today/next links\n gotoCurrent: false,\n // True if today link goes back to current selection instead\n changeMonth: false,\n // True if month can be selected directly, false if only prev/next\n changeYear: false,\n // True if year can be selected directly, false if only prev/next\n yearRange: \"c-10:c+10\",\n // Range of years to display in drop-down,\n // either relative to today's year (-nn:+nn), relative to currently displayed year\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n showOtherMonths: false,\n // True to show dates in other months, false to leave blank\n selectOtherMonths: false,\n // True to allow selection of dates in other months, false for unselectable\n showWeek: false,\n // True to show week of the year, false to not show it\n calculateWeek: this.iso8601Week,\n // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: \"+10\",\n // Short year values < this are in the current century,\n // > this are in the previous century,\n // string value starting with \"+\" for current year + value\n minDate: null,\n // The earliest selectable date, or null for no limit\n maxDate: null,\n // The latest selectable date, or null for no limit\n duration: \"fast\",\n // Duration of display/closure\n beforeShowDay: null,\n // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\n beforeShow: null,\n // Function that takes an input field and\n // returns a set of custom settings for the date picker\n onSelect: null,\n // Define a callback function when a date is selected\n onChangeMonthYear: null,\n // Define a callback function when the month or year is changed\n onClose: null,\n // Define a callback function when the datepicker is closed\n numberOfMonths: 1,\n // Number of months to show at a time\n showCurrentAtPos: 0,\n // The position in multipe months at which to show the current month (starting at 0)\n stepMonths: 1,\n // Number of months to step back/forward\n stepBigMonths: 12,\n // Number of months to step back/forward for the big links\n altField: \"\",\n // Selector for an alternate field to store selected dates into\n altFormat: \"\",\n // The date format to use for the alternate field\n constrainInput: true,\n // The input is constrained by the current date format\n showButtonPanel: false,\n // True to show button panel, false to not show it\n autoSize: false,\n // True to size the input for the date format, false to leave as is\n disabled: false\n };\n $.extend(this._defaults, this.regional[\"\"]);\n this.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n }", "function getSelectedDate()\n{\nreturn curr_date;\n}", "function Datepick() {\n this._uuid = new Date().getTime(); // Unique identifier seed\n this._curInst = null; // The current instance in use\n this._keyEvent = false; // If the last event was a key event\n this._disabledInputs = []; // List of date picker inputs that have been disabled\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\n this._inDialog = false; // True if showing within a \"dialog\", false if not\n this.regional = []; // Available regional settings, indexed by language code\n this.regional[''] = { // Default regional settings\n clearText: 'Clear', // Display text for clear link\n clearStatus: 'Erase the current date', // Status text for clear link\n closeText: 'Close', // Display text for close link\n closeStatus: 'Close without change', // Status text for close link\n prevText: '&laquo;Prev', // Display text for previous month link\n prevStatus: 'Show the previous month', // Status text for previous month link\n prevBigText: '&#x3c;&#x3c;', // Display text for previous year link\n prevBigStatus: 'Show the previous year', // Status text for previous year link\n nextText: 'Next&raquo;', // Display text for next month link\n nextStatus: 'Show the next month', // Status text for next month link\n nextBigText: '&#x3e;&#x3e;', // Display text for next year link\n nextBigStatus: 'Show the next year', // Status text for next year link\n currentText: 'Today', // Display text for current month link\n currentStatus: 'Show the current month', // Status text for current month link\n monthNames: ['January','February','March','April','May','June',\n 'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n monthStatus: 'Show a different month', // Status text for selecting a month\n yearStatus: 'Show a different year', // Status text for selecting a year\n weekHeader: 'Wk', // Header for the week of the year column\n weekStatus: 'Week of the year', // Status text for the week of the year column\n dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n dayStatus: 'Set DD as first week day', // Status text for the day of the week selection\n dateStatus: 'Select DD, M d', // Status text for the date selection\n dateFormat: 'mm/dd/yy', // See format options on parseDate\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n initStatus: 'Select a date', // Initial Status text on opening\n isRTL: false, // True if right-to-left language, false if left-to-right\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\n yearSuffix: '' // Additional text to append to the year in the month headers\n };\n this._defaults = { // Global defaults for all the date picker instances\n showOn: 'focus', // 'focus' for popup on focus,\n // 'button' for trigger button, or 'both' for either\n showAnim: 'show', // Name of jQuery animation for popup\n showOptions: {}, // Options for enhanced animations\n duration: 'normal', // Duration of display/closure\n buttonText: '...', // Text for trigger button\n buttonImage: '', // URL for trigger button image\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n defaultDate: null, // Used when field is blank: actual date,\n // +/-number for offset from today, null for today\n showDefault: false, // True to populate field with the default date\n appendText: '', // Display text following the input box, e.g. showing the format\n closeAtTop: true, // True to have the clear/close at the top,\n // false to have them at the bottom\n mandatory: false, // True to hide the Clear link, false to include it\n hideIfNoPrevNext: false, // True to hide next/previous month links\n // if not applicable, false to just disable them\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n showBigPrevNext: false, // True to show big prev/next links\n stepMonths: 1, // Number of months to step back/forward\n stepBigMonths: 12, // Number of months to step back/forward for the big links\n gotoCurrent: false, // True if today link goes back to current selection instead\n changeMonth: true, // True if month can be selected directly, false if only prev/next\n changeYear: true, // True if year can be selected directly, false if only prev/next\n yearRange: '-10:+10', // Range of years to display in drop-down,\n // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\n changeFirstDay: false, // True to click on day name to change, false to remain as set\n showOtherMonths: false, // True to show dates in other months, false to leave blank\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n highlightWeek: false, // True to highlight the selected week\n showWeeks: false, // True to show week of the year, false to omit\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\n // takes a Date and returns the number of the week for it\n shortYearCutoff: '+10', // Short year values < this are in the current century,\n // > this are in the previous century, string value starting with '+'\n // for current year + value, -1 for no change\n showStatus: false, // True to show status bar at bottom, false to not show it\n statusForDate: this.dateStatus, // Function to provide status text for a date -\n // takes date and instance as parameters, returns display text\n minDate: null, // The earliest selectable date, or null for no limit\n maxDate: null, // The latest selectable date, or null for no limit\n numberOfMonths: 1, // Number of months to show at a time\n showCurrentAtPos: 0, // The position in multiple months at which to show the current month (starting at 0)\n rangeSelect: false, // Allows for selecting a date range on one date picker\n rangeSeparator: ' - ', // Text between two dates in a range\n multiSelect: 0, // Maximum number of selectable dates\n multiSeparator: ',', // Text between multiple dates\n beforeShow: null, // Function that takes an input field and\n // returns a set of custom settings for the date picker\n beforeShowDay: null, // Function that takes a date and returns an array with\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n // [2] = cell title (optional), e.g. $.datepick.noWeekends\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\n onHover: null, // Define a callback function when hovering over a day\n onSelect: null, // Define a callback function when a date is selected\n onClose: null, // Define a callback function when the datepicker is closed\n altField: '', // Selector for an alternate field to store selected dates into\n altFormat: '', // The date format to use for the alternate field\n constrainInput: true // The input is constrained by the current date format\n };\n $.extend(this._defaults, this.regional['']);\n this.dpDiv = $('<div id=\"' + this._mainDivId + '\" style=\"display: none;\"></div>');\n}", "function initDatePicker()\r\n\t{\r\n\t\tvar dp = $('#datepicker');\r\n\t\tdp.datepicker();\r\n\t}", "function datepicker_build() {\n $('#datetimepicker').datetimepicker({\n format: 'DD/MM/YYYY',\n inline: true\n });\n}", "function loadDatePicker_1()\r\n {\r\n \r\n //date picker on the record meal page\r\n\t$('#main_interface_wrapper').delegate(\"#datepickerweight\", \"click\", function () {\r\n if (!$(this).hasClass(\"hasDatepicker\"))\r\n {\r\n $(this).datepicker();\r\n $(this).datepicker(\"show\");\r\n\t\t\t\r\n }\r\n\t\t\r\n\t});\r\n\t\r\n if(first_time_loading)\r\n\t$('#main_interface_wrapper').delegate(\"#datepickerweight\", \"change\", function () {\r\n \r\n\t first_time_loading=false;\r\n\t\tvar picked_date=\"\"+$('#datepickerweight').val();\r\n\t\t//alert(picked_date);\r\n\t\t var first_slash=picked_date.indexOf(\"/\");\r\n\t\tvar second_slash=picked_date.lastIndexOf(\"/\");\r\n\t\t\r\n\t\tvar mm=picked_date.substring(0,first_slash);\r\n\t\tvar month=mm;\r\n\t\tswitch(mm)\r\n\t\t{\r\n\t\tcase \"01\":mm=\"January\";break;\r\n\t\tcase \"02\":mm=\"February\";break;\r\n\t\tcase \"03\":mm=\"March\";break;\r\n\t\tcase \"04\":mm=\"April\";break;\r\n\t\tcase \"05\":mm=\"May\";break;\r\n\t\tcase \"06\":mm=\"June\";break;\r\n\t\tcase \"07\":mm=\"July\";break;\r\n\t\tcase \"08\":mm=\"August\";break;\r\n\t\tcase \"09\":mm=\"September\";break;\r\n\t\tcase \"10\":mm=\"October\";break;\r\n\t\tcase \"11\":mm=\"November\";break;\r\n\t\tcase \"12\":mm=\"December\";break;\r\n\t\t\r\n\t\t}\r\n\t\tvar dd=picked_date.substring(first_slash+1,second_slash);\r\n\t\tvar yyyy=picked_date.substring(second_slash+1,picked_date.length);\r\n\t\t$('#datepickerweight').val(dd+\" \"+mm+\" \"+yyyy);\r\n\t\t$('#date_eaten_1').val(yyyy+\"-\"+month+\"-\"+dd);\r\n\t\t$('#date_captured_weight').val(yyyy+\"-\"+month+\"-\"+dd);\r\n\t\t if(recording_weight_allowed)\r\n\t\t {\r\n\t\t \r\n\t\t retrieveWeight();\r\n\t\t\t\r\n\t\t\t}\r\n\t});\r\n \r\n }", "function onChangeDatepicker(){\n vm.dateString = getFormattedDateString(vm.datepickerStartDate,\n vm.datepickerEndDate);\n performDateSearch();\n }", "function initDatePicker() {\n var date = document.querySelector(\"input[type='date']\");\n\n function todayClickBack(){\n date.value = getCurrentJsonDate().split('T')[0];\n update();\n }\n\n getComponent('pick-date-bn').addEventListener('click',function () {\n if(!date.classList.contains('cur')){\n date.classList.add('cur');\n this.classList.add('selected');\n date.disabled = false;\n getComponent('today').addEventListener('click',todayClickBack);\n getComponent('today').classList.add('cur');\n }else{\n date.classList.remove('cur');\n getComponent('today').classList.remove('cur');\n getComponent('today').removeEventListener('click',todayClickBack);\n date.value = null;\n date.disabled = true;\n this.classList.remove('selected');\n update();\n }\n })\n date.addEventListener('change',function (e) {\n console.log(date.value);\n update();\n })\n}", "function actionDateSelectedForAgendaManage(){\n\n\t}", "function DateUpdater() { }", "function EzdtePkyyyy(date1) {\n $(date1).datetimepicker({\n defaultDate: new Date(),\n format: 'YYYY',\n showClose: true,\n showClear: true,\n // maxDate: new Date(),\n \n\n });\n }", "function quickDate(quickCode) {\n var sDate = $(\"#sDate\");\n var eDate = $(\"#eDate\");\n\n var oneDayInMilli = 1 * 1000 * 60 * 60 * 24;\n var days;\n var startDt;\n var endDt;\n\n switch (quickCode) {\n case TODAY:\n startDt = new Date();\n endDt = new Date();\n break;\n case YESTERDAY:\n days = 1 * oneDayInMilli;\n startDt = new Date();\n startDt.setTime(startDt.getTime() - days);\n endDt = startDt;\n break;\n case LAST7_DAYS:\n days = 7 * oneDayInMilli;\n startDt = new Date();\n startDt.setTime(startDt.getTime() - days);\n endDt = new Date();\n break;\n case CURR_MONTH:\n startDt = new Date();\n startDt.setDate(1);\n endDt = new Date();\n break;\n case LAST_MONTH:\n days = 30 * oneDayInMilli;\n\n startDt = new Date();\n startDt.setDate(1);\n startDt.setTime(startDt.getTime() - days);\n startDt.setDate(1);\n\n endDt = new Date();\n endDt.setDate(1);\n endDt.setTime(endDt.getTime() - days);\n break;\n }\n\n sDate.datetimepicker(\"setDate\", startDt);\n eDate.datetimepicker(\"setDate\", endDt);\n}", "function showDate()\r\n{\r\n\t$(\"#txtNewExpiry\").datepicker({ dateFormat: 'yy-mm-dd' });\r\n}", "function loadDatePicker_2()\r\n {\r\n //date picker on the record meal page\r\n\t$('#main_interface_wrapper').delegate(\"#datepicker2\", \"click\", function () {\r\n if (!$(this).hasClass(\"hasDatepicker\"))\r\n {\r\n $(this).datepicker();\r\n $(this).datepicker(\"show\");\r\n }\r\n\t\t \r\n\t});\r\n\t\r\n\t\r\n if(first_time_loading)\r\n\t$('#main_interface_wrapper').delegate(\"#datepicker2\", \"change\", function () {\r\n\t first_time_loading=false; \r\n\t\tvar picked_date=\"\"+$('#datepicker2').val();\r\n\t\t var first_slash=picked_date.indexOf(\"/\");\r\n\t\tvar second_slash=picked_date.lastIndexOf(\"/\");\r\n\t\t\r\n\t\tvar mm=picked_date.substring(0,first_slash);\r\n\t\tvar month=mm;\r\n\t\tswitch(mm)\r\n\t\t{\r\n\t\tcase \"01\":mm=\"January\";break;\r\n\t\tcase \"02\":mm=\"February\";break;\r\n\t\tcase \"03\":mm=\"March\";break;\r\n\t\tcase \"04\":mm=\"April\";break;\r\n\t\tcase \"05\":mm=\"May\";break;\r\n\t\tcase \"06\":mm=\"June\";break;\r\n\t\tcase \"07\":mm=\"July\";break;\r\n\t\tcase \"08\":mm=\"August\";break;\r\n\t\tcase \"09\":mm=\"September\";break;\r\n\t\tcase \"10\":mm=\"October\";break;\r\n\t\tcase \"11\":mm=\"November\";break;\r\n\t\tcase \"12\":mm=\"December\";break;\r\n\t\t\r\n\t\t}\r\n\t\tvar dd=picked_date.substring(first_slash+1,second_slash);\r\n\t\tvar yyyy=picked_date.substring(second_slash+1,picked_date.length);\r\n\t\t$('#datepicker2').val(dd+\" \"+mm+\" \"+yyyy);\r\n\t\t$('#date_eaten_2').val(yyyy+\"-\"+month+\"-\"+dd);\r\n\t\t$('#date_captured_2').val(yyyy+\"-\"+month+\"-\"+dd);\r\n\t\t\r\n\t});\r\n \r\n }", "function datePicker(obj) {\r\n\r\n\tvar id = obj.parentNode.childNodes[1].id;\r\n\r\n\tjQuery('#' + id.replace(/(:|\\.)/g, '\\\\$1')).dynDateTime( {\r\n\t\tshowsTime : true,\r\n\t\tifFormat : \"%m/%d/%Y %H:%M\",\r\n\t\tdaFormat : \"%l;%M %p, %e %m, %Y\",\r\n\t\talign : \"TL\",\r\n\t\telectric : false,\r\n\t\tsingleClick : false,\r\n\t\tdisplayArea : \".siblings('.dtcDisplayArea')\",\r\n\t\tbutton : \".next()\" // next sibling\r\n\t});\r\n\r\n}", "function callDatePicker(){\n\tif($('.datetimepicker1').length > 0){\n\t\t// $('.datetimepicker1').attr('disabled',true);\n\t\t$('.datetimepicker1').on('click', function(){\n\t\t\t// if ($(this).val() == '') {\n\t\t\t\t$(this).val('');\n\n\t\t\t// };\n\t\t})\n \t$('.datetimepicker1').datetimepicker({\n\t \tformat: 'DD/MM/YYYY'\n\t });\n }\n if($('#datetimepicker6').length > 0){\n\t $('#datetimepicker6').datetimepicker({\n\t \tformat: 'DD/MM/YYYY'\n\t });\n\t $('#datetimepicker7').datetimepicker({\n\t useCurrent: false, //Important! See issue #1075\n\t format: 'DD/MM/YYYY'\n\t });\n\t $(\"#datetimepicker6\").on(\"dp.change\", function (e) {\n\t $('#datetimepicker7').data(\"DateTimePicker\").minDate(e.date);\n\t });\n\t $(\"#datetimepicker7\").on(\"dp.change\", function (e) {\n\t $('#datetimepicker6').data(\"DateTimePicker\").maxDate(e.date);\n\t });\n\t }\t\n\n\t if($('#datetimepicker8').length > 0){\n\t $('#datetimepicker8').datetimepicker({\n\t \tformat: 'MM/YYYY'\n\t });\n\t $('#datetimepicker9').datetimepicker({\n\t useCurrent: false, //Important! See issue #1075\n\t format: 'MM/YYYY'\n\t });\n\t $(\"#datetimepicker8\").on(\"dp.change\", function (e) {\n\t $('#datetimepicker9').data(\"DateTimePicker\").minDate(e.date);\n\t });\n\t $(\"#datetimepicker8\").on(\"dp.change\", function (e) {\n\t $('#datetimepicker9').data(\"DateTimePicker\").maxDate(e.date);\n\t });\n\t }\n}", "'click #start_date'(){\n \n\n $(\"#start_date\").datepicker({dateFormat : \"mm/dd/yy\"});\n\n // showOn: \"button\",\n \n // buttonImageOnly: true,\n // buttonText: \"Select date\",\n // onSelect: function(){\n // var due_date = $(this).val();\n // task_list.update({_id : due_date_id},{$set:{'due_date' : due_date}});\n\n // }\n // });\n document.getElementById('start_date').value='';\n }", "function updateDatepicker(){\n\t\t\t$( \".ui-datepicker-header\", dp ).addClass(\"ui-body-c ui-corner-top\").removeClass(\"ui-corner-all\");\n\t\t\t$( \".ui-datepicker-prev, .ui-datepicker-next\", dp ).attr(\"href\", \"#\");\n\t\t\t$( \".ui-datepicker-prev\", dp ).buttonMarkup({iconpos: \"notext\", icon: \"arrow-l\", shadow: true, corners: true});\n\t\t\t$( \".ui-datepicker-next\", dp ).buttonMarkup({iconpos: \"notext\", icon: \"arrow-r\", shadow: true, corners: true});\n\t\t\t$( \".ui-datepicker-calendar th\", dp ).addClass(\"ui-bar-c\");\n\t\t\t$( \".ui-datepicker-calendar td\", dp ).addClass(\"ui-body-c\");\n\t\t\t$( \".ui-datepicker-calendar a\", dp ).buttonMarkup({corners: false, shadow: false}); \n\t\t\t$( \".ui-datepicker-calendar a.ui-state-active\", dp ).addClass(\"ui-btn-active\"); // selected date\n\t\t\t$( \".ui-datepicker-calendar a.ui-state-highlight\", dp ).addClass(\"ui-btn-up-e\"); // today\"s date\n\t $( \".ui-datepicker-calendar .ui-btn\", dp ).each(function(){\n\t\t\t\tvar el = $(this);\n\t\t\t\t// remove extra button markup - necessary for date value to be interpreted correctly\n\t\t\t\tel.html( el.find( \".ui-btn-text\" ).text() ); \n\t });\n\t\t}", "function updateDatepicker(){\n\t\t\t$( \".ui-datepicker-header\", dp ).addClass(\"ui-body-c ui-corner-top\").removeClass(\"ui-corner-all\");\n\t\t\t$( \".ui-datepicker-prev, .ui-datepicker-next\", dp ).attr(\"href\", \"#\");\n\t\t\t$( \".ui-datepicker-prev\", dp ).buttonMarkup({iconpos: \"notext\", icon: \"arrow-l\", shadow: true, corners: true});\n\t\t\t$( \".ui-datepicker-next\", dp ).buttonMarkup({iconpos: \"notext\", icon: \"arrow-r\", shadow: true, corners: true});\n\t\t\t$( \".ui-datepicker-calendar th\", dp ).addClass(\"ui-bar-c\");\n\t\t\t$( \".ui-datepicker-calendar td\", dp ).addClass(\"ui-body-c\");\n\t\t\t$( \".ui-datepicker-calendar a\", dp ).buttonMarkup({corners: false, shadow: false}); \n\t\t\t$( \".ui-datepicker-calendar a.ui-state-active\", dp ).addClass(\"ui-btn-active\"); // selected date\n\t\t\t$( \".ui-datepicker-calendar a.ui-state-highlight\", dp ).addClass(\"ui-btn-up-e\"); // today\"s date\n\t $( \".ui-datepicker-calendar .ui-btn\", dp ).each(function(){\n\t\t\t\tvar el = $(this);\n\t\t\t\t// remove extra button markup - necessary for date value to be interpreted correctly\n\t\t\t\tel.html( el.find( \".ui-btn-text\" ).text() ); \n\t });\n\t\t}", "function tbldtpicker() {\n $('.datepicker').datetimepicker({\n // defaultDate: new Date(),\n format: 'DD/MM/YYYY',\n showClose: true,\n showClear: true,\n // minDate: new Date(),\n \n });\n }", "function BindDatePicker(elem) {\n elem.removeClass('hasDatepicker');\n elem.datepicker({\n format: DEFAULT_DATE_PICKER_FORMAT,\n changeMonth: true,\n changeYear: true,\n endDate: 0,\n maxViewMode: 2,\n defaultDate: new Date(),\n minDate: MIN_PRODUCTION_DATA_DATE,\n language: 'vi',\n autoclose: true\n });\n}", "function Calendar_OnDateSelected(sender, eventArgs) {\r\n // limpa o span das datas\t \r\n var dtSelecionada = document.getElementById(\"dtSelecionada\");\r\n dtSelecionada.innerHTML = \"\";\r\n // obtém a referencia para o calendario\r\n var calendario = $find(IdCalendario);\r\n // obtém as datas selecionadas\r\n var dates = calendario.get_selectedDates();\r\n\r\n // para cada data..\r\n for (var i = 0; i < dates.length; i++) {\r\n var date = dates[i];\r\n var data = date[2] + \"/\" + date[1] + \"/\" + date[0];\r\n data += \" \"; // adiciona um espaco ao final para dar espaco entre as datas\r\n dtSelecionada.innerHTML += data;\r\n }\r\n}", "function Datepicker() {\r\n this._curInst = null; // The current instance in use\r\n this._keyEvent = false; // If the last event was a key event\r\n this._disabledInputs = []; // List of date picker inputs that have been disabled\r\n this._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n this._inDialog = false; // True if showing within a \"dialog\", false if not\r\n this._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n this._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n this._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n this._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n this._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n this._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n this._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n this._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n this._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n this.regional = []; // Available regional settings, indexed by language code\r\n this.regional[\"\"] = { // Default regional settings\r\n closeText: \"Done\", // Display text for close link\r\n prevText: \"Prev\", // Display text for previous month link\r\n nextText: \"Next\", // Display text for next month link\r\n currentText: \"Today\", // Display text for current month link\r\n monthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n \"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n monthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n dayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n dayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n dayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n weekHeader: \"Wk\", // Column header for week of the year\r\n dateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n isRTL: false, // True if right-to-left language, false if left-to-right\r\n showMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n yearSuffix: \"\" // Additional text to append to the year in the month headers\r\n };\r\n this._defaults = { // Global defaults for all the date picker instances\r\n showOn: \"focus\", // \"focus\" for popup on focus,\r\n // \"button\" for trigger button, or \"both\" for either\r\n showAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n showOptions: {}, // Options for enhanced animations\r\n defaultDate: null, // Used when field is blank: actual date,\r\n // +/-number for offset from today, null for today\r\n appendText: \"\", // Display text following the input box, e.g. showing the format\r\n buttonText: \"...\", // Text for trigger button\r\n buttonImage: \"\", // URL for trigger button image\r\n buttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n hideIfNoPrevNext: false, // True to hide next/previous month links\r\n // if not applicable, false to just disable them\r\n navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n gotoCurrent: false, // True if today link goes back to current selection instead\r\n changeMonth: false, // True if month can be selected directly, false if only prev/next\r\n changeYear: false, // True if year can be selected directly, false if only prev/next\r\n yearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n // either relative to today's year (-nn:+nn), relative to currently displayed year\r\n // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n showOtherMonths: false, // True to show dates in other months, false to leave blank\r\n selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n showWeek: false, // True to show week of the year, false to not show it\r\n calculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n // takes a Date and returns the number of the week for it\r\n shortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n // > this are in the previous century,\r\n // string value starting with \"+\" for current year + value\r\n minDate: null, // The earliest selectable date, or null for no limit\r\n maxDate: null, // The latest selectable date, or null for no limit\r\n duration: \"fast\", // Duration of display/closure\r\n beforeShowDay: null, // Function that takes a date and returns an array with\r\n // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n // [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n beforeShow: null, // Function that takes an input field and\r\n // returns a set of custom settings for the date picker\r\n onSelect: null, // Define a callback function when a date is selected\r\n onChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n onClose: null, // Define a callback function when the datepicker is closed\r\n numberOfMonths: 1, // Number of months to show at a time\r\n showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n stepMonths: 1, // Number of months to step back/forward\r\n stepBigMonths: 12, // Number of months to step back/forward for the big links\r\n altField: \"\", // Selector for an alternate field to store selected dates into\r\n altFormat: \"\", // The date format to use for the alternate field\r\n constrainInput: true, // The input is constrained by the current date format\r\n showButtonPanel: false, // True to show button panel, false to not show it\r\n autoSize: false, // True to size the input for the date format, false to leave as is\r\n disabled: false // The initial disabled state\r\n };\r\n $.extend(this._defaults, this.regional[\"\"]);\r\n this.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n }", "function setDatePicker(){\r\n\tvar sDateFormat=\"dd-mm-yy\";\t\r\n\t$( \".dateTime\" ).datepicker({\r\n\t\t dateFormat : sDateFormat // SET THE FORMAT.\r\n\t ,yearRange : '1920:2050' //starting year\r\n\t ,changeMonth : true // month list\r\n\t\t,changeYear : true //year list\r\n\t\t,orientation: \"top\"\r\n\t\t,onClose: function(dateText, inst) {\r\n $(this).datepicker('option', 'dateFormat', sDateFormat); //clear texfield if date is not in correct format\r\n $(this).change();\r\n }\r\n\t});\r\n}", "function rangeDateBootstrapDatePicker(idStartDate,idEndDate,optionStartDate='',optionEndDate='')\n{\n let options = {\n language: 'es',\n autoclose:true,\n };\n\n if(optionStartDate !== ''){\n options.startDate = optionStartDate;\n }\n\n if(optionEndDate !== ''){\n options.endDate = optionEndDate;\n }\n\n $(`#${idStartDate}`).datepicker(options).on('changeDate', function() {\n $(`#${idEndDate}`).datepicker('setStartDate',this.value);\n });\n\n $(`#${idEndDate}`).datepicker(options).on('changeDate', function() {\n $(`#${idStartDate}`).datepicker('setEndDate',this.value);\n });\n}", "updateDates() {\n if (document.getElementById(self.datePicker.id + 'currYear') !== null) {\n document.getElementById(self.datePicker.id + 'currYear').value = self.datePicker.current.getFullYear();\n document.getElementById(self.datePicker.id + 'currDate').value = self.pickerString();\n } else {\n if (document.getElementById(self.datePicker.id + 'currDate') !== null) {\n document.getElementById(self.datePicker.id + 'currDate').value = self.pickerString();\n }\n }\n document.getElementById(self.datePicker.id + 'calendar').replaceChild(self.buildCalendar(), document.getElementById(self.datePicker.id + 'calendar').childNodes[0]);\n }", "function addDatepicker(){\n\t$('#startdateinput').datepicker({\n\t\tinline: true,\n\t\tshowOtherMonths: true,\n\t\tdayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n\t});\n\t$('#endateinput').datepicker({\n\t\tinline: true,\n\t\tshowOtherMonths: true,\n\t\tdayNamesMin: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n\t});\n}", "function showDateInput(input)\r\n{\r\n\tshowDateInput(input,false);\r\n}", "function getDatePicker() {\n return box;\n }", "function getDatePicker() {\n return box;\n }", "function initDatePickers(){\n $('#start-date').datetimepicker({\n showTodayButton: true,\n // show one month of configurations by default\n defaultDate: moment().subtract(1, 'month').startOf('d'),\n format: 'YYYY-MM-DD HH:mm'\n });\n $('#end-date').datetimepicker({\n showTodayButton: true,\n // default end-date to now.\n defaultDate: moment().endOf('d'),\n format: 'YYYY-MM-DD HH:mm'\n });\n $(\"#start-date\").on(\"dp.change\", function(e){\n runSearch();\n });\n $(\"#end-date\").on(\"dp.change\", function(e){\n runSearch();\n });\n\n }", "function initDatePickers(){\n $('#start-date').datetimepicker({\n showTodayButton: true,\n // show one month of configurations by default\n defaultDate: moment().subtract(1, 'month').startOf('d'),\n format: 'YYYY-MM-DD HH:mm'\n });\n $('#end-date').datetimepicker({\n showTodayButton: true,\n // default end-date to now.\n defaultDate: moment().endOf('d'),\n format: 'YYYY-MM-DD HH:mm'\n });\n $(\"#start-date\").on(\"dp.change\", function(e){\n runSearch();\n });\n $(\"#end-date\").on(\"dp.change\", function(e){\n runSearch();\n });\n\n }", "function DPC_onContainerClick(event){DatePickerControl.onContainerClick(event);}", "function Datepicker() {\r\n\tthis.debug = false; // Change this to true to start debugging\r\n\tthis._nextId = 0; // Next ID for a date picker instance\r\n\tthis._inst = []; // List of instances indexed by ID\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[''] = { // Default regional settings\r\n\t\tclearText: 'Clear', // Display text for clear link\r\n\t\tclearStatus: 'Erase the current date', // Status text for clear link\r\n\t\tcloseText: 'Close', // Display text for close link\r\n\t\tcloseStatus: 'Close without change', // Status text for close link\r\n\t\tprevText: '&#x3c;Prev', // Display text for previous month link\r\n\t\tprevStatus: 'Show the previous month', // Status text for previous month link\r\n\t\tnextText: 'Next&#x3e;', // Display text for next month link\r\n\t\tnextStatus: 'Show the next month', // Status text for next month link\r\n\t\tcurrentText: 'Today', // Display text for current month link\r\n\t\tcurrentStatus: 'Show the current month', // Status text for current month link\r\n\t\tmonthNames: ['January','February','March','April','May','June',\r\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\r\n\t\tmonthStatus: 'Show a different month', // Status text for selecting a month\r\n\t\tyearStatus: 'Show a different year', // Status text for selecting a year\r\n\t\tweekHeader: 'Wk', // Header for the week of the year column\r\n\t\tweekStatus: 'Week of the year', // Status text for the week of the year column\r\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\r\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\r\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\r\n\t\tdayStatus: 'Set DD as first week day', // Status text for the day of the week selection\r\n\t\tdateStatus: 'Select DD, M d', // Status text for the date selection\r\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tinitStatus: 'Select a date', // Initial Status text on opening\r\n\t\tisRTL: false // True if right-to-left language, false if left-to-right\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\r\n\t\t\t// 'button' for trigger button, or 'both' for either\r\n\t\tshowAnim: 'show', // Name of jQuery animation for popup\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: '...', // Text for trigger button\r\n\t\tbuttonImage: '', // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\tcloseAtTop: true, // True to have the clear/close at the top,\r\n\t\t\t// false to have them at the bottom\r\n\t\tmandatory: false, // True to hide the Clear link, false to include it\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tchangeMonth: true, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: true, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: '-10:+10', // Range of years to display in drop-down,\r\n\t\t\t// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)\r\n\t\tchangeFirstDay: true, // True to click on day name to change, false to remain as set\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tshowWeeks: false, // True to show week of the year, false to omit\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century, \r\n\t\t\t// string value starting with '+' for current year + value\r\n\t\tshowStatus: false, // True to show status bar at bottom, false to not show it\r\n\t\tstatusForDate: this.dateStatus, // Function to provide status text for a date -\r\n\t\t\t// takes date and instance as parameters, returns display text\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tspeed: 'normal', // Speed of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not,\r\n\t\t\t// [1] = custom CSS class name(s) or '', e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\trangeSelect: false, // Allows for selecting a date range on one date picker\r\n\t\trangeSeparator: ' - ' // Text between two dates in a range\r\n\t};\r\n\t$.extend(this._defaults, this.regional['']);\r\n\tthis._datepickerDiv = $('<div id=\"datepicker_div\">');\r\n}", "function z_show_full_date() {\n var dd, mm, yyyy, yyyymmdd;\n dd = ((z_default_day < 10) ? '0' + parseInt(z_default_day, 10) : z_default_day);\n mm = ((z_default_month < 10) ? '0' + parseInt(z_default_month, 10) : z_default_month);\n yyyy = z_default_year;\n yyyymmdd = String(yyyy) + String(mm) + String(dd);\n $(text_id_name).val(yyyy + '/' + mm + '/' + dd);\n $(text_id_name).trigger('change');\n $('.picker__day-display').html(z_default_day);\n day_no = getGregorianDate(yyyymmdd).dayNo;\n $('.picker__weekday-display').html(weekDayName[day_no]);\n set_weekday_class(day_no);\n}", "function DPC_onEditControlChange(event){DatePickerControl.onEditControlChange(event);}", "function EzdtePk(date1) {\n \n $(date1).datetimepicker({\n defaultDate: new Date(),\n format: 'DD/MM/YYYY',\n showClose: true,\n showClear: true,\n // minDate: new Date(), \n \n });\n }", "function selectDate(e){\r\n\t\t\tmainEvt.target.value = addLeadingZero(e.target.textContent)+\".\"+addLeadingZero(jcalendar_month.value)+\".\"+jcalendar_year.value;\r\n\t\t\tJC.style.display = \"none\";\r\n\t\t}", "function CalendarPopup_select(inputobj, linkname, format) \r\n{\r\n\tif (!window.getDateFromFormat) \r\n\t{\r\n\t\talert(\"calendar.select: To use this method you must also include 'date.js' for date formatting\");\r\n\t\treturn;\r\n\t}\r\n\t/*if (this.displayType!=\"date\" && this.displayType!=\"week-end\") \r\n\t{\r\n\t\talert(\"calendar.select: This function can only be used with displayType 'date' or 'week-end'\");\r\n\t return;\r\n\t}*/\r\n\tif (inputobj.type!=\"text\" && inputobj.type!=\"hidden\" && inputobj.type!=\"textarea\") \r\n\t{ \r\n\t\talert(\"calendar.select: Input object passed is not a valid form input object\"); \r\n\t\twindow.CalendarPopup_targetInput=null;\r\n\t\treturn;\r\n\t}\r\n\twindow.CalendarPopup_targetInput = inputobj;\r\n\tif (inputobj.value!=\"\") \r\n\t{\r\n\t\tvar time = getDateFromFormat(inputobj.value,format);\r\n\t\tif (time==0) this.currentDate=null;\r\n \t\telse this.currentDate=new Date(time);\r\n\t}\r\n\telse this.currentDate=null;\r\n\twindow.CalendarPopup_dateFormat = format;\r\n\tthis.showCalendar(linkname);\r\n}", "function initSingleDatepicker( datepickerElement ) {\n //console.log(\"1 initSingleDatepicker:\",datepickerElement);\n if( datepickerElement.hasClass('datepicker-ignore') ) {\n printF(datepickerElement,'Ignore:');\n return;\n }\n\n //disable datepickers with readonly attributes\n var inputField = datepickerElement.find('input.datepicker, input.datepicker-exception');\n //var inputField = datepickerElement.find('input.datepicker');\n //printF(inputField,'inputField:');\n\n if( inputField.hasClass('datepicker-ignore') ) {\n printF(inputField,'Ignore:');\n return;\n }\n\n //console.log(\"2 initSingleDatepicker:\");\n //printF(datepickerElement,'datepicker element:');\n //console.log(datepickerElement);\n\n var calendarIconBtn = datepickerElement.find('.calendar-icon-button');\n //console.log(\"initSingleDatepicker: calendarIconBtn:\",calendarIconBtn);\n //console.log(calendarIconBtn);\n\n if( inputField.is('[readonly]') || inputField.is('[disabled]') ) {\n\n //console.log('datepicker input field is readonly');\n //console.log(inputField);\n datepickerElement.datepicker(\"remove\");\n\n //calendarIconBtn.off();\n calendarIconBtn.prop('disabled', true);\n\n } else {\n\n //console.log('datepicker input field is active !!!!!!!!!!!!!!!!!!!!!!');\n\n var endDate = new Date(); //use current date as default\n if( datepickerElement.hasClass('allow-future-date') ) {\n //console.log('allow future date');\n endDate = false;//'End of time';\n }\n //console.log('endDate='+endDate);\n\n var datepickertodayBtn = \"linked\";\n var datepickerFormat = \"mm/dd/yyyy\";\n //var datepickerStartView = \"month\";\n var datepickerMinViewMode = \"days\";\n var datepickerViewMode = null; //\"days\";\n var datepickerMultidate = false;\n if( datepickerElement.hasClass('datepicker-only-month-year') ) {\n datepickertodayBtn = false;\n datepickerFormat = \"mm/yyyy\";\n //datepickerStartView = \"month\";\n datepickerMinViewMode = \"months\";\n //datepickerViewMode = \"months\";\n //console.log('datepickerFormat='+datepickerFormat);\n //console.log(datepickerElement);\n }\n if( datepickerElement.hasClass('datepicker-only-day-month') ) {\n datepickertodayBtn = false;\n datepickerFormat = \"dd/mm\";\n //datepickerStartView = \"month\";\n datepickerMinViewMode = \"days\";\n //datepickerViewMode = \"months\";\n //console.log('datepickerFormat='+datepickerFormat);\n //console.log(datepickerElement);\n }\n if( datepickerElement.hasClass('datepicker-only-year') ) {\n datepickertodayBtn = false;\n datepickerFormat = \" yyyy\";\n datepickerMinViewMode = \"years\";\n datepickerViewMode = \"years\";\n }\n if( datepickerElement.hasClass('datepicker-multidate') ) {\n datepickerMultidate = true;\n }\n\n //calendarStartDate calendarEndDate\n //printF(datepickerElement,\"datepickerElement:\");\n //console.log('datepickerElement:',datepickerElement);\n var calendarStartDate = datepickerElement.find('input').data(\"calendarstartdate\");\n //console.log('calendarStartDate='+calendarStartDate);\n //calendarStartDate = new Date(); //testing\n //calendarStartDate.setDate(calendarStartDate.getDate() - 2); //testing\n var startDate = false;\n if( calendarStartDate ) {\n startDate = calendarStartDate;\n }\n var calendarEndDate = datepickerElement.find('input').data(\"calendarenddate\");\n //console.log('endDate='+endDate);\n //endDate = new Date(); //testing\n //endDate.setDate(endDate.getDate() + 2); //testing\n if( calendarEndDate ) {\n endDate = calendarEndDate;\n }\n\n //console.log('endDate',endDate);\n\n //to prevent datepicker clear on Enter key, use the version from https://github.com/eternicode/bootstrap-datepicker/issues/775\n datepickerElement.datepicker({\n autoclose: true,\n clearBtn: true,\n todayBtn: datepickertodayBtn,\n todayHighlight: true,\n startDate: startDate,\n endDate: endDate,\n orientation: \"auto\", //\"auto top\"\n ////minDate: new Date(1902, 1, 1) //null\n format: datepickerFormat,\n minViewMode: datepickerMinViewMode,\n viewMode: datepickerViewMode,\n multidate: datepickerMultidate,\n });\n\n calendarIconBtn.prop('disabled', false);\n\n //fix bug: https://github.com/eternicode/bootstrap-datepicker/issues/978\n //datepickerElement.datepicker().on('hide.bs.collapse', function(event) {\n datepickerElement.on('hide.bs.collapse', function(event) {\n // prevent datepicker from firing bootstrap modal \"show.bs.modal\"\n event.stopPropagation();\n //console.log('hide.bs.collapse element id='+$(this).attr(\"id\"));\n //printF($(this).find('input.datepicker'),\"hide.bs.collapse element:\");\n $(this).find('input.datepicker').removeClass('datepicker-status-open');\n });\n //datepickerElement.datepicker().on('shown.bs.collapse', function(event) {\n datepickerElement.on('shown.bs.collapse', function(event) {\n // prevent datepicker from firing bootstrap modal \"show.bs.modal\"\n event.stopPropagation();\n });\n\n //datepickerElement.datepicker().on(\"clearDate\", function(e){\n datepickerElement.on(\"clearDate\", function (e) {\n var inputField = $(this).find('input.datepicker, input.datepicker-exception');\n //console.log('on clear Date');\n //printF(inputField, \"clearDate input:\");\n clearErrorField(inputField);\n\n //if( inputField.hasClass('datepicker-onclear-cleartooltip') ) {\n // console.log(\"clear tooltip!!!!!!\");\n // console.log($(this));\n // //$(this).closest('.datepicker').tooltip('destroy');\n // //$(this).tooltip('destroy');\n // $(this).tooltip({\n // title: function() {\n // return \"\";\n // }\n // });\n //}\n\n });\n\n //open/close the date picker on click icon (calendar-icon-button) or body\n calendarIconBtn.on( \"click\", function(event) {\n event.stopPropagation();\n //console.log( \"user-common: click calendar icon\" );\n var inputField = $(this).closest('.input-group').find('input.datepicker');\n if( inputField.hasClass(\"datepicker-status-open\") ) {\n //console.log( \"hide datepicker\" );\n //$('body').off('click');\n //$('body').click();\n $(\".datepicker-dropdown\").remove();\n inputField.removeClass(\"datepicker-status-open\");\n } else {\n inputField.addClass(\"datepicker-status-open\");\n }\n\n });\n\n if(0) {\n //fiddle: http://jsfiddle.net/oab6eyv1/230/\n //datepickerElement.find('input.datepicker').on(\"click\", function (event) {\n datepickerElement.on(\"click\", function (event) {\n event.stopPropagation();\n //console.log(\"click datepicker body\");\n\n var inputField = $(this).find('input.datepicker');\n\n if (inputField.hasClass(\"datepicker-status-open\")) {\n //if( inputField.hasClass('focus.inputmask') ) {\n //console.log(\"hide datepicker\");\n //$(\".datepicker-dropdown\").remove();\n //$(document).click();\n //$('html,body').click();\n $(\".datepicker-dropdown\").remove();\n inputField.removeClass(\"datepicker-status-open\");\n inputField.removeClass(\"focus.inputmask\");\n //$(this).find('.calendar-icon-button').click();\n $(this).find('.calendar-icon-button').focus();\n $(document).click();\n //printF($(this).parent().find('.calendar-icon-button'), \"calendar:\");\n } else {\n inputField.addClass(\"datepicker-status-open\");\n }\n });\n }\n\n //datepickerElement.on('keyup', function(){\n // console.log(\"datepicker on keyup value=\"+$(this).val());\n // if( $(this).val() == datepickerFormat ){\n // // this only happens when a key is released and no valid value is in the field. Eg. when tabbing into the field, we'll make sure the datepicker plugin does not get '__/__/____' as a date value\n // $(this).val('');\n // }\n //});\n\n }\n\n return;\n}", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\r\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\r\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function Datepicker() {\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._keyEvent = false; // If the last event was a key event\r\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\r\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\r\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\r\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\r\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\r\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\r\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\r\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\r\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\r\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\r\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\r\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\r\n\tthis.regional = []; // Available regional settings, indexed by language code\r\n\tthis.regional[\"\"] = { // Default regional settings\r\n\t\tcloseText: \"Done\", // Display text for close link\r\n\t\tprevText: \"Prev\", // Display text for previous month link\r\n\t\tnextText: \"Next\", // Display text for next month link\r\n\t\tcurrentText: \"Today\", // Display text for current month link\r\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\r\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\r\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\r\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\r\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\r\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\r\n\t\tweekHeader: \"Wk\", // Column header for week of the year\r\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\r\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\r\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\r\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\r\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\r\n\t};\r\n\tthis._defaults = { // Global defaults for all the date picker instances\r\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\r\n\t\t\t// \"button\" for trigger button, or \"both\" for either\r\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\r\n\t\tshowOptions: {}, // Options for enhanced animations\r\n\t\tdefaultDate: null, // Used when field is blank: actual date,\r\n\t\t\t// +/-number for offset from today, null for today\r\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\r\n\t\tbuttonText: \"...\", // Text for trigger button\r\n\t\tbuttonImage: \"\", // URL for trigger button image\r\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\r\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\r\n\t\t\t// if not applicable, false to just disable them\r\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\r\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\r\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\r\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\r\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\r\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\r\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\r\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\r\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\r\n\t\tshowWeek: false, // True to show week of the year, false to not show it\r\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\r\n\t\t\t// takes a Date and returns the number of the week for it\r\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\r\n\t\t\t// > this are in the previous century,\r\n\t\t\t// string value starting with \"+\" for current year + value\r\n\t\tminDate: null, // The earliest selectable date, or null for no limit\r\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\r\n\t\tduration: \"fast\", // Duration of display/closure\r\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\r\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\r\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\r\n\t\tbeforeShow: null, // Function that takes an input field and\r\n\t\t\t// returns a set of custom settings for the date picker\r\n\t\tonSelect: null, // Define a callback function when a date is selected\r\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\r\n\t\tonClose: null, // Define a callback function when the datepicker is closed\r\n\t\tnumberOfMonths: 1, // Number of months to show at a time\r\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\r\n\t\tstepMonths: 1, // Number of months to step back/forward\r\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\r\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\r\n\t\taltFormat: \"\", // The date format to use for the alternate field\r\n\t\tconstrainInput: true, // The input is constrained by the current date format\r\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\r\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\r\n\t\tdisabled: false // The initial disabled state\r\n\t};\r\n\t$.extend(this._defaults, this.regional[\"\"]);\r\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\r\n}", "function calendarDisplay () {\n $.datepicker.setDefaults({\n onSelect: function () {\n var oldValue = $(this).val()\n var newValue = ' ' + oldValue.substring(0, 2) + ' / ' + oldValue.substring(8, 10)\n $(this).val(newValue)\n // console.log(\"calendarClosed\")\n // console.log($(this))\n }\n })\n\n $('.datepicker').datepicker('option', 'firstDay', 1)\n $('.datepicker').datepicker('option', 'maxDate', null)\n $('.datepicker').datepicker('option', 'dayNames', [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ])\n $('.datepicker').datepicker('option', 'dayNamesMin', [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ])\n $('.datepicker').datepicker('option', 'dayNamesShort', [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ])\n $('.datepicker').datepicker('option', 'monthNames', [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ])\n\n $('.datepicker').datepicker({\n firstDay: 1,\n dayNames: [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ],\n dayNamesMin: [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ],\n dayNamesShort: [ 'DOM', 'LUN', 'MAR', 'MIÉ', 'JUE', 'VIE', 'SÁB' ],\n monthNames: [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre' ],\n maxDate: null,\n changeMonth: true,\n changeYear: true\n })\n $('#ui-datepicker-div').hide()\n }", "function showCal(id,dateField,dateFormat)\n{\n // set default dateFormat if no dateFormat is passed\n if(dateFormat == null) {\n dateFormat = \"m/d/Y\";\n }\n var x = document.getElementById(id);\n x.innerHTML = '';\n var dp = new Ext.DatePicker({ renderTo:id, format:dateFormat, idField:dateField });\n // read value of date input field\n var el = document.getElementById(dateField);\n \n // if value on input field exists use it to preselect datepicker\n if(el.value != \"\")\n {\n /* now we have to convert localized timestamp to a format that \"Date\" understands\n * because datepicker needs Date Object to be able to preselect date according to\n * value on input field\n */\n \n // get char that splits date pieces on localized timestamp ( \".\", \"/\" or \"-\" )\n splitChar = \".\";\n if (el.value.indexOf(\"-\") != -1) {\n splitChar = \"-\";\n } \n if (el.value.indexOf(\"/\") != -1) {\n splitChar = \"/\";\n }\n \n // split the date from input field with splitChar\n var splitDate = el.value.split(splitChar);\n \n // prepare variables for date \"pieces\"\n var year = null;\n var month = null;\n var day = null;\n \n // remove all splitChars (max 2)\n // TODO do not call replace twice use reg exp\n dateFormat = dateFormat.replace(splitChar, \"\");\n dateFormat = dateFormat.replace(splitChar, \"\");\n \n // get date \"pieces\" according to dateFormat\n for(i=0; i < dateFormat.length; i++) {\n switch (dateFormat.charAt(i)) {\n case \"Y\":\n year = splitDate[i];\n break;\n // not necessary right now as all localized timestamps use \"Y\" -> four digit year\n //case \"y\":\n // year = splitDate[i];\n // break;\n case \"m\": \n month = splitDate[i];\n break;\n case \"d\": \n day = splitDate[i];\n break;\n }\n }\n \n // finally create Date object to preselect date on datepicker\n // subtract 1 from month as january has value 0\n selectedDate = new Date(year,(month-1),day);\n \n if (isNaN(selectedDate.getTime()))\n {\n selectedDate = '';\n el.value = '';\n }\n else\n dp.setValue(selectedDate);\n }\n dp.addListener(\"select\", onSelect);\n}", "function DPC_onEditControlFocus(event){DatePickerControl.onEditControlFocus(event);}", "initPickersCalendar(){\n var options = {\n // closeText: 'Fermer',\n // prevText: '&#x3c;Préc',\n // nextText: 'Suiv&#x3e;',\n currentText: 'Aujourd\\'hui',\n monthNames: ['Janvier','Fevrier','Mars','Avril','Mai','Juin',\n 'Juillet','Aout','Septembre','Octobre','Novembre','Decembre'],\n monthNamesShort: ['Jan','Fev','Mar','Avr','Mai','Jun',\n 'Jul','Aou','Sep','Oct','Nov','Dec'],\n dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],\n dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],\n dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],\n weekHeader: 'Sm',\n dateFormat: 'dd/mm/yy',\n firstDay: 1,\n // isRTL: false,\n showMonthAfterYear: false,\n yearSuffix: '',\n // minDate: 0,\n maxDate: '+12M +0D',\n minDate: new Date (2017, 8, 1), \n beforeShowDay: $.proxy(this.CalendarEventDay, this), // pour ne pas perdre le this en tant que mon app\n numberOfMonths: 1,\n showButtonPanel: true\n \n };\n \n this.$datepicker.datepicker(options);\n // this.$datepicker.datepicker( \"options\", \"beforeShowDay\", true);\n\n }", "function init_datepicker() {\n $('.datepicker').datepicker({\n autoclose: true,\n todayHighlight: true,\n format: date_format\n });\n $('.calendar-icon').on('click', function () {\n $(this).parents('.date').find('.datepicker').datepicker('show');\n });\n}", "function initDatepicker() {\n var today = new Date();\n\n jQuery.datepicker.setDefaults($.datepicker.regional[$(\"html\").attr(\"lang\")]);//abe++\n\n jQuery('.datepicker-holder').each(function () {\n var holder = jQuery(this);\n var inputs = holder.find('input:text, input:hidden');\n var from = inputs.filter('input.from');\n var to = inputs.filter('input.to');\n var nbDays = holder.parent().find('#date_range_nb_days');\n\n inputs.each(function () {\n var input = jQuery(this);\n\n input.closest('.col').find('.add-on').on('click', function (e) {\n e.preventDefault();\n input.focus();\n });\n });\n\n inputs.datepicker({\n //dateFormat: \"dd / mm / y\",\n dateFormat: \"dd/mm/yy\",//abe++\n minDate: today,\n onSelect: function (selectedDate) {\n var input = jQuery(this);\n var option = input.is(from) ? 'minDate' : 'maxDate';\n var instance = input.data('datepicker');\n var date = jQuery.datepicker.parseDate(instance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat, selectedDate, instance.settings);\n\n inputs.not(input).filter('input:text').datepicker('option', option, date);\n\n if (input.is(from)) {\n //abe++\n if (to.attr('type') == 'text') {//Days are displayed range mode (cocorico.days_display_mode: range)\n setTimeout(function () {\n to.focus();\n }, 100);\n } else if (to.attr('type') == 'hidden') {//Day are displayed in duration mode\n setEndDay(input, to, nbDays);\n }\n }\n }\n });\n\n //abe++\n nbDays.on('change', function () {\n setEndDay(from, to, $(this));\n });\n });\n\n initTimePicker('.timepicker-holder');\n}", "function lpSetDateInput(sectionId) {\n // $(\":date\").dateinput({\n $(\"#section_due_date_\"+sectionId).dateinput({\n format: 'mmmm dd, yyyy', // the format displayed for the user\n selectors: true, // whether month/year dropdowns are shown\n offset: [10, 20], // tweak the position of the calendar\n speed: 'fast', // calendar reveal speed\n firstDay: 1 // which day starts a week. 0 = sunday, 1 = monday etc..\n });\n// $(\":date\").dateinput({format: 'mmmm dd, yyyy', selectors: true, offset: [10, 20], speed: 'fast', firstDay: 1});\n}", "function DateTimePick(inputId) {\r\n\tcalendar = new Calendar(dateToday);\r\n\tif (inputId != null) {\r\n\t\tcalendar.inputId = inputId;\r\n\t}\r\n\r\n\texistingsDate = document.getElementById(inputId).value;\r\n\tif (existingsDate!=\"\")//Parse Date String\r\n\t{\r\n\t\t//parse month\r\n\t\tvar separator1 = existingsDate.indexOf(DATE_SEPARATOR, 0)\r\n\t\tvar separator2 = existingsDate.indexOf(DATE_SEPARATOR, (parseInt(separator1) + 1));\r\n\t\tvar length = existingsDate.length;\r\n\t\t\r\n\t\tvar strMonth = existingsDate.substring(separator1 + 1, separator2);\r\n\t\tvar strDate = existingsDate.substring(separator2 + 1, length);\r\n\t\tvar intMonth = parseInt(strMonth, 10) - 1;\r\n\t\t\t\t\r\n\t\tif ((parseInt(intMonth, 10) >= 0) && (parseInt(intMonth, 10) < 12)){\r\n\t\t\tcalendar.month = intMonth;\r\n\t\t}\r\n\t\t//end parse month\r\n\t\t\r\n\t\t//parse Date\r\n\t\tif ((parseInt(strDate, 10) <= calendar.getMonDays()) && (parseInt(strDate, 10) >= 1)){\r\n\t\t\tcalendar.date = strDate;\r\n\t\t}\r\n\t\t//end parse Date\r\n\t\t\r\n\t\t//parse year\r\n\t\tvar strYear = existingsDate.substring(0, 4);\r\n\t\tvar YearPattern = /^\\d{4}$/;\r\n\t\tif (YearPattern.test(strYear)){\r\n\t\t\tcalendar.year = parseInt(strYear, 10);\r\n\t\t}\r\n\t\t//end parse year\r\n\t}\r\n\t\r\n\tdatePickerWindow=window.open(\"\",\"DateTimePicker\",\"width=200, height=180, status=no, toolbar=no, location=no, menubar=no, resizable=no, scrollbars=no, top=\" + POSITION_TOP + \",left=\" + POSITION_LEFT);\r\n\tdatePickerDocument = datePickerWindow.document;\r\n\trenderCalendar();\r\n}", "function bindInitializeDatePickerOnDateInput() {\n //txtLeaseExpiryDate, txtLeaseStartDate\n var leaseStartDate = $('#txtLeaseStartDate');\n var leaseExpiryDate = $('#txtLeaseExpiryDate');\n var leasingStatus = $('#txtLeaseMandatory');\n\n if(leasingStatus.val() === '1') {\n // lease start date section\n leaseStartDate.datepicker({\n dateFormat: \"dd/mm/yy\",\n onClose: function() {\n var startDateArray = $(this).val().split('/');\n var day = parseInt(startDateArray[0]);\n var month = parseInt(startDateArray[1]);\n var year = parseInt(startDateArray[2]);\n leaseExpiryDate.datepicker(\"change\", {\n minDate: new Date(year, month-1, day) \n });\n }\n }).on('change', function(e) {\n bindShowContractLeasePeriodMonths();\n });\n \n // lease expiry date section\n leaseExpiryDate.datepicker({\n dateFormat: \"dd/mm/yy\",\n onClose: function() {\n var expiryDateArray = $(this).val().split('/');\n var day = parseInt(expiryDateArray[0]);\n var month = parseInt(expiryDateArray[1]);\n var year = parseInt(expiryDateArray[2]);\n leaseStartDate.datepicker(\"change\", {\n maxDate: new Date(year, month-1, day) \n });\n }\n \n }).on('change', function(e) {\n bindShowContractLeasePeriodMonths();\n });\n } else {\n // for destroy date picker\n// leaseStartDate.removeClass('calendarclass');\n leaseStartDate.removeClass('hasDatepicker');\n leaseStartDate.unbind();\n \n leaseExpiryDate.removeClass('hasDatepicker');\n leaseExpiryDate.unbind();\n }\n}", "function calendarWindowDate (file, theField) {\n// popup the calendar window for DATE.\n// and take the returned value and do something with it.\n// theField: input assumes input type=text\n\nvar fileName,w,h;\nfileName = file;\n\nvar windowName = \"calendar\";\nvar width = 310;\nvar widthString = \"width=\"+width;\nvar height = 420;\nvar heightString = \"height=\"+height;\n\nvar hasToolbar = \"toolbar=no\";\nvar hasLocation = \"location=no\";\nvar hasDirectories = \"directories=no\";\nvar hasMenubar = \"menubar=no\";\nvar isResizable = \"resizable=yes\";\nvar propString = fileName +\",\"+ windowName +\",\"+ widthString +\",\"+ heightString +\",\"+ hasToolbar +\",\"+ hasLocation +\",\"+ hasDirectories +\",\"+ hasMenubar +\",\"+ isResizable;\nvar calendarPopup = window.open (fileName, windowName, propString);\ncalendarFieldHolder = theField;\ntoday= new Date(dateParser(theField.value,FORMAT));\nuser_sel_val_holder = new Date(dateParser(theField.value,FORMAT));\ncal_val_holder= today;\nreturn false;\n}", "function FlurryDatePicker(){\n cc('FlurryDatePicker','run');\n $( \"#start_date\" ).datepicker({\n defaultDate: \"+1w\",\n changeMonth: true,\n numberOfMonths: 3,\n onClose: function( selectedDate ) {\n $( \"#end_date\" ).datepicker( \"option\", \"minDate\", selectedDate );\n localStorage.setItem( 'start_date', selectedDate );\n console.log('NEW start_date: ' +selectedDate);\n }\n });\n $( \"#end_date\" ).datepicker({\n formatDate: \"yyyy-mm-dd\",\n // defaultDate: \"+1w\",\n changeMonth: true,\n numberOfMonths: 3,\n onClose: function( selectedDate ) {\n $( \"#start_date\" ).datepicker( \"option\", \"maxDate\", selectedDate );\n localStorage.setItem( 'end_date', selectedDate );\n console.log('NEW end_date: ' +selectedDate);\n }\n });\n\n $.datepicker.setDefaults({\n dateFormat: 'yy-mm-dd'\n });\n}", "function CalendarPopup_tmpReturnFunction(y,m,d) \r\n{ \r\n\tif (window.CalendarPopup_targetInput!=null) \r\n\t{\r\n\t\tvar d = new Date(y,m-1,d,0,0,0);\r\n\t\twindow.CalendarPopup_targetInput.value = formatDate(d,window.CalendarPopup_dateFormat);\r\n\t}\r\n\telse alert('Use setReturnFunction() to define which function will get the clicked results!'); \r\n}", "function test_service_dialog_date_datetime_picker_dynamic_dialog() {}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.regional.en = $.extend( true, {}, this.regional[ \"\" ]);\n\tthis.regional[ \"en-US\" ] = $.extend( true, {}, this.regional.en );\n\tthis.dpDiv = datepicker_bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}", "function Datepicker() {\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = \"ui-datepicker-div\"; // The ID of the main datepicker division\n\tthis._inlineClass = \"ui-datepicker-inline\"; // The name of the inline marker class\n\tthis._appendClass = \"ui-datepicker-append\"; // The name of the append marker class\n\tthis._triggerClass = \"ui-datepicker-trigger\"; // The name of the trigger marker class\n\tthis._dialogClass = \"ui-datepicker-dialog\"; // The name of the dialog marker class\n\tthis._disableClass = \"ui-datepicker-disabled\"; // The name of the disabled covering marker class\n\tthis._unselectableClass = \"ui-datepicker-unselectable\"; // The name of the unselectable cell marker class\n\tthis._currentClass = \"ui-datepicker-current-day\"; // The name of the current day marker class\n\tthis._dayOverClass = \"ui-datepicker-days-cell-over\"; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[\"\"] = { // Default regional settings\n\t\tcloseText: \"Done\", // Display text for close link\n\t\tprevText: \"Prev\", // Display text for previous month link\n\t\tnextText: \"Next\", // Display text for next month link\n\t\tcurrentText: \"Today\", // Display text for current month link\n\t\tmonthNames: [\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\n\t\t\t\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], // For formatting\n\t\tdayNames: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], // For formatting\n\t\tdayNamesShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], // For formatting\n\t\tdayNamesMin: [\"Su\",\"Mo\",\"Tu\",\"We\",\"Th\",\"Fr\",\"Sa\"], // Column headings for days starting at Sunday\n\t\tweekHeader: \"Wk\", // Column header for week of the year\n\t\tdateFormat: \"mm/dd/yy\", // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: \"\" // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: \"focus\", // \"focus\" for popup on focus,\n\t\t\t// \"button\" for trigger button, or \"both\" for either\n\t\tshowAnim: \"fadeIn\", // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: \"\", // Display text following the input box, e.g. showing the format\n\t\tbuttonText: \"...\", // Text for trigger button\n\t\tbuttonImage: \"\", // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: \"c-10:c+10\", // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: \"+10\", // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with \"+\" for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: \"fast\", // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or \"\",\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: \"\", // Selector for an alternate field to store selected dates into\n\t\taltFormat: \"\", // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional[\"\"]);\n\tthis.dpDiv = bindHover($(\"<div id='\" + this._mainDivId + \"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>\"));\n}" ]
[ "0.83340704", "0.83340704", "0.7624151", "0.73965794", "0.73290354", "0.72314584", "0.71330553", "0.71274036", "0.7096862", "0.7096862", "0.7096862", "0.70495117", "0.7023234", "0.7023234", "0.7011322", "0.6985043", "0.6977587", "0.69663864", "0.69570243", "0.6955271", "0.69485605", "0.69245636", "0.6921166", "0.6918333", "0.68892854", "0.6889255", "0.6867892", "0.6859509", "0.6853337", "0.6853219", "0.6853111", "0.6841484", "0.68353695", "0.68141013", "0.67949414", "0.6781331", "0.6775063", "0.6757394", "0.67561936", "0.6752304", "0.67244256", "0.6723975", "0.6719653", "0.67169076", "0.6705914", "0.67043424", "0.66952324", "0.6688693", "0.6688366", "0.6688366", "0.668325", "0.66810966", "0.66797966", "0.66754025", "0.6674226", "0.6674035", "0.66566986", "0.66429335", "0.6637879", "0.6634057", "0.6634057", "0.66222054", "0.66222054", "0.662121", "0.66143286", "0.6612324", "0.66083604", "0.66033465", "0.6602338", "0.6601301", "0.65980077", "0.65955377", "0.65955377", "0.65774244", "0.65542305", "0.65530103", "0.6550958", "0.65457696", "0.6542219", "0.6535891", "0.65330315", "0.65299875", "0.6523349", "0.6518901", "0.6517787", "0.6512451", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086", "0.65087086" ]
0.0
-1
Adds metadata tags to the footer.
addTags() { const { doc, margins, metadata, documentFont, documentBoldFont, } = this.pdfBuilder; const fontSize = 9; let lineHeight = this.data.length - 1; doc.font(documentFont); doc.fontSize(fontSize); const tags = metadata.tags || []; for (let i = 0; i < tags.length; i += 1) { if (typeof tags[i] === 'string') { doc.text( tags[i], margins.left, (this.height + margins.bottom) - (lineHeight * fontSize)); lineHeight -= 1; } else if (typeof tags[i] === 'object' && tags[i].value !== undefined && tags[i].label !== undefined) { doc .font(documentBoldFont) .text(`${tags[i].label}:`, margins.left, (this.height + margins.bottom) - (lineHeight * fontSize), { lineBreak: false }) .font(documentFont) .text(tags[i].value); lineHeight -= 1; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createFooter(footer) {\n footer.appendChild(footerTemplate.content);\n }", "function addFooter() {\r\n const contentsSrc = 'MasterPage/footer_contents.txt';\r\n if (document.getElementById) {\r\n let footer = document.getElementById('footer');\r\n if (footer) {\r\n let pathPrefix = relativePath();\r\n let footerContents = readContents(pathPrefix + contentsSrc);\r\n if (footerContents) { \r\n placeInOuterHtml(footer, footerContents);\r\n }\r\n }\r\n } \r\n}", "function metaOutput(data) {\n if (data !== \"\") {\n //search metadata from response\n var search_title = data.title;\n var search_link = data.link;\n //build heading output for metadata heading\n var metaHeading = '<h6>'+search_title+' | <a href=\"'+search_link+'\">Flickr</a></h6>';\n //render metadata to contextual-output\n $(\".contextual-output\").prepend(metaHeading);\n }\n }", "appendFooter(tagName){\n return this.footer.append(tagName);\n }", "function addMeta(toAdd, name, defContent) {\n return add(\"<meta>\", {\n name: name,\n content: toAdd ? toAdd : defContent\n });\n }", "addFooters() {\n /* Add footers for modified rows */\n this.gridApi.forEachNodeAfterFilterAndSort((node) => {\n if (node.data.hadronDocument.isModified()) {\n this.addFooter(node, node.data, 'editing');\n }\n });\n }", "function addFooter(report) {\n report.getFooter().addClass(\"footer\");\n var versionLine = report.getFooter().addText(\"Banana Accounting - Page \", \"description\");\n report.getFooter().addFieldPageNr();\n}", "displayFooter() {\n }", "function addFooter(report) {\r\n report.getFooter().addClass(\"footer\");\r\n var versionLine = report.getFooter().addText(\"Banana Accounting 8\" + \" - \", \"description\");\r\n report.getFooter().addText(\"Pagina \", \"description\");\r\n report.getFooter().addFieldPageNr();\r\n}", "function appendFooter(){\n var footer = \"<div class='footer'>\";\n footer += \"<center><div class='copyrightText'>&copy; 2017 ITEE Group Canada</div></center>\";\n footer += \"</div>\";\n $('body').append(footer);\n }", "function afterFooter() {\n // Get Cartridge Cache\n var cache = dw.system.CacheMgr.getCache('DevToolsCache');\n\n // Write log types to their own cache key ( 128KB max per key )\n cache.put('debug', Debugger.debug);\n cache.put('error', Debugger.error);\n cache.put('fatal', Debugger.fatal);\n cache.put('info', Debugger.info);\n cache.put('log', Debugger.log);\n cache.put('warn', Debugger.warn);\n\n // Render Remote Include to Prevent ISML Bug\n var velocity = require('dw/template/Velocity');\n velocity.render('$velocity.remoteInclude(\\'DevTools-AfterFooter\\')', {\n velocity: velocity\n });\n}", "_appendSpecificMetaData(meta) {\n return meta;\n }", "function setFooter(stats) {\n var footer = '';\n if (stats.show == 'true') {\n if (stats.type.value == \"image\") {\n footer = '<div id=\"footer\" style=\"z-index:30;text-align:' + stats.align.value + ';\"> <img src=\"' + basePath + 'images/' + stats.logo + '\" /></div>';\n }\n else {\n footer = '<div id=\"footer\" style=\"z-index:3;position:absolute;width:100%;text-align:' + stats.align.value + ';\"><div class=\"font-setter\" style=\"z-index:3;font-size:' + stats.size.value + ';\">' + stats.text + '</div></div>';\n }\n }\n return footer;\n }", "function setupFooter(docname, docver, docstage, docrev, docdate) {\n var footer = doc.getFooter();\n var paragraphs = footer.getParagraphs();\n var doctrack = convertStageToTrack(docstage);\n \n // Build the filename based on provided data\n var docfilename = \"\";\n \n // The passed in docname will be something like \"Playbook Requirements\"\n // We need to make this lower case and remove the spaces\n docname = docname.toLowerCase();\n docname = docname.replace(/\\ /g, '-');\n if (docstage === \"wd\" || docstage === \"csd\" || docstage === \"cnd\") {\n docfilename = \"draft-\" + docname + '-v' + docver + '-' + docstage + docrev;\n }\n else {\n docfilename = docname + '-v' + docver + '-' + docstage + docrev;\n }\n\n // Update the first line of the footer\n e0 = paragraphs[0];\n\n // Update filename name on first line of footer\n e0.replaceText('##docfilename##', docfilename);\n \n // Update the Working Draft ##, but only if this is a WD.\n if (docstage === \"wd\") {\n // Update document revision\n e0.replaceText('##docrev##', docrev);\n }\n else {\n // Remove the Working Draft ## for CSD, CS, CND, CN, but only if it is found\n e0.replaceText('Working Draft ##docrev##', \"\");\n }\n\n // Update the document date\n e0.replaceText('##docdate##', docdate);\n\n // Update the second line of the footer\n e1 = paragraphs[1];\n \n // Update document track type (standards track, non-standards track, standards track draft, etc)\n e1.replaceText('##doctrack##', doctrack);\n}", "function addEmbMeta(doc) {\n\tvar translator = Zotero.loadTranslator(\"web\");\n\t//Embedded Metadata translator\n\ttranslator.setTranslator(\"951c027d-74ac-47d4-a107-9c3069ab7b48\");\n\n\ttranslator.setDocument(doc);\n\n\ttranslator.setHandler(\"itemDone\", function(obj, item) {\n\t\t//remove all caps in Names and Titles\n\t\tfor (i in item.creators){\n\t\t\tif (item.creators[i].lastName && item.creators[i].lastName == item.creators[i].lastName.toUpperCase()) {\n\t\t\t\titem.creators[i].lastName = Zotero.Utilities.capitalizeTitle(item.creators[i].lastName.toLowerCase(),true);\n\t\t\t}\n\t\t\tif (item.creators[i].firstName && item.creators[i].firstName == item.creators[i].firstName.toUpperCase()) {\n\t\t\t\titem.creators[i].firstName = Zotero.Utilities.capitalizeTitle(item.creators[i].firstName.toLowerCase(),true);\n\t\t\t}\n\t\t}\n\n\t\tif (item.title == item.title.toUpperCase()) {\n\t\t\titem.title = Zotero.Utilities.capitalizeTitle(item.title.toLowerCase(),true);\n\t\t}\n\n\t\tif(!item.abstractNote) item.abstractNote = getAbstract(doc);\n\n\t\tif( !item.tags || item.tags.length < 1 ) item.tags = getKeywords(doc);\n\n\t\tif (item.notes) item.notes = [];\n\n\t\titem.complete();\n\t});\n\n\ttranslator.translate();\n}", "function addFooter(report) {\n\tvar date = new Date();\n\tvar d = Banana.Converter.toLocaleDateFormat(date);\n\treport.getFooter().addClass(\"footer\");\n\tvar versionLine = report.getFooter().addText(d + \" - Trial balance - Page \", \"description\");\n\treport.getFooter().addFieldPageNr();\n}", "function insertFooter () {\n \"use strict\";\n try {\n var footer;\n\t\t\t/* There are at least one, and maybe more, courses that are developed in partnership with BYU or BYU-Hawaii and require that to be displayed in the copyright. Checking here for customCopyright allows for those courses to create this variable with the custom text in the course.js file before the online.js is appended and then will use the custom text */\n\t\t\tif (typeof customCopyright === \"undefined\") {\n\t\t\t\tfooter = \"<div id='footer'>Copyright &copy; \" + new Date().getFullYear() + \" by Brigham Young University - Idaho. All Rights Reserved.</div>\";\n\t\t\t} else {\n\t\t\t\tfooter = \"<div id='footer'>\" + customCopyright + \"</div>\";\n\t\t\t}\n document.getElementById(\"main\").insertAdjacentHTML(\"beforeend\", footer); \n } catch (ex) {\n console.log(ex.name + \": \" + ex.message);\n }\n }", "function populateFooter() {\n var container = document.querySelector(\"#networksContainer\");\n var networks = Object.keys(socialNetworks);\n var len = networks.length;\n // Iterate over networks and generate tags\n for (var i = 0; i < len; i++) {\n var name = networks[i];\n var url = socialNetworks[name].url;\n\n // Create and attach link element\n var link = document.createElement('a');\n link.href = url;\n container.appendChild(link);\n link.title = 'Kyle Maxwell on ' + name + '.';\n\n // Create and attach image element\n var image = document.createElement('img');\n image.src = 'images/' + name + '.png';\n link.appendChild(image);\n image.classList.add(\"icon\");\n }\n}", "function getMetadata(metadata) {\n\n var metadataHtml=d3.select(\"#sample-metadata\");\n // clean metadata tabel if data exists\n metadataHtml.html(\"\");\n // and append current sample metadata to html\n Object.entries(metadata).forEach(([key, value]) => metadataHtml.append(\"p\").text(`${key}: ${value}`)\n );\n}", "genFooterContent() {\n return <Footer />;\n }", "function addFooter(footText){\n return \"<footer class=\\\"card_footer w3-container\\\">\" +\n \"<h5>\" + footText + \"</h5>\" +\n \"</footer>\";\n}", "function footerData(sourcefile){\r\n\treturn `<div class='information' id='information'>\r\n\t\t\t\r\n\t\t<div style='float:right; padding-top: 28px; padding-right: 14px;'>\r\n\t\t\tRobert Calamari 2019\r\n\t\t</div>\r\n\r\n\t</div>\r\n`;\r\n}", "function EMBEDDED_FOOTER$static_(){ToolbarSkin.EMBEDDED_FOOTER=( new ToolbarSkin(\"embedded-footer\"));}", "function changeMetaData(data) {\n let $panelBody = document.getElementById(\"metadata-sample\");\n // clear any existing metadata\n $panelBody.innerHTML = \"\";\n // Loop through keys in json response and create new tags for metadata\n for (let key in data) {\n h5Tag = document.createElement(\"h5\");\n metadataText = document.createTextNode(`${key}: ${data[key]}`);\n h5Tag.append(metadataText);\n $panelBody.appendChild(h5Tag);\n }\n}", "function initFooterAnalytics() {\n\n var category, label;\n\n //High Level Links\n $(\".high-level-links a\").click(function(e) {\n\n category = \"Information\";\n label = e.target.getAttribute(\"data-label\");\n\n onGlobalNavClick(\"Footer\", category, label);\n });\n\n //Secondary Links\n $(\".secondary-links a, .secondary-links-footer a\").click(function(e) {\n\n category = e.target.getAttribute(\"data-category\") || $(e.target).closest(\"a\").data(\"category\") || \"No Category Found\";\n label = e.target.getAttribute(\"data-label\") || $(e.target).closest(\"a\").data(\"label\") || \"No Label Found\";\n\n onGlobalNavClick(\"Footer\", category, label);\n });\n\n //Social Links\n $(\"footer .social a\").click(function(e) {\n\n category = \"Social Links\";\n label = e.target.getAttribute(\"data-label\") || $(e.target).closest(\"a\").data(\"label\") || \"No Label Found\";\n\n onGlobalNavClick(\"Footer\", category, label);\n });\n\n //Disclaimer\n $(\".footer-disclaimer a\").click(function(e) {\n fireTag(HOME_PAGE_ALERT_MESSAGE_CLICK, {\n \"<container>\": \"Footer\",\n \"<message>\": e.target.textContent,\n \"<break_point>\": getBreakpoint(),\n \"<orientation>\": getOrientation()\n });\n });\n }", "function footer(){\ndiv= document.createElement(\"div\");\ndiv.className=\"bg-dark justify-content-center p-4 \";\n// adding techs used ---------------------------\ntech = document.createElement(\"p\");\ntech.innerHTML=`Techs Used - <span>html,css,bootstrap,javascript</span>`;\ntech.id=\"tech\";\ndiv.appendChild(tech);\n// adding Content Disclamier---------------------\ncontent = document.createElement(\"p\");\ncontent.innerHTML=`Content Disclamier - <span>The contant of this website is taken from <a href=\"https://api.openbrewerydb.org/breweries\">Open Brewery</a></span>`;\ncontent.id=\"content\";\ndiv.appendChild(content);\n// adding social media icons --------------------\nsocialmedia = document.createElement(\"p\");\nsocialmedia.innerHTML=`<a href=\"#\" class=\"fab fa-facebook-f\"></a> <a href=\"#\" class=\"fab fa-twitter\"></a> <a href=\"#\" class=\"fab fa-google\"></a> <a href=\"#\" class=\"fab fa-linkedin-in\"></a> <a href=\"#\" class=\"fab fa-youtube\"></a>`;\nsocialmedia.id=\"social\"\ndiv.appendChild(socialmedia);\nroot.appendChild(div); // adding all things to main root element \n}", "function footer( text ) {\n var textObject = game.add.text(\n game.world.width, game.world.height, text,\n { font: game.vars.font.footer(), fill: game.vars.font.fill, align: \"right\" }\n );\n textObject.anchor.set( 1, 1 );\n\n return textObject;\n }", "goToFooter() {\n this.owner.enableHeaderAndFooter = true;\n this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget);\n }", "function addFooter(banDoc, report) {\r\n\treport.getFooter().addClass(\"footer\");\r\n\treport.getFooter().addText(\"[Banana Accounting, v. \" + banDoc.info(\"Base\", \"ProgramVersion\") + \", \" + scriptVersion + \"] - Page \", \"footer\");\r\n\treport.getFooter().addFieldPageNr();\r\n}", "function placeMetadata(item) {\n\tvar news_data = document.getElementById(\"news-data\");\n\n\tnews_data.innerHTML = \"\";\n\tvar entities = item[\"ents\"];\n\tvar relationships = item[\"rels\"];\n\n\tif( entities.length > 0 ) {\n\t\tnews_data.appendChild(createHeadlineElement(\"ENTITIES\"));\n\t\tnews_data.appendChild(generateEntityTable(entities));\n\t}\n\tif ( relationships.length > 0 ) {\n\t\tnews_data.appendChild(createHeadlineElement(\"RELATIONSHIPS\"));\n\t\tnews_data.appendChild(generateRelationshipTable(relationships));\n\t}\n}", "addHeaderFooter(hf, hfType, id) {\n let hfColl = new Dictionary();\n this.headersFooters.add(hfType, hfColl);\n this.headersFooters.get(hfType).add(id, hf);\n }", "function footer_func(){\n showfooter();\n hideicon();\n }", "function footer() {\n var amountCompleted = ctrl.amountCompleted();\n var amountActive = ctrl.list.length - amountCompleted;\n \n return E('footer') . is ({ id: 'footer' }) . has([\n \n E('span') . is ({ id: 'todo-count' }) . has([\n// E('strong') . has (T(F`${count} items left`)) // jshint ignore:line\n ]),\n \n // Filters (all, active, completed)\n E('ul') . is({ id: 'filters' }) . has ([\n E('li') . has(T(\"All\")) . does({ click: _ => data.filter = 'all' }),\n E('li') . has(T(\"Active\")) . does({ click: _ => data.filter = 'active' }),\n E('li') . has(T(\"Completed\")) . does({ click: _ => data.filter = 'completed' })\n ]),\n \n /* jshint ignore:start */\n E('button') .\n has (T(F`Clear completed ${completedcount}`)) . // jshint ignore:line\n is ({ id: 'clear-completed' }) .\n does({ click: _ => 0 }) //clearCompleted })\n /* jshint ignore:end */\n ]);\n }", "prepareMetadata_() {\n if (this.jekyllMetadata.iconId) {\n this.jekyllMetadata.icon_id = this.jekyllMetadata.iconId;\n }\n }", "_onMetaData (chunk) {\n this.emit('metadata', _parseMetadata(chunk));\n this._passthrough(this._icyMetaInt, this._onMetaSectionStart);\n }", "function setFooter(file){\r\n\tvar withoutFooter = file.length-20;\r\n\tfile.set(sha1_hmac(new Uint8Array(file.buffer, 0, withoutFooter), HMAC_KEY), withoutFooter);\r\n}", "function buildFooter() {\r\n $(\"#footer\").html(\r\n `\r\n <hr>\r\n My Sheridan Program: <em>${meArr[0].program}</em><br>\r\n My Home Country: <em>${meArr[0].hCountry}</em>\r\n `\r\n );\r\n $(\"#footer\").addClass(\"bottom\");\r\n}", "function FOOTER$static_(){ToolbarSkin.FOOTER=( new ToolbarSkin(\"footer\"));}", "function createFooter() {\r\n var foot = document.querySelector('tfoot');\r\n foot.innerHTML = '';\r\n newRow = addElement('tr', '', foot);\r\n addElement('th', 'Totals', newRow);\r\n for (var i = 0; i < times.length; i++) {\r\n var hourTotal = 0;\r\n for (var j = 0; j < Store.stores.length; j++) {\r\n hourTotal += Store.stores[j].hourlySales[i];\r\n }\r\n addElement('td', hourTotal, newRow);\r\n }\r\n}", "showMetadata(){\n document.getElementById('trackInfo').innerHTML = \n '<h3 class=\"trackMetaSnippet artistTitle\">'+this.currentTrackMetadata.tags.artist+'</h3>'+\n '<h3 class=\"trackMetaSnippet trackTitle\">'+this.currentTrackMetadata.tags.title +'</h3>'+\n '<h3 class=\"trackMetaSnippet albumTitle\">'+this.currentTrackMetadata.tags.album+'</h3>';\n }", "renderFooter() {\n return null;\n }", "updateFooter() {\n // Get new footer row HTML string\n let newFoot = footer.render();\n // Add new footer row to table footer\n this.footer.appendChild(newFoot);\n }", "function addscript(){\n var footer = document.getElementById('footer');\n var tagScript = document.createElement('script');\n tagScript.src = \"//c.fqtag.com/tag/implement-r.js?org=TksRHGen5rmjsG48m9pC&p=bamfordsTestPage&a=testpage&cmp=adframe2&fmt=banner&dmn=http://any.dominayoulike.com/thiswont/doanything&rt=display&sl=1&fq=1&ad=adframe2\";\n footer.appendChild(tagScript);\n}", "function commonFooter() {\n var text;\n text = botTable();\n text += \"<table style='margin-bottom:40px; margin-top:20px; width:100%;'>\";\n text += \"<tr><td style='text-align:left; vertical-align:bottom;'>\" + foot1() + \"</td>\";\n text += \"<td id='tdMathJaXFooter' style='text-align:center; vertical-align:bottom;'>\" + mathJaXImgAnchor + \"<br />beautiful math</td>\";\n text += \"<td id='tdJSXGraphFooter' style='text-align:center; vertical-align:bottom;'>\" + jsxGraphImgAnchor + \"<br />beautiful graphics</td>\";\n text += \"<td id='tdTermsOfUseFooter' style='text-align:right; vertical-align:bottom;'>\" + foot3() + \"<td></tr>\";\n text += \"</table>\";\n return text;\n}", "function initFooter() {\n\t\n\t//hide the timeline feature first before creating content\n\t$('.inner').hide();\n\t$('#playNext').hide();\n\n\t//create elements of the timeline\n\tinitPhaseLabels();\n\tinitDayList();\n\tinitSliderBoxContent();\n\tinitPlayBtn();\n\n\t//add functionality, must come after creation of elements\n\tmoveSliderBox_onClick();\n\tretractableTimeline();\n\thighlightPhase();\n\n}", "addConstraintMetadata(metadata) {\n this.constraintMetadatas.push(metadata);\n }", "function addMetadataElm(parent, tag, attr, textContent, doReplace) {\n var elm = $('div[tag=\"'+tag+'\"]',parent);\n if(!doReplace || elm.length===0){\n elm = $('<div tag=\"'+tag+'\"></div>');\n parent.append(elm);\n }\n if(attr) {\n for(var name in attr) {\n elm.attr(name, attr[name]);\n }\n }\n if(textContent) elm.text(textContent);\n }", "function link( scope, element, attributes ) {\n console.log( 'Footer directive linking.' );\n }", "chargerFooter(){\n $(\"#page\"+this.instrument.ref).append('<div data-role=\"footer\" data-position=\"fixed\" data-tap-toggle=\"false\" data-fullscreen=\"false\" data-theme=\"b\">\\\n <div data-role=\"navbar\" data-grid=\"\" data-iconpos=\"left\">\\\n <ul id=\"menu\">\\\n <li><a href=\"#pageEtat\">Etat</a></li>\\\n <li><a href=\"#pageInstruments\"> Instruments</a></li>\\\n <li><a href=\"#pageCommande\">Commande</a></li>\\\n <li><a href=\"#pageConfiguration\"> Configuration</a></li>\\\n </ul>\\\n </div>\\\n </div>');\n }", "function addMetadata(packname, author) {\t\n\t\t\t\tif (!packname) packname = 'Made In'; if (!author) author = 'Bineria Universal';\t\n\t\t\t\tauthor = author.replace(/[^a-zA-Z0-9]/g, '');\t\n\t\t\t\tlet name = `${author}_${packname}`\n\t\t\t\tif (fs.existsSync(`./src/stickers/${name}.exif`)) return `./src/stickers/${name}.exif`\n\t\t\t\tconst json = {\t\n\t\t\t\t\t\"sticker-pack-name\": packname,\n\t\t\t\t\t\"sticker-pack-publisher\": author,\n\t\t\t\t}\n\t\t\t\tconst littleEndian = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00])\t\n\t\t\t\tconst bytes = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00]\t\n\n\t\t\t\tlet len = JSON.stringify(json).length\t\n\t\t\t\tlet last\t\n\n\t\t\t\tif (len > 256) {\t\n\t\t\t\t\tlen = len - 256\t\n\t\t\t\t\tbytes.unshift(0x01)\t\n\t\t\t\t} else {\t\n\t\t\t\t\tbytes.unshift(0x00)\t\n\t\t\t\t}\t\n\n\t\t\t\tif (len < 16) {\t\n\t\t\t\t\tlast = len.toString(16)\t\n\t\t\t\t\tlast = \"0\" + len\t\n\t\t\t\t} else {\t\n\t\t\t\t\tlast = len.toString(16)\t\n\t\t\t\t}\t\n\n\t\t\t\tconst buf2 = Buffer.from(last, \"hex\")\t\n\t\t\t\tconst buf3 = Buffer.from(bytes)\t\n\t\t\t\tconst buf4 = Buffer.from(JSON.stringify(json))\t\n\n\t\t\t\tconst buffer = Buffer.concat([littleEndian, buf2, buf3, buf4])\t\n\n\t\t\t\tfs.writeFile(`./src/stickers/${name}.exif`, buffer, (err) => {\t\n\t\t\t\t\treturn `./src/stickers/${name}.exif`\t\n\t\t\t\t})\t\n\n\t\t\t}", "serializeFooter(footer, id, headerFooterPath, headerFooterRelsPath) {\n this.headerFooter = footer;\n let writer = new XmlWriter();\n writer.writeStartElement('w', 'ftr', this.wNamespace);\n this.writeHFCommonAttributes(writer);\n this.serializeBodyItems(writer, footer.blocks, true);\n writer.writeEndElement();\n let zipArchiveItem = new ZipArchiveItem(writer.buffer, headerFooterPath);\n this.mArchive.addItem(zipArchiveItem);\n this.serializeHFRelations(id, headerFooterRelsPath);\n }", "setFooter(html){\n this.footer.html(html);\n }", "function applyMetadata()\n {\n\n\n // get metadata values\n var metadata = groovebox[\"metadata\"];\n\n\n // get the current audio file name\n var currentAudioFile = $(\".track-info\").attr(\"file\");\n\n\n // check if the (new) metadata is different than the currently playing song\n if (groovebox[\"stream\"][\"track\"] !== currentAudioFile)\n {\n\n\n // update the metadata\n\n\n // update the track name\n $(\".track-info .track-name\").html(metadata[\"title\"]).attr(\"title\", metadata[\"title\"]);\n\n\n // update the track artist\n $(\".track-info .track-artist\").html(metadata[\"artist\"]).attr(\"title\", metadata[\"artist\"]);\n\n\n // update the cover-art\n $(\".album-art img\").attr(\"src\", metadata[\"coverArt\"] +\"&\"+ new Date().getTime());\n\n\n // update the current audio file\n $(\".track-info\").attr(\"file\", groovebox[\"stream\"][\"track\"]);\n\n\n }\n\n\n }", "function EpisodeMetadata() {}", "async setMetadata(id, metadata) {\n const filename = this._formatMetadataFilename(id);\n\n const contents = JSON.stringify(\n metadata.constructor.toObject(metadata), null, 2\n );\n\n await fs.writeFile(filename, contents);\n }", "function callback() {\n let keeper = `\n <div class=\"container py-5\">\n <div class=\"text-center text-white\">\n <h5>&copy;Ahmad Essam 30-9-2021</h5>\n </div>\n </div>\n `\n document.getElementById('myFooter').innerHTML = keeper;\n}", "get footer() { return $('#page-footer'); }", "function belowEntryMetaClass( param ) {\n if ( body.hasClass( 'page' ) || body.hasClass( 'search' ) || body.hasClass( 'single-attachment' ) || body.hasClass( 'error404' ) ) {\n return;\n }\n\n $( '.entry-content' ).find( param ).each( function() {\n var element = $( this ),\n elementPos = element.offset(),\n elementPosTop = elementPos.top,\n entryFooter = element.closest( 'article' ).find( '.entry-footer' ),\n entryFooterPos = entryFooter.offset(),\n entryFooterPosBottom = entryFooterPos.top + ( entryFooter.height() + 28 ),\n caption = element.closest( 'figure' ),\n newImg;\n\n // Add 'below-entry-meta' to elements below the entry meta.\n if ( elementPosTop > entryFooterPosBottom ) {\n\n // Check if full-size images and captions are larger than or equal to 840px.\n if ( 'img.size-full' === param ) {\n\n // Create an image to find native image width of resized images (i.e. max-width: 100%).\n newImg = new Image();\n newImg.src = element.attr( 'src' );\n\n $( newImg ).on( 'load.twentysixteen', function() {\n if ( newImg.width >= 840 ) {\n element.addClass( 'below-entry-meta' );\n\n if ( caption.hasClass( 'wp-caption' ) ) {\n caption.addClass( 'below-entry-meta' );\n caption.removeAttr( 'style' );\n }\n }\n } );\n } else {\n element.addClass( 'below-entry-meta' );\n }\n } else {\n element.removeClass( 'below-entry-meta' );\n caption.removeClass( 'below-entry-meta' );\n }\n } );\n }", "function addFooterTooltips(nFoot)\n\t{\n\t\tvar qTipOptions = MutationViewsUtil.defaultTableTooltipOpts();\n\n\t\tvar qTipOptionsFooter = {};\n\t\tjQuery.extend(true, qTipOptionsFooter, qTipOptions);\n\t\tqTipOptionsFooter.position = {my:'top center', at:'bottom center', viewport: $(window)};\n\n\t\tcbio.util.addTargetedQTip($(nFoot).find(\"th\"), qTipOptionsFooter);\n\t}", "function buildEnd(options) {\n html += `</main>\n\n <footer>\n <p>Copyright info?</p>\n </footer>\n </body>\n </html>`\n}", "function trackArticleAAMFooter(msg) {\n var s = s_gi(s_account);\n s.trackExternalLinks = false;\n s.linkTrackVars = 'prop6,eVar6';\n s.tl(this, 'o', msg);\n}", "function FreeMetadata(metadata) {\n binding.FreeMetadata(metadata);\n}", "function belowEntryMetaClass( param ) {\n\t\tif ( body.hasClass( 'page' ) || body.hasClass( 'search' ) || body.hasClass( 'single-attachment' ) || body.hasClass( 'error404' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$( '.entry-content' ).find( param ).each( function() {\n\t\t\tvar element = $( this ),\n\t\t\t\telementPos = element.offset(),\n\t\t\t\telementPosTop = elementPos.top,\n\t\t\t\tentryFooter = element.closest( 'article' ).find( '.entry-footer' ),\n\t\t\t\tentryFooterPos = entryFooter.offset(),\n\t\t\t\tentryFooterPosBottom = entryFooterPos.top + ( entryFooter.height() + 28 ),\n\t\t\t\tcaption = element.closest( 'figure' ),\n\t\t\t\tnewImg;\n\n\t\t\t// Add 'below-entry-meta' to elements below the entry meta.\n\t\t\tif ( elementPosTop > entryFooterPosBottom ) {\n\n\t\t\t\t// Check if full-size images and captions are larger than or equal to 840px.\n\t\t\t\tif ( 'img.size-full' === param ) {\n\n\t\t\t\t\t// Create an image to find native image width of resized images (i.e. max-width: 100%).\n\t\t\t\t\tnewImg = new Image();\n\t\t\t\t\tnewImg.src = element.attr( 'src' );\n\n\t\t\t\t\t$( newImg ).load( function() {\n\t\t\t\t\t\tif ( newImg.width >= 840 ) {\n\t\t\t\t\t\t\telement.addClass( 'below-entry-meta' );\n\n\t\t\t\t\t\t\tif ( caption.hasClass( 'wp-caption' ) ) {\n\t\t\t\t\t\t\t\tcaption.addClass( 'below-entry-meta' );\n\t\t\t\t\t\t\t\tcaption.removeAttr( 'style' );\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} else {\n\t\t\t\t\telement.addClass( 'below-entry-meta' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\telement.removeClass( 'below-entry-meta' );\n\t\t\t\tcaption.removeClass( 'below-entry-meta' );\n\t\t\t}\n\t\t} );\n\t}", "function _getMetadata(anchor) {\n\t\treturn '';\n\t}", "function onToggleFooterSection() {\n setAttributes(toggleSection(attributes, 'foot'));\n }", "getFooter() {\n return '</quiz>';\n }", "install() {\n let el = document.getElementsByTagName(\"footer\")\n if (el) { // there should only be one footer...\n let message = this.message\n el[0].innerHTML = `\n <div class=\"footer_copyright\">&copy; 2015—-${ moment().year() } <a href=\"http://www.oscars-sa.eu/\" title=\"Oscars s.a.\" alt=\"Oscars s.a.\">Oscars s.a.</a></div>\n <div class=\"footer_message\">${ message }</div>\n <div class=\"footer_byline\">designed by <a href=\"https://github.com/devleaks\" title=\"Devleaks' github\" alt=\"Devleaks' github\">devleaks</a></div>\n `\n }\n this.listen(this.update.bind(this))\n }", "function Meta(metaId) {\n // Use d3 to connect to the json\n d3.json(sdata).then((data) => {\n MetaHuman = data.metadata\n var fdata = MetaHuman.filter(object => object.id == metaId)[0];\n // Connect to the sample-metadata id on the html through a variable\n var metapanel = d3.select(\"#sample-metadata\")\n\n // Append each key value pair the object.entries code\n Object.entries(fdata).forEach(([key, value]) => {\n metapanel.append(\"metapanel\").text(`${key}: ${value}`)\n });\n });\n}", "function getFooter(options) {\n\n\t// -- get this year\n\tlet date = new Date().getFullYear();\n\n\t// -- update the variables\n\toptions.name ? options.name : null;\n\toptions.url ? options.url : null;\n\toptions.copyYear ? options.copyYear : date;\n\toptions.policy ? options.policy : false;\n\toptions.terms ? options.terms : false;\n\toptions.cookies ? options.cookies : false;\n\toptions.customStyle ? options.customStyle : false;\n}", "function renderFooter() {\n\t\tfooter.setToolbarOptions(computeFooterOptions());\n\t\tfooter.render();\n\t\tif (footer.el) {\n\t\t\telement.append(footer.el);\n\t\t}\n\t}", "function createMetadata(article) {\n // Authors. Title. Journal. Year Month;Volume(Issue):Pages. Times cited: n. Percentile rank in Field: n.\n var year = parseInt(article.cover_date.split(\".\")[2]);\n var month = parseInt(article.cover_date.split(\".\")[1]);\n return article.authors.replace(new RegExp('\\\\|', 'g'), ', ') + \". \" +\n article.title + \". \" +\n article.publication_name + \". \" +\n year + \" \" + month + \";\" +\n article.volume + \"(\" + article.issue + \"):\" + article.pages + \". \" +\n \"Times cited: \" + article.citation_count + \". \" +\n \"Percentile rank in field: \" + article.percentile_rank_dummy_data + \".<br /><br />\" +\n \"<a href='http://vivo.med.cornell.edu/display/pubid\" + article.scopus_doc_id + \"'>View details &#9654;</a>\";\n}", "function printFooter()\r\n{\r\n\ttry\r\n\t{\r\n\r\n\t\tpdfxml += '</body></pdf>';\r\n\t}\r\n\tcatch(e)\r\n\t{\r\n\t\terrorHandler('printFooter', e);\r\n\t}\r\n}", "function loadMetadata() {\n\tvar s = '<thead><td class=\"textcell1\">Type</td><td class=\"textcell2\"><span id=\"mprop\"></span></td><td class=\"textcell3\"><span id=\"mval\"></span></td><td class=\"textcell4\">Information</td></thead>';\n\ts += '<tbody>';\n\ts += stringLine4Val( 'codeMetadata', '<span id=\"tytitle\">-</span>', '-', '', '<span id=\"infotytitle\">-</span>', 'writehalf' );\n\ts += stringLine4Val( 'codeMetadata', 'Transcription', '<span id=\"tyname\">-</span>', '', '<span id=\"infotyname\">-</span>', 'writehalf' ); // put 'readonly' if edit the filename in metadata is not permitted anymore\n\ts += stringLine4Val( 'codeMetadata', 'Transcription', '<span id=\"tyloc\">-</span>', '', '<span id=\"infotyloc\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', 'Transcription', '<span id=\"tydate\">-</span>', '', '<span id=\"infotydate\">-</span>', 'writehalf' );\n\ts += stringLine4Val( 'codeMetadata', 'Transcription', '<span id=\"typlacen\">-</span>', '', '<span id=\"infoplacen\">-</span>', 'writehalf' );\n\ts += stringLine4Val( 'codeMetadata', 'Media', '<span id=\"tymname\">-</span>', '', '<span id=\"infotymname\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', 'Media', '<span id=\"tymrelloc\">-</span>', '', '<span id=\"infotymrelloc\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', 'Media', '<span id=\"tymloc\">-</span>', '', '<span id=\"infotymloc\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', 'Media', '<span id=\"tymtype\">-</span>', '', '<span id=\"infotymtype\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', 'Media', '<span id=\"tymdur\">-</span>', '', '<span id=\"infotymdur\">-</span>', 'readonly' );\n\ts += stringLine4Val( 'codeMetadata', '-', '-', '-', '---', 'readonly' );\n\t/*\n\t * et on y ajoute les notes s'il y en a (compatibilité anciens formats)\n\t */\n\tif (trjs.data.note) {\n\t\tfor (var i = 0; i < trjs.data.note.length; i++) {\n s += stringLine4Val( 'codeMetadata', trjs.data.note[i]['type'], trjs.data.note[i]['property'], trjs.data.note[i]['value'], trjs.data.note[i]['info'] );\n\t\t}\n\t}\n\ts += stringLine4Val( 'codeMetadata', '-', '-', '-', '---', 'readonly' );\n\tif (trjs.data.metadata) {\n for (var i=0 ; i < trjs.data.metadata.length; i++) {\n s += stringLine4Val( 'codeMetadata', trjs.data.metadata[i]['type'], trjs.data.metadata[i]['property'], trjs.data.metadata[i]['value'], trjs.data.metadata[i]['info'] );\n }\n\t}\n\ts += '</tbody>';\n\t$('#metadata').html(s);\n}", "function createFooter() {\n var foot = document.createElement(\"footer\");\n foot.setAttribute(\"class\", \"footer fixed-bottom mt-auto py-2\");\n \n var footDiv = document.createElement(\"div\");\n footDiv.setAttribute(\"class\", \"container-fluid\");\n \n var footDivSpan = document.createElement(\"span\");\n footDivSpan.setAttribute(\"class\", \"text-muted\");\n footDivSpan.innerHTML =\n 'Designed with <i class=\"fas fa-heart\" style=\"color:red\"></i> by Prashant Gupta(<a href=\"https://github.com/codyprashant/new-york-times-api\" target=\"_blank\" style=\"color: crimson;\">@codyPrashant</a>)';\n \n footDiv.appendChild(footDivSpan);\n foot.appendChild(footDiv);\n \n return foot;\n }", "function Footer({\n framework,\n lang,\n sliceContext: { framework: frameworkViaContext },\n}) {\n const { posts } = useContext(AppContext)\n\n const data = useStaticQuery(graphql`\n {\n site {\n siteMetadata {\n alias: title\n }\n }\n }\n `)\n\n return (\n <footer\n style={{\n marginTop: `10px`,\n fontSize: `12px`,\n }}\n >\n <span data-testid=\"footer-slice-context-value\">\n {frameworkViaContext}\n </span>\n <span data-testid=\"footer-static-text\">Built with {` `}</span>\n <span data-testid=\"footer-props\">{`${framework}${lang}`}</span>\n {` `}Posts Count:{\" \"}\n <span data-testid=\"footer-context-derieved-value\">{`${posts.length}`}</span>\n <span data-testid=\"footer-static-query-title\">\n {data.site.siteMetadata.alias}\n </span>\n </footer>\n )\n}", "function Footer() {\n const currentYear = new Date().getFullYear();\n\n return (\n <footer>\n <p>Copyright © {currentYear}</p>\n </footer>\n );\n }", "getFooter(mainFileName) {\n const ret =\n `files.exit = () => {\\n` +\n ` core.exit();\\n` +\n `};\\n` +\n `if (!isDryRun){ files['${mainFileName}'](); }\\n` +\n `return { files, scope }\\n` +\n `}`;\n return ret;\n }", "function displayPageFooterDescription(response) { \r\n var $footerDescription = $(\"#footer-description\");\r\n if(!$footerDescription.is(\":visible\")) {\r\n toggleTouLinksColor(\r\n (typeof (response.image) != \"undefined\" && response.image) ||\r\n (typeof (response.video) != \"undefined\" && response.video) ||\r\n (BROWSER && BROWSER == \"firefox\")\r\n );\r\n if (!getWelcomePageState()) {\r\n $(document).on(\"click\", \"#footer-description-close\", function () {\r\n changeWelcomePageState();\r\n $(\"#footer-description\").fadeOut(750);\r\n });\r\n setTimeout(function () {\r\n $footerDescription.fadeIn(750);\r\n }, 2500);\r\n }\r\n }\r\n displayTermsOfUse(response);\r\n}", "function footerBottom(){\n\tvar $footer = $('.footer');\n\tif($footer.length){\n\t\tvar $tplSpacer = $('<div />', {\n\t\t\tclass: 'spacer'\n\t\t});\n\n\t\t$('.main').after($tplSpacer.clone());\n\n\t\t$(window).on('load resizeByWidth', function () {\n\t\t\tvar footerOuterHeight = $footer.outerHeight();\n\t\t\t$footer.css({\n\t\t\t\t'margin-top': -footerOuterHeight\n\t\t\t});\n\n\t\t\t$('.spacer').css({\n\t\t\t\t'height': footerOuterHeight\n\t\t\t});\n\t\t});\n\t}\n}", "function compileMetaData(myMetaData) {\n\t\t$('#metaData').empty();\n\t\tfor (var i = 0; i < myMetaData.length; ++i) {\n\t\t\tsource = $('#metaDataTemplate').html();\n\t\t\ttemplate = Handlebars.compile(source);\n\t\t\tvar metaData = template(myMetaData[i]);\n\t\t\t$('#metaData').append(metaData);\n\t\t}\n\t}", "function updateOutputDataFooter() {\n console.log('updateOutputDataFooter');\n $('#output-data-footer').text('Total nodes: ' + gaOutputData.length);\n}", "function genfooterText(label, linkName, linkUrl, i, item) {\n\tlet nameText = \"\";\n\tlet urlText = \"\";\n\t//If in english return the name text and string text based on the matching header label\n\tif (isEnglish === true) {\n\t\tnameText = `footer.site.${label.substr(0,4).toLowerCase()}.name.${i} = ${linkName}`;\n\t\turlText = `footer.site.${label.substr(0,4).toLowerCase()}.url.${i} = ${linkUrl}`;\n\t}\n\t//If not in English return the name and url text with item and id number\n\telse if (isEnglish == false) {\n\t\t\n\t\tnameText = `footer.site.${item}.name.${i} = ${linkName}`;\n\t\turlText = `footer.site.${item}.url.${i} = ${linkUrl}`;\n\t\t\n\t}\n\t//Save the name and link text to the footer text array\n\tfooterText.push(nameText, urlText);\t\t\n}", "function footerLoaded(){\n\tlet footer = document.createElement(\"FOOTER\");\n\tfooter.setAttribute(\"id\", \"footer\");\n\t\n\tlet outTable = document.createElement(\"TABLE\");\n\toutTable.setAttribute(\"style\", \"width: 100%; height:200px;\");\n\tfooter.appendChild(outTable);\n\t\n\tlet outTr = document.createElement(\"TR\");\n\toutTable.appendChild(outTr);\n\t\n\t//table logo and social media link\n\tlet outTd1 = document.createElement(\"TD\");\n\toutTd1.setAttribute(\"valign\", \"center\");\n\toutTd1.setAttribute(\"align\", \"center\");\n\toutTr.appendChild(outTd1);\n\t\n\t//tr logo\n\tlet inTable1 = document.createElement(\"TABLE\");\n\toutTd1.appendChild(inTable1);\n\t\n\tlet inTr1_1 = document.createElement(\"TR\");\n\tinTable1.appendChild(inTr1_1);\n\t\n\tlet inTh1_1 = document.createElement(\"TH\");\n\tinTr1_1.appendChild(inTh1_1);\n\t\n\tlet imglogo1 = document.createElement(\"IMG\");\n\timglogo1.setAttribute(\"src\", \"images/footer/Logo-removebg1.png\");\n\timglogo1.setAttribute(\"alt\", \"logo\");\n\timglogo1.setAttribute(\"width\", 25);\n\timglogo1.setAttribute(\"height\", 25);\n\tinTh1_1.appendChild(imglogo1);\n\t\n\tlet inTh1_2 = document.createElement(\"TH\");\n\tinTh1_2.setAttribute(\"colspan\", \"2\");\n\tinTr1_1.appendChild(inTh1_2);\n\t\n\tlet imglogo2 = document.createElement(\"IMG\");\n\timglogo2.setAttribute(\"src\", \"images/footer/Logo-removebg2.png\");\n\timglogo2.setAttribute(\"alt\", \"logo\");\n\timglogo2.setAttribute(\"width\", 150);\n\timglogo2.setAttribute(\"height\", 25);\n\tinTh1_2.appendChild(imglogo2);\n\t\n\t//tr social media link\n\tlet inTr1_2 = document.createElement(\"TR\");\n\tinTable1.appendChild(inTr1_2);\n\t\n\t//fb link\n\tlet inTd1_1 = document.createElement(\"TD\");\n\tinTd1_1.setAttribute(\"style\", \"text-align:right;\");\n\tinTr1_2.appendChild(inTd1_1);\n\t\n\tlet fbLink = document.createElement(\"A\");\n\tfbLink.setAttribute(\"href\", \"https://www.facebook.com/sanjosestate/\");\n\tinTd1_1.appendChild(fbLink);\n\t\n\tlet imgfb = document.createElement(\"IMG\");\n\timgfb.setAttribute(\"src\", \"images/footer/fb_icon.png\");\n\timgfb.setAttribute(\"alt\", \"fbicon\");\n\timgfb.setAttribute(\"width\", 30);\n\timgfb.setAttribute(\"height\", 30);\n\tfbLink.appendChild(imgfb);\n\t\n\t//ig link\n\tlet inTd1_2 = document.createElement(\"TD\");\n\tinTd1_2.setAttribute(\"style\", \"text-align:right;\");\n\tinTr1_2.appendChild(inTd1_2);\n\t\n\tlet igLink = document.createElement(\"A\");\n\tigLink.setAttribute(\"href\", \"https://www.instagram.com/sjsu/\");\n\tinTd1_2.appendChild(igLink);\n\t\n\tlet imgig = document.createElement(\"IMG\");\n\timgig.setAttribute(\"src\", \"images/footer/ig_icon.png\");\n\timgig.setAttribute(\"alt\", \"igicon\");\n\timgig.setAttribute(\"width\", 25);\n\timgig.setAttribute(\"height\", 25);\n\tigLink.appendChild(imgig);\n\t\n\t//twitter link\n\tlet inTd1_3 = document.createElement(\"TD\");\n\tinTd1_3.setAttribute(\"style\", \"text-align:right;\");\n\tinTr1_2.appendChild(inTd1_3);\n\t\n\tlet twLink = document.createElement(\"A\");\n\ttwLink.setAttribute(\"href\", \"https://twitter.com/sjsu\");\n\tinTd1_3.appendChild(twLink);\n\t\n\tlet imgtw = document.createElement(\"IMG\");\n\timgtw.setAttribute(\"src\", \"images/footer/twitter_icon.png\");\n\timgtw.setAttribute(\"alt\", \"twicon\");\n\timgtw.setAttribute(\"width\", 25);\n\timgtw.setAttribute(\"height\", 25);\n\ttwLink.appendChild(imgtw);\n\t\n\t//table contact info\n\t//tr contact head text\n\tlet outTd2 = document.createElement(\"TD\");\n\toutTd2.setAttribute(\"valign\", \"top\");\n\toutTd2.setAttribute(\"align\", \"center\");\n\toutTr.appendChild(outTd2);\n\t\n\tlet inTable2 = document.createElement(\"TABLE\");\n\toutTd2.appendChild(inTable2);\n\t\n\tlet inTr2_1 = document.createElement(\"TR\");\n\tinTr2_1.setAttribute(\"style\", \"height:50px; text-align:left;\");\n\tinTable2.appendChild(inTr2_1);\n\t\n\tlet inTh2 = document.createElement(\"TH\");\n\tinTh2.setAttribute(\"colspan\", \"2\");\n\tinTr2_1.appendChild(inTh2);\n\t\n\tlet heading3_1 = document.createElement(\"H3\");\n\tinTh2.appendChild(heading3_1);\n\t\n\tlet txthd1 = document.createTextNode(\"Contact us\");\n\theading3_1.appendChild(txthd1);\n\t\n\t//tr contact body text\n\t//email icon\n\tlet inTr2_2 = document.createElement(\"TR\");\n\tinTr2_2.setAttribute(\"style\", \"height:50px;\");\n\tinTable2.appendChild(inTr2_2);\n\t\n\tlet inTd2_1 = document.createElement(\"TH\");\n\tinTr2_2.appendChild(inTd2_1);\n\t\n\tlet imgemail = document.createElement(\"IMG\");\n\timgemail.setAttribute(\"src\", \"images/footer/email_icon.png\");\n\timgemail.setAttribute(\"alt\", \"emailicon\");\n\timgemail.setAttribute(\"width\", 30);\n\timgemail.setAttribute(\"height\", 30);\n\tinTd2_1.appendChild(imgemail);\n\t//email info\n\tlet inTd2_2 = document.createElement(\"TH\");\n\tinTr2_2.appendChild(inTd2_2);\n\t\n\tlet heading4_1 = document.createElement(\"H4\");\n\tinTd2_2.appendChild(heading4_1);\n\t\n\tlet txtinfo1 = document.createTextNode(\"info@superestate.com\");\n\theading4_1.appendChild(txtinfo1);\n\t\n\t//phone icon\n\tlet inTr2_3 = document.createElement(\"TR\");\n\tinTr2_3.setAttribute(\"style\", \"height:50px;\");\n\tinTable2.appendChild(inTr2_3);\n\t\n\tlet inTd2_3 = document.createElement(\"TH\");\n\tinTr2_3.appendChild(inTd2_3);\n\t\n\tlet imgphone = document.createElement(\"IMG\");\n\timgphone.setAttribute(\"src\", \"images/footer/phone_icon.png\");\n\timgphone.setAttribute(\"alt\", \"phoneicon\");\n\timgphone.setAttribute(\"width\", 30);\n\timgphone.setAttribute(\"height\", 30);\n\tinTd2_3.appendChild(imgphone);\n\t//phone info\n\tlet inTd2_4 = document.createElement(\"TH\");\n\tinTr2_3.appendChild(inTd2_4);\n\t\n\tlet heading4_2 = document.createElement(\"H4\");\n\tinTd2_4.appendChild(heading4_2);\n\t\n\tlet txtinfo2 = document.createTextNode(\"(408) 859-7420\");\n\theading4_2.appendChild(txtinfo2);\n\t\n\t//address icon\n\tlet inTr2_4 = document.createElement(\"TR\");\n\tinTr2_4.setAttribute(\"style\", \"height:50px;\");\n\tinTable2.appendChild(inTr2_4);\n\t\n\tlet inTd2_5 = document.createElement(\"TH\");\n\tinTr2_4.appendChild(inTd2_5);\n\t\n\tlet imgadd = document.createElement(\"IMG\");\n\timgadd.setAttribute(\"src\", \"images/footer/map_icon.png\");\n\timgadd.setAttribute(\"alt\", \"mapicon\");\n\timgadd.setAttribute(\"width\", 30);\n\timgadd.setAttribute(\"height\", 25);\n\tinTd2_5.appendChild(imgadd);\n\t//address info\n\tlet inTd2_6 = document.createElement(\"TH\");\n\tinTr2_4.appendChild(inTd2_6);\n\t\n\tlet heading4_3 = document.createElement(\"H4\");\n\tinTd2_6.appendChild(heading4_3);\n\t\n\tlet txtinfo3 = document.createTextNode(\"2836 Walnut Grove Ave\");\n\theading4_3.appendChild(txtinfo3);\n\tlet br=document.createElement(\"BR\");\n\theading4_3.appendChild(br);\n\tlet txtinfo3_2 = document.createTextNode(\"San Jose, CA 95128\");\n\theading4_3.appendChild(txtinfo3_2);\n\t\n\t//table update\n\t//tr update head text\n\tlet outTd3 = document.createElement(\"TD\");\n\toutTd3.setAttribute(\"valign\", \"top\");\n\toutTd3.setAttribute(\"align\", \"center\");\n\toutTr.appendChild(outTd3);\n\t\n\tlet inTable3 = document.createElement(\"TABLE\");\n\toutTd3.appendChild(inTable3);\n\t\n\tlet inTr3_1 = document.createElement(\"TR\");\n\tinTr3_1.setAttribute(\"style\", \"height:50px; text-align:left;\");\n\tinTable3.appendChild(inTr3_1);\n\t\n\tlet inTh3 = document.createElement(\"TH\");\n\tinTr3_1.appendChild(inTh3);\n\t\n\tlet heading3_2 = document.createElement(\"H3\");\n\tinTh3.appendChild(heading3_2);\n\t\n\tlet txthd2 = document.createTextNode(\"For updates\");\n\theading3_2.appendChild(txthd2);\n\t\n\t//tr form\n\tlet inTr3_2 = document.createElement(\"TR\");\n\tinTr3_2.setAttribute(\"style\", \"height:30px;\");\n\tinTable3.appendChild(inTr3_2);\n\t\n\tlet inTd3_1 = document.createElement(\"TD\");\n\tinTr3_2.appendChild(inTd3_1);\n\t\n\tlet formSub = document.createElement(\"FORM\");\n\tformSub.setAttribute(\"id\", \"inputform\");\n\tinTd3_1.appendChild(formSub);\n\t\n\tlet input1 = document.createElement(\"INPUT\");\n\tinput1.setAttribute(\"id\", \"useremail\");\n\tinput1.setAttribute(\"type\", \"email\");\n\tinput1.setAttribute(\"placeholder\", \"example@gmail.com\");\n\tformSub.appendChild(input1);\n\tlet br2 = document.createElement(\"BR\");\n\tformSub.appendChild(br2);\n\t\n\t//input button\n\tlet input2 = document.createElement(\"INPUT\");\n\tinput2.setAttribute(\"id\", \"subscribe\");\n\tinput2.setAttribute(\"type\", \"submit\");\n\tinput2.setAttribute(\"value\", \"SUBSCRIBE\");\n\tinput2.setAttribute(\"onclick\", \"buttonPressed()\");\n\tformSub.appendChild(input2);\n\t\n\t//copyright\n\tlet p = document.createElement(\"p\");\n\tp.setAttribute(\"style\", \"float:right;color:black;margin:3px;\");\n\tfooter.appendChild(p);\n\t\n\tlet txtword = document.createTextNode(\"© 2020 Superestate Corp. All rights reserved.\");\n\tp.appendChild(txtword);\n\t\n\tdocument.body.insertBefore(footer, document.body.nextSibling);\n\n\tvar form = document.getElementById(\"inputform\");\n\tfunction handleForm(event) { event.preventDefault(); } \n\tform.addEventListener('submit', handleForm);\n\t\n}", "function zoto_detail_meta_info(options) {\n\tthis.options = options || {};\n\tthis.options.mode = this.options.mode || 'page'; // 'page' or 'modal'\n\n\t/*\n\t * Create our page elements\n\t */\n\tvar desc_epaper_options = {'attribute': \"description\", 'multi_line': 1, 'starting_text': _(\"click here to add a photo description.\")};\n\tvar tag_cloud_options = {'can_delete': true, 'weighted': false};\n\tif(this.options.mode == 'modal') {\n\t\tdesc_epaper_options['maxchar'] = 300;\n\t\ttag_cloud_options['tag_count'] = 15;\n\t} else {\n\t\tthis.modal_licensing = new zoto_modal_licensing(this.options.mode);\n\t\tthis.a_edit_license = A({'href':\"javascript:void(0)\"}, \"edit\");\n\t\tthis.edit_license = SPAN({'style':\"font-size: 9px;\"}, \" (\", this.a_edit_license, \")\");\n\t}\n\tthis.title_epaper = new zoto_e_paper_lite({'id': \"title_epaper\", 'blur_update': true, 'attribute': \"title\", 'starting_text': _(\"click here to add a title\")});\n\tthis.description_epaper = new zoto_e_paper_image_attributes(desc_epaper_options);\n\tthis.tags_header = DIV({'style': \"margin-bottom: 3px\"}, H3({}, _('tags')));\n\tthis.look_ahead = new zoto_tag_lookahead({min_length: 3, allow_spaces: true});\n\tthis.tag_cloud = new zoto_image_tag_cloud(tag_cloud_options);\n\n\t//replaceChildNodes(this.albums_header, H3({'style': \"margin-top: 10px;\"}, _(\"albums\")));\n\t//this.albums_header = DIV({'syle': \"margin-bottom: 10px; margin-top: 10px;\"});\n\tthis.albums_header = H3({'style': \"margin-top: 10px;\"}, _(\"albums\"));\n\tthis.album_list = SPAN({}, \"\");\n\n\t//\n\t// Advanced info\n\t//\n\tthis.perms = SPAN({});\n\tthis.license_text = SPAN({}, \"\");\n\n\tthis.date_taken_link = A({'href': \"javascript: void(0);\"}, \"\");\n\tthis.date_taken = SPAN({});\n\tthis.date_taken_holder = SPAN({}, _('taken: '), this.date_taken);\n\n\tthis.date_uploaded = SPAN({});\n\tthis.date_uploaded_holder = SPAN({}, _(\"uploaded: \"), this.date_uploaded);\n\t\t\n\t/* Advanced info */\n\tvar advanced = DIV({'style': \"margin-top: 5px\"},\n\t\tH3({}, _('advanced info')),\n\t\tthis.perms,\n\t\tthis.license_text, BR({'clear':\"ALL\"}),\n\t\tthis.date_taken_holder, BR({'clear':\"ALL\"}),\n\t\tthis.date_uploaded_holder, BR()\n\t);\n\n\tif (this.options.mode == \"page\") {\n\t\n\t\tthis.filename = SPAN({});\n\t\tthis.filename_holder = SPAN({}, _(\"filename\"), ': ', this.filename, BR());\n\t\n\t\tthis.source_name = SPAN({});\n\t\tthis.source_name_holder = SPAN({}, _(\"uploaded via\"), \": \", this.source_name, BR());\n\t\n\t\tthis.camera_make = SPAN({});\n\t\tthis.camera_make_holder = SPAN({}, _(\"make\"), \": \", this.camera_make, BR());\n\t\n\t\tthis.camera_model = SPAN({});\n\t\tthis.camera_model_holder = SPAN({}, _(\"model\"), \": \", this.camera_model, BR());\n\t\n\t\tthis.iso_speed = SPAN({});\n\t\tthis.iso_speed_holder = SPAN({}, _(\"iso speed\"), \": \", this.iso_speed, BR());\n\t\n\t\tthis.focal_length = SPAN({});\n\t\tthis.focal_length_holder = SPAN({}, _(\"focal length\"), \": \", this.focal_length, BR());\n\t\n\t\tthis.fstop = SPAN({});\n\t\tthis.fstop_holder = SPAN({}, _(\"f-stop\"), \": \", this.fstop, BR());\n\t\n\t\tthis.exposure_time = SPAN({});\n\t\tthis.exposure_time_holder = SPAN({}, _(\"exposure time\"), \": \", this.exposure_time, BR());\n\t\n\t\tvar extra_advanced = DIV({id: 'extra_advanced'}, \n\t\t\tthis.filename_holder,\n\t\t\tthis.source_name_holder,\n\t\t\tthis.camera_make_holder,\n\t\t\tthis.camera_model_holder,\n\t\t\tthis.iso_speed_holder,\n\t\t\tthis.focal_length_holder,\n\t\t\tthis.fstop_holder,\n\t\t\tthis.exposure_time_holder\n\t\t);\n\t\tappendChildNodes(advanced, extra_advanced);\n\t\tthis.advanced_link = element_opener(extra_advanced, _(\"view all advanced info\"), _(\"hide advanced info\"));\n\t} else {\n\t\tthis.advanced_link = A({'href': \"javascript: void(0);\"}, _(\"more\"));\n\t}\n\tappendChildNodes(advanced, this.advanced_link);\n\n\tthis.el = DIV({id: 'meta_holder'},\n\t\tthis.title_epaper.el,\n\t\tthis.description_epaper.el,\n\t\tthis.tags_header,\n\t\tthis.look_ahead.el,\n\t\tthis.tag_cloud.el,\n\t\tthis.albums_header,\n\t\tthis.album_list,\n\t\tadvanced\n\t);\n\t\n\tconnect(this.title_epaper, 'EPAPER_EDITED', this, 'handle_edit');\n\tconnect(this.title_epaper, 'IMAGE_ATTRIBUTE_CHANGED', this, function(new_value) {\n\t\tthis.info.title = new_value;\n\t});\n\tconnect(this.tag_cloud, 'TAG_CLICKED', this, function(tag_name) {\n\t\tsignal(this, 'TAG_CLICKED', tag_name);\n\t});\n\tconnect(this.description_epaper, 'IMAGE_ATTRIBUTE_CHANGED', this, function(new_value) {\n\t\tthis.info.description = new_value;\n\t});\n\tconnect(this.look_ahead, 'NEW_TAG_ADDED', this.tag_cloud, 'refresh');\n\tconnect(this.look_ahead, 'NEW_TAG_ADDED', this, function(){\n\t\tsignal(this, 'NEW_TAG_ADDED');\n\t});\n\tconnect(authinator, 'USER_LOGGED_IN', this, 'update');\n\tconnect(this.date_taken_link, 'onclick', this, function(e) {\n\t\tsignal(this, 'DATE_CLICKED', this.info.date);\n\t});\n\n\tif (this.options.mode == \"page\") {\n\t\tconnect(this.a_edit_license, 'onclick', this, function(e){\n\t\t\tthis.modal_licensing.handle_image_detail_click(this.media_id)\n\t\t});\n\t\tconnect(this.modal_licensing, \"LICENSE_UPDATED\", this, function(result){\n\t\t\tthis.info.license = Number(result);\n\t\t\tthis.update();\n\t\t});\n\t} else {\n\t\tconnect(this.advanced_link, 'onclick', this, function(e) {\n\t\t\tcurrentDocument().modal_manager.move_zig();\n\t\t\tcurrentWindow().site_manager.update(this.info.owner_username, 'detail', this.media_id);\n\t\t});\n\t\tconnect(this.description_epaper, 'MORE_CLICKED', this, function(e) {\n\t\t\tcurrentDocument().modal_manager.move_zig();\n\t\t\tcurrentWindow().site_manager.update(this.info.owner_username, 'detail', this.media_id);\n\t\t});\n\t\tconnect(this.tag_cloud, 'MORE_CLICKED', this, function(e) {\n\t\t\tcurrentDocument().modal_manager.move_zig();\n\t\t\tcurrentWindow().site_manager.update(this.info.owner_username, 'detail', this.media_id);\n\t\t});\n\t}\n\n\tthis.a_cc_icon_attribution = this.create_license_icon(\n\t\t['attribution'], \"by\");\n\tthis.a_cc_icon_noderivs = this.create_license_icon(\n\t\t['attribution', 'noderivs'], \"by-nd\");\n\tthis.a_cc_icon_noncomm_noderivs = this.create_license_icon(\n\t\t['attribution', 'noderivs', 'noncomm'], \"by-nc-nd\");\n\tthis.a_cc_icon_noncomm = this.create_license_icon(\n\t\t['attribution', 'noncomm'], \"by-nc\");\n\tthis.a_cc_icon_noncomm_sharealike = this.create_license_icon(\n\t\t['attribution', 'noncomm', 'sharealike'], \"by-nc-sa\");\n\tthis.a_cc_icon_sharealike = this.create_license_icon(\n\t\t['attribution', 'sharealike'], 'by-sa');\n}", "function generateTableFooter(nFoot, aasData, iStart, iEnd, aiDisplay ) {\n\t// Will be set as true if a sum is computed\n\tvar hasSums = false;\n\t\n\tif (aiDisplay.length > 0) {\n\t\t// Table which stores sums\n\t\tvar result = [];\n\t\t$('#dynamictable > thead > tr:first-child > th:visible').each(function (index, element) {\n\t\t\tif ($(element).hasClass('displaysum'))\n\t\t\t\tresult[index] = 0;\n\t\t\telse\n\t\t\t\tresult[index] = NaN;\n\t\t});\n\t\t\n\t\t// Sums computation of displayed data\n\t\tfor (var i = 0; i < aiDisplay.length; i++) {\n\t\t\tfor (var j = 0; j < result.length; j++) {\n\t\t\t\tif (!isNaN(result[j]))\n\t\t\t\t\tresult[j] += Number(aasData[aiDisplay[i]][j]);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Display of sums\n\t\tfor (var i = 0; i < result.length; i++) {\n\t\t\t// Replace NaN by \"\"\n\t\t\tvar colResult = result[i];\n\t\t\tif (isNaN(colResult))\n\t\t\t\tcolResult = \"\";\n\t\t\telse\n\t\t\t\thasSums = true;\n\t\t\t$('th', nFoot).eq(i).text(colResult);\n\t\t}\n\t}\n\t\n\t// Display the footer if there is sums to display\n\tif (!hasSums)\n \t$(nFoot).hide();\n\telse\n\t\t$(nFoot).show();\n}", "function createElementMetadata(context, elementDir, elementTag, widgetDir, directoryType) {\n\n // Load up the widget metadata for later if we are under a widget.\n const widgetMetadata = widgetDir ? readMetadataFromDisk(widgetDir, constants.widgetMetadataJson) : null\n\n // Create the default internal metadata that the user cannot change.\n // Note that we are missing the element repositoryId and widgetId which will be added when we create the element.\n const internalMetadata = {\n \"tag\": elementTag,\n \"source\": 101,\n \"type\": context.type,\n \"title\": context.elementName\n }\n\n // Element is to be under a widget so we need the widget version.\n if (widgetMetadata) {\n internalMetadata.version = widgetMetadata.version\n }\n\n // Write it out to the tracking dir.\n writeMetadata(`${elementDir}/${constants.elementMetadataJson}`, internalMetadata)\n\n // Load the default user modifiable metadata using the dust template.\n renderWithTemplate(figureElementPath(\"exampleMetadataJson\"), context, (err, out) => {\n\n // Turn it into JSON so we can mess with it.\n const metadata = JSON.parse(out)\n\n // Add in translations array but only fully populate it if users ask for it.\n metadata.translations = createElementMetadataTranslations(context)\n\n // Figure out the element availability.\n if (directoryType == PuttingFileType.WIDGET || directoryType == PuttingFileType.WIDGET_ELEMENT) {\n\n // Under a widget. Just make it usable with that widget.\n metadata.supportedWidgetType = [widgetMetadata.widgetType]\n } else {\n\n // Element is global. Make it usable with any widget.\n metadata.availableToAllWidgets = true\n }\n\n // Write out the metadata.\n writeFile(`${elementDir}/${constants.userElementMetadata}`, JSON.stringify(metadata, null, 2))\n })\n}", "function createDefaultFooter() {\n footer = document.createElement(\"footer\");\n\n let footerContainer = document.createElement(\"div\");\n footerContainer.setAttribute(\"id\", \"footerContainer\");\n footer.appendChild(footerContainer);\n\n let zaanLogo = document.createElement(\"img\");\n zaanLogo.setAttribute(\"src\", \"/img/ZAAN/ZAAN_Logo_Invert_NoText.svg\");\n zaanLogo.setAttribute(\"height\", \"60px\");\n zaanLogo.setAttribute(\"alt\", \"ZAAN Games Logo\");\n zaanLogo.setAttribute(\"onerror\", \"this.src='./img/ZAAN/ZAAN_Logo_Invert_NoText_Small.png\");\n footerContainer.appendChild(zaanLogo);\n\n let emailParagraph = document.createElement(\"p\");\n let emailText = document.createTextNode(\"General @ Mytholympics.com\");\n emailParagraph.appendChild(emailText);\n footerContainer.appendChild(emailParagraph);\n\n let copyrightHeader = document.createElement(\"h2\");\n let copyrightText = document.createTextNode(\"ZAAN Games \\u00A9 2018\");\n copyrightHeader.appendChild(copyrightText);\n footerContainer.appendChild(copyrightHeader);\n\n document.body.appendChild(footer);\n\n handleFooterPositioning();\n}", "function _generateFooterReport() {\n\t\n\n\tthis.htmlFile.writeln( \"</body>\");\n\tthis.htmlFile.writeln( \"</html>\");\n}", "function searchForMetadata(node)\n{\n var current = node;\n while (current !== null)\n {\n if (current.type == 'code_block')\n {\n // console.log('checking code block');\n var metadataExpr = /document-metadata/\n var friendlyNameExpr = /friendly-name\\:(.*)/\n var pubDateExpr = /publish-date\\:(.*)/\n if (metadataExpr.test(current.literal))\n {\n console.log(\"is metadata block\");\n var matches = current.literal.match(friendlyNameExpr);\n if (matches.length > 1)\n {\n friendlyTitle = matches[1].trim();\n }\n\n var matches = current.literal.match(pubDateExpr);\n if (matches.length > 1)\n {\n publishDate = new Date(matches[1].trim());\n }\n\n current.unlink();\n }\n }\n\n if (current.firstChild != null)\n {\n searchForMetadata(current.firstChild);\n }\n current = current.next;\n }\n}", "function Footer() {\n return (\n <Wrapper>\n <section>This project is licensed under the MIT license.</section>\n <section>语言选择开关</section>\n <section>\n Made with love by\n <A href=\"https://twitter.com/mxstbr\">Max Stoiber</A>,\n </section>\n </Wrapper>\n );\n}", "function changeFooterText(){\n\n }", "function updateInputDataFooter() {\n console.log('updateInputDataFooter');\n $('#input-data-footer').text('Total ' + DATATYPE_NAME[gDataType] + 's: ' + gaInputData.length);\n}", "function buildFooter (filename) {\n const challengeNumber = filename.split('_')[0]\n const nearbyChallenges = getNearbyChallenges(challengeNumber)\n\n // No further content necessary apart from nearby Challenges\n return partialTemplates.chalFooter(nearbyChallenges)\n}", "function NextYearBoth(feet, theYear) {\n feet.innerHTML = \"\\<h5\\>\\&copy 2016 - \" + theYear + \" Junior Developer Toolbox. All Rights Reserved. \\<br \\/\\>A Member of the Complete Developer Family \\&copy 2015 - \" + theYear + \" \\<a href=\\\"http:\\/\\/completedeveloperpodcast.com\\\" \\> \\<img class=\\\"CDPlogo\\\" src= \\\"http:\\/\\/completedeveloperpodcast.com\\/wp-content\\/uploads\\/2015\\/09\\/JPEG300_iTunes.jpg\\\" \\> Complete Developer Podcast\\<\\/a\\>. All rights reserved.\\<\\/h5 \\> \";\n document.getElementById(\"footer\").appendChild(feet);\n}", "function footerAlign() {\r\n jQuery('.site-footer').css('display', 'block');\r\n jQuery('.site-footer').css('height', 'auto');\r\n var footerHeight = jQuery('.site-footer').outerHeight();\r\n jQuery('.footer-fixed > .page-wraper').css('padding-bottom', footerHeight);\r\n jQuery('.site-footer').css('height', footerHeight);\r\n}", "function addMetadata(vFile, destinationFilePath) {\n vFile.data = {\n destinationFilePath,\n destinationDir: path.dirname(destinationFilePath),\n };\n}", "function addMetadata(vFile, destinationFilePath) {\n vFile.data = {\n destinationFilePath,\n destinationDir: path.dirname(destinationFilePath),\n };\n}", "function addMetadata(vFile, destinationFilePath) {\n vFile.data = {\n destinationFilePath,\n destinationDir: path.dirname(destinationFilePath),\n };\n}", "function addFooter() {\n DataRow = document.createElement('tr');\n table.appendChild(DataRow);\n\n emptycol = document.createElement('td');\n emptycol.textContent = 'Total';\n DataRow.appendChild(emptycol);\n\n for (var tot = 0; tot < colSum.length; tot++) {\n\n var TotalRow = document.createElement('td');\n TotalRow.textContent = colSum[tot];\n DataRow.appendChild(TotalRow);\n }\n\n}", "function animateFooter(fc, id) {\n fc.css(\"display\", \"block\");\n anime({\n targets: id + ' .wpc-footer > .names',\n translateX: 100 + \"px\",\n opacity: [1, 0],\n // scale: [.75, .9],\n delay: function (el, index) {\n return index * 380;\n },\n direction: 'reverse'\n });\n }" ]
[ "0.62264466", "0.6184167", "0.5966228", "0.59176284", "0.5886173", "0.5870695", "0.5862643", "0.57946664", "0.5774751", "0.5730894", "0.5713376", "0.5695958", "0.56797725", "0.5661281", "0.5631116", "0.5621426", "0.5594163", "0.5558887", "0.5527553", "0.5520443", "0.55010873", "0.54962146", "0.546986", "0.54616374", "0.5436798", "0.54335415", "0.54276365", "0.54117143", "0.53969944", "0.5364226", "0.5361317", "0.53571504", "0.53513587", "0.5338782", "0.53376675", "0.5310431", "0.53082144", "0.53064454", "0.52898633", "0.5288277", "0.5276276", "0.5273125", "0.52696514", "0.5262876", "0.526255", "0.5250913", "0.52486855", "0.5246062", "0.5229771", "0.522343", "0.5204268", "0.51902103", "0.5162557", "0.51601726", "0.51494026", "0.5147152", "0.5146588", "0.5143214", "0.51366144", "0.5135327", "0.5134533", "0.51257914", "0.51106715", "0.5105516", "0.51043767", "0.51006746", "0.5098165", "0.5094882", "0.50938344", "0.50887215", "0.50874853", "0.5077402", "0.5072897", "0.50667053", "0.5025653", "0.50236094", "0.50221974", "0.50218344", "0.5020894", "0.50184786", "0.50073147", "0.50070304", "0.50024855", "0.49947444", "0.498955", "0.49766704", "0.49735847", "0.49621803", "0.49577072", "0.49530685", "0.49485707", "0.4945771", "0.4937199", "0.49366227", "0.4918499", "0.4910536", "0.4910536", "0.4910536", "0.4909842", "0.49050912" ]
0.52707326
42
Adds the page number to the footer if enabled.
addPagination() { if (this.pdfBuilder.includePageNumber) { const { doc, margins, documentFont } = this.pdfBuilder; let text = this.currentPage; doc.font(documentFont); doc.fontSize(9); if (this.docTitle.length > 0) { text = `${this.docTitle} - ${text}`; } doc.text(text, margins.left, this.height + margins.bottom, { align: 'right', width: this.width }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addFooter(report) {\n report.getFooter().addClass(\"footer\");\n var versionLine = report.getFooter().addText(\"Banana Accounting - Page \", \"description\");\n report.getFooter().addFieldPageNr();\n}", "goToFooter() {\n this.owner.enableHeaderAndFooter = true;\n this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget);\n }", "function addFooter(report) {\n\tvar date = new Date();\n\tvar d = Banana.Converter.toLocaleDateFormat(date);\n\treport.getFooter().addClass(\"footer\");\n\tvar versionLine = report.getFooter().addText(d + \" - Trial balance - Page \", \"description\");\n\treport.getFooter().addFieldPageNr();\n}", "function addFooter(report) {\r\n report.getFooter().addClass(\"footer\");\r\n var versionLine = report.getFooter().addText(\"Banana Accounting 8\" + \" - \", \"description\");\r\n report.getFooter().addText(\"Pagina \", \"description\");\r\n report.getFooter().addFieldPageNr();\r\n}", "function addFooter(banDoc, report) {\r\n\treport.getFooter().addClass(\"footer\");\r\n\treport.getFooter().addText(\"[Banana Accounting, v. \" + banDoc.info(\"Base\", \"ProgramVersion\") + \", \" + scriptVersion + \"] - Page \", \"footer\");\r\n\treport.getFooter().addFieldPageNr();\r\n}", "get footer() { return $('#page-footer'); }", "function addFooter() {\r\n const contentsSrc = 'MasterPage/footer_contents.txt';\r\n if (document.getElementById) {\r\n let footer = document.getElementById('footer');\r\n if (footer) {\r\n let pathPrefix = relativePath();\r\n let footerContents = readContents(pathPrefix + contentsSrc);\r\n if (footerContents) { \r\n placeInOuterHtml(footer, footerContents);\r\n }\r\n }\r\n } \r\n}", "displayFooter() {\n }", "chargerFooter(){\n $(\"#page\"+this.instrument.ref).append('<div data-role=\"footer\" data-position=\"fixed\" data-tap-toggle=\"false\" data-fullscreen=\"false\" data-theme=\"b\">\\\n <div data-role=\"navbar\" data-grid=\"\" data-iconpos=\"left\">\\\n <ul id=\"menu\">\\\n <li><a href=\"#pageEtat\">Etat</a></li>\\\n <li><a href=\"#pageInstruments\"> Instruments</a></li>\\\n <li><a href=\"#pageCommande\">Commande</a></li>\\\n <li><a href=\"#pageConfiguration\"> Configuration</a></li>\\\n </ul>\\\n </div>\\\n </div>');\n }", "createFooter(footer) {\n footer.appendChild(footerTemplate.content);\n }", "function setFooterPos() {\n var $footer = $('.footer-section'),\n $main = $('.main-container'),\n viewport = $(window).height() - $('.header-section').height() - $('.footer-section').height();\n\n if( $main.height() > viewport ) {\n $footer.addClass('static');\n $('.progress-wrapper').addClass('bottom');\n }\n}", "function handleFooterPositioning() {\n if (footer) {\n let maxCoord = Math.max(window.innerHeight - 80, document.body.offsetHeight) - 80;\n footer.style.top = maxCoord + \"px\";\n footer.style.visibility = \"visible\";\n }\n}", "function onToggleFooterSection() {\n setAttributes(toggleSection(attributes, 'foot'));\n }", "addFooters() {\n /* Add footers for modified rows */\n this.gridApi.forEachNodeAfterFilterAndSort((node) => {\n if (node.data.hadronDocument.isModified()) {\n this.addFooter(node, node.data, 'editing');\n }\n });\n }", "function checkPages(doc) {\n var pageHeight = doc.internal.pageSize.height;\n // Before adding new content\n if (y >= pageHeight) {\n doc.text(60, 800, \"Page:\" + pages);\n doc.addPage();\n pages++;\n y = 0; // Restart height position\n }\n return doc;\n }", "function composeBottomPage()\n {\n buildBottomPage();\n //ddCont[ ddCont.length - 1 ].pageBreak = 'after';\n }", "pageNext(num) {\n this.setPage(num)\n }", "function printFooter()\r\n{\r\n\ttry\r\n\t{\r\n\r\n\t\tpdfxml += '</body></pdf>';\r\n\t}\r\n\tcatch(e)\r\n\t{\r\n\t\terrorHandler('printFooter', e);\r\n\t}\r\n}", "function scrollTopBtnWithFooter() {\n\t\t$(window).on('scroll', function() {\n\t\t\tif ($(window).width() < 1500) {\n\t\t\t\t\tvar pageHeight = $(document).height(),\n\t\t\t\t\t\t\tbottomOfPage = $(document).scrollTop() + $(window).height(),\n\t\t\t\t\t\t\tfooterHeight = $('.js-footer').outerHeight();\n\n\t\t\t\t\tif (pageHeight === bottomOfPage) {\n\t\t\t\t\t\t$('.js-scroll-top-button').css('bottom', footerHeight);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('.js-scroll-top-button').css('bottom', 0);\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$('.js-scroll-top-button').css('bottom', 0);\n\t\t\t}\n\t\t});\n\t}", "getCurrentPageHeaderFooter(section, isHeader) {\n return this.getCurrentHeaderFooter(this.getHeaderFooterType(section, isHeader), section.index);\n }", "function changeFooterText(){\n\n }", "function renumberPages(document){\n var pageStart = 1;\n for(var p=0;p < document.sections.length;p++){\n document.sections[p].continueNumbering = false;\n document.sections[p].pageNumberStart = pageStart;\n pageStart = pageStart + destination_doc.sections[p].length;\n }\n}", "function insertFooter () {\n \"use strict\";\n try {\n var footer;\n\t\t\t/* There are at least one, and maybe more, courses that are developed in partnership with BYU or BYU-Hawaii and require that to be displayed in the copyright. Checking here for customCopyright allows for those courses to create this variable with the custom text in the course.js file before the online.js is appended and then will use the custom text */\n\t\t\tif (typeof customCopyright === \"undefined\") {\n\t\t\t\tfooter = \"<div id='footer'>Copyright &copy; \" + new Date().getFullYear() + \" by Brigham Young University - Idaho. All Rights Reserved.</div>\";\n\t\t\t} else {\n\t\t\t\tfooter = \"<div id='footer'>\" + customCopyright + \"</div>\";\n\t\t\t}\n document.getElementById(\"main\").insertAdjacentHTML(\"beforeend\", footer); \n } catch (ex) {\n console.log(ex.name + \": \" + ex.message);\n }\n }", "function footerSize() {\n var footerOuterHeight = $('footer').outerHeight(true);\n var footerHeight = $('footer').height();\n $(\"body\").css(\"margin-bottom\", footerOuterHeight);\n /* Contact Us section on index.html & index_carousel.html \n should stick to footer */\n $(\"body.body_index\").css(\"margin-bottom\", footerHeight);\n return false;\n}", "function renumberPageBreaks() {\n\t\tvar i, containerClass,\n\t\t\tpages = document.getElementsByClassName( 'frm-page-num' );\n\n\t\tif ( pages.length > 1 ) {\n\t\t\tdocument.getElementById( 'frm-fake-page' ).style.display = 'block';\n\t\t\tfor ( i = 0; i < pages.length; i++ ) {\n\t\t\t\tcontainerClass = pages[i].parentNode.parentNode.parentNode.classList;\n\t\t\t\tif ( i === 1 ) {\n\t\t\t\t\t// Hide previous button on page 1\n\t\t\t\t\tcontainerClass.add( 'frm-first-page' );\n\t\t\t\t} else {\n\t\t\t\t\tcontainerClass.remove( 'frm-first-page' );\n\t\t\t\t}\n\t\t\t\tpages[i].innerHTML = ( i + 1 );\n\t\t\t}\n\t\t} else {\n\t\t\tdocument.getElementById( 'frm-fake-page' ).style.display = 'none';\n\t\t}\n\t}", "function nextPage(){\n if (page > 0)\n {\n setPage( page +1);\n }\n }", "static showFooter(param) {\n if (param) {\n butCountBar === null || butCountBar === void 0 ? void 0 : butCountBar.setAttribute(\"style\", \"display:block\");\n }\n else {\n butCountBar === null || butCountBar === void 0 ? void 0 : butCountBar.setAttribute(\"style\", \"display:none\");\n }\n }", "createLastPage(architect) {\n let pageEllipsis = this.createPageEllipsis(architect);\n architect.addChild(pageEllipsis, this.getShowNumbers && this.addLastPage);\n this.createPageNumber(architect, {\n condition: this.getShowNumbers && this.addLastPage,\n current: this.isLastPage,\n value: this.numberOfPages\n });\n }", "checkAndEnableHeaderFooter(point, pagePoint) {\n let page = this.viewer.currentPage;\n if (this.isCursorInsidePageRect(point, page)) {\n if (this.isCursorInHeaderRegion(point, page)) {\n if (this.owner.enableHeaderAndFooter) {\n return false;\n }\n return this.enableHeadersFootersRegion(page.headerWidget);\n }\n if (this.isCursorInFooterRegion(point, page)) {\n if (this.owner.enableHeaderAndFooter) {\n return false;\n }\n return this.enableHeadersFootersRegion(page.footerWidget);\n }\n }\n if (this.owner.enableHeaderAndFooter) {\n this.owner.enableHeaderAndFooter = false;\n this.viewer.updateTextPositionForSelection(pagePoint, 1);\n return true;\n }\n return false;\n }", "function adjustFooter() {\n var windowHeight = $(window).height()\n var contentHeight = $(\"body\").height()\n \n var extraHeight = 0;\n if($(\"footer\").css(\"position\") == \"fixed\")\n {\n extraHeight = $(\"footer\").height() + 60\n }\n else\n {\n extraHeight = 0\n }\n \n if(contentHeight < windowHeight-extraHeight)\n {\n $(\"footer\").css({\n position: \"fixed\"\n })\n }\n else\n {\n $(\"footer\").css({\n position: \"static\"\n })\n }\n \n $(\"footer\").show() // Hidden in CSS by default\n }", "updateFooter() {\n // Get new footer row HTML string\n let newFoot = footer.render();\n // Add new footer row to table footer\n this.footer.appendChild(newFoot);\n }", "set_pagecount(n) {\n if (this.pagecount !== n) {\n this.pagecount = n;\n this.draw();\n }\n }", "function class_addPagingFooter( tbl, numCol, searchPage )\r\n\t{\r\n\t\tvar activePicStyle;\r\n\t\tvar browsePicStyle;\r\n\t\tvar cellCount;\r\n\t\tvar endPt;\r\n\t\tvar i;\r\n\t\tvar innerHTMLStr;\r\n\t\tvar innertbl;\r\n\t\tvar innertblBody;\r\n\t\tvar itemStr;\r\n\t\tvar pageCellCount;\r\n\t\tvar pageRow;\r\n\t\tvar pagingTbl;\r\n\t\tvar pagingDiv;\r\n\t\tvar row;\r\n\t\tvar startPt;\r\n\t\tvar tblCell;\r\n\t\tvar pagePrefix;\r\n\r\n\t\ttry\r\n\t\t{ \r\n\t\t\t// Check to see if this is being rendered on the search results page\r\n\t\t\t// to setup variables appropriately\r\n\t\t\tif ( searchPage === undefined || searchPage == false )\r\n\t\t\t{\r\n\t\t\t\tsearchPage = false;\r\n\t\t\t\tpagePrefix = \"Browse\";\r\n\t\t\t}\r\n\t\t\t// Setup variables for search result page rendrind\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpagePrefix = \"Result\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Check to see if there any actual rows being shown to the user. \r\n\t\t\t// If not then skip this section\r\n\t\t\tif ( ( class_myRows != null ) && ( class_myRows.length > 0 ) ) \r\n\t\t\t{\r\n\r\n\t\t\t\t// Try and get the reference to the table showing the details. If it exists then\r\n\t\t\t\t// remove the rows and if not then create a new one\r\n\t\t\t\ttbl = document.getElementById( pagePrefix + \"PageRowPagingSectionCellTable2\" );\r\n\r\n\t\t\t\tif ( null === tbl )\r\n\t\t\t\t{ \r\n\t\t\t\t\ttblCell = document.getElementById( pagePrefix + \"PageRowPagingSectionCell2\" );\r\n\r\n\t\t\t\t\tif ( null !== tblCell )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttbl = document.createElement(\"table\");\r\n\t\t\t\t\t\tinnertblBody = document.createElement(\"tbody\");\r\n\t\t\t\t\t\ttbl.appendChild( innertblBody );\r\n\t\t\t\t\t\ttbl.width = \"100%\";\r\n\t\t\t\t\t\ttbl.id = pagePrefix + \"PageRowPagingSectionCellTable2\";\r\n\t\t\t\t\t\ttbl.setAttribute(\"cellPadding\", \"0px\");\r\n\t\t\t\t\t\ttbl.setAttribute(\"cellSpacing\", \"0px\");\r\n\r\n\t\t\t\t\t\ttblCell.appendChild(tbl);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t// clear the rows of the existing table to recreate the rows\r\n\t\t\t\t\tvar x = tbl.rows.length;\r\n\r\n\t\t\t\t\tfor( i=0; i<x; i++ )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttbl.deleteRow(0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( null !== tbl )\r\n\t\t\t\t{\r\n\t\t\t\t\t// Draw the header row\r\n\t\t\t\t\trow = tbl.insertRow(tbl.rows.length);\r\n\r\n\t\t\t\t\t// add the cell to span all of the detail columns\r\n\t\t\t\t\tcell = row.insertCell(0);\r\n\t\t\t\t\t// Make sure to count all of the columns\r\n\t\t\t\t\tif ( undefined !== numCol )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcell.colSpan = numCol;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Create the table for the data\r\n\t\t\t\t\tinnertbl = document.createElement(\"table\");\r\n\t\t\t\t\tinnertblBody = document.createElement(\"tbody\");\r\n\t\t\t\t\tinnertbl.appendChild( innertblBody );\r\n\t\t\t\t\tinnertbl.width = '100%';\r\n\t\t\t\t\tinnertbl.setAttribute(\"cellPadding\", \"0px\");\r\n\t\t\t\t\tinnertbl.setAttribute(\"cellSpacing\", \"0px\");\r\n\t\t\t\t\tinnertbl.visibility = \"hidden\";\r\n\t\t\t\t\tinnertbl.display = \"none\";\r\n\r\n\t\t\t\t\tcell.appendChild(innertbl);\r\n\r\n\t\t\t\t\t// Do not insert a row after the content area if we are not paging\r\n\t\t\t\t\tif ( class_isPaged )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t// reset the cell count for the next row\r\n\t\t\t\t\tcellCount = 0;\r\n\r\n\t\t\t\t\t// Draw the header row\r\n\t\t\t\t\trow = innertbl.insertRow(innertbl.rows.length);\r\n\r\n\t\t\t\t\t// add the cell for the pagesize dropdown\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\r\n\t\t\t\t\t// Check to see if the total number of pages > 1 and\r\n\t\t\t\t\t// the number of objects on the page < smallestPageSize\r\n\t\t\t\t\t// then put in the dropdown\r\n\t\t\t\t\tif ( ( class_myRows.length >= smallestPageSize || currentPageNum > 1 ) && class_isPaged )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Set the text\r\n\t\t\t\t\t\tcell.style.color = '#666666';\r\n\t\t\t\t\t\tcell.style.padding = \"2px 0 2px 0\";\r\n\t\t\t\t\t\tcell.innerHTML = LocString( \"Show\" );\r\n\t\t\t\t\t\tcell.innerHTML += \"<IMG SRC='\" + imgSrc + \"spacer.gif' TITLE='' WIDTH='4' HEIGHT='1' BORDER='0'>\";\r\n\r\n\t\t\t\t\t\t// add the cell for the actual pagesize dropdown\r\n\t\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\r\n\t\t\t\t\t\t// Write out the page size selector\r\n\t\t\t\t\t\tbc_resetTextInMenu();\r\n\t\t\t\t\t\tbc_setMenuName( pagePrefix + \"PageSize\" );\r\n\r\n\t\t\t\t\t\tinnerHTMLStr = bc_menuTxtStart( \"\", LocString( \"Select number of items on page\" ) , pageSize, \"itemID\", \"\" );\r\n\t\t\t\t\t\tinnerHTMLStr += bc_optionsStart();\r\n\t\t\t\t\t\tfor ( i = 0;i<pageSizeArray.length;i++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tinnerHTMLStr += bc_itemTxt( pageSizeArray[i], pageSizeArray[i], 0 );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tinnerHTMLStr += bc_searchItemTxt( 'document.SearchForm', pageSizeArray[i], pageSizeArray[i] );\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tinnerHTMLStr += bc_menuEnd();\r\n\t\t\t\t\t\tcell.innerHTML = innerHTMLStr ;\r\n\r\n\t\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='10' HEIGHT='1' BORDER='0'>\";\r\n\r\n\t\t\t\t\t\t// Set the text\r\n\t\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t\tcell.style.color = '#666666';\r\n\t\t\t\t\t\tcell.style.padding = \"2px 0 2px 0\";\r\n\t\t\t\t\t\tcell.innerHTML = \"items\";\r\n\t\t\t\t\t\tcell.innerHTML += \"<IMG SRC='\" + imgSrc + \"spacer.gif' TITLE='' WIDTH='4' HEIGHT='1' BORDER='0'>\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// - - - - - - - - add the spacer cell - - - - - - - -\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.width = '100%';\r\n\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='3' HEIGHT='14' BORDER='0'>\";\r\n\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.width = '100%';\r\n\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='3' HEIGHT='14' BORDER='0'>\";\r\n\r\n\t\t\t\t\tif ( totalPages > 1 )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// - - - - - - - - Start of the pagination selection control - - - - - - - -\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\r\n\t\t\t\t\t\t// Need to figure out the classes and set the timer to set the focus\r\n\t\t\t\t\t\tif ( true === btmPickControlOpen )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tactivePicStyle = 'activatePickDivHide';\r\n\t\t\t\t\t\t\tbrowsePicStyle = 'browsePickDivShow';\r\n\t\t\t\t\t\t\tsetTimeout( setPagePickFocus, 2 );\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\tactivePicStyle = 'activatePickDivShow';\r\n\t\t\t\t\t\t\tbrowsePicStyle = 'browsePickDivHide';\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Create a paging div to surround the entire page control table\r\n\t\t\t\t\t\t// This will allow easy hiding/showing of the entire control\r\n\t\t\t\t\t\tpagingDiv = document.createElement(\"div\");\r\n\t\t\t\t\t\tpagingDiv.id = \"classPageSelectDiv\";\r\n\t\t\t\t\t\tpagingDiv.className = activePicStyle;\r\n\t\t\t\t\t\tcell.appendChild(pagingDiv);\r\n\r\n\t\t\t\t\t\t// Create the table for the paging selections and attach it to the div\r\n\t\t\t\t\t\tpagingTbl = document.createElement(\"table\");\r\n\t\t\t\t\t\tinnertblBody = document.createElement(\"tbody\");\r\n\t\t\t\t\t\tpagingTbl.appendChild( innertblBody );\r\n\t\t\t\t\t\tpagingTbl.width = '100%';\r\n\t\t\t\t\t\tpagingTbl.setAttribute(\"cellPadding\", \"0px\");\r\n\t\t\t\t\t\tpagingTbl.setAttribute(\"cellSpacing\", \"0px\");\r\n\r\n\t\t\t\t\t\tpagingDiv.appendChild(pagingTbl);\r\n\t\t\t\t\t\tpageCellCount = 0;\r\n\r\n\t\t\t\t\t\t// Add the table row for the paging selection\r\n\t\t\t\t\t\tpageRow = pagingTbl.insertRow(pagingTbl.rows.length);\r\n\r\n\t\t\t\t\t\t// from here the paging control cells are added to pageRow NOT Row and the count needs to\r\n\t\t\t\t\t\t// be adding to pageCellCount\r\n\r\n\t\t\t\t\t\t// Put out the Prev tag\r\n\t\t\t\t\t\tcell = pageRow.insertCell( pageCellCount++ );\r\n\t\t\t\t\t\tif ( currentPageNum > 1 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcell.onmouseover = function(){ imageCell(this, 'page_previous16_mo.gif', 'PagePrevImg', true); };\r\n\t\t\t\t\t\t\tcell.onmouseout = function(){ imageCell(this, 'page_previous16.gif', 'PagePrevImg', false); };\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcell.onclick = function(){ class_getFolderContents( ( currentPageNum - 1 ), String.formatLoc( \"Retrieving page n\", currentPageNum - 1 ) ); };\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\t\tcell.onclick = function(){ DoSearch( document.SearchForm, 'func', 'NewSearch', ( currentPageNum - 2 ) * pageSize ); };\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"page_previous16.gif' Alt='\"+ LocString( \"Previous Page\" ) +\"' Title='\"+ LocString( \"Previous Page\" ) +\"' ID='PagePrevImg' WIDTH='16' HEIGHT='16' BORDER='0'>\";\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\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='16' HEIGHT='16' BORDER='0'>\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// add the spacer cell\r\n\t\t\t\t\t\tcell = pageRow.insertCell( pageCellCount++ );\r\n\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='2' HEIGHT='4' BORDER='0'>\";\r\n\r\n\t\t\t\t\t\t// Calculate the boundries of what the control will show\r\n\t\t\t\t\t\tvar startAt = Math.max( currentPageNum - 2, 1 );\r\n\t\t\t\t\t\tvar endAt = Math.min( totalPages + 1, startAt + 5 );\r\n\r\n\t\t\t\t\t\tif ( ( endAt - startAt ) < 5 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Need to recalculate the startAt point if the calculated\r\n\t\t\t\t\t\t\t// start is less than 5 from the end\r\n\t\t\t\t\t\t\tstartAt = Math.max( endAt - 5, 1 );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar clickHandler = function( e )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar pgNum = this.getAttribute( 'pageNumAccess' ) ;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tclass_getFolderContents( pgNum , String.formatLoc( \"Retrieving page n\", pgNum ) );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\t\t\tDoSearch( document.SearchForm, 'func', 'NewSearch', ( pgNum - 1 ) * pageSize );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar mouseoverHandler = function(){ colourCell(this); };\r\n\t\t\t\t\t\tvar mouseoutHandler = function(){ clearCell(this, true); };\r\n\r\n\t\t\t\t\t\tfor ( i = startAt; i < endAt; i++ )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// NOTE: the mouseover effect by changing the css style doesn't seem to\r\n\t\t\t\t\t\t\t// work very well so in the mean time. Changing the styles directly\r\n\t\t\t\t\t\t\t// will have to do\r\n\r\n\t\t\t\t\t\t\tcell = pageRow.insertCell( pageCellCount++ );\r\n\t\t\t\t\t\t\tcell.className = 'pageSelectorReference';\r\n\t\t\t\t\t\t\tcell.setAttribute('pageNumAccess', i);\r\n\t\t\t\t\t\t\tcell.style.margin = \"0 4px 0 4px\";\r\n\t\t\t\t\t\t\tcell.style.padding = \"0 2px 0 2px\";\r\n\t\t\t\t\t\t\tcell.style.color = '#00609e';\r\n\t\t\t\t\t\t\tcell.title = String.formatLoc( \"Page n\", i );\r\n\r\n\t\t\t\t\t\t\tif ( i !== currentPageNum )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcell.onmouseover = mouseoverHandler;\r\n\t\t\t\t\t\t\t\tcell.onmouseout = mouseoutHandler;\r\n\t\t\t\t\t\t\t\tcell.style.border = \"solid 1px #F5F5F5\";\r\n\t\t\t\t\t\t\t\tcell.onclick = clickHandler;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcell.style.backgroundColor = \"white\";\r\n\t\t\t\t\t\t\t\tcell.style.border = \"solid 1px #A9B7C6\";\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcell.innerHTML = \"&nbsp;\" + i + \"&nbsp;\";\r\n\r\n\t\t\t\t\t\t\t// add the spacer cell\r\n\t\t\t\t\t\t\tcell = pageRow.insertCell( pageCellCount++ );\r\n\t\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='2' HEIGHT='4' BORDER='0'>\";\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tcell = pageRow.insertCell( pageCellCount++ );\r\n\t\t\t\t\t\tif ( currentPageNum < totalPages )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcell.onmouseover = function(){ imageCell(this, 'page_next16_mo.gif', 'PageNextImg', true); };\r\n\t\t\t\t\t\t\tcell.onmouseout = function(){ imageCell(this, 'page_next16.gif', 'PageNextImg', false); };\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcell.onclick = function(){ class_getFolderContents( ( currentPageNum + 1 ), String.formatLoc( \"Retrieving page n\", currentPageNum + 1 ) ); };\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\t\tcell.onclick = function(){ DoSearch( document.SearchForm, 'func', 'NewSearch', ( currentPageNum ) * pageSize ); };\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"page_next16.gif' Alt='\"+ LocString( \"Next Page\" ) +\"' Title='\"+ LocString( \"Next Page\" ) +\"' ID='PageNextImg' WIDTH='16' HEIGHT='16' BORDER='0'>\";\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\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"page_next16_ds.gif' Title='' WIDTH='16' HEIGHT='16' BORDER='0'>\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// - - - - - - - - End of the pagination selection control - - - - - - - -\r\n\r\n\t\t\t\t\t\t// - - - - - - - - Start of the pagination goto/picker control - - - - - - - -\r\n\r\n\t\t\t\t\t\t// add the spacer cell\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='2' HEIGHT='4' BORDER='0'>\";\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// add the edit box cell to jump to a page\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\t\t\t\t\t\tcell.id = \"PickPageCell\";\r\n\t\t\t\t\t\tcell.style.padding = \"0 2px 0 2px\";\r\n\t\t\t\t\t\tcell.style.color = '#666666';\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t\tcell.title = LocString( 'Go to page...' );\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcell.innerHTML += \"<DIV ID='typePickDiv' CLASS='\" + browsePicStyle + \"'>\" + LocString( \"Go to page\" ) + \"&nbsp;&nbsp;<INPUT CLASS='browsePaginationBarEdit' autocomplete='off' TYPE='text' ID='pagePickEdit' TITLE='\" + LocString( 'Enter a page number here' ) + \"' SIZE='5' MAXLENGTH='20' LIMIT='20' VALUE='' ONKEYPRESS='return browsePageNumEnter( this.form, event, false )'></DIV>\";\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\tcell.innerHTML += \"<DIV ID='typePickDiv' CLASS='\" + browsePicStyle + \"'>\" + LocString( \"Go to page\" ) + \"&nbsp;&nbsp;<INPUT CLASS='browsePaginationBarEdit' autocomplete='off' TYPE='text' ID='pagePickEdit' TITLE='\" + LocString( 'Enter a page number here' ) + \"' SIZE='5' MAXLENGTH='20' LIMIT='20' VALUE='' ONKEYPRESS='return browsePageNumEnter( this.form, event, true )'></DIV>\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// This cell contains the flip control icons\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\t\t\t\t\t\tcell.style.padding = \"0 2px 0 2px\";\r\n\t\t\t\t\t\tcell.style.border = \"solid 1px #F5F5F5\";\r\n\t\t\t\t\t\tcell.onmouseover = function(){ imageCell(this, 'goto_page16_mo.gif', 'gotoPageLinkImg', true); imageCell(this, 'goto_close1216_mo.gif', 'browsePageLinkImg', true); };\r\n\t\t\t\t\t\tcell.onmouseout = function(){ imageCell(this, 'goto_page16.gif', 'gotoPageLinkImg', false);imageCell(this, 'goto_close1216.gif', 'browsePageLinkImg', false); };\r\n\t\t\t\t\t\tcell.innerHTML = \"<DIV ID='activatePickDiv' CLASS='\" + activePicStyle + \"'><a href='javascript:void(0)' onclick='javascript:flipPagePick();return false;' TITLE='\" + LocString( 'Go to page...' ) + \"'><IMG SRC='\" + imgSrc + \"goto_page16.gif' ID='gotoPageLinkImg' WIDTH='16' HEIGHT='16' BORDER='0' ALT='\" + LocString( 'Go to page...' ) + \"'></a></DIV>\";\r\n\t\t\t\t\t\tcell.innerHTML += \"<DIV ID='browsePickDiv' CLASS='\" + browsePicStyle + \"'><a href='javascript:void(0)' onclick='javascript:flipPagePickBack();return false;' TITLE='\" + LocString( 'Go to page...' ) + \"'><IMG SRC='\" + imgSrc + \"goto_close1216.gif' ID='browsePageLinkImg' WIDTH='16' HEIGHT='16' BORDER='0' ALT='\" + LocString( 'Close' ) + \"'></a></DIV>\";\r\n\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\t\t\t\t\t\tcell.style.padding = \"0 0 0 2px\";\r\n\r\n\t\t\t\t\t\t// - - - - - - - - End of the pagination goto/picker control - - - - - - - -\r\n\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trow = innertbl.insertRow(innertbl.rows.length);\r\n\t\t\t\t\tcellCount = 0;\r\n\r\n\t\t\t\t\tif ( searchPage == false )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// - - - - - - - - add the cell for the number of items - - - - - - - -\r\n\t\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t\tcell.style.color = '#666666';\r\n\t\t\t\t\t\tcell.style.padding = \"2px 0 2px 0\";\r\n\t\t\t\t\t\tcell.colSpan = '5';\r\n\r\n\t\t\t\t\t\tif ( currentPageNum === 1 )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstartPt = 1;\r\n\t\t\t\t\t\t\tendPt = class_myRows.length;\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\tstartPt = ( ( currentPageNum - 1 ) * pageSize ) + 1;\r\n\t\t\t\t\t\t\tendPt = ( ( currentPageNum - 1 ) * pageSize ) + class_myRows.length;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( !hideContainerSize )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// At this point there are a number of conditions to look at before putting up the # of items\r\n\t\t\t\t\t\t\tif ( 1 === totalPages )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif ( 1 === totalCount )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif ( objFilter.length > 0 || filterValue.length > 0 )\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"p item (filtered)\", totalCount );\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"p item\", totalCount );\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif ( objFilter.length > 0 || filterValue.length > 0 )\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"p items (filtered)\", totalCount );\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"p items\", totalCount );\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if ( endPt === totalCount )\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif ( objFilter.length > 0 || filterValue.length > 0 )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"n-m of p items (filtered)\", startPt, endPt, totalCount );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"n-m of p items\", startPt, endPt, totalCount );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif ( objFilter.length > 0 || filterValue.length > 0 )\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"n-m of about p items (filtered)\", startPt, endPt, totalCount );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\titemStr = String.formatLoc( \"n-m of about p items\", startPt, endPt, totalCount );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tcell.innerHTML = itemStr;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// - - - - - - - - add the spacer cell - - - - - - - -\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='15' HEIGHT='1' BORDER='0'>\";\r\n\r\n\t\t\t\t\tif ( searchPage == true )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcell.colSpan = '6';\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ( totalPages > 1 && !hideContainerSize )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// write out the current page indicator\r\n\t\t\t\t\t\tcell = row.insertCell( cellCount++ );\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t\tcell.align = 'right';\r\n\t\t\t\t\t\tcell.colSpan = '5';\r\n\t\t\t\t\t\tcell.width = '5%';\r\n\t\t\t\t\t\tcell.style.color = '#666666';\r\n\t\t\t\t\t\tcell.style.padding = \"2px 0 2px 0\";\r\n\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='3' HEIGHT='12' BORDER='0'>\";\r\n\t\t\t\t\t\tif ( currentPageNum === totalPages )\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcell.innerHTML += String.formatLoc( \"n of m pages\", currentPageNum, totalPages );\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\tcell.innerHTML += String.formatLoc( \"n of about m pages\", currentPageNum, totalPages );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// - - - - - - - - End of the pagination control - - - - - - - -\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( true === isDebugPaging && tbl != null )\r\n\t\t\t\t{\r\n\t\t\t\t\t// Draw the row\r\n\t\t\t\t\trow = tbl.insertRow(tbl.rows.length);\r\n\r\n\t\t\t\t\t// add the cell to span all of the detail columns\r\n\t\t\t\t\tcell = row.insertCell(0);\r\n\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t// Make sure to count all of the columns\r\n\t\t\t\t\tif ( undefined !== numCol )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcell.colSpan = numCol;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Create the table for the data\r\n\t\t\t\t\tinnertbl = document.createElement(\"table\");\r\n\t\t\t\t\tinnertblBody = document.createElement(\"tbody\");\r\n\t\t\t\t\tinnertbl.width = '100%';\r\n\t\t\t\t\tinnertbl.setAttribute(\"cellPadding\", \"0px\");\r\n\t\t\t\t\tinnertbl.setAttribute(\"cellSpacing\", \"0px\");\r\n\r\n\t\t\t\t\tcell.appendChild(innertbl);\r\n\t\t\t\t\tcellCount = 0;\r\n\r\n\t\t\t\t\t// Draw the header row\r\n\t\t\t\t\trow = innertbl.insertRow(innertbl.rows.length);\r\n\t\t\t\t\tif ( debugMsgs )\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\t\tcell.width = '20%';\r\n\t\t\t\t\t\tcell.innerHTML = \"<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='1' HEIGHT='17' BORDER='0'>&nbsp;Debug: <span id='loggingMsgId'>\" + loggingmessage + \"</span> \";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// add the cell spacing\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.width = '20%';\r\n\t\t\t\t\tcell.innerHTML = \"&nbsp;<IMG SRC='\" + imgSrc + \"spacer.gif' ALT='' WIDTH='3' HEIGHT='17' BORDER='0'>\";\r\n\r\n\t\t\t\t\t// Now for the stats\r\n\t\t\t\t\tcell = row.insertCell(cellCount++);\r\n\t\t\t\t\tcell.width = '20%';\r\n\t\t\t\t\tcell.align = 'right';\r\n\t\t\t\t\tcell.style.whiteSpace = 'nowrap';\r\n\t\t\t\t\tcell.innerHTML = \"Total server [\" + timeTaken / 1000.0 + \"] sec&nbsp;|&nbsp;\";\r\n\t\t\t\t\tcell.innerHTML += \"RDB [\" + dbTimeTaken / 1000.0 + \"] sec&nbsp;|&nbsp;\";\r\n\t\t\t\t\tcell.innerHTML += \"Round Trip [\" + rtTimeTaken / 1000.0 + \"] sec&nbsp;|&nbsp;\";\r\n\t\t\t\t\tcell.innerHTML += \"Render [\" + renderTimeTaken + \"] ms&nbsp;|&nbsp;\";\r\n\t\t\t\t\tcell.innerHTML += \"Size [\" + packetSize + \"] bytes&nbsp;\";\r\n\r\n\t\t\t\t\tinnertbl.visibility = \"visible\";\r\n\t\t\t\t\tinnertbl.display = \"block\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tsetConfigUrl( pageSize );\r\n\t\t}\r\n\t\tcatch(e)\r\n\t\t{\r\n\t\t\tkillPopup();\r\n\t\t\texceptionAlert( e, \"Issue occured in classbrowse.js/addPagingFooter. An issue has occured in creating the paging footer. \" );\r\n\t\t}\r\n\t}", "function appendFooter(){\n var footer = \"<div class='footer'>\";\n footer += \"<center><div class='copyrightText'>&copy; 2017 ITEE Group Canada</div></center>\";\n footer += \"</div>\";\n $('body').append(footer);\n }", "nextPage() {\n if (!this.isLastPage) {\n this.currentPageNumber++;\n }\n this.updateData();\n }", "function adaptFooterPosition() {\n if(!$('#player').is(':empty')){\n footer.css(\"margin-bottom\", \"100px\")\n }\n}", "function footerBottom(){\n\tvar $footer = $('.footer');\n\tif($footer.length){\n\t\tvar $tplSpacer = $('<div />', {\n\t\t\tclass: 'spacer'\n\t\t});\n\n\t\t$('.main').after($tplSpacer.clone());\n\n\t\t$(window).on('load resizeByWidth', function () {\n\t\t\tvar footerOuterHeight = $footer.outerHeight();\n\t\t\t$footer.css({\n\t\t\t\t'margin-top': -footerOuterHeight\n\t\t\t});\n\n\t\t\t$('.spacer').css({\n\t\t\t\t'height': footerOuterHeight\n\t\t\t});\n\t\t});\n\t}\n}", "function footer() {\n var amountCompleted = ctrl.amountCompleted();\n var amountActive = ctrl.list.length - amountCompleted;\n \n return E('footer') . is ({ id: 'footer' }) . has([\n \n E('span') . is ({ id: 'todo-count' }) . has([\n// E('strong') . has (T(F`${count} items left`)) // jshint ignore:line\n ]),\n \n // Filters (all, active, completed)\n E('ul') . is({ id: 'filters' }) . has ([\n E('li') . has(T(\"All\")) . does({ click: _ => data.filter = 'all' }),\n E('li') . has(T(\"Active\")) . does({ click: _ => data.filter = 'active' }),\n E('li') . has(T(\"Completed\")) . does({ click: _ => data.filter = 'completed' })\n ]),\n \n /* jshint ignore:start */\n E('button') .\n has (T(F`Clear completed ${completedcount}`)) . // jshint ignore:line\n is ({ id: 'clear-completed' }) .\n does({ click: _ => 0 }) //clearCompleted })\n /* jshint ignore:end */\n ]);\n }", "layoutHeaderFooter(section, viewer, page) {\n //Header layout\n let headerFooterWidget = viewer.getCurrentPageHeaderFooter(section, true);\n if (headerFooterWidget) {\n let header = headerFooterWidget.clone();\n header.page = page;\n viewer.updateHFClientArea(section.sectionFormat, true);\n page.headerWidget = this.layoutHeaderFooterItems(viewer, header);\n this.updateHeaderFooterToParent(header);\n }\n //Footer Layout\n headerFooterWidget = viewer.getCurrentPageHeaderFooter(section, false);\n if (headerFooterWidget) {\n let footer = headerFooterWidget.clone();\n footer.page = page;\n viewer.updateHFClientArea(section.sectionFormat, false);\n page.footerWidget = this.layoutHeaderFooterItems(viewer, footer);\n this.updateHeaderFooterToParent(footer);\n }\n }", "function updatePage() {\n\tlet countUpdate = 0;\n\t$(\"ul li\").each(function(index) {\n\t\tif (index % 10 === 0) {\n\t\t\tcountUpdate++;\n\t\t}\n\t\tif (countUpdate === pageNumber) {\n\t\t\t$(this).show();\n\t\t} else if ($(this).attr(\"id\") !== \"page\"){\n\t\t\t$(this).hide();\n\t\t}\n\n\t})\n\n}", "function giveFooterSomeRoom() {\n footer = $('footer#footer');\n padding = footer.outerHeight();\n $('body').css('padding-bottom',padding);\n // console.log('padding applied');\n }", "adjustFooterView() {\n setTimeout(function () {\n if (document.querySelector('.footer-section')) {\n document.querySelector('.footer-section').style.paddingBottom = document.querySelector('.order-summary-section').offsetHeight + 'px';\n } else if (document.querySelector('.vx-employee-footer')) {\n document.querySelector('.vx-employee-footer').style.paddingBottom = document.querySelector('.order-summary-section').offsetHeight + 'px';\n }\n }, 50);\n }", "function onDocumentLoadSuccess() {\n setPageNumber(1);\n }", "function addPagination(myMetaData) {\n\t\tif (myMetaData[0].numPages > 1) {\n\t\t\t$('.pagination').removeClass('hide');\n\n\t\t\tif (myMetaData[0].currentPage === 1) {\n\t\t\t\t$('.pagination-previous').addClass('disabled');\n\t\t\t} else {\n\t\t\t\t$('.pagination-previous').removeClass('disabled');\n\t\t\t}\n\n\t\t\tif (myMetaData[0].currentPage === myMetaData[0].numPages) {\n\t\t\t\t$('.pagination-next').addClass('disabled');\n\t\t\t} else {\n\t\t\t\t$('.pagination-next').removeClass('disabled');\n\t\t\t}\n\t\t} else {\n\t\t\t$('.pagination').addClass('hide');\n\t\t}\n\t}", "hasFooter() {\n return visible(this.footer.node());\n }", "function FOOTER$static_(){ToolbarSkin.FOOTER=( new ToolbarSkin(\"footer\"));}", "function toggleFooter() {\r\n\t\t\tconsole.info('Info: Footer toggled.');\r\n\t\t\tif($(window).scrollTop() + $(window).height() + 80 >= $(document).height()) {\r\n\t \t\t\t$element.show();\r\n\t \t} else {\r\n\t\t\t\t$element.hide();\r\n\t\t\t}\r\n\t\t}", "add_page() {\n\t\tthis.pdf_canvass.addPage(\"a4\", \"portrait\");\n\t}", "function setUIPages(totalPage) {\n totalPage = Math.max(1, totalPage);\n $(\"#total-page\").text(totalPage)\n }", "nextPage() {\n if (!this.msg) throw new Error(\"Tried to go to next page but embed pages havn't been created yet.\");\n this.currentPageNumber++;\n if (this.currentPageNumber >= this.pages.length) this.currentPageNumber = 0;\n const embed = this.pages[this.currentPageNumber];\n if (this.pageFooter) embed.setFooter(`Page: ${this.currentPageNumber + 1}/${this.pages.length}`);\n this.msg.edit({ embed: embed }).catch(() => null);\n }", "function printFooter(){\n //var footer = document.getElementById(\"footer-page\");\n document.write('<!--Begin Footer Code-->');\n\n //print Bootstrap\n document.write('<!-- Bootstrap core JavaScript \\\n ================================================== --> \\\n <!-- Placed at the end of the document so the pages load faster --> \\\n <!-- jQuery (necessary for Bootstrap\\'s JavaScript plugins) --> \\\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js\"></script> \\\n <!-- Include all compiled plugins (below), or include individual files as needed --> \\\n <script src=\"js/bootstrap.min.js\"></script> \\\n <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> \\\n <script src=\"js/ie10-viewport-bug-workaround.js\"></script>');\n\n //print StatCounter\n document.write('<!-- Start of StatCounter Code for Default Guide --> \\\n <script type=\"text/javascript\"> \\\n var sc_project=11034084; \\\n var sc_invisible=1; \\\n var sc_security=\"3e7dba9f\"; \\\n var scJsHost = ((\"https:\" == document.location.protocol) ? \\\n \"https://secure.\" : \"http://www.\"); \\\n document.write(\"<sc\"+\"ript type=\\'text/javascript\\' src=\\'\" + \\\n scJsHost+ \\\n \"statcounter.com/counter/counter.js\\'></\"+\"script>\"); \\\n </script> \\\n <noscript><div class=\"statcounter\"><a title=\"shopify site \\\n analytics\" href=\"http://statcounter.com/shopify/\" \\\n target=\"_blank\"><img class=\"statcounter\" \\\n src=\"//c.statcounter.com/11034084/0/3e7dba9f/1/\" \\\n alt=\"shopify site analytics\"></a></div></noscript> \\\n <!-- End of StatCounter Code for Default Guide -->');\n\n document.write('<!--End Footer Code-->');\n}", "function updateQuestionNumber () {\n $('footer').find('.footer-question-number').text(questionNum);\n}", "setFooter(html){\n this.footer.html(html);\n }", "function appendPage() {\n\tif (currentPage+1 >= nbPages) return;\n\t\n\tvar end = $(\"#pieces-end\")[0];\n\tvar rect = end.getBoundingClientRect();\n\tif (rect.top < $(window).height()) {\n\t\t// Spinning icon is visible, append next page.\n\t\tdisplayPieces(currentPage+1);\n\t}\n}", "function footerAlign() {\r\n jQuery('.site-footer').css('display', 'block');\r\n jQuery('.site-footer').css('height', 'auto');\r\n var footerHeight = jQuery('.site-footer').outerHeight();\r\n jQuery('.footer-fixed > .page-wraper').css('padding-bottom', footerHeight);\r\n jQuery('.site-footer').css('height', footerHeight);\r\n}", "set footerDistance(value) {\n this.footerDistanceIn = value;\n this.notifyPropertyChanged('footerDistance');\n }", "verifyUserShouldSeeFooterPage(){\n let footerLocator =utils.byLocator(jobsPageLocator.jobsPage.footer);\n utils.scrollToTheView(footerLocator);\n utils.verifyTheElementIsDisplayed(footerLocator);\n }", "insertPageBreak() {\n if (!this.owner.isReadOnlyMode) {\n if (this.viewer.selection.start.paragraph.isInsideTable ||\n this.viewer.selection.start.paragraph.isInHeaderFooter) {\n return;\n }\n this.initComplexHistory('PageBreak');\n this.onEnter(true);\n if (this.editorHistory && this.editorHistory.currentHistoryInfo != null) {\n this.editorHistory.updateComplexHistory();\n }\n this.selection.checkForCursorVisibility();\n }\n }", "function clickPageNumber(pagenumber){\n pageNumber = pagenumber;\n //chang display amount label and write page to next page\n changeDisplayAmount(displayType,pagenumber);\n}", "function updatePager() {\n if (isNext) {\n nextButton.removeClass('disable');\n } else {\n nextButton.addClass('disable');\n }\n if (isPrevious) {\n prevButton.removeClass('disable');\n } else {\n prevButton.addClass('disable');\n }\n //Setting the Page Number\n if (prevButton.siblings('.pageno').length == 1) {\n prevButton.siblings('.pageno').html(pageNo);\n } else if (nextButton.siblings('.pageno').length == 1) {\n nextButton.siblings('.pageno').html(pageNo);\n }\n }", "get footerDistance() {\n return this.footerDistanceIn;\n }", "function setPage(pageNumber) {\n\t\tif (pageNumber) {\n\t\t\tpageHandle.page = pageNumber\n\t\t} else {\n\t\t\tpageHandle.page = 0\n\t\t}\n\t}", "function footerTotal(api, col, round) {\n //var api = this.api(), data;\n\n // Remove the formatting to get integer data for summation\n var intVal = function (i) {\n return typeof i === 'string' ?\n i.replace(/[\\$,]/g, '') * 1 :\n typeof i === 'number' ?\n i : 0;\n };\n\n // Total over all pages\n total = api\n .column(col)\n .data()\n .reduce(function (a, b) {\n return intVal(a) + intVal(b);\n }, 0);\n\n // Total over this page\n //pageTotal = api\n // .column(col, { page: 'current' })\n // .data()\n // .reduce(function (a, b) {\n // return intVal(a) + intVal(b);\n // }, 0);\n\n\n // Update footer\n $(api.column(col).footer()).html(\n //+ pgTotalVal + '<br/>' +\n total.toFixed(round)\n );\n}", "function incrementPagegroup(){\n\tvar cur_last_pagegroup_pagenum = getLastPagegroupPagenum();\n\tvar cur_first_pagegroup_pagenum = getFirstPagegroupPagenum();\n\t\n\tvar new_last_pagegroup_pagenum = cur_last_pagegroup_pagenum + 1;\n\t\n\tchangePagegroup(\"incrementPagegroup\", new_last_pagegroup_pagenum, null, cur_first_pagegroup_pagenum, new_last_pagegroup_pagenum);\n}", "updatePagination() {\n\t\tlet next_page = this.current_page+1;\n\t\tlet next_next_page = next_page+1;\n\t\tgetComponentElementById(this,\"PaginationCurrentItem\").html('<span class=\"page-link\">'+this.current_page+'</span>');\n\t\tgetComponentElementById(this,\"PaginationNextItem\").html('<span class=\"page-link\">'+next_page+'</span>');\n\t\tgetComponentElementById(this,\"PaginationNextNextItem\").html('<span class=\"page-link\">'+next_next_page+'</span>');\n\t\tgetComponentElementById(this,\"ResultCountWrapper\").html('<span class=\"badge float-right\">Total: '+this.total_items+'</span>');\n\t}", "function numbe(index){\r\n var numbe=document.querySelector(\".footer\");\r\n numbe.innerHTML=\"<h3> pregunta \"+index+\" de \"+questions.length+\"</h3>\";\r\n }", "insertTocPageNumber(bookMarkname, lineWidget, isRightAlign, widget) {\n let fieldCode = ' PAGEREF' + bookMarkname + ' \\\\h ';\n let fieldBegin = this.createTocFieldElement(lineWidget, fieldCode);\n let text = (this.viewer.pages.indexOf(widget.bodyWidget.page) + 1).toString();\n //text element.\n let span = new FieldTextElementBox();\n span.fieldBegin = fieldBegin;\n if (!isRightAlign) {\n text = ' ' + text;\n }\n span.text = text;\n span.line = lineWidget;\n lineWidget.children.push(span);\n this.pageRefFields[bookMarkname] = span;\n return fieldBegin;\n }", "function footer_at_bottom() {\n\n var winWidth = $(window).width();\n var $footer = $('#footer');\n var $wrapper = $('#wrapper');\n var $footer_height = $footer.height();\n\n winWidth >= 960 ? $wrapper.css('paddingBottom',$footer_height) : $wrapper.css('paddingBottom',0)\n\n\n }", "function footerAlwayInBottom(footerSelector) {\n var docHeight = $(window).height();\n var footerTop = footerSelector.position().top + footerSelector.height();\n if (footerTop < docHeight) {\n footerSelector.css(\"margin-top\", (docHeight - footerTop) + \"px\");\n }\n }", "function pageInfo() {\n lblPageInfo.text(\"Page \" + options.currentPage + \" of \" + options.total);\n }", "function setFooter(stats) {\n var footer = '';\n if (stats.show == 'true') {\n if (stats.type.value == \"image\") {\n footer = '<div id=\"footer\" style=\"z-index:30;text-align:' + stats.align.value + ';\"> <img src=\"' + basePath + 'images/' + stats.logo + '\" /></div>';\n }\n else {\n footer = '<div id=\"footer\" style=\"z-index:3;position:absolute;width:100%;text-align:' + stats.align.value + ';\"><div class=\"font-setter\" style=\"z-index:3;font-size:' + stats.size.value + ';\">' + stats.text + '</div></div>';\n }\n }\n return footer;\n }", "renderFooter() {\n return null;\n }", "function setupFooter(docname, docver, docstage, docrev, docdate) {\n var footer = doc.getFooter();\n var paragraphs = footer.getParagraphs();\n var doctrack = convertStageToTrack(docstage);\n \n // Build the filename based on provided data\n var docfilename = \"\";\n \n // The passed in docname will be something like \"Playbook Requirements\"\n // We need to make this lower case and remove the spaces\n docname = docname.toLowerCase();\n docname = docname.replace(/\\ /g, '-');\n if (docstage === \"wd\" || docstage === \"csd\" || docstage === \"cnd\") {\n docfilename = \"draft-\" + docname + '-v' + docver + '-' + docstage + docrev;\n }\n else {\n docfilename = docname + '-v' + docver + '-' + docstage + docrev;\n }\n\n // Update the first line of the footer\n e0 = paragraphs[0];\n\n // Update filename name on first line of footer\n e0.replaceText('##docfilename##', docfilename);\n \n // Update the Working Draft ##, but only if this is a WD.\n if (docstage === \"wd\") {\n // Update document revision\n e0.replaceText('##docrev##', docrev);\n }\n else {\n // Remove the Working Draft ## for CSD, CS, CND, CN, but only if it is found\n e0.replaceText('Working Draft ##docrev##', \"\");\n }\n\n // Update the document date\n e0.replaceText('##docdate##', docdate);\n\n // Update the second line of the footer\n e1 = paragraphs[1];\n \n // Update document track type (standards track, non-standards track, standards track draft, etc)\n e1.replaceText('##doctrack##', doctrack);\n}", "function generatePage() {\n let pageSec = document.getElementById('pageNumber');\n notice.innerText = `Showing ${ 0} to ${ 10}`;\n for (let i = 1; i <= pageNumbers; i++) {\n let aTag = document.createElement('a');\n aTag.classList.add('paginate_button');\n aTag.innerText = i;\n pageSec.appendChild(aTag);\n }\n}", "genFooterContent() {\n return <Footer />;\n }", "function addFooter(footText){\n return \"<footer class=\\\"card_footer w3-container\\\">\" +\n \"<h5>\" + footText + \"</h5>\" +\n \"</footer>\";\n}", "function initPageScroller(){\n $(\".text-to-scroll\").click(function() {\n $('html, body').animate({\n scrollTop: $(\".footer\").offset().top\n }, 1000);\n });\n}", "function EMBEDDED_FOOTER$static_(){ToolbarSkin.EMBEDDED_FOOTER=( new ToolbarSkin(\"embedded-footer\"));}", "function _getHeaderFooter(group, options){\n\t\tvar header = webix.html.create(\"div\", { \n\t\t\t\"class\":\"webix_view webix_print_\"+group.toLowerCase(),\n\t\t\t\"style\":\"height:0px;visibility:hidden;\"\n\t\t}, options[\"doc\"+group]);\n\n\t\tif(group ===\"Header\")\n\t\t\twebix.html.insertBefore(header, document.body.firstChild);\n\t\telse\n\t\t\tdocument.body.appendChild(header);\n\n\t\toptions[\"doc\"+group] = header;\n\t}", "showFooter(state, val) {\n state.showFooter = val;\n }", "function footer_func(){\n showfooter();\n hideicon();\n }", "closeHeaderFooter() {\n this.disableHeaderFooter();\n }", "function addNext(scope, pageCount) {\n\n\t\t\t// Calculate the next page number and if the click actions are allowed\n\t\t\t// blocking where page is >= pageCount\n\t\t\tvar disabled = scope.page + 1 > pageCount;\n\t\t\tvar nextPage = scope.page + 1 >= pageCount ? pageCount\n\t\t\t\t\t: scope.page + 1;\n\n\t\t\tvar last = {\n\t\t\t\tvalue : '>>',\n\t\t\t\ttitle : 'Last Page',\n\t\t\t\tclass : disabled ? 'disabled' : '',\n\t\t\t\taction : function() {\n\t\t\t\t\tif (!disabled) {\n\t\t\t\t\t\tinternalAction(scope, pageCount);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar next = {\n\t\t\t\tvalue : '>',\n\t\t\t\ttitle : 'Next Page',\n\t\t\t\tclass : disabled ? 'disabled' : '',\n\t\t\t\taction : function() {\n\t\t\t\t\tif (!disabled) {\n\t\t\t\t\t\tinternalAction(scope, nextPage);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tscope.items.push(next);\n\t\t\tscope.items.push(last);\n\t\t}", "specificFooterChildElement(numbr){\n return this.footerParent.$(`li:nth-child(${numbr})`)\n }", "function pageNext()\n{\n\tif (currentPage<lastPage) {\n\t\tcurrentPage=currentPage + 1;\n\t\tviewPage();\n\t}\n}", "function setFooter() {\n\n // Remove prop from content\n $content.css( \"min-height\", \"\" );\n\n if ( $win.height() > $content.outerHeight() + $footer.outerHeight() ) {\n // Calculate the desired height\n let targetHeight = $win.height() - $footer.outerHeight();\n $content.css( \"min-height\", targetHeight + \"px\" );\n } else {\n // Clear the min height\n $content.css( \"min-height\", \"\" );\n }\n\n }", "function makePage(number, text, isDisabled, isPrevious, isNext) {\n return {\n number: number,\n text: text,\n disabled: isDisabled,\n previous: align && isPrevious,\n next: align && isNext\n };\n }", "function buildFooter() {\r\n $(\"#footer\").html(\r\n `\r\n <hr>\r\n My Sheridan Program: <em>${meArr[0].program}</em><br>\r\n My Home Country: <em>${meArr[0].hCountry}</em>\r\n `\r\n );\r\n $(\"#footer\").addClass(\"bottom\");\r\n}", "function pageNumber(number){\n var current = document.querySelector('.current');\n current.innerHTML = number;\n}", "function makePage(number, text, isDisabled, isPrevious, isNext) {\n return {\n number: number,\n text: text,\n disabled: isDisabled,\n previous: ( align && isPrevious ),\n next: ( align && isNext )\n };\n }", "function makePage(number, text, isDisabled, isPrevious, isNext) {\n return {\n number: number,\n text: text,\n disabled: isDisabled,\n previous: ( align && isPrevious ),\n next: ( align && isNext )\n };\n }", "function makePage(number, text, isDisabled, isPrevious, isNext) {\n return {\n number: number,\n text: text,\n disabled: isDisabled,\n previous: ( align && isPrevious ),\n next: ( align && isNext )\n };\n }", "function update_footer(html_text) {\n if (html_text != page_state.current_footer) {\n d3.select(\"#footer\")\n .style(\"opacity\", 1)\n .transition()\n .duration(500)\n .style(\"opacity\", 1e-6)\n setTimeout(function(){\n d3.select(\"#footer\")\n .html(html_text)\n .transition()\n .duration(500)\n .style(\"opacity\", 1)\n }, 500)\n page_state.current_footer = html_text\n\n }\n}", "print() {\n var printPdf = require('mapbox-print-pdf');\n this.spinner = true;\n var template = `\n <div data-scale-height=\"margin-top\" id=\"footer\" class=\"footer\">\n <sapn>Hello</span>\n </div>\n `\n var elementClonedCb = (elem) => {\n elem.removeAttribute(\"id\");\n }\n\n printPdf.build()\n .format(\"a2\")\n .footer({\n html: template,\n baseline: { format: \"a4\", orientation: \"p\" }\n }, elementClonedCb)\n .scale({ maxWidthPercent: 10, unit: \"metric\" })\n .print(this.map, mapboxgl)\n .then((pdf) => {\n pdf.save(\"map.pdf\");\n this.spinner = false;\n });\n }", "function getNextPage() {\n // the page number can't beyond over the last page\n if ((curPage + 1) < $(\".page\").size()) {\n flipOver(curPage + 1);\n }\n }", "if (currentPage <= 6) {\n startPage = 1;\n endPage = totalPages;\n }", "createPageNumber(\n architect,\n { condition = false, current = false, value = 1 } = config\n ) {\n let root = architect.createLi(\"is-hidden-mobile\");\n\n let pageNumber = root.createA(this.getLinkClass);\n pageNumber.addClass(\"is-current\", current);\n pageNumber.addClass(\n this.currentLinkClass,\n this.currentLinkClass !== undefined && current\n );\n pageNumber.innerHTML(value);\n pageNumber.addEvent(\"click\", () => {\n this.goTo(value);\n });\n\n root.addChild(pageNumber, condition);\n architect.addChild(root);\n }", "_refreshFooter() {\n const that = this;\n\n if ((that.viewSections.indexOf('footer') < 0 || that.$.footer.offsetHeight === 0)) {\n return;\n }\n\n function preFormatDateOutput() {\n if (that.selectedDates.length === 0) {\n return '';\n }\n\n if (that.selectedDates.length === 1) {\n return that.selectedDates[0].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' });\n }\n else {\n let sortedDates = that.selectedDates.slice(0).sort((a, b) => a.getTime() - b.getTime());\n\n return sortedDates[0].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' }) + ' - ' +\n sortedDates[sortedDates.length - 1].toLocaleDateString(that.locale, { year: that.yearFormat, weekday: 'short', month: 'short', day: 'numeric' });\n }\n }\n\n if (that.footerTemplate) {\n if (typeof that.footerTemplate === 'function') {\n return;\n }\n\n let layoutTemplate = that._layoutTemplates.filter(template => template.selector === that.$.footer)[0],\n clone = document.importNode(layoutTemplate.template.content, true);\n\n if (layoutTemplate.bindings.length > 0) {\n let bindingHolderElement = clone.childNodes[layoutTemplate.bindings[0].childNodeIndex];\n\n layoutTemplate.selector.childNodes[layoutTemplate.bindings[0].childNodeIndex].innerHTML =\n bindingHolderElement.innerHTML.replace(layoutTemplate.bindings[0].bindingString, preFormatDateOutput());\n }\n\n return;\n }\n\n that.$.selectedDatesRange.innerHTML = preFormatDateOutput();\n }", "function calculateHeightPage(){\n if(!$('.height-inner-page').length) return false;\n var header_height = $('header').outerHeight();\n\t\tvar footer_height = $('footer').outerHeight();\n\t\tvar real_height_inner_page = $('.height-inner-page').outerHeight();\n\t\tvar calculate_inner_page = $(window).height() - header_height - footer_height;\n\t\tif(calculate_inner_page > real_height_inner_page){\n\t\t\t$('.height-inner-page').css('height', calculate_inner_page +'px');\n\t\t}\n\t}", "function goNext() {\n if (pageNum == pdfDoc.numPages-1)\n {\n \t$(\"#next\").prop(\"disabled\", true);\n \t}\n pageNum++;\n renderPage(pageNum);\n }" ]
[ "0.6581624", "0.63644516", "0.62790376", "0.62181216", "0.60112476", "0.5886219", "0.57654256", "0.5645177", "0.56161845", "0.56085783", "0.5595043", "0.5594914", "0.55426466", "0.553101", "0.549846", "0.54967815", "0.54759806", "0.545483", "0.54474366", "0.5441457", "0.54240286", "0.5358213", "0.5320138", "0.53045845", "0.5269675", "0.5267664", "0.5261134", "0.5249066", "0.52473253", "0.5234666", "0.52341306", "0.5230142", "0.522022", "0.519683", "0.5182862", "0.51767665", "0.51658607", "0.5163854", "0.5162294", "0.51585776", "0.51563716", "0.51481843", "0.5131735", "0.51251686", "0.5123458", "0.5119268", "0.51168823", "0.5114357", "0.51127124", "0.51039094", "0.510024", "0.50933844", "0.50885004", "0.50866747", "0.50824416", "0.5082128", "0.5080807", "0.5072965", "0.50649637", "0.50595754", "0.5053128", "0.50525594", "0.50459814", "0.50352937", "0.50282824", "0.50200284", "0.5005077", "0.5003744", "0.50005865", "0.49939126", "0.49826732", "0.49688497", "0.49656668", "0.4962738", "0.49603367", "0.49559477", "0.4939725", "0.49357697", "0.4930241", "0.4924428", "0.49157155", "0.49121785", "0.49073058", "0.48971352", "0.48918965", "0.48882622", "0.48871157", "0.48869887", "0.48828676", "0.48801595", "0.48801595", "0.48801595", "0.48731998", "0.487139", "0.48688823", "0.48578107", "0.4852666", "0.48462197", "0.4844653", "0.4843835" ]
0.58928835
5
is this in the correct place?
isEmpty(){ return this.size==0; }
{ "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 protected internal function m182() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "static private internal function m121() {}", "obtain(){}", "static private protected internal function m118() {}", "static transient final private internal function m43() {}", "static transient final protected internal function m47() {}", "static final private internal function m106() {}", "transient private protected public internal function m181() {}", "static transient private protected internal function m55() {}", "__previnit(){}", "transient final private protected internal function m167() {}", "transient final private internal function m170() {}", "function _____SHARED_functions_____(){}", "static transient final protected public internal function m46() {}", "static transient final private protected internal function m40() {}", "static transient private protected public internal function m54() {}", "transient private public function m183() {}", "static private protected public internal function m117() {}", "transient final private protected public internal function m166() {}", "static final private protected internal function m103() {}", "static transient final protected function m44() {}", "static transient private internal function m58() {}", "static protected internal function m125() {}", "static transient private public function m56() {}", "_firstRendered() { }", "prepare() {}", "static final private protected public internal function m102() {}", "function priv () {\n\t\t\t\n\t\t}", "function ea(){}", "function fm(){}", "static transient final private protected public internal function m39() {}", "static transient final private public function m41() {}", "function _construct()\n\t\t{;\n\t\t}", "function oi(){}", "static final private public function m104() {}", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "static transient final private protected public function m38() {}", "apply () {}", "function comportement (){\n\t }", "transient final private public function m168() {}", "function __func(){}", "constructor () {\r\n\t\t\r\n\t}", "static transient protected internal function m62() {}", "static private public function m119() {}", "static final protected internal function m110() {}", "function miFuncion (){}", "function init() {\n\t \t\n\t }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function wa(){}", "prepare() {\n }", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function r(){}", "function fn() {\n\t\t }", "function whatisthis() {\n return this;\n }", "function __it() {}", "function oi(a){this.Of=a;this.rg=\"\"}", "function TMP() {\n return;\n }", "_validate() {\n\t}", "SameSide() {}", "init () {\n\t\treturn null;\n\t}", "function ba(){}", "function ba(){}", "function ba(){}", "function ba(){}", "added() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function DWRUtil() { }", "init () {}", "init () {}", "function Scdr() {\r\n}", "function Ha(){}", "constructor (){}", "function Rep() {\r\n}" ]
[ "0.6892941", "0.68278426", "0.66623014", "0.66250587", "0.6515964", "0.64029765", "0.6320984", "0.62367415", "0.6109403", "0.60940343", "0.6074002", "0.5993156", "0.5990777", "0.5951018", "0.5922288", "0.5921505", "0.58841264", "0.585513", "0.5851345", "0.5836027", "0.57816875", "0.5737925", "0.5655956", "0.56226236", "0.5619064", "0.5573087", "0.55337185", "0.55316204", "0.55285686", "0.5492842", "0.54661536", "0.54043365", "0.5361725", "0.5350402", "0.5343082", "0.5342327", "0.5329687", "0.53199756", "0.5306779", "0.5305352", "0.53053105", "0.53037924", "0.53037924", "0.52864575", "0.52392507", "0.521372", "0.5191932", "0.5182553", "0.51797694", "0.51643217", "0.5163795", "0.51609915", "0.51500493", "0.5149437", "0.5149425", "0.5149425", "0.5149425", "0.5149425", "0.5149425", "0.5149425", "0.5124133", "0.511189", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5111087", "0.5108587", "0.51014507", "0.5097313", "0.50959206", "0.50916797", "0.5087759", "0.50840616", "0.5076671", "0.5063192", "0.5063192", "0.5063192", "0.5063192", "0.50574625", "0.5052666", "0.5052666", "0.5052666", "0.50498873", "0.50498873", "0.50498873", "0.5045583", "0.5018811", "0.5018811", "0.5018234", "0.50182027", "0.50093", "0.50022554" ]
0.0
-1
used to have a (runID)
checkAndRun(){ var checks=this.checkPointers(); if(checks.passed){ this.passedRun=true; this.update(); //this doesn't find if there are any fails in the update... }else{ checks.errors.forEach(function(error){console.error (error)}) this.passedRun=false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkRunId() {\n const ret = db.runCommand({find: \"c\", filter: {_id: 'block_test'}});\n assert.commandWorked(ret);\n\n const doc = ret[\"cursor\"][\"firstBatch\"][0];\n return doc[\"run_id\"];\n}", "getID() {}", "function ID(sample){ return sample.id == sampleID;}", "function idGen(){\n\t//return job_history[job_history.length-1].jobID + 1;\n\tjob_id += 1;\n\tconsole.log(\"== idGen: job_id: \" + job_id);\n\treturn job_id;\n}", "function getUniqueRunDependency(id) {\nreturn id;\n}", "get id() {\n\t\tif (!this._id) {\n\t\t\tthis._id = 'Scheduler' + Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n\t\t}\n\n\t\treturn this._id;\n\t}", "function incrementRunId() {\n assert.commandWorked(db.runCommand({\n update: \"c\",\n updates: [{q: {_id: 'block_test'}, u: {$inc: {run_id: 1}}}],\n }));\n}", "function getId() {\n\treturn '[' + pad(++testId, 3) + '] ';\n}", "function addOneToGen(oldRunGen) {\n \n \n const stringLen = oldRunGen.length;\n const sym = oldRunGen.indexOf(\"#\");\n \n const runId = oldRunGen.substring(0, sym);\n const genStr = oldRunGen.substring(sym + 1, stringLen);\n \n const genNum = Number(genStr);\n const incrementGen = genNum + 1;\n \n const incKey = runId + '#' + incrementGen;\n \n return incKey;\n}", "add(runnerId, raceId){\n\n return addrunner.update({idRacer:raceId,idRunner: parseInt(runnerId)}, {})\n }", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n}", "function run() {}", "function RRDFltOpIdentId(rrd_data,id) {\r\n this.ds_name=rrd_data.getDS(id).getName();\r\n this.getName = function() {return this.ds_name;}\r\n this.getDSNames = function() {return [this.ds_name];}\r\n this.computeResult = function(val_list) {return val_list[0];}\r\n}", "function thisToDoId(id) {\n return id;\n}", "function getUniqueRunDependency(id) {\n return id;\n }", "function get_run_url(db, ts, runID) {\n \"use strict\";\n return [lnt_url_base, \"db_\" + db, \"v4\", ts, runID].join('/');\n}", "function run() {\n\n }", "doShowRunNote (modelDgst, runDgst) {\n this.runInfoTickle = !this.runInfoTickle\n }", "get id() {\n\t\tif (!this._id) {\n\t\t\tthis._id = 'ProgressWindow' + Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n\t\t}\n\n\t\treturn this._id;\n\t}", "function addRun() {\n let team = document.getElementById(\"team-selector\").value;\n let inning = parseInt(document.getElementById(\"inning-selector\").value);\n\n let currentRuns = getInningValue(team, inning);\n fillInning(team, inning, currentRuns+1);\n}", "function run() {\n }", "function grabEBI(id){ return tf_Id(id); }", "function grabNextId() {\n\n\treturn nextId++;\n\n }", "run (task) {\n\t\tconst taskid = App.systemAgent.getUuid (SystemInterface.CommandId.TaskItem);\n\t\ttask.id = taskid;\n\t\tthis.taskList.push (task);\n\t\tthis.taskMap[task.id] = task;\n\t\tif (this.runCount < this.maxRunCount) {\n\t\t\tsetImmediate (() => {\n\t\t\t\tthis.executeNextTask ();\n\t\t\t});\n\t\t}\n\t\tthis.updateTask.setNextRepeat (0);\n\t\treturn (taskid);\n\t}", "function updateRun(e) {\n detail.queryParams.versionNumber = $(e.currentTarget).attr('data-version');\n detail.queryParams.runId = $(e.currentTarget).attr('data-run');\n setCurrentArticle(detail.article.versions[detail.queryParams.versionNumber].details);\n if (_.findWhere(detail.article.versions[detail.queryParams.versionNumber].runs, {'run-id': detail.queryParams.runId})) {\n setCurrentRun(_.findWhere(detail.article.versions[detail.queryParams.versionNumber].runs, {'run-id': detail.queryParams.runId}));\n }\n\n renderArticle();\n }", "function getWorkflowRunID() {\n const workflowRunID = parseInt(getRequiredEnvParam(\"GITHUB_RUN_ID\"), 10);\n if (Number.isNaN(workflowRunID)) {\n throw new Error(\"GITHUB_RUN_ID must define a non NaN workflow run ID\");\n }\n return workflowRunID;\n}", "payload({ run, plates, wells, smrtLinkVersion, instrumentType }) {\n // eslint-disable-next-line no-unused-vars\n const { id, ...attributes } = run\n\n return createPayload({ run: attributes, plates, wells, smrtLinkVersion, instrumentType })\n }", "function computeCurrentId(id){\n switch(id){\n case \"threeByThree_Tile1\":\n arrayData.currentTile = 0;\n break;\n case \"threeByThree_Tile2\":\n arrayData.currentTile = 1;\n break;\n case \"threeByThree_Tile3\":\n arrayData.currentTile = 2;\n break;\n\n case \"threeByThree_Tile4\":\n arrayData.currentTile = 3;\n break;\n \n case \"threeByThree_Tile5\":\n arrayData.currentTile = 4;\n break;\n \n case \"threeByThree_Tile6\":\n arrayData.currentTile = 5;\n break;\n \n case \"threeByThree_Tile7\":\n arrayData.currentTile = 6;\n break;\n \n case \"threeByThree_Tile8\":\n arrayData.currentTile = 7;\n break;\n \n case \"threeByThree_Tile9\":\n arrayData.currentTile = 8;\n break;\n\n }\n }", "function run() {\n\n}", "firstRun() { }", "function assignTaskID() {\n const data = $(\"body\").data();\n const taskID = data.taskID + 1;\n data.taskID++;\n return taskID;\n}", "logNextId() {\n const testNumber = this.getNextUniqueId();\n console.log(testNumber);\n }", "function $uid() {\n unique_id += 2;\n return unique_id;\n }", "function getRunner(runner_id, callback) {\n client.hget('wf_runners', runner_id, function (err, runner) {\n if (err) {\n log.error({err: err});\n return callback(new wf.BackendInternalError(err));\n }\n return callback(null, new Date(runner));\n });\n }", "function stampId(val) {\n if (answerData.correct_answer === val) {\n return \"1\";\n } else {\n return \"0\";\n }\n }", "generateId() { return this._get_uid() }", "generateRuleId(){\n\n\treturn (\"R-\"+this.props.advertiserId+\"-\"+this.props.addId+\"-\"+Date.now());\n\t}", "function getSummonerID(){\n\n}", "get idRaron() {\n return this._idRaton;\n }", "function logMyId() {\n\t// log some stuff to the dev tools\n\tconsole.log(this.id);\n\tdebugger;\n\t}", "function createGameID () {\n return \"game\"+(+Date.now());\n}", "getId() {\n return this._executeAfterInitialWait(() => this.currently.getAttribute('id'));\n }", "get id() {\n\t\treturn this.__id;\n\t}", "function addID() {\n\tfor (let i = 0; i < gs; i++) {\n\t\tif (getGrid(i) != undefined) {\n\t\t\tgetGrid(i).id = i;\n\t\t}\t\t\n\t}\n}", "step(dt) {\n logID(1006);\n }", "function getStartPid() {\n return self.players.ids.list[Math.floor(Math.random() * 2)];\n }", "function id(dataset) {\n return dataset.id;\n }", "static id(arg) {\nreturn arg;\n}", "get ID(){return ID}", "function OwnerID() { }", "getID() {\n this.id = userID;\n userID++;\n }", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}" ]
[ "0.63493884", "0.5737148", "0.5721672", "0.5703246", "0.5687337", "0.5558516", "0.55462134", "0.5491464", "0.54781926", "0.5430642", "0.53978527", "0.53978527", "0.53978527", "0.53978527", "0.53978527", "0.53978527", "0.53978527", "0.5396078", "0.53956133", "0.5375573", "0.53622705", "0.53403664", "0.5337918", "0.5271563", "0.5268773", "0.52637196", "0.52448356", "0.5243137", "0.5242106", "0.52400494", "0.5234506", "0.5201326", "0.51916087", "0.5182145", "0.51806897", "0.5158655", "0.5150199", "0.5114522", "0.5096622", "0.5081927", "0.50685376", "0.50613815", "0.504971", "0.50429875", "0.50397253", "0.5019087", "0.5011657", "0.5000767", "0.49925074", "0.4981714", "0.49771908", "0.496966", "0.4966294", "0.4964894", "0.49637046", "0.49587402", "0.4958359", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488", "0.49565488" ]
0.0
-1
should we handle seperate error logs?
checkPointers(){ var self=this; var check=true; var errors=[]; ///check there are enough inputs specified and all are valid // if(this.inputs.length && this.inputs.every(input=>input || input===0)){ if(!this.inputs.length){ check=false; errors.push(`No input sources specified for ${self.constructor.name}`) }else{ for(let i=0;i<this.inputs.length;i++){ let val=this.inputs[i] let type=this.inputTypes[i] if(val===undefined){ check=false; }else{ if(val || val===0){ }else{ check=false; } // console.log(this.inputs[i],this.inputTypes[i]); } } if(check===false){ errors.push(`Not enough input sources specified for ${self.constructor.name}`) } } return {"passed":check,"errors":errors}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_logError (msg, url, lineNo, columnNo, error) {\n let log = ErrLogger.getLogs()\n if (!log) {log = { session: [] } }\n log.session.push({\n timestamp: new Date().valueOf(),\n columnNo,\n error: error,\n lineNo,\n message: msg,\n url,\n })\n ErrLogger.setLog(log)\n return true\n }", "handleAppErrors() {\r\n this.app.on('error', (err, ctx) => {\r\n logger.error(`Application Error: ${ err.name } @ ${ ctx.method }:${ ctx.url }`);\r\n logger.error(err.stack);\r\n });\r\n }", "error_handler(err) {\n console.log(`Problem encountered. Detail:${err.message}`);\n }", "function errorHandler(){\n Logger.log(\"=========================EXAMPLES=========================\")\n Logger.log(\"firebase-engine operations=\\\"clean, restore\\\" path=\\\"./test/utils/vend-park-development.json\\\" services=\\\"firestore, auth\\\" backup=\\\"vend-park-development.backup\\\"\")\n Logger.log(\"firebase-engine o=\\\"b, c\\\" p=\\\"./test/utils/vend-park-development.json\\\"\")\n Logger.log(\"=========================ARGUMENTS========================\")\n Logger.table(arg)\n Logger.log(\"===========================ERROR==========================\")\n}", "error(...theArgs) { return this._log('ERROR', {}, theArgs); }", "createErrorLog(req, res) {\n\n }", "function logErrors (err, req, res, next) {\n //console.error(err.stack)\n console.log(\"caught an erroor\");\n console.log(err.stack)\n next(err)\n}", "function error(msg){\r\n rootLogger.error(msg)\r\n}", "handleCallError(errs, url, method) {\n // TODO: probably we need some logger, now it's just logging to console\n console.log(`Failed calling ${method} for URL:`, url);\n console.log(`Reason:`, errs);\n }", "function checkError(err, msg) {\n logger.log('error',msg + '\\n' + err);\n}", "function logApiError(msg, err) {\n\tlet errormsg = msg + \", \" + formatError(err);\n\n\tif (Number.isInteger(err)) {\n\t\tswitch (err) {\n\t\t\tcase 400:\tadapter.log.error(errormsg); break;\n\t\t\tcase 404:\tadapter.log.warn(errormsg); break;\n\t\t\tcase 422:\tadapter.log.error(errormsg); break;\n\t\t\tdefault:\tadapter.log.debug(errormsg);\n\t\t}\n\t}\n\telse adapter.log.debug(errormsg);\n}", "function testForErrorOnlyLogging() {\n let loggerConfig = {\n \"log-level\": customLogger.LOG_LEVEL.error\n }\n\n customLogger.setConfig(loggerConfig);\n\n let txnID = shortid.generate();\n customLogger.logMessage(\"This is ERROR message 1 for same transaction\", customLogger.LOG_LEVEL.error, \"some-business-tag\", txnID);\n customLogger.logMessage(\"This is ERROR message 2 for same transaction\", customLogger.LOG_LEVEL.error, \"some-business-tag\", txnID);\n\n customLogger.logMessage(\"This is DEBUG message. Will not be logged\", customLogger.LOG_LEVEL.debug, \"some-business-tag\", shortid.generate());\n customLogger.logMessage(\"This is INFO message. Will not be logged\", customLogger.LOG_LEVEL.info, \"some-business-tag\", shortid.generate());\n customLogger.logMessage(\"This is VERBOSE message. Will not be logged\", customLogger.LOG_LEVEL.verbose, \"some-business-tag\", shortid.generate());\n customLogger.logMessage(\"This is WARN message. Will not be logged\", customLogger.LOG_LEVEL.warn, \"some-business-tag\", shortid.generate());\n}", "static logError(error) {\r\n console.log(`[ERROR] Something did not work - \\n`, error);\r\n }", "logDiagnostics(err) {\n systemLog_1.default.error({ leadingBlankLine: true, indent: true }, `Error in stage \"${this.currentStage}\": ${err.description}`);\n for (let i = 0; i < err.errorData.length; i++) {\n systemLog_1.default.error({ doubleIndent: true }, `\"${i}: ${err.errorData[i]}`);\n }\n systemLog_1.default.error({ leadingBlankLine: true, indent: true }, `\"${this.currentStage}\" stage failed. See SystemManager console for additional information.`);\n }", "logErrors(err, req, res, next) {\n console.error(err.stack);\n next(err);\n }", "static get LOG_ERRORS() {\n return false;\n }", "function errorlogging(err) \r\n{\r\n\talert(\"Error processing SQL: Main err\"+err.code);\r\n}", "error(handleRequest) {\n if (!handleRequest.jovo) {\n return;\n }\n const log = this.createErrorLog(handleRequest);\n if (log) {\n Sentry.configureScope(scope => {\n scope.setTag('locale', log.locale);\n scope.setTag('platform', log.platform);\n if (log.intent)\n scope.setTag('intent', log.intent);\n scope.setTag('state', log.state);\n scope.setExtra('request', log.request);\n scope.setExtra('session', log.session);\n scope.setUser({ id: log.userId });\n });\n Sentry.captureException(handleRequest.error);\n }\n }", "function logRequestError(err) {\n\n\tvar {response} = err;\n\tif (!response) {\n\t\tlogger.warning(`TritonAgent raised exception for URL ${this._urlPath}`, err);\n\t} else if (response.notFound) {\n\t\t// 404? don't care about response\n\t\tlogger.warning(`Resource not found on server: ${this._urlPath}`);\n\t} else if (response.serverError) {\n\t\tlogger.warning(`Received server error for URL ${this._urlPath}`, err);\n\t} else {\n\t\tlogger.warning(`Unexpected status code returned for URL ${this._urlPath}`, err);\n\t}\n}", "function logErrors(err, req, res, next) {\n\tconsole.error(err.stack);\n\tnext(err);\n}", "function logError(serverError,clientError){ //Function that simplifies the logging of errors\n console.log(\"==========================\\n\"+serverError);\n customString = clientError;\n}", "static handleErrors(error) {\n\n if (error.response) {\n const message = error.response.data.message;\n const errorMessage = message ? message : 'something went wrong.'\n console.log(errorMessage);\n } else {\n console.log('something went wrong');\n }\n }", "function errors(response, error) {\n let errorMessage = `Status code ${response.statusCode}. `; //Starts building the error message string\n\n switch (response.statusCode) {\n case 401: errorMessage += `Unauthorized access. Requires username and password`;\n break;\n case 403: errorMessage += `Forbidden. Permission to access was not allowed.`;\n break;\n case 404: errorMessage += `Not Found. Requested URL was not found.`;\n break;\n default: errorMessage += `Error. Unable to scrape data.`;\n break;\n }\n console.log(errorMessage); //Sends error message to console\n\n //Writes error to an error file. The current date and time is appended to the front of the error and some minor formatting is done for readability in the log file\n fs.appendFile('scraper-error.log', `[${new Date()}] <${errorMessage}> \\r\\n`, function (err) {\n if (err) throw err;\n console.log('Error logged to scraper-error.log'); //If error was successfully written, this message is printed to console\n });\n}", "function devlog(msg)\n{\n customError(\"Dev\", msg, -1, true, false);\n}", "function testForUnHandledException() {\n let loggerConfig = {\n \"log-level\": customLogger.LOG_LEVEL.verbose\n }\n\n customLogger.setConfig(loggerConfig);\n customLogger.logMessage(\"tion\", customLogger.LOG_LEVEL.error, \"some-business-tag\", txnID);\n\n}", "function logErrors(err, req, res, next) {\n\tif (typeof err === \"number\") {\n\t\treq.soajs.log.error(core.error.generate(err));\n\t\treturn next(err);\n\t}\n\tif (typeof err === \"object\") {\n\t\tif (err.code && err.message) {\n\t\t\treq.soajs.log.error(err);\n\t\t\t\n\t\t\tlet error = {\"code\": err.code, \"msg\": err.message};\n\t\t\tif(process.env.SOAJS_ERROR2HTTP && err.error){\n\t\t\t\terror.error = err.error;\n\t\t\t\terror.status = err.code;\n\t\t\t}\n\t\t\treturn next(error);\n\t\t}\n\t\telse {\n\t\t\treq.soajs.log.error(err);\n\t\t\treq.soajs.log.error(core.error.generate(164));\n\t\t}\n\t}\n\telse {\n\t\treq.soajs.log.error(err);\n\t\treq.soajs.log.error(core.error.generate(164));\n\t}\n\t\n\treturn next(core.error.getError(164));\n}", "function logError (err) {\n util.log('error:', err)\n}", "error(reqOrMsg, msg) {\n\t\tif (msg) {\n\t\t\tthis.log(reqOrMsg, LEVEL_ERROR, msg);\n\t\t} else {\n\t\t\tthis.log(LEVEL_ERROR, reqOrMsg); // if only one arg, it is the msg\n\t\t}\n\t}", "function errorLog(errorMsg) {\n error('*** Start of Error ***');\n error(errorMsg);\n error('*** End of Error ***');\n\n process.exit(-1);\n }", "checkpointLogDiagnostics(err) {\n if (err.description) {\n systemLog_1.default.warn({ indent: true }, `checkpoint issue in stage \"${this.currentStage}\": ${err.description}`);\n for (let i = 0; i < err.errorData.length; i++) {\n systemLog_1.default.warn({ doubleIndent: true }, `${i}: ${err.errorData[i]}`);\n }\n }\n else {\n for (let i = 0; i < err.errorData.length; i++) {\n systemLog_1.default.warn({ indent: true }, `${err.errorData[i]}`);\n }\n }\n }", "function lastError(msg) {\n if (!msg)\n return;\n msg = \"\"+msg;\n if (_lastErrors.push({msg: msg, stackTrace: undefined}) > _maxLastErrors)\n _lastErrors = _lastErrors.slice(1);\n }", "componentDidCatch(error) {\n if (this.persistentLogEnabled) {\n this.saveExtendedLog(\"error\", [error]);\n } else {\n console.error(error);\n }\n }", "onError(...args) {\n this.logError(this.formatOnError(args));\n }", "function logErrors(err, req, res, next) {\n console.error(err.stack);\n next(err);\n}", "error(err) {\n this.checkDate();\n console.error(`[${red(`ERROR ${dayjs().format(\"HH:mm:ss\")}`)}]: ${err.message + (err.stack ? \"\\n\"+err.stack.split('\\n').splice(1).join('\\n'):\"\")}\\n`);\n }", "function logError (controller, err, message) {\n controller.log(message)\n controller.log(err)\n}", "error(...params) {\r\n console.error(this.getLogStamp(), ...params);\r\n }", "function errorHandling(err) {\r\n if (err) console.log(err);\r\n else console.log(`Done`)\r\n\r\n}", "function logErrors(err, req, res, next) {\n console.error(err.stack);\n next(err);\n}", "LogError() {}", "logError(message, meta) {\n this.winstonLogger.log('error', message, meta);\n }", "_logError() {\n console.log(\n `${Logger.colors.invalid}An invalid log level '${this.level}' was provided on logger instantiation.`,\n `\\nThe valid logger levels are as follows: ${Logger.validLevels.join(\n \", \"\n )}${Logger.colors.reset}`\n );\n }", "function handleErrors(error) {\n console.log('Please try again problem occured!');\n}", "function logerror(content) {\n return logger(content,\" [ERROR] \");\n}", "function my_log(msg, error) {\n var ln = error.lineNumber;\n var fn = error.fileName.split('->').slice(-1)[0].split('/').splice(-1)[0];\n console.log(fn + \",\" + ln + \": \" + msg);\n}", "function commonErrorHandler (err) {\n console.log(err); \n resetToLibraryIndexPage();\n }", "error(err) {\n console.warn(`ERROR(${err.code}): ${err.message}`);\n }", "function handleError(err) {\n switch (err.errorCode) {\n default:\n console.warn(err);\n }\n}", "function processErrors(data){\n \n}", "function prettyError(logger, args, error) {\n logger.all();\n logger.all(`----------------------------------------------------------------`);\n logger.all(`-------------- 🔥🔥🔥 an error occurred 🔥🔥🔥 --------------`);\n logger.all(`----------------------------------------------------------------`);\n const ftpError = error;\n if (typeof error.code === \"string\") {\n const errorCode = error.code;\n if (errorCode === \"ENOTFOUND\") {\n logger.all(`The server \"${args.server}\" doesn't seem to exist. Do you have a typo?`);\n }\n }\n else if (typeof error.name === \"string\") {\n const errorName = error.name;\n if (errorName.includes(\"ERR_TLS_CERT_ALTNAME_INVALID\")) {\n logger.all(`The certificate for \"${args.server}\" is likely shared. The host did not place your server on the list of valid domains for this cert.`);\n logger.all(`This is a common issue with shared hosts. You have a few options:`);\n logger.all(` - Ignore this error by setting security back to loose`);\n logger.all(` - Contact your hosting provider and ask them for your servers hostname`);\n }\n }\n else if (typeof ftpError.code === \"number\") {\n if (ftpError.code === types_1.ErrorCode.NotLoggedIn) {\n const serverRequiresFTPS = ftpError.message.toLowerCase().includes(\"must use encryption\");\n if (serverRequiresFTPS) {\n logger.all(`The server you are connecting to requires encryption (ftps)`);\n logger.all(`Enable FTPS by using the protocol option.`);\n }\n else {\n logger.all(`Could not login with the username \"${args.username}\" and password \"${args.password}\".`);\n logger.all(`Make sure you can login with those credentials. If you have a space or a quote in your username or password be sure to escape them!`);\n }\n }\n }\n logOriginalError(logger, error);\n}", "static logError(error) {\n console.log('[ERROR] Looks like there was a problem: \\n', error);\n }", "logError(error) {\n console.error(error);\n return error;\n }", "function errorHandler(error) { console.log('Error: ' + error.message); }", "function err() {\n logWithProperFormatting(out.console.error, '(ERROR)', arguments);\n}", "function errorHandler(err)\n {\n if(err.code == 1)\n {\n console.log(\"error: access is denied!\");\n }\n else if( err.code == 2) {\n console.log(\"error: position is unavailable!\");\n }\n }", "function handleError(err, user1, user2) {\n console.error(`Username: ${user1} ${user2 ? ` ${user2} ` : ''}-- Error: ${err}`);\n if (err === errors.UNAVAILABLE_ERROR.INPUT)\n return err.UNAVAILABLE_ERROR.OUTPUT;\n else if (err.error === errors.NOT_FOUND_ERROR)\n return getUserNotFoundError(user1, user2);\n else\n return err;\n}", "error(text) {\n if (this.seenErrors.has(text))\n return;\n this.seenErrors.add(text);\n this.log(text, LogLevel.Error);\n }", "function handleErrors(msg) {\n throw new Error(msg);\n}", "function eLog(err) {\n if (err) {\n console.log('Redis Error: ' + err);\n }\n}", "function logErrors(err, req, res, next) {\n console.log(err);\n next(err);\n}", "logError (err) {\n\n switch (err) {\n\n case 1: //Autodesk.Viewing.ErrorCode.UNKNOWN_FAILURE\n return 'An unknown failure has occurred.'\n\n case 2: //Autodesk.Viewing.ErrorCode.BAD_DATA\n return 'Bad data (corrupted or malformed) was encountered.'\n\n case 3: //Autodesk.Viewing.ErrorCode.NETWORK_FAILURE\n return 'A network failure was encountered.'\n\n case 4: //Autodesk.Viewing.ErrorCode.NETWORK_ACCESS_DENIED\n return 'Access was denied to a network resource (HTTP 403).'\n\n case 5: //Autodesk.Viewing.ErrorCode.NETWORK_FILE_NOT_FOUND\n return 'A network resource could not be found (HTTP 404).'\n\n case 6: //Autodesk.Viewing.ErrorCode.NETWORK_SERVER_ERROR\n return 'A server error was returned when accessing ' +\n 'a network resource (HTTP 5xx).'\n\n case 7: //Autodesk.Viewing.ErrorCode.NETWORK_UNHANDLED_RESPONSE_CODE\n return 'An unhandled response code was returned ' +\n 'when accessing a network resource (HTTP everything else).'\n\n case 8: //Autodesk.Viewing.ErrorCode.BROWSER_WEBGL_NOT_SUPPORTED\n return 'Browser error: WebGL is not ' +\n 'supported by the current browser.'\n\n case 9: //Autodesk.Viewing.ErrorCode.BAD_DATA_NO_VIEWABLE_CONTENT\n return 'There is nothing viewable in the fetched document.'\n\n case 10: //Autodesk.Viewing.ErrorCode.BROWSER_WEBGL_DISABLED\n return 'Browser error: WebGL is supported, but not enabled.'\n\n case 11: //Autodesk.Viewing.ErrorCode.RTC_ERROR\n return 'Collaboration server error'\n }\n }", "error(error) {}", "async _handleErrors(err, {eventId, critical, param} = {}) {\n let newErr = new Error();\n /* All validation and constraint errors renamed as ValidationError. */\n newErr.name = 'ValidationError';\n newErr.status = 500;\n newErr.stack = err.stack;\n newErr.errors = [];\n switch (err.name) {\n /* Input failed to validate by Sequelize implementation of\n validator.js. */\n case 'SequelizeValidationError':\n for (let i = 0; i < err.errors.length; i++) {\n newErr.errors.push({\n msg: err.errors[i].message,\n param: err.errors[i].path\n });\n }\n break;\n\n /* Input for foreign key does not exist in associated models. */\n case 'SequelizeForeignKeyConstraintError':\n const path = err.index.split('_')[1];\n newErr.errors.push({\n msg: `Invalid ${path} selected.`,\n param: path\n });\n break;\n\n /* Input is a duplicate of existing record when it needs to be\n unique. */\n case 'SequelizeUniqueConstraintError':\n for (let i = 0; i < err.errors.length; i++) {\n const path = err.errors[i].path;\n const cap_path = path.charAt(0).toUpperCase() + path.substr(1);\n newErr.errors.push({\n msg: `${cap_path} already in use.`,\n param: path\n });\n }\n break;\n\n /* Other errors shouldn't occur, so there is either a server,\n connection, or code error. */\n default:\n if (critical) {\n newErr.errors = 'unknown';\n } else {\n newErr.errors.push({\n msg: err.message,\n param\n });\n }\n }\n /* Set event to error. */\n let msg;\n if (Array.isArray(newErr.errors)) {\n msg = newErr.errors[0].msg;\n } else {\n msg = newErr.errors;\n }\n await this.events.throw(eventId, msg, newErr.stack);\n\n /* Throw error. */\n throw newErr;\n }", "function error_log(error){\n console.log(error.message);\n }", "errorListener(line) {\n verboseLog('ERROR'.red, line);\n this.emit('err', line);\n for (const {match, solution, name, message} of knownErrors) {\n if (line.match(match)) {\n errorLog(`Encountered ${name.red}. ${solution ? 'Known fix:\\n ' + solution : message || 'Unknown error.'}`);\n }\n }\n }", "function logErr(err) {\n\tfs.appendFile('botErrors.log',err,function(err) {\n\t\tif (err) console.log(\"Error recording error: \",err);\n\t\telse console.log(\"Error logged\");\n\t});\n}", "process({getState, action, log}, dispatch) {\n\n const err = action.err || // ... from GeekU async '*.fail' actions\n action.payload; // ... from redux-logic error handler\n\n dispatch( handleUnexpectedError(err) );\n }", "function logError(err) { if(console && console.log) console.log('Error!', err); return false; }", "function ErrorHandler() {}", "function handleError(err){\n\tconsole.log(`Request failed: ${err}`);\n}", "function error(err) {\n\t\t// TODO output error message to HTML\n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`);\n\t\t// let msg = \"If you don't want us to use your location, you can still make a custom search\";\n\t\t// displayErrorMsg(msg);\n\t}", "_receiveError (err) {\n this._log.error('ReceiveError: %s', err.message)\n }", "_receiveError (err) {\n this._log.error('ReceiveError: %s', err.message)\n }", "_receiveError (err) {\n this._log.error('ReceiveError: %s', err.message)\n }", "_receiveError (err) {\n this._log.error('ReceiveError: %s', err.message)\n }", "function errorlog(toAdd) {\n //Print error\n logString += \"<span style='color:red'>\" + \"Error: \" + toAdd + \"</span><br />\";\n //end compile\n if (document.getElementById('machine-code') !== null) {\n document.getElementById('machine-code').id = 'error-log';\n } //no more output will occur\n document.getElementById('hex-code').innerHTML = \"Machine Code was not generated due to an error, see logger for details.\";\n notError = false;\n}", "function logErr(err) {\n\tlet d = new Date();\n\tlet errMsg = \"error occurred at \" + d + \": \" + err;\n\tfs.appendFileSync(\"Error_Log.txt\", errMsg, \"utf8\");\n}", "onerror(err) {\n debug(\"error\", err);\n super.emit(\"error\", err);\n }", "function handleError(err) {\n $log.warn('warning: Something went wrong', err.message);\n }", "function error() {\n var args = [];\n for (var _i = 0; _i < (arguments.length - 0); _i++) {\n args[_i] = arguments[_i + 0];\n }\n // Short circuit if logging is disabled. This is as close to noop as we can get, incase there is a direct reference to this method.\n if(!tConfig.log.enabled) {\n return;\n }\n if(logLevel >= LEVEL.ERROR) {\n var args = slice.call(arguments);\n args.unshift(cError);\n logRunner.apply(this, args, 'error');\n }\n }", "function logGridError(e) {\r\n var stErrMsg = \"An error occurred\";\r\n\r\n if (e && e.errors) {\r\n for (var prop in e.errors) {\r\n stErrMsg = e.errors[prop].errors;\r\n }\r\n }\r\n logError(stErrMsg);\r\n}", "function errHandler(err) {\n console.error('There was an error performing the operation');\n console.log(err);\n console.log(err.code);\n console.error(err.message);\n}", "function map_error(err) {\n if (err.fileName) {\n // regular error\n gutil.log(chalk.red(err.name)\n + ': '\n + chalk.yellow(err.fileName.replace(__dirname + '/src/js/', ''))\n + ': '\n + 'Line '\n + chalk.magenta(err.lineNumber)\n + ' & '\n + 'Column '\n + chalk.magenta(err.columnNumber || err.column)\n + ': '\n + chalk.blue(err.description))\n } else {\n // browserify error..\n gutil.log(chalk.red(err.name)\n + ': '\n + chalk.yellow(err.message))\n }\n\n this.end()\n}", "function errHandler(err) {\n console.error('There was an error performing the operation');\n console.log(err);\n console.log(err.code);\n console.error(err.message);\n}", "function errorHandler(e) {\n var msg = '';\n switch (e.code) {\n case FileError.QUOTA_EXCEEDED_ERR:\n\t\t \tprint('Error: QUOTA_EXCEEDED_ERR');\n break;\n case FileError.NOT_FOUND_ERR:\n\t\t \tprint('Error: NOT_FOUND_ERR');\n break;\n case FileError.SECURITY_ERR:\n\t\t \tprint('Error: SECURITY_ERR');\n break;\n case FileError.INVALID_MODIFICATION_ERR:\n\t\t \tprint('Error: INVALID_MODIFICATION_ERR');\n break;\n case FileError.INVALID_STATE_ERR:\n\t\t \tprint('Error: INVALID_STATE_ERR');\n break;\n default:\n\t\t \tprint('Error: Unknown Error\\n(Check console for details)');\n\t\t \tconsole.log(e);\n break;\n };\n}", "function onFail(d) { console.log(\"ERR:ON FAIL\"+d); logm(\"ERR\",1,\"ON FAIL\",d); }", "function handleError(error){\n\t\tconsole.error(\"[ERROR] \", error);\n\t}", "_handle_error(event) {\n let message = event.detail;\n this.$.log.error(message)\n }", "function handleError(err) {\n // Print the error to the console so we can debug it.\n console.log(\"Error: \", err);\n }", "logQueryError(error) {\n if (this.options.logFailedQueryError /*|| process.env.LOGGER_CLI_SCHEMA_SYNC*/)\n this.log(\"error\", \"error during executing query:\" + error);\n }", "static error(...args) {\n if (this.toLog('ERROR')) {\n console.error.apply(console, arguments);\n }\n }", "function _error(message,error){\r\n if(error){\r\n message += ' ' + JSON.stringify(error);\r\n }\r\n console.log(message);\r\n var logger = _getLogger();\r\n if(logger){\r\n logger.error(message);\r\n }\r\n}", "function handleError(err){\n\t //TODO: we need to handle the error correctly here... \n\n\t if (err && err.data) {\n\t //need to set it to .data because this handles the error\n\t //bubbling up from $http and from the taskman event\n\t err = err.data;\n\t }\n\n\t if (err) {\n\t var msg = {\n\t message: err.Message,\n\t exception: err.ExceptionMessage,\n\t type: err.ExceptionType,\n\t stack: err.StackTrace\n\t }\n\t $scope.currentTask.exception = msg;\n\t }\n\t else {\n\t $scope.currentTask.exception = err;\n\t }\n\t }", "function map_error(err) {\n\tif (err.fileName) {\n\t\t// Regular error\n\t\tgutil.log(chalk.red(err.name) +\n\t\t\t': ' +\n\t\t\tchalk.yellow(err.fileName.replace(__dirname + '/src/', '')) +\n\t\t\t': ' +\n\t\t\t'Line ' +\n\t\t\tchalk.magenta(err.lineNumber) +\n\t\t\t' & ' +\n\t\t\t'Column ' +\n\t\t\tchalk.magenta(err.columnNumber || err.column) +\n\t\t\t': ' +\n\t\t\tchalk.blue(err.description))\n\t} else {\n\t\t// Browserify error..\n\t\tgutil.log(chalk.red(err.name) +\n\t\t\t': ' +\n\t\t\tchalk.yellow(err.message))\n\t}\n\n\tthis.emit('end');\n}", "function processError(){\n\t\tconsole.log('Error connecting to twitter API!');\t\n\t}", "function _reportError(err){\n console.log(\"Mysql \"+ err);\n}", "function error() {\n let ln = '??'\n try {\n const line = ((new Error).stack ?? '').split('\\n')[2]\n const parts = line.split(':')\n ln = parts[parts.length - 2]\n }\n catch { }\n log_print(ln, 'error', arguments)\n}", "_handleRequestError(err, request, response) {\n\t\tconst url_parts = url.parse(request.url, true);\n\t\tlet payload = '';\n\n\t\tif (!!request.post) payload = request.post.Value;\n\n\t\tthis._requestslog('error', err.message, { error: err, client: url_parts, payload: payload });\n\n\t\tresponse.writeHead(err.code, { 'Content-Type': 'text/plain' });\n\t\tresponse.write(err.message);\n\t\tresponse.end();\n\t}", "function handleError() {\n // TODO handle errors\n // var message = 'Something went wrong...';\n }", "static error(message) {\n\t\tthis.log(Logger.Level.error, message)\n\t}", "function errorHandler(e) {\n var msg = '';\n\n switch (e.code) {\n case FileError.QUOTA_EXCEEDED_ERR:\n msg = 'QUOTA_EXCEEDED_ERR';\n break;\n case FileError.NOT_FOUND_ERR:\n msg = 'NOT_FOUND_ERR';\n break;\n case FileError.SECURITY_ERR:\n msg = 'SECURITY_ERR';\n break;\n case FileError.INVALID_MODIFICATION_ERR:\n msg = 'INVALID_MODIFICATION_ERR';\n break;\n case FileError.INVALID_STATE_ERR:\n msg = 'INVALID_STATE_ERR';\n break;\n default:\n msg = 'Unknown Error';\n break;\n }\n console.log('Error: ' + msg);\n }" ]
[ "0.6783541", "0.66144705", "0.65754795", "0.65069044", "0.6477446", "0.64546734", "0.6429792", "0.6400925", "0.6399612", "0.63855135", "0.63630056", "0.635187", "0.62987435", "0.62821656", "0.62743145", "0.6265746", "0.6263134", "0.6257579", "0.62516415", "0.62366015", "0.6235675", "0.6227079", "0.6226564", "0.62229455", "0.62120134", "0.62048656", "0.6192137", "0.6164389", "0.6162363", "0.6157934", "0.6151196", "0.6141409", "0.61207336", "0.6102663", "0.6096726", "0.6095357", "0.6092671", "0.6092049", "0.6089537", "0.6086197", "0.60823625", "0.6053689", "0.6044067", "0.6040721", "0.60378426", "0.60260797", "0.6021827", "0.6019278", "0.5999928", "0.5996795", "0.5996318", "0.5991024", "0.59774256", "0.5974104", "0.5958263", "0.5955874", "0.59460026", "0.5945303", "0.5943991", "0.5941604", "0.59330875", "0.5932138", "0.59312755", "0.5926433", "0.59247524", "0.5922749", "0.5919698", "0.59180796", "0.5917034", "0.5915044", "0.59066236", "0.58950526", "0.58950526", "0.58950526", "0.58950526", "0.5888977", "0.5887982", "0.58817166", "0.5877885", "0.58716017", "0.5869733", "0.58640724", "0.586053", "0.58602184", "0.58572453", "0.5852966", "0.58505934", "0.5849003", "0.5847005", "0.5846648", "0.58466166", "0.583868", "0.58319443", "0.58296716", "0.5828701", "0.58204573", "0.5819135", "0.5811302", "0.58068264", "0.58045185", "0.5804066" ]
0.0
-1
Methodes pour les boutons next et prev
next () { console.log(this.currentItem) this.gotoItem(this.currentItem + this.slidesToScroll) // Appel de la methode gotoItem et parametres : index de l'item + nombres de slide a defiler }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tagNextPrev() {\n\t\t\tif ($nav_panels.children('.last').hasClass('active_page')) {\n\t\t\t\t$nav_panels.children('.next_link').add('.last_link').addClass('no_more ' + jquery_ui_disabled_class);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$nav_panels.children('.next_link').add('.last_link').removeClass('no_more ' + jquery_ui_disabled_class);\n\t\t\t}\n\n\t\t\tif ($nav_panels.children('.first').hasClass('active_page')) {\n\t\t\t\t$nav_panels.children('.previous_link').add('.first_link').addClass('no_more ' + jquery_ui_disabled_class);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$nav_panels.children('.previous_link').add('.first_link').removeClass('no_more ' + jquery_ui_disabled_class);\n\t\t\t}\n\t\t}", "function prevNextBtnEvents() {\n document\n .querySelectorAll(\".slider .handle:not(.net-prev-next)\")\n .forEach((item) => {\n item.classList.add(\"net-prev-next\");\n item.addEventListener(\"mousedown\", (event) => {\n setTimeout(function () {\n addEvents();\n prevNextBtnEvents();\n }, 1000);\n });\n });\n }", "function hideNextPrev(el) {\n var lastIsVisible = (($(el).children('li').last().offset().left + $(el).children('li').last().outerWidth(true) - $(el).parent().offset().left) <= $(el).parent().outerWidth(true));\n if (lastIsVisible) {\n $(el).parent().find(\"a.move-next\").hide();\n }\n else {\n $(el).parent().find(\"a.move-next\").show();\n }\n\n var firstIsVisible = (($(el).children('li').first().offset().left - $(el).parent().offset().left) >= 0);\n if (firstIsVisible) {\n $(el).parent().find(\"a.move-prev\").hide();\n }\n else {\n $(el).parent().find(\"a.move-prev\").show();\n }\n }", "function getPrev(){\n page--\n getSearch()\n}", "get prev() {return this._pp.prev;}", "function getNext() {\n\n }", "_nextButtonClickHandler() {\n const that = this;\n\n that.next();\n }", "function nextPrevFoto(direzione) {\n console.log(direzione);\n var activeImg = $('.images img.active');\n var activeCrcl = $('.nav i.active');\n\n\n //RESET\n activeImg.removeClass('active');\n activeCrcl.removeClass('active');\n\n //NEXT\n if(direzione === 'next') {\n\n //SE RAGGIUNGIAMO L'ULTIMA FOTO/CERCHIO, RITORNIAMO AL PRIMO\n if(activeImg.hasClass('last')){\n $('.images img.first').addClass('active');\n $('.nav i.first').addClass('active');\n }\n\n //SE CLICCHIAMO LA FRECCIA, PASSA ALLA PROSSIMA FOTO/CERCHIO\n activeImg.next('img').addClass('active');\n activeCrcl.next('i').addClass('active');\n }\n \n //PREV\n else if (direzione === 'prev') {\n\n //SE RAGGIUNGIAMO LA PRIMA FOTO/CERCHIO, RITORNIAMO ALL'ULTIMA\n if(activeImg.hasClass('first')){\n $('.images img.last').addClass('active');\n $('.nav i.last').addClass('active');\n }\n\n else {//SE CLICCHIAMO LA FRECCIA SINISTRA, TORNA INDIETRO DI FOTO/CERCHIO\n activeImg.prev('img').addClass('active');\n activeCrcl.prev('i').addClass('active');}\n } else {\n //direzione -> $(this) -> referenza elemento che genera l'evento\n direzione.addClass('active');\n\n console.log(direzione.index());\n var pos = direzione.index();\n $('.images img').eq(pos).addClass('active');\n }\n\n }", "function prev() {\n\t\t\treturn go(current-1);\n\t\t}", "onPrevClick(){\n if(this.state.currentPage - 1 >= 1){\n this.changePage(this.state.currentPage - 1);\n }\n }", "function fNextPreviousButtons (rightArrowId, leftArrowId, aImages, aTitles, sectionImgsContainerId) {\n var ii = 0;\n /**-------------===========( Next Click Functions )===========-------------**/\n rightArrowId.click (function () {\n //console.log (\"rightArrowId:--------------\");\n leftArrowId.show ();\n ii++;\n nextPos = colRightWidth * ii;\n titolo.textContent = aTitles[ii];\n if (nextPos <= 0) {\n nextPos = 0;\n }\n if (ii >= (aImages.length - 1)) {\n ii = aImages.length - 1; //imgsCount - 1; //\n rightArrowId.hide ();\n //console.log (\"ij2b: \", ii);\n }\n fSlider (sectionImgsContainerId, -nextPos);\n\n /** Test position **/\n /*elemPosition = sectionImgsContainerId.position ();\n //console.log (\"elemPosition: \", elemPosition.left);*/\n });\n\n /**-------------===========( Previous Click Functions )===========-------------**/\n leftArrowId.bind (\"click\", function () {\n //console.log (\"leftArrowId:--------------\");\n rightArrowId.show ();\n ii--;\n //console.log (\"ij1: \", ii);\n prevPos = colRightWidth * ii;\n //console.log (\"prevPos: \", prevPos);\n //console.log (\"colRightWidth: \", colRightWidth);\n //console.log (\"aImages.length: \", aImages.length);\n titolo.textContent = aTitles[ii];\n if (prevPos <= 0) {\n prevPos = 0;\n }\n if (ii <= 0) {\n //console.log (\"ij1b: \", ii);\n j = 0;\n leftArrowId.hide ();\n }\n fSlider (sectionImgsContainerId, -prevPos);\n })\n }", "function paginationPrevNext() {\n paginationPreviousButton.style.opacity = \"1\";\n paginationPreviousButton.style.pointerEvents = \"auto\";\n paginationNextButton.style.opacity = \"1\";\n paginationNextButton.style.pointerEvents = \"auto\";\n if (page == 1) {\n paginationPreviousButton.style.opacity = \"0\";\n paginationPreviousButton.style.pointerEvents = \"none\";\n }\n if (page == maxPage) {\n paginationNextButton.style.opacity = \"0\";\n paginationNextButton.style.pointerEvents = \"none\";\n }\n}", "key(e) {\n if(e.keyCode == 39) {this.next();}\n else if(e.keyCode == 37) {this.prev();}\n }", "function nextArrow(){\r\n // Utilizziamo una variabile per indicare la condizione iniziale dell'active, il quale si dovrà spostare nelle immagini successive al click.\r\n var immagini = $('.images img.active');\r\n // Dobbiamo prima togliere la classe 'active' dall'immagine iniziale e, dopo, aggiungere 'active' all'immagine successiva.\r\n immagini.removeClass('active');\r\n immagini.next().addClass('active');\r\n // La condizione if permette di far ritornare la classe 'active' dall'ultima immagine (last) alla prima immagine (first).\r\n if (immagini.hasClass('last')) {\r\n $('.images img.first').addClass('active');\r\n }\r\n // Adesso dobbiamo cambiare il colore dei pallini della navbar che devono diventare blu quando si clicca. Utilizziamo una variabile per indicare la condizione iniziale dell'active.\r\n var pallinoBlu = $('.nav i.active');\r\n // La classe 'active' passa dal primo pallino (first) al pallino successivo.\r\n pallinoBlu.removeClass('active');\r\n pallinoBlu.next().addClass('active');\r\n // if permette di far ritornare la classe 'active' dall'ultimo pallino (last) al prima pallino (first).\r\n if (pallinoBlu.hasClass('last')) {\r\n $('.nav i.first').addClass('active');\r\n }\r\n}", "function thumb_next() {\n\tremove_watermark();\n\tif ($('#container').find('.thumb_current').length > 0) {\n\t\t$nb_thumb = $('#container').find('.thumb').length;\n\t\t$index = $('.thumb_current').index();\n\t\t$index++;\n\t\tif ($index < $nb_thumb) { //Goto next\n\t\t\t$item_next = $('#container').children()[$index];\n\t\t\t$('.thumb_current').removeClass('thumb_current');\n\t\t\t$item_next.className += ' thumb_current';\n\t\t\tthumb_adjust_container_position();\n\t\t\treturn true; //We have move\n\t\t} else {\n\t\t\treturn false; //We do not move\n\t\t}\n\t}\n }", "function my_next(that){\n\t\tthat.hideNextButton(); //schova tlacitko next\n\t\tthat.hidePreviousButton(); //schova tlacitko previous\n\t\t\n\t\tthat.questionclick = function(event, element) {\n\t\t\tif(element.type == \"radio\") {that.clickNextButton();}\n\t\t\t//Pokud nekdo klikne na moznost u multiple choice otazky ,\n\t\t\t//POZOR, pokud by Vam to nefungovalo, ujistete se v inspektoru,ze jsou Vase moznosti HTML elementy typu radio; ruzne sablony to mohou mit ruzne\n\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}", "function showNextPrev(){\n\n\tlink = \"\";\n\n\tcountImg = $(\"#inner_div>img\").size();\n\t\n\tfor (var i =1; i<=countImg; i++) {\n\n\t\tif (i==1) {\n\n\t\t\tlink +=\"<a class='activeLink' id=\"+i+\" href='#\"+i+\"' onclick='slideShow(\"+i+\"); return false;'><span class='btn btn-default btn-circle'></span></a>\";\n\t\t}else{\n\t\t\tlink +=\"<a id=\"+i+\" href='#\"+i+\"' onclick='slideShow(\"+i+\"); return false;'><span class='btn btn-default btn-circle'></span></a>\";\n\t\t}\t\n\t\t\n\t}\n\n\t$(\"#linkList\").html(link);\n\n}", "function paginationBackward(event) {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tvar currentEq = $('.sp-thumbs .sp-current').index();\n\t\t\t\tif(currentEq <= 0) {\n\t\t\t\t} else {\n\t\t\t\t\tif (currentEq == 1) {\n\t\t\t\t\t\t$('#sp-prev').css('opacity','.1');\n\t\t\t\t\t}\n\t\t\t\t\tvar nextEq = currentEq - 1;\n\t\t\t\t\t$('#sp-next').css('opacity','1');\n\t\t\t\t\t$('.sp-current').removeClass();\n\t\t\t\t\t$('.sp-thumbs a:eq('+nextEq+')').addClass('sp-current');\n\t\t\t\t\tswapImages(currentEq, nextEq)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t}", "createControls() {\n document.getElementById('next').addEventListener('click', () => {\n this.nextSlide();\n });\n\n document.getElementById('prev').addEventListener('click', () => {\n this.previousSlide();\n });\n\n for(let pager of this.paginationButtons) {\n pager.addEventListener('click', (event) => {\n let index = event.target.dataset.index;\n this.goToSlide(index);\n });\n }\n }", "function updatePrevNextButtons(index) {\n\n var $nextBtn = $('.prev-next-buttons circle.button-right, ' +\n '.prev-next-buttons polygon.button-right');\n var $prevBtn = $('.prev-next-buttons circle.button-left, ' +\n '.prev-next-buttons polygon.button-left');\n\n if (index <= 0) {\n $prevBtn.css('opacity', '0.35');\n } else {\n $prevBtn.css('opacity', '1.0');\n }\n\n if (index >= (Session.get('imagesCount') - 1)) {\n $nextBtn.css('opacity', '0.35');\n } else {\n $nextBtn.css('opacity', '1.0');\n }\n\n}", "function bubbleNextRun(){\n addStep(\"Set node 1 as current and node 2 as \\\"next\\\"\");\n setClass(nodes[0], 2, \"Current\"); \n setClass(nodes[1], 2, \"Special\");\n bubbleIndex = 0;\n bubbleIsSorted = true;\n bubbleEndStep = 1;\n}", "_previousButtonClickHandler() {\n const that = this;\n\n that.prev();\n }", "traversePreviousQuestion() {\r\n this.curr = this.curr.prev;\r\n }", "function prev() {\n\t\t\tgoToImage((curImage-1 < 0 ? numImages-1 : curImage-1), next ,true);\n\t\t}", "buttons(){\n data.then(data=>{\n \n // condition logic for next button\n if(this.firstIndex < data.length-6 && this.firstIndex >= 0){\n nextBtn.style.display = \"block\"\n } else {\n nextBtn.style.display = \"none\"\n }\n // condition logic for prev btn\n\n if(this.firstIndex > 0 && this.firstIndex < data.length){\n prevBtn.style.display = \"block\"\n }else{\n prevBtn.style.display = \"none\"\n }\n\n }).catch(err => console.log(err))\n}", "function paginationForward(event){\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tvar currentEq = $('.sp-thumbs .sp-current').index(),\n\t\t\t\t\ttotalItems = $('.sp-thumbs a').length;\n\t\t\t\tif(currentEq+1 >= totalItems) {\n\t\t\t\t} else {\n\t\t\t\t\tvar nextEq = currentEq + 1,\n\t\t\t\t\t\tnewImg = $('.sp-thumbs').find('a:eq('+nextEq+')').attr('href');\n\t\t\t\t\tif (currentEq == (totalItems - 1)) {\n\t\t\t\t\t\t$('#sp-next').css('opacity','.1');\n\t\t\t\t\t}\n\t\t\t\t\t$('.sp-current').removeClass();\n\t\t\t\t\t$('.sp-thumbs a:eq('+nextEq+')').addClass('sp-current');\n\t\t\t\t\tswapImages(currentEq, nextEq);\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t}", "next() {\n\n if (this.currStep < this.slides[this.currSlide].steps.length - 1) {\n\n this.nextStep();\n\n } else {\n\n this.nextSlide();\n\n }\n\n }", "function prevArrow() {\r\n var immagini = $('.images img.active');\r\n immagini.removeClass('active');\r\n immagini.prev().addClass('active');\r\n if (immagini.hasClass('first')) {\r\n $('.images img.last').addClass('active');\r\n }\r\n var pallinoBlu = $('.nav i.active');\r\n pallinoBlu.removeClass('active');\r\n pallinoBlu.prev().addClass('active');\r\n if (pallinoBlu.hasClass('first')) {\r\n $('.nav i.last').addClass('active');\r\n }\r\n}", "function navigate() {\n\t   \t//remove css classes from items\n\t\t$('#js_itemlist > li').removeAttr('style');\n\t\t$('#js_itemlist > li.current').removeClass('current');\n\t\t$('#js_itemlist > li.next-out').removeClass('next-out');\n\t\t$('#js_itemlist > li.next-in').removeClass('next-in');\n\t\t$('#js_itemlist > li.prev-out').removeClass('prev-out');\n\t\t$('#js_itemlist > li.prev-in').removeClass('prev-in');\n\t\t\n\t\t\t\t\n\t\t//active and isNext nodes\n\t\tvar $active = $('#js_itemlist > li.current'),\n\t isNext = $(this).hasClass('next');\n\t\t\n\t\t//get current index\n\t\tcurrentIndex = (currentIndex + (isNext ? 1 : -1)) % itemCount;\n\n\t\t/* go back to the last item if we hit -1 */\n\t\tif (currentIndex === -1) {\n\t\t\tcurrentIndex = itemCount - 1;\n\t\t}\n\t\t\n\t\t//add css classes for transition\n\t\tvar $next = $('#js_itemlist > li:eq(' + currentIndex + ')');\n\t\t$active.addClass(isNext ? 'next-out' : 'prev-out');\n\t\t$next.addClass('current').addClass(isNext ? 'next-in' : 'prev-in');\n\t\t\n\t\treturn false;\n\t\t\n}", "next() {\r\n this.active = (this.active < this.len - 1) ? this.active + 1 : 0\r\n this.move('->')\r\n }", "constructor(value, prev = null, next = null) {\n this.value = value;\n this.prev = prev;\n this.next = next;\n }", "function handleNext() {\n var current = document.getElementsByClassName(\"current\")[0];\n var next = current.getAttribute(\"data-next\");\n\n startLightBox(next);\n }", "handleClickButtons(event){\n let label = event.target.label;\n if(label === 'Previous'){\n this.pageNo -=1;\n }else if(label === 'Next'){\n this.pageNo +=1;\n }\n this.preparePaginationList();\n }", "function next(item){\r\n return item.nextElementSibling;\r\n }", "function next(item){\r\n return item.nextElementSibling;\r\n }", "prev() {\n\n if (this.currStep > -1) {\n\n this.prevStep();\n\n } else {\n\n this.prevSlide();\n\n }\n\n }", "function next(item){\n return item.nextElementSibling;\n }", "function next(item){\n return item.nextElementSibling;\n }", "function next(item){\n return item.nextElementSibling;\n }", "function next() {\r\n // attribuisco alla variabile l'immagine e il point che ha come classe active\r\n var forth = $(\"img.active\");\r\n var circleForth = $(\".point i.active\");\r\n // rimuovo la classe active all'elemento che diventerà display:none\r\n forth.removeClass(\"active\");\r\n circleForth.removeClass(\"active\");\r\n // se arrivo all'ultimo elemento (a cui ho attribuito la classe last come bandiera per segnalare che è l'ultimo)\r\n // la classe active l'attribuisco all'elemento che ha come classe first (bandiera assegnata al primo elemento così da poter ricominciare a scorrere dal primo elemento)\r\n if (forth.hasClass(\"last\")) {\r\n $(\"img.first\").addClass(\"active\");\r\n $(\"i.first\").addClass(\"active\")\r\n } // altrimenti assegno la classe active all'elemento successivo che abbia lo stesso tag (quindi suo fratello) dell'elemento\r\n else {\r\n forth.next(\"img\").addClass(\"active\");\r\n circleForth.next(\"i\").addClass(\"active\");\r\n }\r\n}", "next(){\r\n (this.position == this.testimonial.length - 1) ? this.position = 0 : this.position++\r\n }", "function chunkedPrevNext(){\n var toc = $('.toc').first();\n var links = toc.find('a').filter(function () {\n return this.href.match(/.*\\.html?$/);\n });\n\n /* PAL2-7900 there can be more than one prev/next link on a page, and they can be marked with either id or class */\n var nextlink = $('.header-navigation-next,#header-navigation-next');\n var prevlink = $('.header-navigation-prev,#header-navigation-prev');\n\n var next = '';\n var prev = '';\n\n /*ASN: Looping the toc to create correct prev/next navigation corresponding to toc options.*/\n for (var index = 0; index < links.length; index++) {\n var minusone = links[index - 1];\n var plusone = links[index + 1];\n if (typeof minusone !== \"undefined\") {\n if (minusone.classList.contains('active')) {\n var jqueryObj = $(links[index]);\n next = jqueryObj.attr('href');\n nextlink.attr('href', next);\n }\n }\n\n if (typeof plusone !== \"undefined\") {\n if (plusone.classList.contains('active')) {\n var jqueryObj = $(links[index]);\n prev = jqueryObj.attr('href');\n prevlink.attr('href', prev);\n }\n }\n };\n\n\n if (next == '') {\n nextlink.remove();\n }\n}", "nextPage() {\n if (this.state.currentPageNumber[0] < this.state.pageNumbers[this.state.pageNumbers.length - this.state.currentPageNumber.length]) {\n const pageNumbers = this.state.currentPageNumber;\n for (let i = 1; i <= pageNumbers.length; i++){\n pageNumbers[i-1] =(pageNumbers[i-1]+1); \n }\n \n this.setState({\n currentPageNumber: pageNumbers,\n prev:false\n })\n \n }\n else {\n this.setState({\n next:true\n })\n }\n }", "function next() {\n changeSlide($nextel);\n }", "requestMoveNext (event) {\n this.requestMove('next', event)\n }", "function prev(item){\r\n return item.previousElementSibling;\r\n }", "function prev(item){\r\n return item.previousElementSibling;\r\n }", "bindEventListeners(links) \r\n\t{\r\n\t\tlet instance = this;\r\n\r\n\t\tthis.next.childNodes[0].onclick = function(e) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tlet requestedPage = instance.current+1;\r\n\r\n\t\t\tif (instance.notInPageRange(requestedPage)) {\r\n\t\t\t\tthrow new NotInPageRangeException('The page you requesting does not exists');\r\n\t\t\t}\r\n\r\n\t\t\tif (Products && Products.booted) {\r\n\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\tinstance.setCurrent(requestedPage);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tthis.previous.childNodes[0].onclick = function(e) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tlet requestedPage = instance.current-1;\r\n\r\n\t\t\tif(instance.notInPageRange(requestedPage)) {\r\n\t\t\t\tthrow new NotInPageRangeException('The page you requesting does not exists');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (Products && Products.booted) {\r\n\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\tinstance.setCurrent(requestedPage);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfor(var i = 0; i < this.pages.length; i++) {\r\n\t\t\tthis.pages[i].childNodes[0].onclick = function(e) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\t\r\n\t\t\t\tlet requestedPage = this.getAttribute('data-page-nr');\r\n\t\t\t\t\r\n\t\t\t\tif (Products && Products.booted) {\r\n\t\t\t\t\tProducts.loadProducts(requestedPage).then(function(products) {\r\n\t\t\t\t\t\tinstance.setCurrent(requestedPage);\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}", "function Previous() {\n currentIndex = (currentIndex <= 0) ? currentIndex : (currentIndex - 1);\n // Call function to display the beer informations\n displayBeers();\n}", "get reversed() {\n return \"prev\" === this._next;\n }", "function goNext( event ){\n event.preventDefault();\n go( revOffset - 1 );\n return false;\n }", "requestMoveNext(event) {\n this.requestMove('next', event);\n }", "_setEvent_next(){\n $(this._controlSelectors.next).click(()=>{\n this.next();\n });\n }", "function slideNextPrev(slides, picSwiper, labelSwiper) {\n for(var i = 0; i < slides.length; i++) {\n (function (index) {\n slides[index].addEventListener('click', function() {\n if(slides[index].classList.contains('swiper-slide-next')) {\n console.log ('next')\n picSwiper.slideNext(500);\n event.preventDefault();\n } else if (slides[index].classList.contains('swiper-slide-prev')) {\n console.log ('prev')\n picSwiper.slidePrev(500);\n event.preventDefault();\n } else {\n console.log ('active')\n }\n });\n }) (i)\n };\n // link between img and label slides \n if(typeof labelSwiper !== 'undefined') {\n picSwiper.controller.control = labelSwiper;\n };\n }", "function next(item) {\n return item.nextElementSibling;\n }", "function next() {\n var nextButton = gAppState.checkId(\"nextBtnID\", \"nextBtnID2\");\n var prevButton = gAppState.checkId(\"prevBtnID\", \"prevBtnID2\");\n var remainder = tableSize - limit;\n\n if (nextButton.classList.contains('disabled')) { // stop action if button is disabled\n return false;\n }\n\n if (offset < remainder) { // if there is a next page\n offset += parseInt(limit);\n buttonDisplay();\n }\n\n // refresh table\n if (resultMode == \"bn\") {\n bnQueryGen();\n } else if (resultMode == \"query\") {\n queryGen();\n } else {\n updateTable();\n }\n}", "function prev_slide(ev)\n {\n ev.preventDefault();\n if (current == 0) return; // Already at first element\n activate(current - 1); // Move the \"active\" class\n //console.log(\"prev: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "get next() { return this.nextStep; }", "function setEventButtonNavigation(listtemp) {\n let buttonprev = document.getElementById('buttonprev');\n let buttonnext = document.getElementById('buttonnext');\n buttonprev.addEventListener('click', function () {\n let ul = document.getElementById('itemPage');\n let active = document.getElementById('active');\n itempage = parseInt(active.firstChild.innerHTML) - 1;\n tbody.innerHTML = '';\n setList(listtemp, itempage);\n if (totaltemp <= 5) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else {\n if (itempage <= 3) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else if (itempage >= totaltemp - 2) {\n itemnavigate = totaltemp - 4;\n setPageNavigation(listtemp);\n } else {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) - 1;\n setPageNavigation(listtemp);\n }\n }\n });\n buttonnext.addEventListener('click', function () {\n let ul = document.getElementById('itemPage');\n let active = document.getElementById('active');\n itempage = parseInt(active.firstChild.innerHTML) + 1;\n tbody.innerHTML = '';\n setList(listtemp, itempage);\n if (totaltemp <= 5) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else {\n if (itempage <= 3) {\n itemnavigate = 1;\n setPageNavigation(listtemp);\n } else if (itempage >= totaltemp - 2) {\n itemnavigate = totaltemp - 4;\n setPageNavigation(listtemp);\n } else {\n itemnavigate = parseInt(ul.firstChild.firstChild.innerHTML) + 1;\n setPageNavigation(listtemp);\n }\n }\n });\n}", "function getPrevButton(){\n if (!urlList[arrURL[4]][urlIndex-1]) {\n navButtonBack.className='hidden';\n return \"this is the End\";\n };\n\n var linkBack = urlList[arrURL[4]][urlIndex-1]['url'];\n fetch(linkBack)\n .then(function(response){\n if(response.ok){\n return response.json();\n } else {navButtonBack.className='hidden';};\n })\n .then(function(obj){\n navButtonBack.addEventListener('click',function(){loadData(obj.url)});\n navButtonBack.setAttribute('title',obj.name||obj.title);\n })\n .catch(function(error){\n console.log(error.message);\n });\n }", "function processNextFuntion(currentProc){\r\n $('.process-prev-next .pr-btns').css('display','none');\r\n $('.process-prev-next .pr-btns[data-stepName = ' + currentProc + ']').css('display','block');\r\n}", "function goPrev( event ){\n event.preventDefault();\n go( revOffset + 1 );\n return false;\n }", "function calcNextPrev(index, array, direction) {\n if (direction === 'next') {\n return array[index + 1] ? array[index + 1] : array[0];\n } else if (direction === 'prev') {\n return array[index - 1] ? array[index - 1] : array[array.length - 1];\n }\n\n return false;\n }", "bindControlsEvent () {\n this.nextBtn.addEventListener(\"click\", () => this.nextSlide())\n this.prevBtn.addEventListener(\"click\", () => this.prevSlide())\n }", "function prevButton() {\n $('#person').fadeOut('fast');\n if(i > 0) {\n i = prev; //if/else checks if you are at the end of the carousel, and if so jumps to the other end.\n var person = data.people[i];\n stagePerson(person);\n console.log(i);\n next = i + 1;\n prev = i - 1;\n } else {\n i = 16;\n var person = data.people[i];\n stagePerson(person);\n console.log(i);\n next = i + 1;\n prev = i - 1;\n }\n }", "function setupNavbuttons() {\n prevBtn = document.createElement('a');\n prevBtn.className = 'prev disabled';\n\n buttons.push(prevBtn);\n parentElement.appendChild(prevBtn);\n\n prevBtn.addEventListener('click', function (event) {\n event.preventDefault();\n prev();\n });\n \n nextBtn = document.createElement('a');\n nextBtn.className = 'next disabled';\n\n buttons.push(nextBtn);\n parentElement.appendChild(nextBtn);\n\n nextBtn.addEventListener('click', function (event) {\n event.preventDefault();\n next();\n });\n }", "function buttonNavUrl(pPrev, pNext) {\n buttons[0].removeAttribute('disabled')\n buttons[0].style.visibility = 'visible'\n buttons[1].removeAttribute('disabled')\n buttons[1].style.visibility = 'visible'\n\n buttons[0].dataset.url = pPrev;\n buttons[1].dataset.url = pNext;\n\n if (pPrev === null) {\n buttons[0].setAttribute('disabled', true)\n buttons[0].style.visibility = 'hidden'\n }\n if (pNext === null) {\n buttons[1].setAttribute('disabled', true)\n buttons[1].style.visibility = 'hidden'\n }\n}", "function prev(item){\n return item.previousElementSibling;\n }", "function prev(item){\n return item.previousElementSibling;\n }", "function prev(item){\n return item.previousElementSibling;\n }", "function nextImage(){\nbuttonModule.next();\n}", "break(dir = 'both'){\n if (dir === 'next'){\n if (this.next != null){\n this.next.last = null;\n this.next = null;\n }\n }else if (dir === 'last'){\n if (this.last != null){\n this.last.next = null;\n this.last = null;\n }\n }else if(dir === 'both'){\n if (this.last != null){\n this.last.next = null;\n this.last = null;\n }\n if (this.next != null){\n this.next.last = null;\n this.next = null;\n }\n }\n }", "function pageButtons($pCount, $cur) {\n /* this variables will disable the \"Prev\" button on 1st page\n and \"next\" button on the last one */\n var $prevDis = ($cur == 1) ? \"disabled\" : \"\",\n $nextDis = ($cur == $pCount) ? \"disabled\" : \"\",\n /* this ($buttons) will hold every single button needed\n ** it will creates each button and sets the onclick attribute\n ** to the \"sort\" function with a special ($p) number..\n */\n $buttons = \"<input type='button' value='&lt;&lt; Anterior' onclick='sort(\" + ($cur - 1) + \")' \" + $prevDis + \">\";\n $buttons += \"&nbsp;<h3 style='display:inline'><span class='label label-warning'>\" + $cur + \" / \" + $pCount +\"</span></h3>&nbsp;\";\n $buttons += \"<input type='button' value='Siguiente &gt;&gt;' onclick='sort(\" + ($cur + 1) + \")' \" + $nextDis + \">\";\n return $buttons;\n}", "next() {\n // $(this.parentElement).data(\"obj\").select_fwd();\n $(this.parentElement).data(\"obj\").update_idx(1);\n return false;\n }", "traverseNextQuestion() {\r\n this.curr = this.curr.next;\r\n }", "function next_slide(ev)\n {\n ev.preventDefault();\n if (current == sync_elts.length - 1) return; // No next element\n activate(current + 1); // Move the \"active\" class\n //console.log(\"next: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "clickedNext(state) {\n return state.clickedNext;\n }", "function slider() {\n\n var slides = document.getElementsByClassName('slide');\n var currentSlide = 0;\n slides[currentSlide].style.display = 'block';\n\n var forward = function (curSlide) {\n var nextSlide = curSlide + 1;\n\n if (nextSlide > slides.length - 1) {\n nextSlide = 0;\n }\n\n return nextSlide;\n }\n\n var backward = function (curSlide) {\n var prevSlide = curSlide - 1;\n\n if (prevSlide < 0) {\n prevSlide = slides.length - 1;\n }\n\n return prevSlide;\n }\n\n var clicker = function (direction) {\n return function () {\n slides[currentSlide].style.display = 'none';\n currentSlide = direction(currentSlide);\n slides[currentSlide].style.display = 'block';\n }\n }\n\n\n var nextButton = document.getElementById('next');\n nextButton.onclick = clicker(forward);\n\n var prevButton = document.getElementById('prev');\n prevButton.onclick = clicker(backward);\n\n}", "function initButtonsEvents(env){\n\t\n\t\tenv.$elts.nextBtn.add(env.$elts.prevBtn)\n\t\t\t\n\t\t\t.bind(\"enable\", function(){\n\t\t\t\t\n\t\t\t\tvar $this = $(this)\n\t\t\t\t\t.unbind(\"click\")\n\t\t\t\t\t.bind(\"click\", function(){\n\t\t\t\t\t\t// Ajax init\n\t\t\t\t\t\tif(env.params.ajaxMode && $this.is('.next') && getActivePageIndex(env) == (getPageTotal(env)-1) && !env.lastItemsToLoad) {\n\t\t\t\t\t\t\t// Append content in ajax\n\t\t\t\t\t\t\tajaxLoad(env);\n\t\t\t\t\t\t\t// Go to next page of the carousel\n\t\t\t\t\t\t\tenv.$elts.content.ajaxSuccess(function() {\n\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}else{\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tgoToStep( env, getRelativeStep(env, ($this.is(\".next\")? \"next\" : \"prev\" )) );\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(env.params.stopSlideBtn == true){\n\t\t\t\t\t\t\t\tenv.$elts.stopSlideBtn.trigger('pause');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tstopAutoSlide(env);\n\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})\n\t\t\t\t\t.removeClass(\"disabled\").removeAttr('disabled');\n\t\t\t\t\n\t\t\t\t// Combined classes (IE6 compatibility)\n\t\t\t\tif (env.params.combinedClasses) {\n\t\t\t\t\t$this.removeClass(\"next-disabled previous-disabled\").removeAttr(\"disabled\");\n\t\t\t\t}\n\t\t\t})\n\t\t\t.bind(\"disable\", function(){\n\t\t\t\t\n\t\t\t\tvar $this = $(this).unbind(\"click\").addClass(\"disabled\").attr(\"disabled\",\"disabled\");\n\t\t\t\t\n\t\t\t\t// Combined classes (IE6 compatibility)\n\t\t\t\tif (env.params.combinedClasses) {\n\t\t\t\t\t\n\t\t\t\t\tif ($this.is(\".next\")) {\n\t\t\t\t\t\t$this.addClass(\"next-disabled\");\n\t\t\t\t\t\t\n\t\t\t\t\t} else if ($this.is(\".previous\")) {\n\t\t\t\t\t\t$this.addClass(\"previous-disabled\");\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.hover(function(){\n\t\t\t\t$(this).toggleClass(\"hover\");\n\t\t\t});\n\t}", "function onClickNaviNext(el) {\n curPageNumber = curPageNumber + 1;\n refreshTable();\n debug('Next button clicked. page number : ' + curPageNumber);\n }", "function getNext(){\n page++\n getSearch()\n}", "getNext() {\n return this.next;\n }", "next() {\n const that = this;\n\n that.navigateTo(that.pageIndex + 1);\n }", "function previousSteps() {\n\tcurrent_step = current_step - 1;\n\tnext_step = next_step - 1;\n}", "function handlePrevButtonClick(){\n count--;\n}", "prev() {\n const that = this;\n\n that.navigateTo(that.pageIndex - 1);\n }", "function handlePrev() {\n let tempPage = page - 1;\n if (tempPage < 1) {\n tempPage = 1;\n }\n setPage(tempPage);\n }", "function prev(item) {\n return item.previousElementSibling;\n }", "function checkActiveClass(){\n\tvar ul,li=[],pagesHidden,nextToDisplay=1;\n\tvar pagination = document.getElementById(\"customPagination\");\n\tif(pagination){\n\t\t ul = document.getElementById(\"ulPagination\");\n\t\tif(ul){\n\t\t\tli = ul.getElementsByClassName(\"customLink\");\n\t\t}\n\t}\n\t\n\tvar isActive = false;\n\tfor(i=0;i<li.length;i++){\n\t\tif(!(li[i].classList.contains(\"active\"))){\n\t\t\tli[i].style.display=\"none\"\n\t\t\t\t document.getElementById(\"prev\").style.display=\"\";\n\t\t} else{\n\t\t\tif(li[i].style.display=\"none\"){\n\t\t\t\tli[i].style.display=\"\";\n\t\t\t}\n\t\t\tif(li[i-1] != undefined){\n\t\t\t\tli[i-1].style.display=\"\";\n\t\t\t} else if(li[i+1] != undefined){\n\t\t\t\tli[i+1].style.display=\"\";\n\t\t\t}\n\t\t\t\n\t\t\tif(li[i+1] != undefined){\n\t\t\t\tli[i+1].style.display=\"\";\n\t\t\t} else if(li[i-1] != undefined){\n\t\t\t\tli[i-1].style.display=\"\";\n\t\t\t\tli[i-2].style.display=\"\";\n\t\t\t}\n\t\t\tisActive = true;\n\t\t}\n\t\n\t\t\n\t\tif(isActive == true){ break; }\n}\n\tif(li[0].style.display==\"\"){\n\t\tdocument.getElementById(\"prev\").style.display=\"none\";\n\t} \n\tif(li[li.length-1].style.display==\"\"){\n\t\tdocument.getElementById(\"next\").style.display=\"none\";\n\t}\n}", "function activeLinks() {\n // Disable prev button if on first slide\n if (count === 0) {\n prev.style.opacity = .5\n prev.removeAttribute('href', '#')\n } else {\n prev.setAttribute('href', '#')\n prev.style.opacity = 1\n }\n // Disable next button if on last slide\n if (count === (div.length - 1)) {\n next.style.opacity = .5\n next.removeAttribute('href', '#')\n } else {\n next.setAttribute('href', '#')\n next.style.opacity = 1\n }\n }", "createNavigation() {\n this.prevButton.addEventListener('click', this.prev.bind(this));\n this.nextButton.addEventListener('click', this.next.bind(this));\n }", "function navigateNext(){\n ++current;\n var $thumb = $('#thumbs_container li:nth-child('+parseInt(current+1)+')').find('img');\n if(!$thumb.length) {\n --current;\n return;\n }\n loadPhoto($thumb);\n }", "function ButtonPrev()\r\n\t{\r\n\t\tdocument.getElementById('influPrevButton').style.backgroundColor='#ffffff'; \r\n\t\tdocument.getElementById('influPrevButton').style.borderTop='0';\r\n\t\tdocument.getElementById('influGeneralButton1').style.backgroundColor='#FBFBFB'; \r\n\t\tdocument.getElementById('influGeneralButton1').style.borderTop='1px solid #DEDEDE';\r\n\t\tdocument.getElementById('influGeneralButton2').style.backgroundColor='#FBFBFB'; \r\n\t\tdocument.getElementById('influGeneralButton2').style.borderTop='1px solid #DEDEDE';\r\n\t\tdocument.getElementById('influGeneralButton3').style.backgroundColor='#FBFBFB'; \r\n\t\tdocument.getElementById('influGeneralButton3').style.borderTop='1px solid #DEDEDE';\r\n\t\tdocument.getElementById('influGeneralButton4').style.backgroundColor='#FBFBFB'; \r\n\t\tdocument.getElementById('influGeneralButton4').style.borderTop='1px solid #DEDEDE';\r\n\t\tdocument.getElementById('influGeneralButton5').style.backgroundColor='#FBFBFB'; \r\n\t\tdocument.getElementById('influGeneralButton5').style.borderTop='1px solid #DEDEDE';\r\n\t\tdocument.getElementById('influNextButton').style.backgroundColor='#FBFBFB';\r\n\t\tdocument.getElementById('influNextButton').style.borderTop='1px solid #DEDEDE';\r\n\t}", "getNext() {\n return this.next || null;\n }", "prev() {\n this.state.index === 0 ?\n this.setState({index: size-1, current: size-1}) :\n this.setState({index: this.state.current-1, current: this.state.current-1 })\n this.setState({turnBluePrev: true, turnBlueNext: false})\n }", "function cambioDePagina(xhttp) {\r\n let paginaAnterior = document.getElementById(\"paginaAnterior\");\r\n\r\n let paginaSiguiente = document.getElementById(\"paginaSiguiente\");\r\n\r\n paginaAnterior.addEventListener(\"click\", function() {\r\n if (xhttp.info.prev) {\r\n traerPersonaje(xhttp.info.prev, insertarCartas);\r\n\r\n } else {\r\n alert(\"No hay paginas antes de esta\")\r\n }\r\n });\r\n paginaSiguiente.addEventListener(\"click\", function() {\r\n if (xhttp.info.next) {\r\n traerPersonaje(xhttp.info.next, insertarCartas);\r\n\r\n } else {\r\n alert(\"No hay paginas despues de esta\")\r\n }\r\n\r\n });\r\n}", "function next() {\n\t\t\treturn go(current+1);\n\t\t}", "function nextSlide() {\n if ( $('.images img.active').hasClass('last') ) {\n\n $('.images img.active').removeClass('active');\n $('.images img.first').addClass('active');\n\n // Pallini\n $('.slider-nav i.active').removeClass('active');\n $('.slider-nav i.first').addClass('active');\n\n } else {\n var imgAttiva = $('.images img.active'); // Rimuovo l'active\n var prossimaImg = $('.images img.active').next();\n\n imgAttiva.removeClass('active');\n prossimaImg.addClass('active');\n\n // Pallini\n var pallinoAttivo = $('.slider-nav i.active'); // Rimuovo l'active\n var prossimaPallino = $('.slider-nav i.active').next();\n\n pallinoAttivo.removeClass('active');\n prossimaPallino.addClass('active');\n }\n }", "function nextSlide() {\n if ( $('.images img.active').hasClass('last') ) {\n\n $('.images img.active').removeClass('active');\n $('.images img.first').addClass('active');\n\n // Pallini\n $('.slider-nav i.active').removeClass('active');\n $('.slider-nav i.first').addClass('active');\n\n } else {\n var imgAttiva = $('.images img.active'); // Rimuovo l'active\n var prossimaImg = $('.images img.active').next();\n\n imgAttiva.removeClass('active');\n prossimaImg.addClass('active');\n\n // Pallini\n var pallinoAttivo = $('.slider-nav i.active'); // Rimuovo l'active\n var prossimaPallino = $('.slider-nav i.active').next();\n\n pallinoAttivo.removeClass('active');\n prossimaPallino.addClass('active');\n }\n }", "function previouss(){\r\n questions.questiontwo();\r\n $(\"#submit\").attr(\"onclick\", \"B()\");\r\n $(\"#previous\").attr(\"onclick\", \"previous(), reset()\");\r\n $(\"#next\").attr(\"onclick\", \"Nextt(), reset()\");\r\n }" ]
[ "0.67157465", "0.6596782", "0.6348247", "0.6312729", "0.6281851", "0.6260482", "0.6235147", "0.6213501", "0.6195057", "0.6193063", "0.61920786", "0.6187541", "0.61347103", "0.6128562", "0.6118152", "0.60822576", "0.6059838", "0.6050084", "0.60205984", "0.6018712", "0.60094357", "0.6003322", "0.6001192", "0.5998767", "0.5984002", "0.5970022", "0.5949717", "0.59166205", "0.5898731", "0.58980846", "0.5897913", "0.5894303", "0.58875304", "0.5877501", "0.5877501", "0.5877254", "0.5869643", "0.5869643", "0.5869643", "0.5863955", "0.5860021", "0.58495533", "0.58458465", "0.5842674", "0.58421373", "0.5823611", "0.5823611", "0.58223546", "0.58214766", "0.58143127", "0.5812896", "0.5810277", "0.5809279", "0.5806374", "0.5802782", "0.58017445", "0.5799676", "0.5795317", "0.5787698", "0.57778466", "0.57750297", "0.5768202", "0.57674706", "0.57672065", "0.57626665", "0.57602847", "0.5757965", "0.57562655", "0.57562655", "0.57562655", "0.5751299", "0.5741024", "0.57347786", "0.57333106", "0.57261765", "0.5725381", "0.57155347", "0.5703863", "0.57033193", "0.5702527", "0.56997937", "0.56995475", "0.5698846", "0.5689113", "0.5678585", "0.5676465", "0.56761545", "0.56744504", "0.5671807", "0.56692976", "0.5668514", "0.5668273", "0.56652135", "0.56638795", "0.5658179", "0.5657521", "0.56472564", "0.56431305", "0.56431305", "0.56339794" ]
0.57494795
71
Methode pour le bouton play
play () { this.playButton = $('#playButton') // Init Bouton play this.options.play ? this.options.play = false : this.options.play = true if (this.options.play === true) { // Si l'option play est égal à true this.playButton.removeClass('carousel__play') // Enlève la classe carousel__play this.playButton.addClass('carousel__pause') // Ajoute la classe carousel__pause this.interval = window.setInterval(() => { // Définis l'intervale this.gotoItem(this.currentItem + 1, this.options.animation) // Appel de la methode GotoItem avec le slide auquel j'ajoute 1 et l'animation à true }, this.options.timer) // 5 secondes entre les défillements } else if (this.options.play === false) { // Si option play est égal à false this.playButton.removeClass('carousel__pause') // Enleve la classe carousel__pause this.playButton.addClass('carousel__play') // Ajoute la classe carousel__play clearInterval(this.interval) // Nettoyage de l'intervale } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Play() {}", "function Play() {}", "ppllay(){\n super.play('Im playing' + ${this.club} );\n\n }", "play()\n {\n\n }", "play(){\n\n\n }", "function play() {\n \n}", "play ({$, buff}) {\n $('own minion').forEach(v => buff(v, 'CS2_046e'));\n }", "get playAutomatically() {}", "function playAlien() {\r\n \r\n}", "function blast(){\n $('#cannon')[0].play();\n}", "play() {\n\t\tthis.trigger('play', this);\n\t}", "play() {\n\t\tthis.trigger('play', this);\n\t}", "playRandom(){\n this.request(this.routes.randomTrack, this.play);\n }", "play() {\n\t\tif (this.getCurrentSong() != null) {\n\n\t\t\t/**\n\t\t\t * factor base del tiempo\n\t\t\t */\n\t\t\tlet seconds = 1.5;\n\n\t\t\t/**\n\t\t\t * funciones asincrona que hace las operaciones\n\t\t\t */\n\t\t\tlet timmer = setInterval(() => {\n\t\t\t\t/**\n\t\t\t\t * segundo actual de la cancion\n\t\t\t\t */\n\t\t\t\tlet currentSecond = this.getCurrentSong().currentSecond;\n\t\t\t\t/**\n\t\t\t\t * Duracion total de la cancion en segundos\n\t\t\t\t */\n\t\t\t\tlet duration = this.getCurrentSong().duration;\n\n\t\t\t\t/**\n\t\t\t\t * Nos indica si la cancion sigue en curso o ya termino\n\t\t\t\t */\n\t\t\t\tif (currentSecond < duration) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Objeto a enviar, obitene la hora actual para\n\t\t\t\t\t * calcular una latencia y el segundo actual de la cancion.\n\t\t\t\t\t */\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\tsendTime: (new Date).getTime(),\n\t\t\t\t\t\tsong: this.getCurrentSong()\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.reproductorConfig.play(data);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Actualizamos los segundos actuales de la cancion.\n\t\t\t\t\t */\n\t\t\t\t\tlet song = this.getCurrentSong();\n\t\t\t\t\tsong.currentSecond += seconds;\n\t\t\t\t\tthis.setCurrentSong(song);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t/**\n\t\t\t\t\t * Limpia La funcion.\n\t\t\t\t\t */\n\t\t\t\t\tclearInterval(timmer);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Selecciona la cancion que sigue.\n\t\t\t\t\t */\n\t\t\t\t\tthis.finishSong();\n\t\t\t\t\tconsole.log('next song please !!');\n\t\t\t\t}\n\t\t\t}, seconds * 1000);\n\t\t}\n\t}", "function Usagi() {\n\tplayer.GetComponent(PlayerMovement).BecomeBunny(this.bunnyTime);\n}", "playHandler() {\n this.startRefreshing();\n this.setStatus({isPlaying: true});\n }", "_onPlayPauze() {\n if (!this.howl) {\n this._playSong(this.props.songs[0]);\n } else {\n this.state.playing ? this.howl.pause() : this.howl.play()\n this.setState({playing: !this.state.playing})\n }\n }", "play() {\r\n /*Display \"Simulating Battle*/\r\n console.log(\"Simulating Battle\");\r\n /*Call the \"createMinions\" function to create the minions.\r\n *Call the \"createPlayers\" function to create the players. */\r\n this.createMinions();\r\n this.createPlayers();\r\n /*create commenceBattle*/\r\n this.commenceBattle();\r\n }", "tocarchampan()\n {\n if(this.scene.sonidoactive && this.scene.sigueJugando)\n {\n this.scene.music.pause();\n this.champmusic.play();\n }\n }", "play() {\n console.log(`WEEEEE I'm a ${this.type}`);\n }", "function mygirl() {\n\t\t\tthis.textbnt_1.play();\n\t\t\tthis.elbent_1.play();\n\t\t\tcreatejs.Sound.play(\"glassdown\");\n\t\t\tcreatejs.Sound.play(\"marwa\");\n\t\t}", "onPlayStateChange() {}", "playController() {\n // If ready to play\n if (readyPlay)\n play();\n else {\n stop();\n }\n }", "function playerswitch() {}", "addBowlButton() {\n\t\tthis.play = this.add.image(config.width * 0.5, config.height * 0.12, \"play\")\n\t\t\t\t\t.setScale(0.5,0.5)\n\t\t\t\t\t.setInteractive();\n\t\tvar _self = this;\n\t\tthis.play.on('pointerdown',function(pointer){\n\t\t\t_self.play.setInteractive(false);\n\t\t\t_self.setInitialBowlerPosition();\n\t\t\t_self.playBowlerAnimation();\n\t\t});\n\t}", "PlayQueued() {}", "$mediaplayerPlay() {\n // console.log('mediaplayerPlay');\n this.tag('Stop').patch({\n visible: false\n }, false);\n this.tag('Play').patch({\n visible: false \n }, false);\n \n}", "start(){\n timeline.play();\n }", "playAudio() {}", "play(note) {\n throw new Error('You have to implement the \"play\" method!');\n }", "function player() {}", "function playBGMInTheCastle (event) {\n bgmInTheCastle.currentTime = 0;\n $(bgmInTheCastle).each(function(){this.play(); $(this).animate({volume:1},1000)});\n }", "function justplay(){\r\n if(Playing_song==false){ //Verifica si se está reproduciendo\r\n playsong(); //Llama a la funcion playsong\r\n () => console.log('i injected');\r\n }else{\r\n pausesong();//Pausa la canción en otro caso\r\n }\r\n}", "play () {\n this.playing = true;\n }", "play() {\n // use \"this\" instead on the object name\n console.log(\"PLAYING '\" + this.title + \"' by \" + this.artist);\n }", "function playBass() {\n\n if (!bassSound.paused) {\n bassSound.play();\n }\n }", "function SamplePlayer() {\r\n}", "function Boom () {\n audio = document.getElementById('boom')\n audio.play()\n}", "onPlayButtonClick() {\n\t\tif ( this.target ) this.target.play();\n\t\tthis.trigger( 'play' );\n\t}", "play() {\n\t\tstaticCache.defouloir.play();\n\t\tthis._width = 1280; // TODO: remove\n\t\tthis._height = 720; // TODO: remove\n\t\tthis._player = new Player(this, this._width / 2, 0, \"Amos\");\n\t\tthis._interface = new Interface(this, this._player);\n\t\tthis._line = new DeathLine(this);\n\t\tthis._platforms = [];\n\t\tthis._bonuses = [];\n\t\tthis._decorations = [];\n\t\tthis._platformGenerator = new PlatformGenerator(this, this._player);\n\t\tthis._bonusGenerator = new BonusGenerator(this);\n\t\tthis._decorationGenerator = new DecorationGenerator(this, this._player);\n\t\tthis._color = \"#1e3514\";\n\t\tthis._select = initButton(true);\n\t\tthis._start = initButton(true);\n\t}", "play(buttonEl) {\n console.log(this)\n playSongLyrics(this.lyrics, this.voice)\n playDrums(this.drums)\n //also play bg song\n playBackgroundSong(this.backgroundSong, this.duration, buttonEl)\n }", "function run(){\n\t\tif(play){\n\t\t\td.find('#pls button').trigger('click')\n\t\t\td.find('#que button').trigger('click')\n\t\t}\n\t\tsetTimeout(function(){\n\t\t\trun()\n\t\t},1)\n\t}", "function playSFXBoatOnOcean (event) {\n sfxBoatOnOcean.currentTime = 0;\n $(sfxBoatOnOcean).each(function(){this.play(); $(this).animate({volume:1},1000)});\n\t}", "start() {\n this.createBoard();\n this.pause();\n this.play();\n this.reset();\n }", "play(){this.__stopped=!0;this.toggleAnimation()}", "function callPlay() {\n bgLog(\"playButton\")\n let message = 1;\n chrome.runtime.sendMessage(message);\n}", "function play() {\n pauseMusic();\n // $ready.show();\n // $btn.show();\n $('html, body').animate({\n scrollTop: $gameboard.offset().top\n }, 2000);\n }", "function playButton(){\n\n\tsocket.emit(\"p\");\n}", "function playBossGun(e) {\n createjs.Sound.play(\"BossGun\");\n}", "function playTShootAudio()\n\t{\n\n\t}", "crier() {\n this.cri.visible = true;\n this.cri.gotoAndPlay(0);\n }", "play() {\n console.log(this);\n }", "function start(){\n board.music.play();\n //si ya esta corriendo el boton, se agrega un if para que no se active de nuevo\n //if()return\n //se pueden colocar aqui extras que requieran inicializar\n if(intervalo > 0) return;\n intervalo = setInterval(function(){\n update();\n }, 100/60);\n flappy.y = 150;//fps a 60\n pipes = [];\n board.score = 0;\n frames = 0;\n }", "play() {\n this.timeline.play();\n }", "play(){\n super.play();\n this.isPlaying = true;\n }", "function startRound(){\n playRound(this.id, computerPlay());\n}", "go() {\n\t\tthis.context.analytics.record(\"Game Loaded\");\n\t\tthis._$template.css({ \"visibility\": \"visible\"}).hide().fadeIn();\n\t\tthis._$start = $(\".start\", this._$template);\n\n\t\tthis._$start.on('click', (e) => {\n\t\t\te.preventDefault();\n\t\t\tthis._$template.fadeOut(() => {\n\t\t\t\tthis.nextState(\"playing\");\n\t\t\t});\n\t\t});\n\t}", "function endPlay() {\n\n}", "function sound(bubb) {\n var audio = new Audio('./sounds/bubble_' + bubb + '.mp3');\n $onOff.hasClass('.soundOff') ? '' : audio.play();\n }", "play(){\n this.initMap();\n this.getMarker();\n }", "function Play(){\n\t\tDebug.Log(\"Playing?\");\n\t\tplaying = true;\n\t\tBotReady();\n\t}", "function play(){\n\tvar container = $(\"container\");\n\tvar levels = [\"Easy\",\"Medium\",\"Hard\",\"Back\"];\n\tvar button;\n\n\t//rimuovo tutti i bottoni\n\tremoveButtons();\n\n\t//aggiungo i bottoni per la scelta del livello difficoltà\n\tfor (var i = 0; i < levels.length; i++) {\n\t\tbutton=createButton(levels[i]);\n\t\tcontainer.appendChild(button);\n\t}\n\n\tbutton.onclick=back;\n}", "function playGame() {\n}", "function playTheme() {\n themeSong.play();\n}", "play(): void {\n var message = Protocol.createMessage(\n false,\n this.clientID,\n 0,\n Protocol.PLAY\n );\n this.socket.emit('postData', JSON.stringify(message));\n }", "play() {\n this.scriptOwner.parentClip.play();\n }", "breakfast() {\n new Breakfast(this.player).breakfast();\n }", "function thememascot_YTPlayer() {\n $(\".player\").mb_YTPlayer();\n }", "click (stream) {\n if (this.current) {\n this.current.state = null;\n this.player.stop();\n }\n\n if (stream == this.current) {\n this.current = null;\n } else {\n this.current = stream;\n this.current.state = 'buffering';\n \n// console.log('this.current.uid'+this.current.uid);\n this.player.play(this.current.uid);\n }\n }", "function opnieuwSpelen(){\n modaal.classList.remove(\"show\");\n startGame();\n muziek2 = new Audio(\"media/opnieuw.wav\");\n muziek2.play();\n}", "function play() {\n\t\t\n\t\t//this function (defined below) will continue to the next turn\n\t\tadvance();\n\t}", "playMusic() {// Load the sound and play it automatically once ready\n // Adding a Continous Sound (we can play it only once with setInterval(() => sound.play(), 3000);)\n this.music = new BABYLON.Sound(\"sound\", \"https://mainline.i3s.unice.fr/mooc/SkywardBound/assets/sounds/humbug.mp3\", \n this.scene,null, { loop: true, autoplay: true });\n \n }", "play() {\n this._playing = true;\n }", "function Insomniac(position,game){\n return game.play({position,action:\"show\",players:[position]});\n}", "ring(nb){\n for(var cpt=0; cpt<nb; cpt++){\n player.play(this.bellPath, function(err){\n if(err){\n console.log(err);\n }\n else{\n console.log('bell rang!');\n }\n });\n }\n return true;\n }", "function BroadSignPlay(){ //set up\n var dd2 = new Date();var hh = dd2.getHours();var mm = dd2.getMinutes();var ss = dd2.getSeconds();\n var data2 = \"BroadSignPlay \" + hh + \":\" + mm + \":\" + ss;\n \n // Print start time to console\n console.log('BroadSignPlay() Called At: ' + hh + \":\" + mm + \":\" + ss )\n \n return badgeDotAnimation();\n}", "play(customData) {\n return Native.play(customData);\n }", "function playThemeSong() {\n themeSong.play();\n}", "handleClick () {\n super.handleClick()\n this.player_.trigger('next')\n }", "function playerReadyBotr(obj) {\n\t\tvar player = document.getElementById(obj.id);\n\t\tplayer.addModelListener('STATE','tdc.Grd.Video.listenerBotrState');\n\t\tvar len = tdc.Grd.Video.push({\n\t\t\tplayer: player,\n\t\t\ttype: 'botr',\n\t\t\tid: player.id,\n\t\t\tplay: function() { this.player.sendEvent('PLAY','true'); },\n\t\t\tpause: function() { this.player.sendEvent('PLAY','false'); },\n\t\t\tstop: function() { this.player.sendEvent('STOP'); }\n\t\t});\n\t\tif (onReadyCallback) {\n\t\t\tonReadyCallback(len - 1);\n\t\t}\n\t}", "function playWallOpenModal() {\n playWallCreateCoverDiv();\n playWallCreateIframe();\n}", "function alarma() {\n pMinutos.innerHTML = `<i class=\"bi bi-alarm\"></i>`\n sonido = document.getElementById('sonidoAlarma')\n sonido.play();\n}", "playerRound() {\n \n }", "seguicionar(){\n \tthis.sonidoseguimiento = game.add.audio('Deslizar.mp3');\n\t\tthis.sonidoseguimiento.play();\n }", "function winner(snowBall0,floor){\n //win.play();\n //boy.animations.play('win');\n soundWin.play();\n soundMainTheme.stop();\n game.state.start('GameOver');\n\n}", "playBGM(keyword, option) {\n return this.changeOption(keyword, option).bind(audio => new M_IO((world) => {\n audio.play();\n return new Tuple(null, world);\n }));\n }", "play() {\n this._source.play();\n }", "startSound() {\n\t\t//nghien cuu them \n\t\tlet audioSound = '';\n\t\t// console.log(audioSound);\n\t\taudioSound = this.mySound.start();\n\t\tlet bat = document.querySelector('#bat');\n\t\tlet tat = document.querySelector('#tat');\n\t\ttat.addEventListener(\"click\", () => {\n\t\t\tif (this.anHien === true) {\n\t\t\t\tbat.style.display = 'block';\n\t\t\t\ttat.style.display = 'none';\n\t\t\t\tthis.anHien = false;\n\t\t\t\taudioSound = this.mySound.stop();\n\t\t\t\t// console.log('da ket noi');\n\t\t\t}\n\t\t});\n\t\tbat.addEventListener('click', () => {\n\t\t\tif (this.anHien === false) {\n\t\t\t\ttat.style.display = 'block';\n\t\t\t\tbat.style.display = 'none';\n\t\t\t\tthis.anHien = true;\n\t\t\t\taudioSound = this.mySound.start();\n\n\t\t\t}\n\t\t});\n\t}", "function play()\n{\n // Ajoute un son aleatoire a la sequence (lettre)\n sequence = \"BVRJB\"\n\n // Joue la sequence\n i = 0;\n const metronome = setInterval( function () {\n joueSon(sequence[i++]);\n if (i >= sequence.length) clearInterval(metronome);\n }, 1000);\n\n // Attend que le joueur la sequence \n\n // Si le joueur se trompe, fin du jeu\n\n // sinon on recommence\n}", "IsPlaying() {}", "function Sound() {\n\t\n}", "playSong(){\n spotifyApi.play({});\n }", "function playStation(){\r\n mySound = new sound (\"us-lab-background.mp3\");\r\n mySound.play();\r\n }", "function endBackSong() {\n // Reduce background song volume \n // using delays until it pauses completely.\n setTimeout(function () {\n startGameSong.volume = .25\n }, 750);\n setTimeout(function () {\n startGameSong.volume = .15\n }, 1500);\n setTimeout(function () {\n startGameSong.volume = .05\n }, 2250);\n setTimeout(function () {\n startGameSong.pause()\n }, 3000);\n\n}", "playClickTrack() {\n const ms = bpmToMs(this.bpm);\n\n this.clickTrackBus.play();\n this.clickTrackPlayer = window.setInterval(() => {\n this.clickTrackBus.stop();\n this.clickTrackBus.play();\n }, ms);\n }", "function playStatic() {\n static.loop();\n}", "caidicionar(){\n \tthis.sonidocaida = game.add.audio('FreeFall.mp3');\n\t\tthis.sonidocaida.play();\n }", "makeSound() {\n\t\tconsole.log('this is the birds sound');\n\t}", "function playInformation(){\n displayPin();\n\n displayBubble();\n\n displayCounter();\n}", "function startSpel() { //roept functie aan.\n hereWeGoAudio.play(); //laat het geluidje afspelen.\n startButton.classList.add(\"remove\"); //De classList.add voegt een class toe en verwijdert de knop.\n\n}" ]
[ "0.7807121", "0.77972215", "0.7623775", "0.7456775", "0.7452273", "0.7351885", "0.6928759", "0.69191116", "0.68777275", "0.6870923", "0.6868757", "0.6868757", "0.6781055", "0.67616165", "0.67546993", "0.6692897", "0.6673415", "0.6671502", "0.663374", "0.65939397", "0.6578189", "0.6577098", "0.65656364", "0.6525604", "0.65169436", "0.6509435", "0.64993507", "0.64977705", "0.6496532", "0.64854515", "0.6476425", "0.6474311", "0.6465139", "0.6464431", "0.6443946", "0.64365464", "0.6426579", "0.6412143", "0.64117706", "0.6406851", "0.6404638", "0.6404609", "0.64002323", "0.6379476", "0.63696516", "0.6351521", "0.63360995", "0.6326525", "0.6318379", "0.6316766", "0.6313362", "0.63129014", "0.63082516", "0.63045925", "0.63021624", "0.62966233", "0.6292533", "0.6283855", "0.62802327", "0.6279266", "0.6278835", "0.6270553", "0.62547576", "0.62502694", "0.6249541", "0.624658", "0.62256956", "0.62240064", "0.62235045", "0.62175846", "0.62172484", "0.62131894", "0.62122536", "0.62106895", "0.6210479", "0.6206263", "0.6205796", "0.6200587", "0.61914426", "0.6190516", "0.619044", "0.61900145", "0.6182789", "0.61827457", "0.61820906", "0.6177805", "0.6158792", "0.61586976", "0.61573887", "0.61545", "0.6151128", "0.6150753", "0.6148396", "0.61483026", "0.6148273", "0.6147656", "0.6140342", "0.6139765", "0.6130078", "0.61248136" ]
0.69634646
6